Mercurial > libavformat.hg
comparison mpeg.c @ 5910:536e5527c1e0 libavformat
Define AVMediaType enum, and use it instead of enum CodecType, which
is deprecated and will be dropped at the next major bump.
author | stefano |
---|---|
date | Tue, 30 Mar 2010 23:30:55 +0000 |
parents | 747753995dee |
children | bd81aaf36a9a |
comparison
equal
deleted
inserted
replaced
5909:b8041f85c327 | 5910:536e5527c1e0 |
---|---|
415 { | 415 { |
416 MpegDemuxContext *m = s->priv_data; | 416 MpegDemuxContext *m = s->priv_data; |
417 AVStream *st; | 417 AVStream *st; |
418 int len, startcode, i, es_type; | 418 int len, startcode, i, es_type; |
419 enum CodecID codec_id = CODEC_ID_NONE; | 419 enum CodecID codec_id = CODEC_ID_NONE; |
420 enum CodecType type; | 420 enum AVMediaType type; |
421 int64_t pts, dts, dummy_pos; //dummy_pos is needed for the index building to work | 421 int64_t pts, dts, dummy_pos; //dummy_pos is needed for the index building to work |
422 uint8_t av_uninit(dvdaudio_substream_type); | 422 uint8_t av_uninit(dvdaudio_substream_type); |
423 | 423 |
424 redo: | 424 redo: |
425 len = mpegps_read_pes_header(s, &dummy_pos, &startcode, &pts, &dts); | 425 len = mpegps_read_pes_header(s, &dummy_pos, &startcode, &pts, &dts); |
441 | 441 |
442 es_type = m->psm_es_type[startcode & 0xff]; | 442 es_type = m->psm_es_type[startcode & 0xff]; |
443 if(es_type > 0 && es_type != STREAM_TYPE_PRIVATE_DATA){ | 443 if(es_type > 0 && es_type != STREAM_TYPE_PRIVATE_DATA){ |
444 if(es_type == STREAM_TYPE_VIDEO_MPEG1){ | 444 if(es_type == STREAM_TYPE_VIDEO_MPEG1){ |
445 codec_id = CODEC_ID_MPEG2VIDEO; | 445 codec_id = CODEC_ID_MPEG2VIDEO; |
446 type = CODEC_TYPE_VIDEO; | 446 type = AVMEDIA_TYPE_VIDEO; |
447 } else if(es_type == STREAM_TYPE_VIDEO_MPEG2){ | 447 } else if(es_type == STREAM_TYPE_VIDEO_MPEG2){ |
448 codec_id = CODEC_ID_MPEG2VIDEO; | 448 codec_id = CODEC_ID_MPEG2VIDEO; |
449 type = CODEC_TYPE_VIDEO; | 449 type = AVMEDIA_TYPE_VIDEO; |
450 } else if(es_type == STREAM_TYPE_AUDIO_MPEG1 || | 450 } else if(es_type == STREAM_TYPE_AUDIO_MPEG1 || |
451 es_type == STREAM_TYPE_AUDIO_MPEG2){ | 451 es_type == STREAM_TYPE_AUDIO_MPEG2){ |
452 codec_id = CODEC_ID_MP3; | 452 codec_id = CODEC_ID_MP3; |
453 type = CODEC_TYPE_AUDIO; | 453 type = AVMEDIA_TYPE_AUDIO; |
454 } else if(es_type == STREAM_TYPE_AUDIO_AAC){ | 454 } else if(es_type == STREAM_TYPE_AUDIO_AAC){ |
455 codec_id = CODEC_ID_AAC; | 455 codec_id = CODEC_ID_AAC; |
456 type = CODEC_TYPE_AUDIO; | 456 type = AVMEDIA_TYPE_AUDIO; |
457 } else if(es_type == STREAM_TYPE_VIDEO_MPEG4){ | 457 } else if(es_type == STREAM_TYPE_VIDEO_MPEG4){ |
458 codec_id = CODEC_ID_MPEG4; | 458 codec_id = CODEC_ID_MPEG4; |
459 type = CODEC_TYPE_VIDEO; | 459 type = AVMEDIA_TYPE_VIDEO; |
460 } else if(es_type == STREAM_TYPE_VIDEO_H264){ | 460 } else if(es_type == STREAM_TYPE_VIDEO_H264){ |
461 codec_id = CODEC_ID_H264; | 461 codec_id = CODEC_ID_H264; |
462 type = CODEC_TYPE_VIDEO; | 462 type = AVMEDIA_TYPE_VIDEO; |
463 } else if(es_type == STREAM_TYPE_AUDIO_AC3){ | 463 } else if(es_type == STREAM_TYPE_AUDIO_AC3){ |
464 codec_id = CODEC_ID_AC3; | 464 codec_id = CODEC_ID_AC3; |
465 type = CODEC_TYPE_AUDIO; | 465 type = AVMEDIA_TYPE_AUDIO; |
466 } else { | 466 } else { |
467 goto skip; | 467 goto skip; |
468 } | 468 } |
469 } else if (startcode >= 0x1e0 && startcode <= 0x1ef) { | 469 } else if (startcode >= 0x1e0 && startcode <= 0x1ef) { |
470 static const unsigned char avs_seqh[4] = { 0, 0, 1, 0xb0 }; | 470 static const unsigned char avs_seqh[4] = { 0, 0, 1, 0xb0 }; |
473 url_fseek(s->pb, -8, SEEK_CUR); | 473 url_fseek(s->pb, -8, SEEK_CUR); |
474 if(!memcmp(buf, avs_seqh, 4) && (buf[6] != 0 || buf[7] != 1)) | 474 if(!memcmp(buf, avs_seqh, 4) && (buf[6] != 0 || buf[7] != 1)) |
475 codec_id = CODEC_ID_CAVS; | 475 codec_id = CODEC_ID_CAVS; |
476 else | 476 else |
477 codec_id = CODEC_ID_PROBE; | 477 codec_id = CODEC_ID_PROBE; |
478 type = CODEC_TYPE_VIDEO; | 478 type = AVMEDIA_TYPE_VIDEO; |
479 } else if (startcode >= 0x1c0 && startcode <= 0x1df) { | 479 } else if (startcode >= 0x1c0 && startcode <= 0x1df) { |
480 type = CODEC_TYPE_AUDIO; | 480 type = AVMEDIA_TYPE_AUDIO; |
481 codec_id = m->sofdec > 0 ? CODEC_ID_ADPCM_ADX : CODEC_ID_MP2; | 481 codec_id = m->sofdec > 0 ? CODEC_ID_ADPCM_ADX : CODEC_ID_MP2; |
482 } else if (startcode >= 0x80 && startcode <= 0x87) { | 482 } else if (startcode >= 0x80 && startcode <= 0x87) { |
483 type = CODEC_TYPE_AUDIO; | 483 type = AVMEDIA_TYPE_AUDIO; |
484 codec_id = CODEC_ID_AC3; | 484 codec_id = CODEC_ID_AC3; |
485 } else if ( ( startcode >= 0x88 && startcode <= 0x8f) | 485 } else if ( ( startcode >= 0x88 && startcode <= 0x8f) |
486 ||( startcode >= 0x98 && startcode <= 0x9f)) { | 486 ||( startcode >= 0x98 && startcode <= 0x9f)) { |
487 /* 0x90 - 0x97 is reserved for SDDS in DVD specs */ | 487 /* 0x90 - 0x97 is reserved for SDDS in DVD specs */ |
488 type = CODEC_TYPE_AUDIO; | 488 type = AVMEDIA_TYPE_AUDIO; |
489 codec_id = CODEC_ID_DTS; | 489 codec_id = CODEC_ID_DTS; |
490 } else if (startcode >= 0xa0 && startcode <= 0xaf) { | 490 } else if (startcode >= 0xa0 && startcode <= 0xaf) { |
491 type = CODEC_TYPE_AUDIO; | 491 type = AVMEDIA_TYPE_AUDIO; |
492 /* 16 bit form will be handled as CODEC_ID_PCM_S16BE */ | 492 /* 16 bit form will be handled as CODEC_ID_PCM_S16BE */ |
493 codec_id = CODEC_ID_PCM_DVD; | 493 codec_id = CODEC_ID_PCM_DVD; |
494 } else if (startcode >= 0xb0 && startcode <= 0xbf) { | 494 } else if (startcode >= 0xb0 && startcode <= 0xbf) { |
495 type = CODEC_TYPE_AUDIO; | 495 type = AVMEDIA_TYPE_AUDIO; |
496 codec_id = CODEC_ID_TRUEHD; | 496 codec_id = CODEC_ID_TRUEHD; |
497 } else if (startcode >= 0xc0 && startcode <= 0xcf) { | 497 } else if (startcode >= 0xc0 && startcode <= 0xcf) { |
498 /* Used for both AC-3 and E-AC-3 in EVOB files */ | 498 /* Used for both AC-3 and E-AC-3 in EVOB files */ |
499 type = CODEC_TYPE_AUDIO; | 499 type = AVMEDIA_TYPE_AUDIO; |
500 codec_id = CODEC_ID_AC3; | 500 codec_id = CODEC_ID_AC3; |
501 } else if (startcode >= 0x20 && startcode <= 0x3f) { | 501 } else if (startcode >= 0x20 && startcode <= 0x3f) { |
502 type = CODEC_TYPE_SUBTITLE; | 502 type = AVMEDIA_TYPE_SUBTITLE; |
503 codec_id = CODEC_ID_DVD_SUBTITLE; | 503 codec_id = CODEC_ID_DVD_SUBTITLE; |
504 } else if (startcode >= 0xfd55 && startcode <= 0xfd5f) { | 504 } else if (startcode >= 0xfd55 && startcode <= 0xfd5f) { |
505 type = CODEC_TYPE_VIDEO; | 505 type = AVMEDIA_TYPE_VIDEO; |
506 codec_id = CODEC_ID_VC1; | 506 codec_id = CODEC_ID_VC1; |
507 } else if (startcode == 0x1bd) { | 507 } else if (startcode == 0x1bd) { |
508 // check dvd audio substream type | 508 // check dvd audio substream type |
509 type = CODEC_TYPE_AUDIO; | 509 type = AVMEDIA_TYPE_AUDIO; |
510 switch(dvdaudio_substream_type & 0xe0) { | 510 switch(dvdaudio_substream_type & 0xe0) { |
511 case 0xa0: codec_id = CODEC_ID_PCM_DVD; | 511 case 0xa0: codec_id = CODEC_ID_PCM_DVD; |
512 break; | 512 break; |
513 case 0x80: if((dvdaudio_substream_type & 0xf8) == 0x88) | 513 case 0x80: if((dvdaudio_substream_type & 0xf8) == 0x88) |
514 codec_id = CODEC_ID_DTS; | 514 codec_id = CODEC_ID_DTS; |