diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2004-05-29 02:06:32 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2004-05-29 02:06:32 +0000 |
commit | e928649b0bf6c8c7b87eb09d5e393a70387b10e9 (patch) | |
tree | 3f065adcb0e5c14127d01162d7cc8a0d934c073f /libavformat/movenc.c | |
parent | a7b2871cd1401ce7be59b153eed3f25565b0bb23 (diff) | |
download | ffmpeg-e928649b0bf6c8c7b87eb09d5e393a70387b10e9.tar.gz |
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/movenc.c')
-rw-r--r-- | libavformat/movenc.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 0e3fb6a9de..0315d18b69 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -950,15 +950,15 @@ static int mov_write_header(AVFormatContext *s) return 0; } -static int mov_write_packet(AVFormatContext *s, int stream_index, - const uint8_t *buf, int size, int64_t pts) +static int mov_write_packet(AVFormatContext *s, AVPacket *pkt) { MOVContext *mov = s->priv_data; ByteIOContext *pb = &s->pb; - AVCodecContext *enc = &s->streams[stream_index]->codec; - MOVTrack* trk = &mov->tracks[stream_index]; + AVCodecContext *enc = &s->streams[pkt->stream_index]->codec; + MOVTrack* trk = &mov->tracks[pkt->stream_index]; int cl, id; unsigned int samplesInChunk = 0; + int size= pkt->size; if (url_is_streamed(&s->pb)) return 0; /* Can't handle that */ if (!size) return 0; /* Discard 0 sized packets */ @@ -974,7 +974,7 @@ static int mov_write_packet(AVFormatContext *s, int stream_index, int len = 0; while (len < size && samplesInChunk < 100) { - len += packed_size[(buf[len] >> 3) & 0x0F]; + len += packed_size[(pkt->data[len] >> 3) & 0x0F]; samplesInChunk++; } } @@ -1021,8 +1021,8 @@ static int mov_write_packet(AVFormatContext *s, int stream_index, trk->cluster[cl][id].size = size; trk->cluster[cl][id].entries = samplesInChunk; if(enc->codec_type == CODEC_TYPE_VIDEO) { - trk->cluster[cl][id].key_frame = enc->coded_frame->key_frame; - if(enc->coded_frame->pict_type == FF_I_TYPE) + trk->cluster[cl][id].key_frame = !!(pkt->flags & PKT_FLAG_KEY); + if(trk->cluster[cl][id].key_frame) trk->hasKeyframes = 1; } trk->enc = enc; @@ -1030,7 +1030,7 @@ static int mov_write_packet(AVFormatContext *s, int stream_index, trk->sampleCount += samplesInChunk; trk->mdat_size += size; - put_buffer(pb, buf, size); + put_buffer(pb, pkt->data, size); put_flush_packet(pb); return 0; |