Mercurial > libavformat.hg
diff movenc.c @ 468:60f897e8dd2d libavformat
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
author | michael |
---|---|
date | Sat, 29 May 2004 02:06:32 +0000 |
parents | 6635c1e75087 |
children | abc8a657a8dd |
line wrap: on
line diff
--- a/movenc.c Tue May 25 23:06:00 2004 +0000 +++ b/movenc.c Sat May 29 02:06:32 2004 +0000 @@ -950,15 +950,15 @@ 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 @@ 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 @@ 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 @@ trk->sampleCount += samplesInChunk; trk->mdat_size += size; - put_buffer(pb, buf, size); + put_buffer(pb, pkt->data, size); put_flush_packet(pb); return 0;