Mercurial > libavformat.hg
annotate h263dec.c @ 6461:c12416642843 libavformat
matroskadec: allow uint and float elements with length = 0
author | aurel |
---|---|
date | Sun, 05 Sep 2010 21:37:40 +0000 |
parents | 4775a49a6045 |
children |
rev | line source |
---|---|
885 | 1 /* |
6436 | 2 * RAW H.263 video demuxer |
3 * Copyright (c) 2009 Michael Niedermayer <michaelni@gmx.at> | |
0 | 4 * |
1358
0899bfe4105c
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
1245
diff
changeset
|
5 * This file is part of FFmpeg. |
0899bfe4105c
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
1245
diff
changeset
|
6 * |
0899bfe4105c
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
1245
diff
changeset
|
7 * FFmpeg is free software; you can redistribute it and/or |
0 | 8 * modify it under the terms of the GNU Lesser General Public |
9 * License as published by the Free Software Foundation; either | |
1358
0899bfe4105c
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
1245
diff
changeset
|
10 * version 2.1 of the License, or (at your option) any later version. |
0 | 11 * |
1358
0899bfe4105c
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
1245
diff
changeset
|
12 * FFmpeg is distributed in the hope that it will be useful, |
0 | 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
15 * Lesser General Public License for more details. | |
16 * | |
17 * You should have received a copy of the GNU Lesser General Public | |
1358
0899bfe4105c
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
1245
diff
changeset
|
18 * License along with FFmpeg; if not, write to the Free Software |
896
edbe5c3717f9
Update licensing information: The FSF changed postal address.
diego
parents:
887
diff
changeset
|
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
0 | 20 */ |
3286 | 21 |
0 | 22 #include "avformat.h" |
6448 | 23 #include "rawdec.h" |
0 | 24 |
135
56590088f801
truncated h263 decoding support / H263-ES "demuxer"
michaelni
parents:
128
diff
changeset
|
25 static int h263_probe(AVProbeData *p) |
56590088f801
truncated h263 decoding support / H263-ES "demuxer"
michaelni
parents:
128
diff
changeset
|
26 { |
5179 | 27 uint64_t code= -1; |
28 int i; | |
29 int valid_psc=0; | |
30 int invalid_psc=0; | |
31 int res_change=0; | |
32 int src_fmt, last_src_fmt=-1; | |
6144 | 33 int last_gn=0; |
135
56590088f801
truncated h263 decoding support / H263-ES "demuxer"
michaelni
parents:
128
diff
changeset
|
34 |
5179 | 35 for(i=0; i<p->buf_size; i++){ |
36 code = (code<<8) + p->buf[i]; | |
37 if ((code & 0xfffffc0000) == 0x800000) { | |
38 src_fmt= (code>>2)&3; | |
39 if( src_fmt != last_src_fmt | |
40 && last_src_fmt>0 && last_src_fmt<6 | |
41 && src_fmt<6) | |
42 res_change++; | |
43 | |
44 if((code&0x300)==0x200 && src_fmt){ | |
45 valid_psc++; | |
6144 | 46 last_gn=0; |
5179 | 47 }else |
48 invalid_psc++; | |
49 last_src_fmt= src_fmt; | |
6144 | 50 } else if((code & 0xffff800000) == 0x800000) { |
51 int gn= (code>>(23-5)) & 0x1F; | |
52 if(gn<last_gn){ | |
53 invalid_psc++; | |
54 }else | |
55 last_gn= gn; | |
5179 | 56 } |
57 } | |
5424 | 58 //av_log(NULL, AV_LOG_ERROR, "h263_probe: psc:%d invalid:%d res_change:%d\n", valid_psc, invalid_psc, res_change); |
5425
9ee7e675a476
Raise threshold of h263 probe by 1 to avoid misdetection.
michael
parents:
5424
diff
changeset
|
59 //h263_probe: psc:3 invalid:0 res_change:0 (1588/recent_ffmpeg_parses_mpg_incorrectly.mpg) |
9ee7e675a476
Raise threshold of h263 probe by 1 to avoid misdetection.
michael
parents:
5424
diff
changeset
|
60 if(valid_psc > 2*invalid_psc + 2*res_change + 3){ |
135
56590088f801
truncated h263 decoding support / H263-ES "demuxer"
michaelni
parents:
128
diff
changeset
|
61 return 50; |
5179 | 62 }else if(valid_psc > 2*invalid_psc) |
63 return 25; | |
135
56590088f801
truncated h263 decoding support / H263-ES "demuxer"
michaelni
parents:
128
diff
changeset
|
64 return 0; |
56590088f801
truncated h263 decoding support / H263-ES "demuxer"
michaelni
parents:
128
diff
changeset
|
65 } |
56590088f801
truncated h263 decoding support / H263-ES "demuxer"
michaelni
parents:
128
diff
changeset
|
66 |
1167 | 67 AVInputFormat h263_demuxer = { |
135
56590088f801
truncated h263 decoding support / H263-ES "demuxer"
michaelni
parents:
128
diff
changeset
|
68 "h263", |
3424
7a0230981402
Make long_names in lavf/lavdev optional depending on CONFIG_SMALL.
diego
parents:
3405
diff
changeset
|
69 NULL_IF_CONFIG_SMALL("raw H.263"), |
135
56590088f801
truncated h263 decoding support / H263-ES "demuxer"
michaelni
parents:
128
diff
changeset
|
70 0, |
56590088f801
truncated h263 decoding support / H263-ES "demuxer"
michaelni
parents:
128
diff
changeset
|
71 h263_probe, |
6430 | 72 ff_raw_video_read_header, |
4610
41542d2edcf4
Separate the raw FLAC demuxer from raw.c and put in a new file,
jbr
parents:
4577
diff
changeset
|
73 ff_raw_read_partial_packet, |
1756 | 74 .flags= AVFMT_GENERIC_INDEX, |
135
56590088f801
truncated h263 decoding support / H263-ES "demuxer"
michaelni
parents:
128
diff
changeset
|
75 // .extensions = "h263", //FIXME remove after writing mpeg4_probe |
56590088f801
truncated h263 decoding support / H263-ES "demuxer"
michaelni
parents:
128
diff
changeset
|
76 .value = CODEC_ID_H263, |
56590088f801
truncated h263 decoding support / H263-ES "demuxer"
michaelni
parents:
128
diff
changeset
|
77 }; |