comparison raw.c @ 6437:c0f18afd0074 libavformat

move h261 demuxer to its own file
author aurel
date Sun, 29 Aug 2010 21:37:37 +0000
parents 505105fc99ab
children 2facedc9f9d7
comparison
equal deleted inserted replaced
6436:505105fc99ab 6437:c0f18afd0074
239 239
240 return 0; 240 return 0;
241 } 241 }
242 #endif 242 #endif
243 243
244 #if CONFIG_H261_DEMUXER
245 static int h261_probe(AVProbeData *p)
246 {
247 uint32_t code= -1;
248 int i;
249 int valid_psc=0;
250 int invalid_psc=0;
251 int next_gn=0;
252 int src_fmt=0;
253 GetBitContext gb;
254
255 init_get_bits(&gb, p->buf, p->buf_size*8);
256
257 for(i=0; i<p->buf_size*8; i++){
258 if ((code & 0x01ff0000) || !(code & 0xff00)) {
259 code = (code<<8) + get_bits(&gb, 8);
260 i += 7;
261 } else
262 code = (code<<1) + get_bits1(&gb);
263 if ((code & 0xffff0000) == 0x10000) {
264 int gn= (code>>12)&0xf;
265 if(!gn)
266 src_fmt= code&8;
267 if(gn != next_gn) invalid_psc++;
268 else valid_psc++;
269
270 if(src_fmt){ // CIF
271 next_gn= (gn+1 )%13;
272 }else{ //QCIF
273 next_gn= (gn+1+!!gn)% 7;
274 }
275 }
276 }
277 if(valid_psc > 2*invalid_psc + 6){
278 return 50;
279 }else if(valid_psc > 2*invalid_psc + 2)
280 return 25;
281 return 0;
282 }
283 #endif
284
285 #if CONFIG_DIRAC_DEMUXER 244 #if CONFIG_DIRAC_DEMUXER
286 static int dirac_probe(AVProbeData *p) 245 static int dirac_probe(AVProbeData *p)
287 { 246 {
288 if (AV_RL32(p->buf) == MKTAG('B', 'B', 'C', 'D')) 247 if (AV_RL32(p->buf) == MKTAG('B', 'B', 'C', 'D'))
289 return AVPROBE_SCORE_MAX; 248 return AVPROBE_SCORE_MAX;
511 .extensions = "gsm", 470 .extensions = "gsm",
512 .value = CODEC_ID_GSM, 471 .value = CODEC_ID_GSM,
513 }; 472 };
514 #endif 473 #endif
515 474
516 #if CONFIG_H261_DEMUXER
517 AVInputFormat h261_demuxer = {
518 "h261",
519 NULL_IF_CONFIG_SMALL("raw H.261"),
520 0,
521 h261_probe,
522 ff_raw_video_read_header,
523 ff_raw_read_partial_packet,
524 .flags= AVFMT_GENERIC_INDEX,
525 .extensions = "h261",
526 .value = CODEC_ID_H261,
527 };
528 #endif
529
530 #if CONFIG_H261_MUXER 475 #if CONFIG_H261_MUXER
531 AVOutputFormat h261_muxer = { 476 AVOutputFormat h261_muxer = {
532 "h261", 477 "h261",
533 NULL_IF_CONFIG_SMALL("raw H.261"), 478 NULL_IF_CONFIG_SMALL("raw H.261"),
534 "video/x-h261", 479 "video/x-h261",