[FFmpeg-devel] [PATCH] mpeg: fix dvdaudio with multiple private streams
Petri Hintukainen
phintuka at gmail.com
Wed Aug 31 12:40:46 CEST 2011
Baptiste Coudurier wrote:
> ---
> libavformat/mpeg.c | 10 +++++++---
> 1 files changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/libavformat/mpeg.c b/libavformat/mpeg.c
> index 364473a..e6e5cfb 100644
> --- a/libavformat/mpeg.c
> +++ b/libavformat/mpeg.c
> @@ -425,14 +425,16 @@ static int mpegps_read_packet(AVFormatContext *s,
> enum AVMediaType type;
> int64_t pts, dts, dummy_pos; //dummy_pos is needed for the index building to work
> uint8_t av_uninit(dvdaudio_substream_type);
> + int sub_id;
>
> redo:
> len = mpegps_read_pes_header(s, &dummy_pos, &startcode, &pts, &dts);
> if (len < 0)
> return len;
>
> + sub_id = startcode;
> if(startcode == 0x1bd) {
> - dvdaudio_substream_type = get_byte(s->pb);
> + sub_id = dvdaudio_substream_type = get_byte(s->pb);
> url_fskip(s->pb, 3);
> len -= 4;
> }
> @@ -440,7 +442,7 @@ static int mpegps_read_packet(AVFormatContext *s,
> /* now find stream */
> for(i=0;i<s->nb_streams;i++) {
> st = s->streams[i];
> - if (st->id == startcode)
> + if (st->id == sub_id)
> goto found;
> }
>
> @@ -515,6 +517,8 @@ static int mpegps_read_packet(AVFormatContext *s,
> switch(dvdaudio_substream_type & 0xe0) {
> case 0xa0: codec_id = CODEC_ID_PCM_DVD;
> break;
> + case 0xa1: codec_id = CODEC_ID_PCM_DVD;
> + break;
> case 0x80: if((dvdaudio_substream_type & 0xf8) == 0x88)
> codec_id = CODEC_ID_DTS;
> else codec_id = CODEC_ID_AC3;
This seems redundant: case 0xa1 is unreachable (5 lowest bits are
already cleared in switch()) ?
> @@ -529,7 +533,7 @@ static int mpegps_read_packet(AVFormatContext *s,
> goto redo;
> }
> /* no stream found: add a new stream */
> - st = av_new_stream(s, startcode);
> + st = av_new_stream(s, sub_id);
> if (!st)
> goto skip;
> st->codec->codec_type = type;
- Petri
More information about the ffmpeg-devel
mailing list