diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-04-11 22:50:22 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-04-11 22:50:22 +0200 |
commit | 4f6df20a008e52e767550e1ea94280a15c1408b6 (patch) | |
tree | 85c15434d2d725cd018a878f7bef75ee13765817 | |
parent | 8e357e8e759b36e5609ccd12a9e324aee0e8afc8 (diff) | |
parent | e1ce756844e684876318570dcebc74bc66c084f0 (diff) | |
download | ffmpeg-4f6df20a008e52e767550e1ea94280a15c1408b6.tar.gz |
Merge remote-tracking branch 'qatar/master'
* qatar/master:
avplay: Don't free video filters string until the end of decoding.
movenc: small refactor mov_write_packet
movenc: remove redundant check
interplayvideo: fix av_dlog parameter type mismatch
Drop some pointless #ifdefs.
Conflicts:
libavcodec/interplayvideo.c
libavcodec/libxvidff.c
libavcodec/snowenc.c
libavformat/movenc.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | ffplay.c | 1 | ||||
-rw-r--r-- | libavcodec/interplayvideo.c | 5 | ||||
-rw-r--r-- | libavcodec/libxvidff.c | 3 | ||||
-rw-r--r-- | libavcodec/snowenc.c | 2 | ||||
-rw-r--r-- | libavformat/movenc.c | 62 | ||||
-rw-r--r-- | libavformat/nutdec.c | 2 |
6 files changed, 36 insertions, 39 deletions
@@ -1882,6 +1882,7 @@ static int video_thread(void *arg) } the_end: #if CONFIG_AVFILTER + av_freep(&vfilters); avfilter_graph_free(&graph); #endif av_free(frame); diff --git a/libavcodec/interplayvideo.c b/libavcodec/interplayvideo.c index 61cc6801c9..76adad9156 100644 --- a/libavcodec/interplayvideo.c +++ b/libavcodec/interplayvideo.c @@ -907,8 +907,9 @@ static void ipvideo_decode_opcodes(IpvideoContext *s) for (x = 0; x < s->avctx->width; x += 8) { opcode = get_bits(&gb, 4); - av_dlog(s->avctx, "block @ (%3d, %3d): encoding 0x%X, data ptr @ %p\n", - x, y, opcode, s->stream_ptr.buffer); + av_dlog(s->avctx, + " block @ (%3d, %3d): encoding 0x%X, data ptr offset %d\n", + x, y, opcode, bytestream2_tell(&s->stream_ptr)); if (!s->is_16bpp) { s->pixel_ptr = s->current_frame.data[0] + x diff --git a/libavcodec/libxvidff.c b/libavcodec/libxvidff.c index 33cf997e17..811efc3793 100644 --- a/libavcodec/libxvidff.c +++ b/libavcodec/libxvidff.c @@ -77,7 +77,6 @@ int xvid_strip_vol_header(AVCodecContext *avctx, AVPacket *pkt, unsigned int hea int xvid_ff_2pass(void *ref, int opt, void *p1, void *p2); void xvid_correct_framerate(AVCodecContext *avctx); -#if CONFIG_LIBXVID_ENCODER /** * Create the private context for the encoder. @@ -791,5 +790,3 @@ AVCodec ff_libxvid_encoder = { .pix_fmts = (const enum PixelFormat[]){ PIX_FMT_YUV420P, PIX_FMT_NONE }, .long_name = NULL_IF_CONFIG_SMALL("libxvidcore MPEG-4 part 2"), }; - -#endif /* CONFIG_LIBXVID_ENCODER */ diff --git a/libavcodec/snowenc.c b/libavcodec/snowenc.c index 61acf85615..ea66d5fd9c 100644 --- a/libavcodec/snowenc.c +++ b/libavcodec/snowenc.c @@ -153,7 +153,6 @@ static void dwt_quantize(SnowContext *s, Plane *p, DWTELEM *buffer, int width, i #endif /* QUANTIZE2==1 */ -#if CONFIG_SNOW_ENCODER static av_cold int encode_init(AVCodecContext *avctx) { SnowContext *s = avctx->priv_data; @@ -1927,7 +1926,6 @@ AVCodec ff_snow_encoder = { .long_name = NULL_IF_CONFIG_SMALL("Snow"), .priv_class = &snowenc_class, }; -#endif #ifdef TEST diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 60a8bb1c28..1e0dab7e82 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -2871,7 +2871,7 @@ static int mov_flush_fragment(AVFormatContext *s) return 0; } -static int mov_write_packet_internal(AVFormatContext *s, AVPacket *pkt) +int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt) { MOVMuxContext *mov = s->priv_data; AVIOContext *pb = s->pb; @@ -2880,26 +2880,6 @@ static int mov_write_packet_internal(AVFormatContext *s, AVPacket *pkt) unsigned int samples_in_chunk = 0; int size= pkt->size; uint8_t *reformatted_data = NULL; - int64_t frag_duration = 0; - - if (!s->pb->seekable && !(mov->flags & FF_MOV_FLAG_EMPTY_MOOV)) - return 0; /* Can't handle that */ - - if (!size) return 0; /* Discard 0 sized packets */ - - if (trk->entry && pkt->stream_index < s->nb_streams) - frag_duration = av_rescale_q(pkt->dts - trk->cluster[0].dts, - s->streams[pkt->stream_index]->time_base, - AV_TIME_BASE_Q); - if ((mov->max_fragment_duration && - frag_duration >= mov->max_fragment_duration) || - (mov->max_fragment_size && mov->mdat_size + size >= mov->max_fragment_size) || - (mov->flags & FF_MOV_FLAG_FRAG_KEYFRAME && - enc->codec_type == AVMEDIA_TYPE_VIDEO && - trk->entry && pkt->flags & AV_PKT_FLAG_KEY)) { - if (frag_duration >= mov->min_fragment_duration) - mov_flush_fragment(s); - } if (mov->flags & FF_MOV_FLAG_FRAGMENT) { int ret; @@ -3033,13 +3013,35 @@ static int mov_write_packet_internal(AVFormatContext *s, AVPacket *pkt) return 0; } -int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt) +static int mov_write_packet(AVFormatContext *s, AVPacket *pkt) { if (!pkt) { mov_flush_fragment(s); return 1; } else { - return mov_write_packet_internal(s, pkt); + MOVMuxContext *mov = s->priv_data; + MOVTrack *trk = &mov->tracks[pkt->stream_index]; + AVCodecContext *enc = trk->enc; + int64_t frag_duration = 0; + int size = pkt->size; + + if (!pkt->size) return 0; /* Discard 0 sized packets */ + + if (trk->entry && pkt->stream_index < s->nb_streams) + frag_duration = av_rescale_q(pkt->dts - trk->cluster[0].dts, + s->streams[pkt->stream_index]->time_base, + AV_TIME_BASE_Q); + if ((mov->max_fragment_duration && + frag_duration >= mov->max_fragment_duration) || + (mov->max_fragment_size && mov->mdat_size + size >= mov->max_fragment_size) || + (mov->flags & FF_MOV_FLAG_FRAG_KEYFRAME && + enc->codec_type == AVMEDIA_TYPE_VIDEO && + trk->entry && pkt->flags & AV_PKT_FLAG_KEY)) { + if (frag_duration >= mov->min_fragment_duration) + mov_flush_fragment(s); + } + + return ff_mov_write_packet(s, pkt); } } @@ -3373,7 +3375,7 @@ AVOutputFormat ff_mov_muxer = { .video_codec = CODEC_ID_MPEG4, #endif .write_header = mov_write_header, - .write_packet = ff_mov_write_packet, + .write_packet = mov_write_packet, .write_trailer = mov_write_trailer, .flags = AVFMT_GLOBALHEADER | AVFMT_ALLOW_FLUSH, .codec_tag = (const AVCodecTag* const []){ @@ -3392,7 +3394,7 @@ AVOutputFormat ff_tgp_muxer = { .audio_codec = CODEC_ID_AMR_NB, .video_codec = CODEC_ID_H263, .write_header = mov_write_header, - .write_packet = ff_mov_write_packet, + .write_packet = mov_write_packet, .write_trailer = mov_write_trailer, .flags = AVFMT_GLOBALHEADER | AVFMT_ALLOW_FLUSH, .codec_tag = (const AVCodecTag* const []){ codec_3gp_tags, 0 }, @@ -3414,7 +3416,7 @@ AVOutputFormat ff_mp4_muxer = { .video_codec = CODEC_ID_MPEG4, #endif .write_header = mov_write_header, - .write_packet = ff_mov_write_packet, + .write_packet = mov_write_packet, .write_trailer = mov_write_trailer, .flags = AVFMT_GLOBALHEADER | AVFMT_ALLOW_FLUSH, .codec_tag = (const AVCodecTag* const []){ ff_mp4_obj_type, 0 }, @@ -3435,7 +3437,7 @@ AVOutputFormat ff_psp_muxer = { .video_codec = CODEC_ID_MPEG4, #endif .write_header = mov_write_header, - .write_packet = ff_mov_write_packet, + .write_packet = mov_write_packet, .write_trailer = mov_write_trailer, .flags = AVFMT_GLOBALHEADER | AVFMT_ALLOW_FLUSH, .codec_tag = (const AVCodecTag* const []){ ff_mp4_obj_type, 0 }, @@ -3452,7 +3454,7 @@ AVOutputFormat ff_tg2_muxer = { .audio_codec = CODEC_ID_AMR_NB, .video_codec = CODEC_ID_H263, .write_header = mov_write_header, - .write_packet = ff_mov_write_packet, + .write_packet = mov_write_packet, .write_trailer = mov_write_trailer, .flags = AVFMT_GLOBALHEADER | AVFMT_ALLOW_FLUSH, .codec_tag = (const AVCodecTag* const []){ codec_3gp_tags, 0 }, @@ -3470,7 +3472,7 @@ AVOutputFormat ff_ipod_muxer = { .audio_codec = CODEC_ID_AAC, .video_codec = CODEC_ID_H264, .write_header = mov_write_header, - .write_packet = ff_mov_write_packet, + .write_packet = mov_write_packet, .write_trailer = mov_write_trailer, .flags = AVFMT_GLOBALHEADER | AVFMT_ALLOW_FLUSH, .codec_tag = (const AVCodecTag* const []){ codec_ipod_tags, 0 }, @@ -3488,7 +3490,7 @@ AVOutputFormat ff_ismv_muxer = { .audio_codec = CODEC_ID_AAC, .video_codec = CODEC_ID_H264, .write_header = mov_write_header, - .write_packet = ff_mov_write_packet, + .write_packet = mov_write_packet, .write_trailer = mov_write_trailer, .flags = AVFMT_GLOBALHEADER | AVFMT_ALLOW_FLUSH, .codec_tag = (const AVCodecTag* const []){ ff_mp4_obj_type, 0 }, diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c index 6d51950e11..be2fd82769 100644 --- a/libavformat/nutdec.c +++ b/libavformat/nutdec.c @@ -985,7 +985,6 @@ static int nut_read_close(AVFormatContext *s) return 0; } -#if CONFIG_NUT_DEMUXER AVInputFormat ff_nut_demuxer = { .name = "nut", .long_name = NULL_IF_CONFIG_SMALL("NUT format"), @@ -1001,4 +1000,3 @@ AVInputFormat ff_nut_demuxer = { ff_nut_subtitle_tags, 0 }, }; -#endif |