[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [14829] trunk/blender/source/blender/src/ buttons_scene.c: == FFMPEG ==

Peter Schlaile peter at schlaile.de
Tue May 13 22:32:52 CEST 2008


Revision: 14829
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=14829
Author:   schlaile
Date:     2008-05-13 22:32:52 +0200 (Tue, 13 May 2008)

Log Message:
-----------
== FFMPEG ==

Not all versions of ffmpeg seem to have av_find_opt. Added my own version... grmbl.

Modified Paths:
--------------
    trunk/blender/source/blender/src/buttons_scene.c

Modified: trunk/blender/source/blender/src/buttons_scene.c
===================================================================
--- trunk/blender/source/blender/src/buttons_scene.c	2008-05-13 13:20:47 UTC (rev 14828)
+++ trunk/blender/source/blender/src/buttons_scene.c	2008-05-13 20:32:52 UTC (rev 14829)
@@ -2372,6 +2372,22 @@
 	return prop;
 }
 
+/* not all versions of ffmpeg include that, so here we go ... */
+
+static const AVOption *my_av_find_opt(void *v, const char *name, 
+				      const char *unit, int mask, int flags){
+	AVClass *c= *(AVClass**)v; 
+	const AVOption *o= c->option;
+
+	for(;o && o->name; o++){
+		if(!strcmp(o->name, name) && 
+		   (!unit || (o->unit && !strcmp(o->unit, unit))) && 
+		   (o->flags & mask) == flags )
+			return o;
+	}
+	return NULL;
+}
+
 static int ffmpeg_property_add_string(const char * type, const char * str)
 {
 	AVCodecContext c;
@@ -2395,7 +2411,7 @@
 		while (*param == ' ') param++;
 	}
 	
-	o = av_find_opt(&c, name, NULL, 0, 0);	
+	o = my_av_find_opt(&c, name, NULL, 0, 0);	
 	if (!o) {
 		return FALSE;
 	}
@@ -2403,7 +2419,7 @@
 		return FALSE;
 	}
 	if (param && o->type != FF_OPT_TYPE_CONST && o->unit) {
-		p = av_find_opt(&c, param, o->unit, 0, 0);	
+		p = my_av_find_opt(&c, param, o->unit, 0, 0);	
 		prop = ffmpeg_property_add(
 			(char*) type, p - c.av_class->option, 
 			o - c.av_class->option);
@@ -2598,7 +2614,7 @@
 
 	avcodec_get_context_defaults(&c);
 
-	o = av_find_opt(&c, param ? param : name, NULL, 0, 0);
+	o = my_av_find_opt(&c, param ? param : name, NULL, 0, 0);
 	if (!o) {
 		return yofs;
 	}





More information about the Bf-blender-cvs mailing list