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
This commit is contained in:
parent
0a87c409cc
commit
4aa533be03
@ -104,12 +104,12 @@ static int put_pack_header(AVFormatContext *ctx,
|
|||||||
if (s->is_mpeg2) {
|
if (s->is_mpeg2) {
|
||||||
/* clock extension */
|
/* clock extension */
|
||||||
put_bits(&pb, 9, 0);
|
put_bits(&pb, 9, 0);
|
||||||
put_bits(&pb, 1, 1);
|
|
||||||
}
|
}
|
||||||
put_bits(&pb, 1, 1);
|
put_bits(&pb, 1, 1);
|
||||||
put_bits(&pb, 22, s->mux_rate);
|
put_bits(&pb, 22, s->mux_rate);
|
||||||
put_bits(&pb, 1, 1);
|
put_bits(&pb, 1, 1);
|
||||||
if (s->is_mpeg2) {
|
if (s->is_mpeg2) {
|
||||||
|
put_bits(&pb, 1, 1);
|
||||||
put_bits(&pb, 5, 0x1f); /* reserved */
|
put_bits(&pb, 5, 0x1f); /* reserved */
|
||||||
put_bits(&pb, 3, 0); /* stuffing length */
|
put_bits(&pb, 3, 0); /* stuffing length */
|
||||||
}
|
}
|
||||||
@ -439,7 +439,8 @@ static void flush_packet(AVFormatContext *ctx, int stream_index,
|
|||||||
put_be32(&ctx->pb, startcode);
|
put_be32(&ctx->pb, startcode);
|
||||||
|
|
||||||
put_be16(&ctx->pb, packet_size);
|
put_be16(&ctx->pb, packet_size);
|
||||||
/* stuffing */
|
|
||||||
|
if (!s->is_mpeg2)
|
||||||
for(i=0;i<stuffing_size;i++)
|
for(i=0;i<stuffing_size;i++)
|
||||||
put_byte(&ctx->pb, 0xff);
|
put_byte(&ctx->pb, 0xff);
|
||||||
|
|
||||||
@ -449,17 +450,17 @@ static void flush_packet(AVFormatContext *ctx, int stream_index,
|
|||||||
if (pts != AV_NOPTS_VALUE) {
|
if (pts != AV_NOPTS_VALUE) {
|
||||||
if (dts != pts) {
|
if (dts != pts) {
|
||||||
put_byte(&ctx->pb, 0xc0); /* flags */
|
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, 0x03, pts);
|
||||||
put_timestamp(&ctx->pb, 0x01, dts);
|
put_timestamp(&ctx->pb, 0x01, dts);
|
||||||
} else {
|
} else {
|
||||||
put_byte(&ctx->pb, 0x80); /* flags */
|
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);
|
put_timestamp(&ctx->pb, 0x02, pts);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
put_byte(&ctx->pb, 0x00); /* flags */
|
put_byte(&ctx->pb, 0x00); /* flags */
|
||||||
put_byte(&ctx->pb, header_len - 3);
|
put_byte(&ctx->pb, header_len - 3 + stuffing_size);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (pts != AV_NOPTS_VALUE) {
|
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 */
|
/* output data */
|
||||||
put_buffer(&ctx->pb, stream->buffer, payload_size - stuffing_size);
|
put_buffer(&ctx->pb, stream->buffer, payload_size - stuffing_size);
|
||||||
put_flush_packet(&ctx->pb);
|
put_flush_packet(&ctx->pb);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user