mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-24 13:56:33 +02:00
avfiltergraph: make the AVFilterInOut alloc/free API public
This is required for letting applications to create and destroy AVFilterInOut structs in a convenient way.
This commit is contained in:
parent
6119b23a36
commit
c535494268
@ -13,6 +13,9 @@ libavutil: 2011-04-18
|
|||||||
|
|
||||||
API changes, most recent first:
|
API changes, most recent first:
|
||||||
|
|
||||||
|
2011-06-12 - xxxxxxx - lavfi 2.17.0 - avfiltergraph.h
|
||||||
|
Add avfilter_inout_alloc() and avfilter_inout_free() functions.
|
||||||
|
|
||||||
2011-06-12 - xxxxxxx - lavfi 2.16.0 - avfilter_graph_parse()
|
2011-06-12 - xxxxxxx - lavfi 2.16.0 - avfilter_graph_parse()
|
||||||
Change avfilter_graph_parse() signature.
|
Change avfilter_graph_parse() signature.
|
||||||
|
|
||||||
|
4
ffmpeg.c
4
ffmpeg.c
@ -405,8 +405,8 @@ static int configure_video_filters(AVInputStream *ist, AVOutputStream *ost)
|
|||||||
ost->graph->scale_sws_opts = av_strdup(args);
|
ost->graph->scale_sws_opts = av_strdup(args);
|
||||||
|
|
||||||
if (ost->avfilter) {
|
if (ost->avfilter) {
|
||||||
AVFilterInOut *outputs = av_malloc(sizeof(AVFilterInOut));
|
AVFilterInOut *outputs = avfilter_inout_alloc();
|
||||||
AVFilterInOut *inputs = av_malloc(sizeof(AVFilterInOut));
|
AVFilterInOut *inputs = avfilter_inout_alloc();
|
||||||
|
|
||||||
outputs->name = av_strdup("in");
|
outputs->name = av_strdup("in");
|
||||||
outputs->filter_ctx = last_filter;
|
outputs->filter_ctx = last_filter;
|
||||||
|
4
ffplay.c
4
ffplay.c
@ -1695,8 +1695,8 @@ static int configure_video_filters(AVFilterGraph *graph, VideoState *is, const c
|
|||||||
goto the_end;
|
goto the_end;
|
||||||
|
|
||||||
if(vfilters) {
|
if(vfilters) {
|
||||||
AVFilterInOut *outputs = av_malloc(sizeof(AVFilterInOut));
|
AVFilterInOut *outputs = avfilter_inout_alloc();
|
||||||
AVFilterInOut *inputs = av_malloc(sizeof(AVFilterInOut));
|
AVFilterInOut *inputs = avfilter_inout_alloc();
|
||||||
|
|
||||||
outputs->name = av_strdup("in");
|
outputs->name = av_strdup("in");
|
||||||
outputs->filter_ctx = filt_src;
|
outputs->filter_ctx = filt_src;
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
#include "libavutil/samplefmt.h"
|
#include "libavutil/samplefmt.h"
|
||||||
|
|
||||||
#define LIBAVFILTER_VERSION_MAJOR 2
|
#define LIBAVFILTER_VERSION_MAJOR 2
|
||||||
#define LIBAVFILTER_VERSION_MINOR 16
|
#define LIBAVFILTER_VERSION_MINOR 17
|
||||||
#define LIBAVFILTER_VERSION_MICRO 0
|
#define LIBAVFILTER_VERSION_MICRO 0
|
||||||
|
|
||||||
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
|
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
|
||||||
|
@ -107,15 +107,29 @@ typedef struct AVFilterInOut {
|
|||||||
struct AVFilterInOut *next;
|
struct AVFilterInOut *next;
|
||||||
} AVFilterInOut;
|
} AVFilterInOut;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create an AVFilterInOut.
|
||||||
|
* Must be free with avfilter_inout_free().
|
||||||
|
*/
|
||||||
|
AVFilterInOut *avfilter_inout_alloc(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Free the AVFilterInOut in *inout, and set its pointer to NULL.
|
||||||
|
* If *inout is NULL, do nothing.
|
||||||
|
*/
|
||||||
|
void avfilter_inout_free(AVFilterInOut **inout);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a graph described by a string to a graph.
|
* Add a graph described by a string to a graph.
|
||||||
*
|
*
|
||||||
* @param graph the filter graph where to link the parsed graph context
|
* @param graph the filter graph where to link the parsed graph context
|
||||||
* @param filters string to be parsed
|
* @param filters string to be parsed
|
||||||
* @param inputs linked list to the inputs of the graph, may be NULL.
|
* @param inputs linked list to the inputs of the graph, may be NULL.
|
||||||
* It is updated to contain the list of open inputs after the parsing.
|
* It is updated to contain the list of open inputs after the parsing,
|
||||||
|
* should be freed with avfilter_inout_free().
|
||||||
* @param outputs linked list to the outputs of the graph, may be NULL.
|
* @param outputs linked list to the outputs of the graph, may be NULL.
|
||||||
* It is updated to contain the list of open outputs after the parsing.
|
* It is updated to contain the list of open outputs after the parsing,
|
||||||
|
* should be freed with avfilter_inout_free().
|
||||||
* @return zero on success, a negative AVERROR code on error
|
* @return zero on success, a negative AVERROR code on error
|
||||||
*/
|
*/
|
||||||
int avfilter_graph_parse(AVFilterGraph *graph, const char *filters,
|
int avfilter_graph_parse(AVFilterGraph *graph, const char *filters,
|
||||||
|
@ -168,13 +168,18 @@ static int parse_filter(AVFilterContext **filt_ctx, const char **buf, AVFilterGr
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void free_inout(AVFilterInOut *head)
|
AVFilterInOut *avfilter_inout_alloc(void)
|
||||||
{
|
{
|
||||||
while (head) {
|
return av_mallocz(sizeof(AVFilterInOut));
|
||||||
AVFilterInOut *next = head->next;
|
}
|
||||||
av_free(head->name);
|
|
||||||
av_free(head);
|
void avfilter_inout_free(AVFilterInOut **inout)
|
||||||
head = next;
|
{
|
||||||
|
while (*inout) {
|
||||||
|
AVFilterInOut *next = (*inout)->next;
|
||||||
|
av_freep(&(*inout)->name);
|
||||||
|
av_freep(inout);
|
||||||
|
*inout = next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -396,8 +401,8 @@ int avfilter_graph_parse(AVFilterGraph *graph, const char *filters,
|
|||||||
for (; graph->filter_count > 0; graph->filter_count--)
|
for (; graph->filter_count > 0; graph->filter_count--)
|
||||||
avfilter_free(graph->filters[graph->filter_count - 1]);
|
avfilter_free(graph->filters[graph->filter_count - 1]);
|
||||||
av_freep(&graph->filters);
|
av_freep(&graph->filters);
|
||||||
free_inout(*open_inputs);
|
avfilter_inout_free(open_inputs);
|
||||||
free_inout(*open_outputs);
|
avfilter_inout_free(open_outputs);
|
||||||
free_inout(curr_inputs);
|
avfilter_inout_free(&curr_inputs);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user