Commit 11d1ca4b authored by Anton Khirnov's avatar Anton Khirnov

Use avcodec_free_frame() to free AVFrames.

parent 9eb29657
...@@ -180,11 +180,11 @@ void exit_program(int ret) ...@@ -180,11 +180,11 @@ void exit_program(int ret)
bsfc = next; bsfc = next;
} }
output_streams[i]->bitstream_filters = NULL; output_streams[i]->bitstream_filters = NULL;
avcodec_free_frame(&output_streams[i]->filtered_frame);
av_freep(&output_streams[i]->forced_keyframes); av_freep(&output_streams[i]->forced_keyframes);
av_freep(&output_streams[i]->avfilter); av_freep(&output_streams[i]->avfilter);
av_freep(&output_streams[i]->logfile_prefix); av_freep(&output_streams[i]->logfile_prefix);
av_freep(&output_streams[i]->filtered_frame);
av_freep(&output_streams[i]); av_freep(&output_streams[i]);
} }
for (i = 0; i < nb_input_files; i++) { for (i = 0; i < nb_input_files; i++) {
...@@ -192,7 +192,7 @@ void exit_program(int ret) ...@@ -192,7 +192,7 @@ void exit_program(int ret)
av_freep(&input_files[i]); av_freep(&input_files[i]);
} }
for (i = 0; i < nb_input_streams; i++) { for (i = 0; i < nb_input_streams; i++) {
av_freep(&input_streams[i]->decoded_frame); avcodec_free_frame(&input_streams[i]->decoded_frame);
av_dict_free(&input_streams[i]->opts); av_dict_free(&input_streams[i]->opts);
free_buffer_pool(&input_streams[i]->buffer_pool); free_buffer_pool(&input_streams[i]->buffer_pool);
av_freep(&input_streams[i]->filters); av_freep(&input_streams[i]->filters);
......
...@@ -1704,7 +1704,7 @@ static int video_thread(void *arg) ...@@ -1704,7 +1704,7 @@ static int video_thread(void *arg)
avfilter_graph_free(&graph); avfilter_graph_free(&graph);
#endif #endif
av_free_packet(&pkt); av_free_packet(&pkt);
av_free(frame); avcodec_free_frame(&frame);
return 0; return 0;
} }
...@@ -2191,7 +2191,7 @@ static void stream_component_close(VideoState *is, int stream_index) ...@@ -2191,7 +2191,7 @@ static void stream_component_close(VideoState *is, int stream_index)
avresample_free(&is->avr); avresample_free(&is->avr);
av_freep(&is->audio_buf1); av_freep(&is->audio_buf1);
is->audio_buf = NULL; is->audio_buf = NULL;
av_freep(&is->frame); avcodec_free_frame(&is->frame);
if (is->rdft) { if (is->rdft) {
av_rdft_end(is->rdft); av_rdft_end(is->rdft);
......
...@@ -212,7 +212,7 @@ static void audio_encode_example(const char *filename) ...@@ -212,7 +212,7 @@ static void audio_encode_example(const char *filename)
fclose(f); fclose(f);
av_freep(&samples); av_freep(&samples);
av_freep(&frame); avcodec_free_frame(&frame);
avcodec_close(c); avcodec_close(c);
av_free(c); av_free(c);
} }
...@@ -308,7 +308,7 @@ static void audio_decode_example(const char *outfilename, const char *filename) ...@@ -308,7 +308,7 @@ static void audio_decode_example(const char *outfilename, const char *filename)
avcodec_close(c); avcodec_close(c);
av_free(c); av_free(c);
av_free(decoded_frame); avcodec_free_frame(&decoded_frame);
} }
/* /*
...@@ -432,7 +432,7 @@ static void video_encode_example(const char *filename) ...@@ -432,7 +432,7 @@ static void video_encode_example(const char *filename)
avcodec_close(c); avcodec_close(c);
av_free(c); av_free(c);
av_freep(&picture->data[0]); av_freep(&picture->data[0]);
av_free(picture); avcodec_free_frame(&picture);
printf("\n"); printf("\n");
} }
...@@ -568,7 +568,7 @@ static void video_decode_example(const char *outfilename, const char *filename) ...@@ -568,7 +568,7 @@ static void video_decode_example(const char *outfilename, const char *filename)
avcodec_close(c); avcodec_close(c);
av_free(c); av_free(c);
av_free(picture); avcodec_free_frame(&picture);
printf("\n"); printf("\n");
} }
......
...@@ -197,7 +197,7 @@ static av_cold void uninit(AVFilterContext *ctx) ...@@ -197,7 +197,7 @@ static av_cold void uninit(AVFilterContext *ctx)
if (movie->format_ctx) if (movie->format_ctx)
avformat_close_input(&movie->format_ctx); avformat_close_input(&movie->format_ctx);
avfilter_unref_buffer(movie->picref); avfilter_unref_buffer(movie->picref);
av_freep(&movie->frame); avcodec_free_frame(&movie->frame);
} }
static int query_formats(AVFilterContext *ctx) static int query_formats(AVFilterContext *ctx)
......
...@@ -165,6 +165,7 @@ static void write_audio_frame(AVFormatContext *oc, AVStream *st) ...@@ -165,6 +165,7 @@ static void write_audio_frame(AVFormatContext *oc, AVStream *st)
fprintf(stderr, "Error while writing audio frame\n"); fprintf(stderr, "Error while writing audio frame\n");
exit(1); exit(1);
} }
avcodec_free_frame(&frame);
} }
static void close_audio(AVFormatContext *oc, AVStream *st) static void close_audio(AVFormatContext *oc, AVStream *st)
......
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