[FFmpeg-soc] [soc]: r1630 - in libavfilter: avfilter.c formats.c
koorogi
subversion at mplayerhq.hu
Fri Dec 21 00:38:49 CET 2007
Author: koorogi
Date: Fri Dec 21 00:38:49 2007
New Revision: 1630
Log:
Need to be careful when dealing with references.
Modified:
libavfilter/avfilter.c
libavfilter/formats.c
Modified: libavfilter/avfilter.c
==============================================================================
--- libavfilter/avfilter.c (original)
+++ libavfilter/avfilter.c Fri Dec 21 00:38:49 2007
@@ -99,6 +99,8 @@ int avfilter_link(AVFilterContext *src,
int avfilter_insert_filter(AVFilterLink *link, AVFilterContext *filt,
unsigned in, unsigned out)
{
+ AVFilterFormats *formats;
+
av_log(NULL, AV_LOG_INFO, "auto-inserting filter '%s'\n",
filt->filter->name);
@@ -116,10 +118,9 @@ int avfilter_insert_filter(AVFilterLink
/* if any information on supported colorspaces already exists on the
* link, we need to preserve that */
- if(link->out_formats) {
- filt->outputs[out]->out_formats = link->out_formats;
- link->out_formats = NULL;
- }
+ if((formats = link->out_formats))
+ avfilter_formats_changeref(&link->out_formats,
+ &filt->outputs[out]->out_formats);
return 0;
}
Modified: libavfilter/formats.c
==============================================================================
--- libavfilter/formats.c (original)
+++ libavfilter/formats.c Fri Dec 21 00:38:49 2007
@@ -134,3 +134,15 @@ void avfilter_formats_unref(AVFilterForm
*ref = NULL;
}
+void avfilter_formats_changeref(AVFilterFormats **oldref,
+ AVFilterFormats **newref)
+{
+ int idx;
+
+ if((idx = find_ref_index(oldref)) >= 0) {
+ (*oldref)->refs[idx] = newref;
+ *newref = *oldref;
+ *oldref = NULL;
+ }
+}
+
More information about the FFmpeg-soc
mailing list