Commit 4aa533be authored by Michael Niedermayer's avatar Michael Niedermayer

Patch for MPEG-2 VOB headers by (Jimmy Blair <blueskyjb at verizon dot net>)

Originally committed as revision 2740 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 0a87c409
......@@ -104,12 +104,12 @@ static int put_pack_header(AVFormatContext *ctx,
if (s->is_mpeg2) {
/* clock extension */
put_bits(&pb, 9, 0);
put_bits(&pb, 1, 1);
}
put_bits(&pb, 1, 1);
put_bits(&pb, 22, s->mux_rate);
put_bits(&pb, 1, 1);
if (s->is_mpeg2) {
put_bits(&pb, 1, 1);
put_bits(&pb, 5, 0x1f); /* reserved */
put_bits(&pb, 3, 0); /* stuffing length */
}
......@@ -439,9 +439,10 @@ static void flush_packet(AVFormatContext *ctx, int stream_index,
put_be32(&ctx->pb, startcode);
put_be16(&ctx->pb, packet_size);
/* stuffing */
for(i=0;i<stuffing_size;i++)
put_byte(&ctx->pb, 0xff);
if (!s->is_mpeg2)
for(i=0;i<stuffing_size;i++)
put_byte(&ctx->pb, 0xff);
if (s->is_mpeg2) {
put_byte(&ctx->pb, 0x80); /* mpeg2 id */
......@@ -449,17 +450,17 @@ static void flush_packet(AVFormatContext *ctx, int stream_index,
if (pts != AV_NOPTS_VALUE) {
if (dts != pts) {
put_byte(&ctx->pb, 0xc0); /* flags */
put_byte(&ctx->pb, header_len - 3);
put_byte(&ctx->pb, header_len - 3 + stuffing_size);
put_timestamp(&ctx->pb, 0x03, pts);
put_timestamp(&ctx->pb, 0x01, dts);
} else {
put_byte(&ctx->pb, 0x80); /* flags */
put_byte(&ctx->pb, header_len - 3);
put_byte(&ctx->pb, header_len - 3 + stuffing_size);
put_timestamp(&ctx->pb, 0x02, pts);
}
} else {
put_byte(&ctx->pb, 0x00); /* flags */
put_byte(&ctx->pb, header_len - 3);
put_byte(&ctx->pb, header_len - 3 + stuffing_size);
}
} else {
if (pts != AV_NOPTS_VALUE) {
......@@ -490,6 +491,10 @@ static void flush_packet(AVFormatContext *ctx, int stream_index,
}
}
if (s->is_mpeg2)
for(i=0;i<stuffing_size;i++)
put_byte(&ctx->pb, 0xff);
/* output data */
put_buffer(&ctx->pb, stream->buffer, payload_size - stuffing_size);
put_flush_packet(&ctx->pb);
......
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