summaryrefslogtreecommitdiff
path: root/libavformat/flvenc.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/flvenc.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/flvenc.c')
-rw-r--r--libavformat/flvenc.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c
index a44ebd966d..aa1308ce2d 100644
--- a/libavformat/flvenc.c
+++ b/libavformat/flvenc.c
@@ -239,18 +239,19 @@ static int flv_write_trailer(AVFormatContext *s)
return 0;
}
-static int flv_write_packet(AVFormatContext *s, int stream_index,
- const uint8_t *buf, int size, int64_t timestamp)
+static int flv_write_packet(AVFormatContext *s, AVPacket *pkt)
{
ByteIOContext *pb = &s->pb;
- AVCodecContext *enc = &s->streams[stream_index]->codec;
+ AVCodecContext *enc = &s->streams[pkt->stream_index]->codec;
FLVContext *flv = s->priv_data;
FLVFrame *frame = av_malloc(sizeof(FLVFrame));
+ int size= pkt->size;
+ uint8_t *buf= pkt->data;
frame->next = 0;
frame->size = size;
frame->data = av_malloc(size);
- frame->timestamp = timestamp;
+ frame->timestamp = pkt->pts;
frame->reserved= flv->reserved;
memcpy(frame->data,buf,size);
@@ -259,7 +260,7 @@ static int flv_write_packet(AVFormatContext *s, int stream_index,
if (enc->codec_type == CODEC_TYPE_VIDEO) {
frame->type = 9;
frame->flags = 2; // choose h263
- frame->flags |= enc->coded_frame->key_frame ? 0x10 : 0x20; // add keyframe indicator
+ frame->flags |= pkt->flags & PKT_FLAG_KEY ? 0x10 : 0x20; // add keyframe indicator
//frame->timestamp = ( ( flv->frameCount * (int64_t)FRAME_RATE_BASE * (int64_t)1000 ) / (int64_t)enc->frame_rate );
//printf("%08x %f %f\n",frame->timestamp,(double)enc->frame_rate/(double)FRAME_RATE_BASE,1000*(double)FRAME_RATE_BASE/(double)enc->frame_rate);
flv->hasVideo = 1;
@@ -306,7 +307,7 @@ static int flv_write_packet(AVFormatContext *s, int stream_index,
assert(size);
if ( flv->initDelay == -1 ) {
- flv->initDelay = timestamp;
+ flv->initDelay = pkt->pts;
}
frame->type = 8;