Commit c71f8d40 authored by Michael Niedermayer's avatar Michael Niedermayer

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: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents 9e586774 9b60d907
......@@ -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);
}
}
......
......@@ -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);
}
......
......@@ -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);
}
......
......@@ -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);
......
......@@ -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);
}
......
......@@ -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);
}
}
......
......@@ -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)
......
......@@ -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, "
......
......@@ -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);
}
}
......
......@@ -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)
......
......@@ -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;
}
......
......@@ -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);
}
}
......
......@@ -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;
}
......
......@@ -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;
......
......@@ -47,6 +47,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
......
......@@ -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, \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment