diff options
author | Reynaldo H. Verdejo Pinochet <reynaldo@opendot.cl> | 2009-10-18 23:56:00 +0000 |
---|---|---|
committer | Reynaldo H. Verdejo Pinochet <reynaldo@opendot.cl> | 2009-10-18 23:56:00 +0000 |
commit | 9cf6bbb9936b8afed2ef3e8ab2a462fa7f537a4f (patch) | |
tree | 7f4ba25eda726c955ad6ed91c2b7b4a5f0b245da /libavformat/mtv.c | |
parent | 027e85d88a4f2e1f3338525d694f8dfd37ae869d (diff) | |
download | ffmpeg-9cf6bbb9936b8afed2ef3e8ab2a462fa7f537a4f.tar.gz |
If missing, calculate width or height from bpp and
image size lowering the probe score too.
Originally committed as revision 20304 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/mtv.c')
-rw-r--r-- | libavformat/mtv.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/libavformat/mtv.c b/libavformat/mtv.c index ef07e4a3b0..0547430f74 100644 --- a/libavformat/mtv.c +++ b/libavformat/mtv.c @@ -61,6 +61,15 @@ static int mtv_probe(AVProbeData *p) if(!(p->buf[51] && AV_RL16(&p->buf[52]) | AV_RL16(&p->buf[54]))) return 0; + /* If width or height are 0 then imagesize header field should not */ + if(AV_RL16(&p->buf[52]) && AV_RL16(&p->buf[54])) + { + if(!!AV_RL16(&p->buf[56])) + return AVPROBE_SCORE_MAX/2; + else + return 0; + } + return AVPROBE_SCORE_MAX; } @@ -82,6 +91,17 @@ static int mtv_read_header(AVFormatContext *s, AVFormatParameters *ap) mtv->img_width = get_le16(pb); mtv->img_height = get_le16(pb); mtv->img_segment_size = get_le16(pb); + + /* Calculate width and height if missing from header */ + + if(!mtv->img_width) + mtv->img_width=mtv->img_segment_size / (mtv->img_bpp>>3) + / mtv->img_height; + + if(!mtv->img_height) + mtv->img_height=mtv->img_segment_size / (mtv->img_bpp>>3) + / mtv->img_width; + url_fskip(pb, 4); audio_subsegments = get_le16(pb); mtv->full_segment_size = |