[FFmpeg-cvslog] r24765 - in trunk: ffmpeg.c ffplay.c libavfilter/avfilter.c libavfilter/avfilter.h libavfilter/avfiltergraph.c libavfilter/graphparser.c tools/lavfi-showfiltfmts.c
stefano
subversion
Wed Aug 11 13:44:51 CEST 2010
Author: stefano
Date: Wed Aug 11 13:44:51 2010
New Revision: 24765
Log:
Change avfilter_open() signature, from:
AVFilterContext *avfilter_open(AVFilter *filter, const char *inst_name);
to:
int avfilter_open(AVFilterContext **filter_ctx, AVFilter *filter, const char *inst_name);
This way it is possible to propagate an error code telling the reason
of the failure.
Modified:
trunk/ffmpeg.c
trunk/ffplay.c
trunk/libavfilter/avfilter.c
trunk/libavfilter/avfilter.h
trunk/libavfilter/avfiltergraph.c
trunk/libavfilter/graphparser.c
trunk/tools/lavfi-showfiltfmts.c
Modified: trunk/ffmpeg.c
==============================================================================
--- trunk/ffmpeg.c Wed Aug 11 13:10:22 2010 (r24764)
+++ trunk/ffmpeg.c Wed Aug 11 13:44:51 2010 (r24765)
@@ -410,9 +410,9 @@ static int configure_filters(AVInputStre
graph = av_mallocz(sizeof(AVFilterGraph));
- if (!(ist->input_video_filter = avfilter_open(avfilter_get_by_name("buffer"), "src")))
+ if (avfilter_open(&ist->input_video_filter, avfilter_get_by_name("buffer"), "src") < 0)
return -1;
- if (!(ist->out_video_filter = avfilter_open(&output_filter, "out")))
+ if (avfilter_open(&ist->out_video_filter, &output_filter, "out") < 0)
return -1;
snprintf(args, 255, "%d:%d:%d", ist->st->codec->width,
@@ -432,7 +432,7 @@ static int configure_filters(AVInputStre
snprintf(args, 255, "%d:%d:%d:%d", ost->leftBand, ost->topBand,
codec->width,
codec->height);
- filter = avfilter_open(avfilter_get_by_name("crop"), NULL);
+ avfilter_open(&filter, avfilter_get_by_name("crop"), NULL);
if (!filter)
return -1;
if (avfilter_init_filter(filter, args, NULL))
@@ -450,7 +450,7 @@ static int configure_filters(AVInputStre
codec->width,
codec->height,
(int)av_get_int(sws_opts, "sws_flags", NULL));
- filter = avfilter_open(avfilter_get_by_name("scale"), NULL);
+ avfilter_open(&filter, avfilter_get_by_name("scale"), NULL);
if (!filter)
return -1;
if (avfilter_init_filter(filter, args, NULL))
Modified: trunk/ffplay.c
==============================================================================
--- trunk/ffplay.c Wed Aug 11 13:10:22 2010 (r24764)
+++ trunk/ffplay.c Wed Aug 11 13:44:51 2010 (r24765)
@@ -1790,8 +1790,8 @@ static int video_thread(void *arg)
snprintf(sws_flags_str, sizeof(sws_flags_str), "flags=%d", sws_flags);
graph->scale_sws_opts = av_strdup(sws_flags_str);
- if(!(filt_src = avfilter_open(&input_filter, "src"))) goto the_end;
- if(!(filt_out = avfilter_open(&output_filter, "out"))) goto the_end;
+ if (avfilter_open(&filt_src, &input_filter, "src") < 0) goto the_end;
+ if (avfilter_open(&filt_out, &output_filter, "out") < 0) 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;
Modified: trunk/libavfilter/avfilter.c
==============================================================================
--- trunk/libavfilter/avfilter.c Wed Aug 11 13:10:22 2010 (r24764)
+++ trunk/libavfilter/avfilter.c Wed Aug 11 13:44:51 2010 (r24765)
@@ -394,12 +394,13 @@ static const AVClass avfilter_class = {
LIBAVUTIL_VERSION_INT,
};
-AVFilterContext *avfilter_open(AVFilter *filter, const char *inst_name)
+int avfilter_open(AVFilterContext **filter_ctx, AVFilter *filter, const char *inst_name)
{
AVFilterContext *ret;
+ *filter_ctx = NULL;
if (!filter)
- return 0;
+ return AVERROR(EINVAL);
ret = av_mallocz(sizeof(AVFilterContext));
@@ -422,7 +423,8 @@ AVFilterContext *avfilter_open(AVFilter
ret->outputs = av_mallocz(sizeof(AVFilterLink*) * ret->output_count);
}
- return ret;
+ *filter_ctx = ret;
+ return 0;
}
void avfilter_destroy(AVFilterContext *filter)
Modified: trunk/libavfilter/avfilter.h
==============================================================================
--- trunk/libavfilter/avfilter.h Wed Aug 11 13:10:22 2010 (r24764)
+++ trunk/libavfilter/avfilter.h Wed Aug 11 13:44:51 2010 (r24765)
@@ -25,7 +25,7 @@
#include "libavutil/avutil.h"
#define LIBAVFILTER_VERSION_MAJOR 1
-#define LIBAVFILTER_VERSION_MINOR 32
+#define LIBAVFILTER_VERSION_MINOR 33
#define LIBAVFILTER_VERSION_MICRO 0
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
@@ -660,11 +660,14 @@ AVFilter **av_filter_next(AVFilter **fil
/**
* Create a filter instance.
+ *
+ * @param filter_ctx put here a pointer to the created filter context
+ * on success, NULL on failure
* @param filter the filter to create an instance of
* @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.
+ * @return >= 0 in case of success, a negative error code otherwise
*/
-AVFilterContext *avfilter_open(AVFilter *filter, const char *inst_name);
+int avfilter_open(AVFilterContext **filter_ctx, AVFilter *filter, const char *inst_name);
/**
* Initialize a filter.
Modified: trunk/libavfilter/avfiltergraph.c
==============================================================================
--- trunk/libavfilter/avfiltergraph.c Wed Aug 11 13:10:22 2010 (r24764)
+++ trunk/libavfilter/avfiltergraph.c Wed Aug 11 13:44:51 2010 (r24765)
@@ -133,8 +133,7 @@ static int query_formats(AVFilterGraph *
/* couldn't merge format lists. auto-insert scale filter */
snprintf(inst_name, sizeof(inst_name), "auto-inserted scaler %d",
scaler_count++);
- scale =
- avfilter_open(avfilter_get_by_name("scale"),inst_name);
+ avfilter_open(&scale, avfilter_get_by_name("scale"), inst_name);
snprintf(scale_args, sizeof(scale_args), "0:0:%s", graph->scale_sws_opts);
if(!scale || scale->filter->init(scale, scale_args, NULL) ||
Modified: trunk/libavfilter/graphparser.c
==============================================================================
--- trunk/libavfilter/graphparser.c Wed Aug 11 13:10:22 2010 (r24764)
+++ trunk/libavfilter/graphparser.c Wed Aug 11 13:44:51 2010 (r24765)
@@ -111,7 +111,7 @@ static AVFilterContext *create_filter(AV
return NULL;
}
- filt_ctx = avfilter_open(filt, inst_name);
+ avfilter_open(&filt_ctx, filt, inst_name);
if (!filt_ctx) {
av_log(log_ctx, AV_LOG_ERROR,
"Error creating filter '%s'\n", filt_name);
Modified: trunk/tools/lavfi-showfiltfmts.c
==============================================================================
--- trunk/tools/lavfi-showfiltfmts.c Wed Aug 11 13:10:22 2010 (r24764)
+++ trunk/tools/lavfi-showfiltfmts.c Wed Aug 11 13:44:51 2010 (r24765)
@@ -49,7 +49,7 @@ int main(int argc, char **argv)
return 1;
}
- if (!(filter_ctx = avfilter_open(filter, NULL))) {
+ if (avfilter_open(&filter_ctx, filter, NULL) < 0) {
fprintf(stderr, "Inpossible to open filter with name '%s'\n", filter_name);
return 1;
}
More information about the ffmpeg-cvslog
mailing list