diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2014-05-08 03:49:04 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-05-08 03:49:12 +0200 |
commit | c71f8d40beb3badaebafa69458ce674cf46bb001 (patch) | |
tree | 3f5bd18737be39dbc722683867b66dc3c151cb47 | |
parent | 9e5867743828c15773fedafe17a3126eb864a523 (diff) | |
parent | 9b60d907ae6d203e8e7877d7e8d357f7731eb4e9 (diff) | |
download | ffmpeg-c71f8d40beb3badaebafa69458ce674cf46bb001.tar.gz |
Merge remote-tracking branch 'lukaszmluki/master'
* lukaszmluki/master:
lavc: use av_fifo_freep
lavf: use av_fifo_freep
ffmpeg: use av_fifo_freep
lavd/jack_audio: use av_fifo_freep
lavfi: use av_fifo_freep
lavu/fifo: add av_fifo_freep function
Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | doc/APIchanges | 3 | ||||
-rw-r--r-- | ffmpeg.c | 2 | ||||
-rw-r--r-- | libavcodec/flac_parser.c | 2 | ||||
-rw-r--r-- | libavcodec/frame_thread_encoder.c | 2 | ||||
-rw-r--r-- | libavcodec/libvorbisenc.c | 2 | ||||
-rw-r--r-- | libavdevice/jack_audio.c | 12 | ||||
-rw-r--r-- | libavfilter/buffersink.c | 3 | ||||
-rw-r--r-- | libavfilter/buffersrc.c | 3 | ||||
-rw-r--r-- | libavfilter/vf_fps.c | 2 | ||||
-rw-r--r-- | libavformat/audiointerleave.c | 2 | ||||
-rw-r--r-- | libavformat/dvenc.c | 4 | ||||
-rw-r--r-- | libavformat/mpegenc.c | 2 | ||||
-rw-r--r-- | libavformat/swfenc.c | 3 | ||||
-rw-r--r-- | libavformat/udp.c | 4 | ||||
-rw-r--r-- | libavutil/fifo.c | 8 | ||||
-rw-r--r-- | libavutil/fifo.h | 6 | ||||
-rw-r--r-- | libavutil/version.h | 2 |
17 files changed, 38 insertions, 24 deletions
diff --git a/doc/APIchanges b/doc/APIchanges index 6c5bf4596a..da8b6969f5 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -15,6 +15,9 @@ libavutil: 2012-10-22 API changes, most recent first: +2014-05-xx - xxxxxxx - lavu 52.82.0 - fifo.h + Add av_fifo_freep() function. + 2014-05-02 - ba52fb11 - lavu 52.81.0 - opt.h Add av_opt_set_dict2() function. @@ -3116,7 +3116,7 @@ static void free_input_threads(void) av_fifo_generic_read(f->fifo, &pkt, sizeof(pkt), NULL); av_free_packet(&pkt); } - av_fifo_free(f->fifo); + av_fifo_freep(&f->fifo); } } diff --git a/libavcodec/flac_parser.c b/libavcodec/flac_parser.c index 37b5fa9dba..3178ee5e55 100644 --- a/libavcodec/flac_parser.c +++ b/libavcodec/flac_parser.c @@ -724,7 +724,7 @@ static void flac_parse_close(AVCodecParserContext *c) av_free(curr); curr = temp; } - av_fifo_free(fpc->fifo_buf); + av_fifo_freep(&fpc->fifo_buf); av_free(fpc->wrap_buf); } diff --git a/libavcodec/frame_thread_encoder.c b/libavcodec/frame_thread_encoder.c index 73801d2524..9ab7c3475e 100644 --- a/libavcodec/frame_thread_encoder.c +++ b/libavcodec/frame_thread_encoder.c @@ -234,7 +234,7 @@ void ff_frame_thread_encoder_free(AVCodecContext *avctx){ pthread_mutex_destroy(&c->buffer_mutex); pthread_cond_destroy(&c->task_fifo_cond); pthread_cond_destroy(&c->finished_task_cond); - av_fifo_free(c->task_fifo); c->task_fifo = NULL; + av_fifo_freep(&c->task_fifo); av_freep(&avctx->internal->frame_thread_encoder); } diff --git a/libavcodec/libvorbisenc.c b/libavcodec/libvorbisenc.c index 4ca8955b2f..c655c21bd6 100644 --- a/libavcodec/libvorbisenc.c +++ b/libavcodec/libvorbisenc.c @@ -183,7 +183,7 @@ static av_cold int libvorbis_encode_close(AVCodecContext *avctx) vorbis_dsp_clear(&s->vd); vorbis_info_clear(&s->vi); - av_fifo_free(s->pkt_fifo); + av_fifo_freep(&s->pkt_fifo); ff_af_queue_close(&s->afq); av_freep(&avctx->extradata); diff --git a/libavdevice/jack_audio.c b/libavdevice/jack_audio.c index db1c4740df..759ef9bcdf 100644 --- a/libavdevice/jack_audio.c +++ b/libavdevice/jack_audio.c @@ -206,14 +206,14 @@ static int start_jack(AVFormatContext *context) } -static void free_pkt_fifo(AVFifoBuffer *fifo) +static void free_pkt_fifo(AVFifoBuffer **fifo) { AVPacket pkt; - while (av_fifo_size(fifo)) { - av_fifo_generic_read(fifo, &pkt, sizeof(pkt), NULL); + while (av_fifo_size(*fifo)) { + av_fifo_generic_read(*fifo, &pkt, sizeof(pkt), NULL); av_free_packet(&pkt); } - av_fifo_free(fifo); + av_fifo_freep(fifo); } static void stop_jack(JackData *self) @@ -224,8 +224,8 @@ static void stop_jack(JackData *self) jack_client_close(self->client); } sem_destroy(&self->packet_count); - free_pkt_fifo(self->new_pkts); - free_pkt_fifo(self->filled_pkts); + free_pkt_fifo(&self->new_pkts); + free_pkt_fifo(&self->filled_pkts); av_freep(&self->ports); ff_timefilter_destroy(self->timefilter); } diff --git a/libavfilter/buffersink.c b/libavfilter/buffersink.c index 5144fdaeee..345af773ff 100644 --- a/libavfilter/buffersink.c +++ b/libavfilter/buffersink.c @@ -76,8 +76,7 @@ static av_cold void uninit(AVFilterContext *ctx) av_fifo_generic_read(sink->fifo, &frame, sizeof(frame), NULL); av_frame_free(&frame); } - av_fifo_free(sink->fifo); - sink->fifo = NULL; + av_fifo_freep(&sink->fifo); } } diff --git a/libavfilter/buffersrc.c b/libavfilter/buffersrc.c index 30d3a3742e..f910ae5df5 100644 --- a/libavfilter/buffersrc.c +++ b/libavfilter/buffersrc.c @@ -426,8 +426,7 @@ static av_cold void uninit(AVFilterContext *ctx) av_fifo_generic_read(s->fifo, &frame, sizeof(frame), NULL); av_frame_free(&frame); } - av_fifo_free(s->fifo); - s->fifo = NULL; + av_fifo_freep(&s->fifo); } static int query_formats(AVFilterContext *ctx) diff --git a/libavfilter/vf_fps.c b/libavfilter/vf_fps.c index af3d410b88..ad7297aab4 100644 --- a/libavfilter/vf_fps.c +++ b/libavfilter/vf_fps.c @@ -103,7 +103,7 @@ static av_cold void uninit(AVFilterContext *ctx) if (s->fifo) { s->drop += av_fifo_size(s->fifo) / sizeof(AVFrame*); flush_fifo(s->fifo); - av_fifo_free(s->fifo); + av_fifo_freep(&s->fifo); } av_log(ctx, AV_LOG_VERBOSE, "%d frames in, %d frames out; %d frames dropped, " diff --git a/libavformat/audiointerleave.c b/libavformat/audiointerleave.c index 2aa95f3dc6..6d24ff5c7f 100644 --- a/libavformat/audiointerleave.c +++ b/libavformat/audiointerleave.c @@ -34,7 +34,7 @@ void ff_audio_interleave_close(AVFormatContext *s) AudioInterleaveContext *aic = st->priv_data; if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO) - av_fifo_free(aic->fifo); + av_fifo_freep(&aic->fifo); } } diff --git a/libavformat/dvenc.c b/libavformat/dvenc.c index 43f65c37b9..defcf2a16e 100644 --- a/libavformat/dvenc.c +++ b/libavformat/dvenc.c @@ -334,7 +334,7 @@ static DVMuxContext* dv_init_mux(AVFormatContext* s) if (c->ast[i] && !(c->audio_data[i]=av_fifo_alloc(100*MAX_AUDIO_FRAME_SIZE))) { while (i > 0) { i--; - av_fifo_free(c->audio_data[i]); + av_fifo_freep(&c->audio_data[i]); } goto bail_out; } @@ -350,7 +350,7 @@ static void dv_delete_mux(DVMuxContext *c) { int i; for (i=0; i < c->n_ast; i++) - av_fifo_free(c->audio_data[i]); + av_fifo_freep(&c->audio_data[i]); } static int dv_write_header(AVFormatContext *s) diff --git a/libavformat/mpegenc.c b/libavformat/mpegenc.c index 1e60c51fdd..5521f48cee 100644 --- a/libavformat/mpegenc.c +++ b/libavformat/mpegenc.c @@ -1159,7 +1159,7 @@ static int mpeg_mux_end(AVFormatContext *ctx) stream = ctx->streams[i]->priv_data; assert(av_fifo_size(stream->fifo) == 0); - av_fifo_free(stream->fifo); + av_fifo_freep(&stream->fifo); } return 0; } diff --git a/libavformat/swfenc.c b/libavformat/swfenc.c index 8d9cf0c246..402f21ef40 100644 --- a/libavformat/swfenc.c +++ b/libavformat/swfenc.c @@ -490,8 +490,7 @@ static int swf_write_trailer(AVFormatContext *s) if (enc->codec_type == AVMEDIA_TYPE_VIDEO) video_enc = enc; else { - av_fifo_free(swf->audio_fifo); - swf->audio_fifo = NULL; + av_fifo_freep(&swf->audio_fifo); } } diff --git a/libavformat/udp.c b/libavformat/udp.c index d9a18d5739..65c7a5549d 100644 --- a/libavformat/udp.c +++ b/libavformat/udp.c @@ -761,7 +761,7 @@ static int udp_open(URLContext *h, const char *uri, int flags) fail: if (udp_fd >= 0) closesocket(udp_fd); - av_fifo_free(s->fifo); + av_fifo_freep(&s->fifo); for (i = 0; i < num_include_sources; i++) av_freep(&include_sources[i]); for (i = 0; i < num_exclude_sources; i++) @@ -867,7 +867,7 @@ static int udp_close(URLContext *h) pthread_cond_destroy(&s->cond); } #endif - av_fifo_free(s->fifo); + av_fifo_freep(&s->fifo); return 0; } diff --git a/libavutil/fifo.c b/libavutil/fifo.c index 235b53ce40..e35237c090 100644 --- a/libavutil/fifo.c +++ b/libavutil/fifo.c @@ -45,6 +45,14 @@ void av_fifo_free(AVFifoBuffer *f) } } +void av_fifo_freep(AVFifoBuffer **f) +{ + if (f) { + av_fifo_free(*f); + *f = NULL; + } +} + void av_fifo_reset(AVFifoBuffer *f) { f->wptr = f->rptr = f->buffer; diff --git a/libavutil/fifo.h b/libavutil/fifo.h index fe7364f427..66fb48a2ed 100644 --- a/libavutil/fifo.h +++ b/libavutil/fifo.h @@ -48,6 +48,12 @@ AVFifoBuffer *av_fifo_alloc(unsigned int size); void av_fifo_free(AVFifoBuffer *f); /** + * Free an AVFifoBuffer and reset pointer to NULL. + * @param f AVFifoBuffer to free + */ +void av_fifo_freep(AVFifoBuffer **f); + +/** * Reset the AVFifoBuffer to the state right after av_fifo_alloc, in particular it is emptied. * @param f AVFifoBuffer to reset */ diff --git a/libavutil/version.h b/libavutil/version.h index 3cb5b66666..a430c6b948 100644 --- a/libavutil/version.h +++ b/libavutil/version.h @@ -56,7 +56,7 @@ */ #define LIBAVUTIL_VERSION_MAJOR 52 -#define LIBAVUTIL_VERSION_MINOR 81 +#define LIBAVUTIL_VERSION_MINOR 82 #define LIBAVUTIL_VERSION_MICRO 100 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ |