summaryrefslogtreecommitdiff
path: root/libavformat/avienc.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2004-05-29 02:06:32 +0000
committerMichael Niedermayer <michaelni@gmx.at>2004-05-29 02:06:32 +0000
commite928649b0bf6c8c7b87eb09d5e393a70387b10e9 (patch)
tree3f065adcb0e5c14127d01162d7cc8a0d934c073f /libavformat/avienc.c
parenta7b2871cd1401ce7be59b153eed3f25565b0bb23 (diff)
pass AVPacket into av_write_frame()
fixes the random dts/pts during encoding asf preroll fix no more initial zero frames for b frame encoding mpeg-es dts during demuxing fixed .ffm timestamp scale fixed, ffm is still broken though Originally committed as revision 3168 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/avienc.c')
-rw-r--r--libavformat/avienc.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/libavformat/avienc.c b/libavformat/avienc.c
index 7b3857fd3d..86f0e83446 100644
--- a/libavformat/avienc.c
+++ b/libavformat/avienc.c
@@ -607,14 +607,15 @@ static int avi_write_idx1(AVFormatContext *s)
return 0;
}
-static int avi_write_packet(AVFormatContext *s, int stream_index,
- const uint8_t *buf, int size, int64_t pts)
+static int avi_write_packet(AVFormatContext *s, AVPacket *pkt)
{
AVIContext *avi = s->priv_data;
ByteIOContext *pb = &s->pb;
unsigned char tag[5];
- unsigned int flags;
+ unsigned int flags=0;
AVCodecContext *enc;
+ const int stream_index= pkt->stream_index;
+ int size= pkt->size;
if (url_ftell(pb) - avi->riff_start > AVI_MAX_RIFF_SIZE) {
avi_write_ix(s);
@@ -629,11 +630,11 @@ static int avi_write_packet(AVFormatContext *s, int stream_index,
enc = &s->streams[stream_index]->codec;
avi_stream2fourcc(&tag[0], stream_index, enc->codec_type);
+ if(pkt->flags&PKT_FLAG_KEY)
+ flags = 0x10;
if (enc->codec_type == CODEC_TYPE_AUDIO) {
avi->audio_strm_length[stream_index] += size;
- flags = 0x10;
- } else
- flags = enc->coded_frame->key_frame ? 0x10 : 0x00;
+ }
if (!url_is_streamed(&s->pb)) {
AVIIndex* idx = &avi->indexes[stream_index];
@@ -657,7 +658,7 @@ static int avi_write_packet(AVFormatContext *s, int stream_index,
put_buffer(pb, tag, 4);
put_le32(pb, size);
- put_buffer(pb, buf, size);
+ put_buffer(pb, pkt->data, size);
if (size & 1)
put_byte(pb, 0);