Mercurial > libavformat.hg
comparison raw.c @ 6436:505105fc99ab libavformat
move h263 demuxer to its own file
author | aurel |
---|---|
date | Sun, 29 Aug 2010 21:34:18 +0000 |
parents | 67433b0c29d5 |
children | c0f18afd0074 |
comparison
equal
deleted
inserted
replaced
6435:67433b0c29d5 | 6436:505105fc99ab |
---|---|
239 | 239 |
240 return 0; | 240 return 0; |
241 } | 241 } |
242 #endif | 242 #endif |
243 | 243 |
244 #if CONFIG_H263_DEMUXER | |
245 static int h263_probe(AVProbeData *p) | |
246 { | |
247 uint64_t code= -1; | |
248 int i; | |
249 int valid_psc=0; | |
250 int invalid_psc=0; | |
251 int res_change=0; | |
252 int src_fmt, last_src_fmt=-1; | |
253 int last_gn=0; | |
254 | |
255 for(i=0; i<p->buf_size; i++){ | |
256 code = (code<<8) + p->buf[i]; | |
257 if ((code & 0xfffffc0000) == 0x800000) { | |
258 src_fmt= (code>>2)&3; | |
259 if( src_fmt != last_src_fmt | |
260 && last_src_fmt>0 && last_src_fmt<6 | |
261 && src_fmt<6) | |
262 res_change++; | |
263 | |
264 if((code&0x300)==0x200 && src_fmt){ | |
265 valid_psc++; | |
266 last_gn=0; | |
267 }else | |
268 invalid_psc++; | |
269 last_src_fmt= src_fmt; | |
270 } else if((code & 0xffff800000) == 0x800000) { | |
271 int gn= (code>>(23-5)) & 0x1F; | |
272 if(gn<last_gn){ | |
273 invalid_psc++; | |
274 }else | |
275 last_gn= gn; | |
276 } | |
277 } | |
278 //av_log(NULL, AV_LOG_ERROR, "h263_probe: psc:%d invalid:%d res_change:%d\n", valid_psc, invalid_psc, res_change); | |
279 //h263_probe: psc:3 invalid:0 res_change:0 (1588/recent_ffmpeg_parses_mpg_incorrectly.mpg) | |
280 if(valid_psc > 2*invalid_psc + 2*res_change + 3){ | |
281 return 50; | |
282 }else if(valid_psc > 2*invalid_psc) | |
283 return 25; | |
284 return 0; | |
285 } | |
286 #endif | |
287 | |
288 #if CONFIG_H261_DEMUXER | 244 #if CONFIG_H261_DEMUXER |
289 static int h261_probe(AVProbeData *p) | 245 static int h261_probe(AVProbeData *p) |
290 { | 246 { |
291 uint32_t code= -1; | 247 uint32_t code= -1; |
292 int i; | 248 int i; |
584 ff_raw_write_packet, | 540 ff_raw_write_packet, |
585 .flags= AVFMT_NOTIMESTAMPS, | 541 .flags= AVFMT_NOTIMESTAMPS, |
586 }; | 542 }; |
587 #endif | 543 #endif |
588 | 544 |
589 #if CONFIG_H263_DEMUXER | |
590 AVInputFormat h263_demuxer = { | |
591 "h263", | |
592 NULL_IF_CONFIG_SMALL("raw H.263"), | |
593 0, | |
594 h263_probe, | |
595 ff_raw_video_read_header, | |
596 ff_raw_read_partial_packet, | |
597 .flags= AVFMT_GENERIC_INDEX, | |
598 // .extensions = "h263", //FIXME remove after writing mpeg4_probe | |
599 .value = CODEC_ID_H263, | |
600 }; | |
601 #endif | |
602 | |
603 #if CONFIG_H263_MUXER | 545 #if CONFIG_H263_MUXER |
604 AVOutputFormat h263_muxer = { | 546 AVOutputFormat h263_muxer = { |
605 "h263", | 547 "h263", |
606 NULL_IF_CONFIG_SMALL("raw H.263"), | 548 NULL_IF_CONFIG_SMALL("raw H.263"), |
607 "video/x-h263", | 549 "video/x-h263", |