[FFmpeg-soc] [soc]: r933 - in libavfilter: avfilter.c avfilter.h avfiltergraph.c ffmpeg.diff
koorogi
subversion at mplayerhq.hu
Sat Aug 18 01:39:55 CEST 2007
Author: koorogi
Date: Sat Aug 18 01:39:55 2007
New Revision: 933
Log:
Rename avfilter_create to avfilter_open and remove the wrapper function
avfilter_create_by_name.
Modified:
libavfilter/avfilter.c
libavfilter/avfilter.h
libavfilter/avfiltergraph.c
libavfilter/ffmpeg.diff
Modified: libavfilter/avfilter.c
==============================================================================
--- libavfilter/avfilter.c (original)
+++ libavfilter/avfilter.c Sat Aug 18 01:39:55 2007
@@ -304,7 +304,7 @@ static const char *filter_name(void *p)
return filter->filter->name;
}
-AVFilterContext *avfilter_create(AVFilter *filter, char *inst_name)
+AVFilterContext *avfilter_open(AVFilter *filter, char *inst_name)
{
AVFilterContext *ret = av_malloc(sizeof(AVFilterContext));
@@ -355,14 +355,6 @@ void avfilter_destroy(AVFilterContext *f
av_free(filter);
}
-AVFilterContext *avfilter_create_by_name(char *name, char *inst_name)
-{
- AVFilter *filt;
-
- if(!(filt = avfilter_get_by_name(name))) return NULL;
- return avfilter_create(filt, inst_name);
-}
-
int avfilter_init_filter(AVFilterContext *filter, const char *args, void *opaque)
{
int ret;
Modified: libavfilter/avfilter.h
==============================================================================
--- libavfilter/avfilter.h (original)
+++ libavfilter/avfilter.h Sat Aug 18 01:39:55 2007
@@ -370,9 +370,10 @@ void avfilter_init(void);
void avfilter_uninit(void);
/**
- * Register a filter. This is only needed if you plan to create an instance of
- * this filter by name later with avfilter_create_by_name. A filter can still
- * by created with acfilter_create even if it is not registered.
+ * Register a filter. This is only needed if you plan to use
+ * avfilter_get_by_name later to lookup the AVFilter structure by name. A
+ * filter can still by instantiated with avfilter_open even if it is not
+ * registered.
* @param filter The filter to register
*/
void avfilter_register(AVFilter *filter);
@@ -391,15 +392,7 @@ AVFilter *avfilter_get_by_name(char *nam
* @param inst_name Name to give to the new instance. Can be NULL for none.
* @return Pointer to the new instance on success. NULL on failure.
*/
-AVFilterContext *avfilter_create(AVFilter *filter, char *inst_name);
-
-/**
- * Creates a filter instace
- * @param name The name of the filter type which is to be instantiated
- * @param inst_name Name to give to the new instance. Can be NULL for none.
- * @return Pointer to the new instance on success. NULL in failure.
- */
-AVFilterContext *avfilter_create_by_name(char *name, char *inst_name);
+AVFilterContext *avfilter_open(AVFilter *filter, char *inst_name);
/**
* Initialize a filter
Modified: libavfilter/avfiltergraph.c
==============================================================================
--- libavfilter/avfiltergraph.c (original)
+++ libavfilter/avfiltergraph.c Sat Aug 18 01:39:55 2007
@@ -430,6 +430,7 @@ int avfilter_graph_config_links(AVFilter
static AVFilterContext *create_filter_with_args(const char *filt, void *opaque)
{
+ AVFilter *filterdef;
AVFilterContext *ret;
char *filter = av_strdup(filt); /* copy - don't mangle the input string */
char *name, *args;
@@ -446,7 +447,8 @@ static AVFilterContext *create_filter_wi
av_log(NULL, AV_LOG_INFO, "creating filter \"%s\" with args \"%s\"\n",
name, args ? args : "(none)");
- if((ret = avfilter_create_by_name(name, NULL))) {
+ if((filterdef = avfilter_get_by_name(name)) &&
+ (ret = avfilter_open(filterdef, NULL))) {
if(avfilter_init_filter(ret, args, opaque)) {
av_log(NULL, AV_LOG_ERROR, "error initializing filter!\n");
avfilter_destroy(ret);
@@ -545,7 +547,7 @@ static int init(AVFilterContext *ctx, co
if(!args)
return 0;
- if(!(gctx->link_filter = avfilter_create(&vf_graph_dummy, NULL)))
+ if(!(gctx->link_filter = avfilter_open(&vf_graph_dummy, NULL)))
return -1;
if(avfilter_init_filter(gctx->link_filter, NULL, ctx))
goto fail;
@@ -578,9 +580,12 @@ static int graph_load_from_desc(AVFilter
AVFilterGraphDescExport *curpad;
AVFilterContext *filt, *filtb;
+ AVFilter *filterdef;
+
/* create all filters */
for(curfilt = desc->filters; curfilt; curfilt = curfilt->next) {
- if(!(filt = avfilter_create_by_name(curfilt->filter, curfilt->name))) {
+ if(!(filterdef = avfilter_get_by_name(curfilt->filter)) ||
+ !(filt = avfilter_open(filterdef, curfilt->name))) {
av_log(ctx, AV_LOG_ERROR, "error creating filter\n");
goto fail;
}
@@ -639,7 +644,7 @@ static int init_desc(AVFilterContext *ct
if(!opaque)
return -1;
- if(!(gctx->link_filter = avfilter_create(&vf_graph_dummy, NULL)))
+ if(!(gctx->link_filter = avfilter_open(&vf_graph_dummy, NULL)))
return -1;
if(avfilter_init_filter(gctx->link_filter, NULL, ctx))
goto fail;
Modified: libavfilter/ffmpeg.diff
==============================================================================
--- libavfilter/ffmpeg.diff (original)
+++ libavfilter/ffmpeg.diff Sat Aug 18 01:39:55 2007
@@ -208,7 +208,7 @@ Index: ffplay.c
if(pkt->data == flush_pkt.data){
avcodec_flush_buffers(is->video_st->codec);
continue;
-@@ -1361,31 +1396,217 @@
+@@ -1361,31 +1396,219 @@
/* NOTE: ipts is the PTS of the _first_ picture beginning in
this packet, if any */
global_video_pkt_pts= pkt->pts;
@@ -384,19 +384,21 @@ Index: ffplay.c
+
+#if ENABLE_AVFILTER
+ AVFilterContext *filt_src = NULL, *filt_out = NULL, *filt_graph = NULL;
++ AVFilter *filterdef;
+
+ avfilter_init();
+ //avfilter_register(&input_filter);
+ //avfilter_register(&output_filter);
+
-+ if(!(filt_src = avfilter_create(&input_filter, "src"))) goto the_end;
-+ if(!(filt_out = avfilter_create(&output_filter, "out"))) goto the_end;
++ if(!(filt_src = avfilter_open(&input_filter, "src"))) goto the_end;
++ if(!(filt_out = avfilter_open(&output_filter, "out"))) goto the_end;
+
+ if(avfilter_init_filter(filt_src, NULL, is)) goto the_end;
+ if(avfilter_init_filter(filt_out, NULL, frame)) goto the_end;
+
+ if(vfilters) {
-+ if(!(filt_graph = avfilter_create_by_name("graph", NULL)))
++ if(!(filterdef = avfilter_get_by_name("graph")) ||
++ !(filt_graph = avfilter_open(filterdef, NULL)))
+ goto the_end;
+ if(avfilter_init_filter(filt_graph, vfilters, NULL))
+ goto the_end;
@@ -438,7 +440,7 @@ Index: ffplay.c
av_free(frame);
return 0;
}
-@@ -2136,6 +2357,12 @@
+@@ -2136,6 +2359,12 @@
/* free all pictures */
for(i=0;i<VIDEO_PICTURE_QUEUE_SIZE; i++) {
vp = &is->pictq[i];
@@ -451,7 +453,7 @@ Index: ffplay.c
if (vp->bmp) {
SDL_FreeYUVOverlay(vp->bmp);
vp->bmp = NULL;
-@@ -2488,6 +2715,9 @@
+@@ -2488,6 +2717,9 @@
#endif
{ "sync", HAS_ARG | OPT_EXPERT, {(void*)opt_sync}, "set audio-video sync. type (type=audio/video/ext)", "type" },
{ "threads", HAS_ARG | OPT_EXPERT, {(void*)opt_thread_count}, "thread count", "count" },
More information about the FFmpeg-soc
mailing list