Mercurial > libavformat.hg
changeset 357:f4f573c7dc56 libavformat
Patch for MPEG-2 VOB headers by (Jimmy Blair <blueskyjb at verizon dot net>)
author | michael |
---|---|
date | Sun, 01 Feb 2004 13:06:46 +0000 |
parents | 72c7cf2f3a7a |
children | d18a2b1fc182 |
files | mpeg.c |
diffstat | 1 files changed, 12 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/mpeg.c Sat Jan 17 22:02:07 2004 +0000 +++ b/mpeg.c Sun Feb 01 13:06:46 2004 +0000 @@ -104,12 +104,12 @@ 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 @@ 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 @@ 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 @@ } } + 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);