Commit d8b5abfa authored by Michael Niedermayer's avatar Michael Niedermayer

simplify put_padding_packet()

Originally committed as revision 3549 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent c40a3a42
...@@ -55,7 +55,7 @@ typedef struct { ...@@ -55,7 +55,7 @@ typedef struct {
computed (VBR case) */ computed (VBR case) */
int64_t last_scr; /* current system clock */ int64_t last_scr; /* current system clock */
double vcd_padding_bitrate; double vcd_padding_bitrate; //FIXME floats
int64_t vcd_padding_bytes_written; int64_t vcd_padding_bytes_written;
} MpegMuxContext; } MpegMuxContext;
...@@ -530,33 +530,18 @@ static int get_packet_payload_size(AVFormatContext *ctx, int stream_index, ...@@ -530,33 +530,18 @@ static int get_packet_payload_size(AVFormatContext *ctx, int stream_index,
} }
/* Write an MPEG padding packet header. */ /* Write an MPEG padding packet header. */
static int put_padding_header(AVFormatContext *ctx,uint8_t* buf, int full_padding_size) static void put_padding_packet(AVFormatContext *ctx, ByteIOContext *pb,int packet_bytes)
{ {
MpegMuxContext *s = ctx->priv_data; MpegMuxContext *s = ctx->priv_data;
int size = full_padding_size - 6; /* subtract header length */ int i;
buf[0] = (uint8_t)(PADDING_STREAM >> 24); put_be32(pb, PADDING_STREAM);
buf[1] = (uint8_t)(PADDING_STREAM >> 16); put_be16(pb, packet_bytes - 6);
buf[2] = (uint8_t)(PADDING_STREAM >> 8);
buf[3] = (uint8_t)(PADDING_STREAM);
buf[4] = (uint8_t)(size >> 8);
buf[5] = (uint8_t)(size & 0xff);
if (!s->is_mpeg2) { if (!s->is_mpeg2) {
buf[6] = 0x0f; put_byte(pb, 0x0f);
return 7; packet_bytes -= 7;
} else } else
return 6; packet_bytes -= 6;
}
static void put_padding_packet(AVFormatContext *ctx, ByteIOContext *pb,int packet_bytes)
{
uint8_t buffer[7];
int size, i;
size = put_padding_header(ctx,buffer, packet_bytes);
put_buffer(pb, buffer, size);
packet_bytes -= size;
for(i=0;i<packet_bytes;i++) for(i=0;i<packet_bytes;i++)
put_byte(pb, 0xff); put_byte(pb, 0xff);
......
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