Mercurial > libavformat.hg
comparison mpegts.c @ 5070:11e86c7bdc25 libavformat
Only set CODEC_ID_PROBE when a packet from a stream having a PES header
is read.
author | bcoudurier |
---|---|
date | Thu, 25 Jun 2009 19:01:16 +0000 |
parents | d44e963aaf1c |
children | c4e22fecdcaa |
comparison
equal
deleted
inserted
replaced
5069:9fd4808c3916 | 5070:11e86c7bdc25 |
---|---|
551 return NULL; | 551 return NULL; |
552 | 552 |
553 av_set_pts_info(st, 33, 1, 90000); | 553 av_set_pts_info(st, 33, 1, 90000); |
554 st->priv_data = pes; | 554 st->priv_data = pes; |
555 st->codec->codec_type = CODEC_TYPE_DATA; | 555 st->codec->codec_type = CODEC_TYPE_DATA; |
556 st->codec->codec_id = CODEC_ID_PROBE; | 556 st->codec->codec_id = CODEC_ID_NONE; |
557 st->need_parsing = AVSTREAM_PARSE_FULL; | 557 st->need_parsing = AVSTREAM_PARSE_FULL; |
558 pes->st = st; | 558 pes->st = st; |
559 | 559 |
560 dprintf(pes->stream, "stream_type=%x pid=%x prog_reg_desc=%.4s\n", | 560 dprintf(pes->stream, "stream_type=%x pid=%x prog_reg_desc=%.4s\n", |
561 pes->stream_type, pes->pid, (char*)&prog_reg_desc); | 561 pes->stream_type, pes->pid, (char*)&prog_reg_desc); |
562 | 562 |
563 st->codec->codec_tag = pes->stream_type; | 563 st->codec->codec_tag = pes->stream_type; |
564 | 564 |
565 mpegts_find_stream_type(st, pes->stream_type, ISO_types); | 565 mpegts_find_stream_type(st, pes->stream_type, ISO_types); |
566 if (prog_reg_desc == AV_RL32("HDMV") && | 566 if (prog_reg_desc == AV_RL32("HDMV") && |
567 st->codec->codec_id == CODEC_ID_PROBE) | 567 st->codec->codec_id == CODEC_ID_NONE) |
568 mpegts_find_stream_type(st, pes->stream_type, HDMV_types); | 568 mpegts_find_stream_type(st, pes->stream_type, HDMV_types); |
569 if (st->codec->codec_id == CODEC_ID_PROBE) | 569 if (st->codec->codec_id == CODEC_ID_NONE) |
570 mpegts_find_stream_type(st, pes->stream_type, MISC_types); | 570 mpegts_find_stream_type(st, pes->stream_type, MISC_types); |
571 | 571 |
572 /* stream was not present in PMT, guess based on PES start code */ | 572 /* stream was not present in PMT, guess based on PES start code */ |
573 if (st->codec->codec_id == CODEC_ID_PROBE) { | 573 if (st->codec->codec_id == CODEC_ID_NONE) { |
574 if (code >= 0x1c0 && code <= 0x1df) { | 574 if (code >= 0x1c0 && code <= 0x1df) { |
575 st->codec->codec_type = CODEC_TYPE_AUDIO; | 575 st->codec->codec_type = CODEC_TYPE_AUDIO; |
576 st->codec->codec_id = CODEC_ID_MP2; | 576 st->codec->codec_id = CODEC_ID_MP2; |
577 } else if (code == 0x1bd) { | 577 } else if (code == 0x1bd) { |
578 st->codec->codec_type = CODEC_TYPE_AUDIO; | 578 st->codec->codec_type = CODEC_TYPE_AUDIO; |
685 break; | 685 break; |
686 | 686 |
687 dprintf(ts->stream, "tag: 0x%02x len=%d\n", | 687 dprintf(ts->stream, "tag: 0x%02x len=%d\n", |
688 desc_tag, desc_len); | 688 desc_tag, desc_len); |
689 | 689 |
690 if (st->codec->codec_id == CODEC_ID_PROBE && | 690 if (st->codec->codec_id == CODEC_ID_NONE && |
691 stream_type == STREAM_TYPE_PRIVATE_DATA) | 691 stream_type == STREAM_TYPE_PRIVATE_DATA) |
692 mpegts_find_stream_type(st, desc_tag, DESC_types); | 692 mpegts_find_stream_type(st, desc_tag, DESC_types); |
693 | 693 |
694 switch(desc_tag) { | 694 switch(desc_tag) { |
695 case 0x59: /* subtitling descriptor */ | 695 case 0x59: /* subtitling descriptor */ |
711 av_metadata_set(&st->metadata, "language", language); | 711 av_metadata_set(&st->metadata, "language", language); |
712 break; | 712 break; |
713 case 0x05: /* registration descriptor */ | 713 case 0x05: /* registration descriptor */ |
714 st->codec->codec_tag = bytestream_get_le32(&p); | 714 st->codec->codec_tag = bytestream_get_le32(&p); |
715 dprintf(ts->stream, "reg_desc=%.4s\n", (char*)&st->codec->codec_tag); | 715 dprintf(ts->stream, "reg_desc=%.4s\n", (char*)&st->codec->codec_tag); |
716 if (st->codec->codec_id == CODEC_ID_PROBE && | 716 if (st->codec->codec_id == CODEC_ID_NONE && |
717 stream_type == STREAM_TYPE_PRIVATE_DATA) | 717 stream_type == STREAM_TYPE_PRIVATE_DATA) |
718 mpegts_find_stream_type(st, st->codec->codec_tag, REGD_types); | 718 mpegts_find_stream_type(st, st->codec->codec_tag, REGD_types); |
719 break; | 719 break; |
720 default: | 720 default: |
721 break; | 721 break; |
953 if (code != 0x1bc && code != 0x1bf && /* program_stream_map, private_stream_2 */ | 953 if (code != 0x1bc && code != 0x1bf && /* program_stream_map, private_stream_2 */ |
954 code != 0x1f0 && code != 0x1f1 && /* ECM, EMM */ | 954 code != 0x1f0 && code != 0x1f1 && /* ECM, EMM */ |
955 code != 0x1ff && code != 0x1f2 && /* program_stream_directory, DSMCC_stream */ | 955 code != 0x1ff && code != 0x1f2 && /* program_stream_directory, DSMCC_stream */ |
956 code != 0x1f8) { /* ITU-T Rec. H.222.1 type E stream */ | 956 code != 0x1f8) { /* ITU-T Rec. H.222.1 type E stream */ |
957 pes->state = MPEGTS_PESHEADER; | 957 pes->state = MPEGTS_PESHEADER; |
958 if (pes->st->codec->codec_id == CODEC_ID_NONE) { | |
959 dprintf(pes->stream, "pid=%x stream_type=%x probing\n", | |
960 pes->pid, pes->stream_type); | |
961 pes->st->codec->codec_id = CODEC_ID_PROBE; | |
962 } | |
958 } else { | 963 } else { |
959 pes->state = MPEGTS_PAYLOAD; | 964 pes->state = MPEGTS_PAYLOAD; |
960 pes->data_index = 0; | 965 pes->data_index = 0; |
961 } | 966 } |
962 } else { | 967 } else { |