[MPlayer-dev-eng] [PATCH] MJPEG patch of APP0/COM skip
John Witford
jw203198 at hotmail.com
Mon Jan 26 03:13:15 CET 2004
Not all JPEG segments necessarily escape marker values.
Therefore it is wrong to just ignore an unwanted marker
and depend on a generic marker search to skip over the
unwanted segment contents.
This is particularly important for the APP0 segment
because it can include a wide variety of data.
For example, an APP0 "AVI1" segment might contain
the length of the image (EOI-SOS) and therefore might
contain an unescaped marker byte.
The following patch for MJPEG decoding (libavcodec/mjpeg.c)
forces the use of the segment length when skipping for
certain marker types.
begin-base64 644 mplayer-20031119-jdw.patch
LS0tIE1QbGF5ZXItMjAwMzExMTkvbGliYXZjb2RlYy9tanBlZy5jLmpkdwky
MDAzLTExLTEzIDA5OjA2OjE1LjAwMDAwMDAwMCArMTEwMAorKysgTVBsYXll
ci0yMDAzMTExOS9saWJhdmNvZGVjL21qcGVnLmMJMjAwNC0wMS0yNiAxMjoy
NTo0MC4wMDAwMDAwMDAgKzExMDAKQEAgLTE0NzUsNiArMTQ3NSwyMCBAQAog
ICAgIHJldHVybiAwOwogfQogCitzdGF0aWMgdm9pZCBtanBlZ19za2lwKE1K
cGVnRGVjb2RlQ29udGV4dCAqcykKK3sKKyAgICBpbnQgbGVuOworICAgIGlu
dCBpOworCisgICAgLyoKKyAgICAgKiBub3QgYWxsIHNlY3Rpb25zIG5lZWQg
dG8gZXNjYXBlIDB4ZmYgd2l0aCAweGZmIDB4MDAgc28gbXVzdCB1c2UgdGhl
CisgICAgICogbGVuZ3RoIHRvIHNhZmVseSBza2lwIHRoZSBkYXRhCisgICAg
ICovCisgICAgbGVuID0gZ2V0X2JpdHMoJnMtPmdiLCAxNik7CisgICAgZm9y
IChpID0gMDsgaSA8IGxlbiAtIDI7IGkrKykKKwlnZXRfYml0cygmcy0+Z2Is
IDgpOworfQorCiBzdGF0aWMgaW50IG1qcGVnX2RlY29kZV9hcHAoTUpwZWdE
ZWNvZGVDb250ZXh0ICpzKQogewogICAgIGludCBsZW4sIGlkOwpAQCA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Vjb2RlX2Fw
cChzKTsKKwkJICAgIGVsc2UKKwkJCW1qcGVnX3NraXAocyk7CisJCSAgICBi
cmVhazsKKworCQljYXNlIENPTToKIAkJICAgIC8qIENvbW1lbnQgKi8KLQkJ
ICAgIGVsc2UgaWYgKHN0YXJ0X2NvZGUgPT0gQ09NKQorCQkgICAgaWYgKHMt
PmZpcnN0X3BpY3R1cmUpCiAJCQltanBlZ19kZWNvZGVfY29tKHMpOwotCQl9
CisJCSAgICBlbHNlCisJCQltanBlZ19za2lwKHMpOworCQkgICAgYnJlYWs7
CiAKLSAgICAgICAgICAgICAgICBzd2l0Y2goc3RhcnRfY29kZSkgewogICAg
ICAgICAgICAgICAgIGNhc2UgU09JOgogCQkgICAgcy0+cmVzdGFydF9pbnRl
cnZhbCA9IDA7CiAgICAgICAgICAgICAgICAgICAgIC8qIG5vdGhpbmcgdG8g
ZG8gb24gU09JICovCkBAIC0xODU4LDcgKzE5MDIsMTMgQEAKIAkJY2FzZSBT
T0YxNDoKIAkJY2FzZSBTT0YxNToKIAkJY2FzZSBKUEc6CisJCWNhc2UgSlBH
MDoKKwkJY2FzZSBKUEcxMzoKKwkJY2FzZSBFWFA6CisJCWNhc2UgREFDOgor
CQljYXNlIEROTDoKIAkJICAgIGF2X2xvZyhzLT5hdmN0eCwgQVZfTE9HX0VS
Uk9SLCAibWpwZWc6IHVuc3VwcG9ydGVkIGNvZGluZyB0eXBlICgleClcbiIs
IHN0YXJ0X2NvZGUpOworCQkgICAgbWpwZWdfc2tpcChzKTsKIAkJICAgIGJy
ZWFrOwogLy8JCWRlZmF1bHQ6CiAvLwkJICAgIHByaW50ZigibWpwZWc6IHVu
c3VwcG9ydGVkIG1hcmtlciAoJXgpXG4iLCBzdGFydF9jb2RlKTsK
====
More information about the MPlayer-dev-eng
mailing list