[FFmpeg-devel] [PATCH 1/2] Implement avfilter_graph_alloc().
Stefano Sabatini
stefano.sabatini-lala
Mon Nov 1 11:49:49 CET 2010
---
doc/APIchanges | 3 +++
ffmpeg.c | 2 +-
ffplay.c | 2 +-
libavfilter/avfiltergraph.c | 5 +++++
libavfilter/avfiltergraph.h | 5 +++++
5 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/doc/APIchanges b/doc/APIchanges
index b92e5dc..4156c1b 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -13,6 +13,9 @@ libavutil: 2009-03-08
API changes, most recent first:
+2010-XX-XX - rXXXXX - lavfi 1.XX.X - avfilter_graph_alloc()
+ Add the function avfilter_graph_alloc() in avfiltergraph.h.
+
2010-10-16 - r25502 - lavfi 1.52.0 - avfilter_graph_config()
Add the function avfilter_graph_config() in avfiltergraph.h.
diff --git a/ffmpeg.c b/ffmpeg.c
index edea4fd..b7da044 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -341,7 +341,7 @@ static int configure_filters(AVInputStream *ist, AVOutputStream *ost)
char args[255];
int ret;
- graph = av_mallocz(sizeof(AVFilterGraph));
+ graph = avfilter_graph_alloc();
if ((ret = avfilter_open(&ist->input_video_filter, avfilter_get_by_name("buffer"), "src")) < 0)
return ret;
diff --git a/ffplay.c b/ffplay.c
index eecf16a..581e994 100644
--- a/ffplay.c
+++ b/ffplay.c
@@ -1794,7 +1794,7 @@ static int video_thread(void *arg)
char sws_flags_str[128];
FFSinkContext ffsink_ctx = { .pix_fmt = PIX_FMT_YUV420P };
AVFilterContext *filt_src = NULL, *filt_out = NULL;
- AVFilterGraph *graph = av_mallocz(sizeof(AVFilterGraph));
+ AVFilterGraph *graph = avfilter_graph_alloc();
snprintf(sws_flags_str, sizeof(sws_flags_str), "flags=%d", sws_flags);
graph->scale_sws_opts = av_strdup(sws_flags_str);
diff --git a/libavfilter/avfiltergraph.c b/libavfilter/avfiltergraph.c
index baffc51..6aa0815 100644
--- a/libavfilter/avfiltergraph.c
+++ b/libavfilter/avfiltergraph.c
@@ -26,6 +26,11 @@
#include "avfilter.h"
#include "avfiltergraph.h"
+AVFilterGraph *avfilter_graph_alloc(void)
+{
+ return av_mallocz(sizeof(AVFilterGraph));
+}
+
void avfilter_graph_destroy(AVFilterGraph *graph)
{
for(; graph->filter_count > 0; graph->filter_count --)
diff --git a/libavfilter/avfiltergraph.h b/libavfilter/avfiltergraph.h
index efb9cc0..0b08f02 100644
--- a/libavfilter/avfiltergraph.h
+++ b/libavfilter/avfiltergraph.h
@@ -32,6 +32,11 @@ typedef struct AVFilterGraph {
} AVFilterGraph;
/**
+ * Allocate a filter graph.
+ */
+AVFilterGraph *avfilter_graph_alloc(void);
+
+/**
* Get a filter instance with name name from graph.
*
* @return the pointer to the found filter instance or NULL if it
--
1.7.1
More information about the ffmpeg-devel
mailing list