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/nut.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/nut.c')
-rw-r--r-- | libavformat/nut.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/libavformat/nut.c b/libavformat/nut.c index cb327675fb..22999ec975 100644 --- a/libavformat/nut.c +++ b/libavformat/nut.c @@ -691,25 +691,22 @@ static int64_t lsb2full(StreamContext *stream, int64_t lsb){ return ((lsb - delta)&mask) + delta; } -static int nut_write_packet(AVFormatContext *s, int stream_index, - const uint8_t *buf, int size, int64_t pts) +static int nut_write_packet(AVFormatContext *s, AVPacket *pkt) { NUTContext *nut = s->priv_data; - StreamContext *stream= &nut->stream[stream_index]; + StreamContext *stream= &nut->stream[pkt->stream_index]; ByteIOContext *bc = &s->pb; int key_frame = 0, full_pts=0; AVCodecContext *enc; int64_t coded_pts; int frame_type, best_length, frame_code, flags, i, size_mul, size_lsb, time_delta; const int64_t frame_start= url_ftell(bc); + int64_t pts= pkt->pts; + int size= pkt->size; + int stream_index= pkt->stream_index; - if (stream_index > s->nb_streams) - return 1; - enc = &s->streams[stream_index]->codec; - key_frame = enc->coded_frame->key_frame; - if(enc->coded_frame->pts != AV_NOPTS_VALUE) - pts= av_rescale(enc->coded_frame->pts, stream->rate_num, stream->rate_den*(int64_t)AV_TIME_BASE); //FIXME XXX HACK + key_frame = !!(pkt->flags & PKT_FLAG_KEY); frame_type=0; if(frame_start + size + 20 - FFMAX(nut->packet_start[1], nut->packet_start[2]) > MAX_DISTANCE) @@ -808,7 +805,7 @@ static int nut_write_packet(AVFormatContext *s, int stream_index, assert(frame_type > 1); } - put_buffer(bc, buf, size); + put_buffer(bc, pkt->data, size); update(nut, stream_index, frame_start, frame_type, frame_code, key_frame, size, pts); |