Commit 24dc7776 authored by Baptiste Coudurier's avatar Baptiste Coudurier

correctly check for audio streams in mpeg ps muxer, fix multiple audio tracks

Originally committed as revision 18891 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent cab4e4e8
...@@ -157,7 +157,7 @@ static int put_system_header(AVFormatContext *ctx, uint8_t *buf,int only_for_str ...@@ -157,7 +157,7 @@ static int put_system_header(AVFormatContext *ctx, uint8_t *buf,int only_for_str
put_bits(&pb, 1, 1); /* marker */ put_bits(&pb, 1, 1); /* marker */
if (s->is_vcd && only_for_stream_id==AUDIO_ID) { if (s->is_vcd && (only_for_stream_id & 0xe0) == AUDIO_ID) {
/* This header applies only to the audio stream (see VCD standard p. IV-7)*/ /* This header applies only to the audio stream (see VCD standard p. IV-7)*/
put_bits(&pb, 5, 0); put_bits(&pb, 5, 0);
} else } else
...@@ -401,7 +401,7 @@ static int mpeg_mux_init(AVFormatContext *ctx) ...@@ -401,7 +401,7 @@ static int mpeg_mux_init(AVFormatContext *ctx)
bitrate += codec_rate; bitrate += codec_rate;
if (stream->id==AUDIO_ID) if ((stream->id & 0xe0) == AUDIO_ID)
audio_bitrate += codec_rate; audio_bitrate += codec_rate;
else if (stream->id==VIDEO_ID) else if (stream->id==VIDEO_ID)
video_bitrate += codec_rate; video_bitrate += codec_rate;
...@@ -594,7 +594,7 @@ static int get_packet_payload_size(AVFormatContext *ctx, int stream_index, ...@@ -594,7 +594,7 @@ static int get_packet_payload_size(AVFormatContext *ctx, int stream_index,
} }
} }
if (s->is_vcd && stream->id == AUDIO_ID) if (s->is_vcd && (stream->id & 0xe0) == AUDIO_ID)
/* The VCD standard demands that 20 zero bytes follow /* The VCD standard demands that 20 zero bytes follow
each audio packet (see standard p. IV-8).*/ each audio packet (see standard p. IV-8).*/
buf_index+=20; buf_index+=20;
...@@ -729,7 +729,7 @@ static int flush_packet(AVFormatContext *ctx, int stream_index, ...@@ -729,7 +729,7 @@ static int flush_packet(AVFormatContext *ctx, int stream_index,
packet_size = s->packet_size - size; packet_size = s->packet_size - size;
if (s->is_vcd && id == AUDIO_ID) if (s->is_vcd && (id & 0xe0) == AUDIO_ID)
/* The VCD standard demands that 20 zero bytes follow /* The VCD standard demands that 20 zero bytes follow
each audio pack (see standard p. IV-8).*/ each audio pack (see standard p. IV-8).*/
zero_trail_bytes += 20; zero_trail_bytes += 20;
...@@ -868,7 +868,7 @@ static int flush_packet(AVFormatContext *ctx, int stream_index, ...@@ -868,7 +868,7 @@ static int flush_packet(AVFormatContext *ctx, int stream_index,
put_byte(ctx->pb, 0x10); /* flags */ put_byte(ctx->pb, 0x10); /* flags */
/* P-STD buffer info */ /* P-STD buffer info */
if (id == AUDIO_ID) if ((id & 0xe0) == AUDIO_ID)
put_be16(ctx->pb, 0x4000 | stream->max_buffer_size/ 128); put_be16(ctx->pb, 0x4000 | stream->max_buffer_size/ 128);
else else
put_be16(ctx->pb, 0x6000 | stream->max_buffer_size/1024); put_be16(ctx->pb, 0x6000 | stream->max_buffer_size/1024);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment