Hello all,

The review-board seems to have problems at the moment. Still, I'd like
to invite everybody to take a closer look at the following:

Last night, I finally got around to tweak MediaKit's GNUmakefile so that
it handles the location of libav(codec|format)-headers more nicely.
The attached patch does this by a combination of a shell conditional and
a sed one-liner. So it's probably not particularly robust and I
desparately need feedback on whether this breaks with other setups (mine
is debian unstable with headers in /usr/include/ffmpeg/libav*).
I'd be especially interested to hear whether a) this works with systems
which put the headers in /usr/include/libav* (meaning that pkg-config
will not report any additional include-dirs) and b) versions with ffmpeg
which use the old-style header locations. 

Additionally, I seem to have found a way to get rid of the (suppressed) 
deprecation warnings from libavcodec. You basically have to switch to
avcodec_decode_audio3() for libavcodec-versions >= 52 in just one place. 
Again, this is not tested against versions prior to 52 (svn snapshot
from 2009-05-09), so I need input on this as well.

Thanks in advance!


Niels
Index: Frameworks/MediaKit/GNUmakefile
===================================================================
--- Frameworks/MediaKit/GNUmakefile	(revision 4666)
+++ Frameworks/MediaKit/GNUmakefile	(working copy)
@@ -30,14 +30,20 @@
 # 
 # See also: https://mail.gna.org/public/etoile-discuss/2008-11/msg00085.html 
 # and http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/2008-April/046144.html
-#
-# The workaround below doesn't take in account custom install locations reported 
-# by pkg-config when the installed FFMepg release is equal or posterior to the 
-# one that introduced the new include style. 
-# e.g. /usr/include/video/libavcodec/avcodec.h for which pkg-config will return 
-# -I/usr/include/video
-ADDITIONAL_OBJCFLAGS += -I/usr/include/libavcodec -I/usr/include/libavformat
 
+NEW_AVCODEC_INCLUDE_DIR=`if [ $$(pkg-config --cflags-only-I libavcodec) ]; then\
+ echo $$(pkg-config --cflags-only-I libavcodec)|sed 's/[ ]*$$/\/libavcodec/g';\
+ else\
+ echo -I/usr/include/libavcodec;\
+ fi`
+NEW_AVFORMAT_INCLUDE_DIR=`if [ -n $$(pkg-config --cflags-only-I libavformat) ]; then\
+ echo $$(pkg-config --cflags-only-I libavformat)|sed 's/[ ]*$$/\/libavformat/g';\
+ else\
+ echo -I/usr/include/libavformat;\
+ fi`
+
+ADDITIONAL_OBJCFLAGS += $(NEW_AVCODEC_INCLUDE_DIR) $(NEW_AVFORMAT_INCLUDE_DIR)
+
 # If you install OSS 4 in Ubuntu, the header files are located here:
 ADDITIONAL_OBJCFLAGS += -I/usr/lib/oss/include
 
Index: Frameworks/MediaKit/MKMediaFile.m
===================================================================
--- Frameworks/MediaKit/MKMediaFile.m	(revision 4666)
+++ Frameworks/MediaKit/MKMediaFile.m	(working copy)
@@ -167,7 +167,12 @@
 		return -1;
 	}
 	timestamp = pkt.pts;
+	#if LIBAVCODEC_VERSION_MAJOR < 52
 	avcodec_decode_audio2(context, buffer, &bufferSize, pkt.data, pkt.size);
+	#else
+	avcodec_decode_audio3(context, buffer, &bufferSize, &pkt);
+	#endif
+
 	av_free_packet(&pkt);
 	return bufferSize;
 }
Index: Frameworks/MediaKit/MKMediaFile.h
===================================================================
--- Frameworks/MediaKit/MKMediaFile.h	(revision 4666)
+++ Frameworks/MediaKit/MKMediaFile.h	(working copy)
@@ -1,7 +1,5 @@
 #import <Foundation/NSObject.h>
-// NOTE: Ugly hack to get rid of deprecation warnings on Ubuntu
-// See https://bugs.launchpad.net/ubuntu/+source/ffmpeg/+bug/122266
-#define attribute_deprecated
+
 #include <avcodec.h>
 #include <avformat.h>
 
_______________________________________________
Etoile-dev mailing list
Etoile-dev@gna.org
https://mail.gna.org/listinfo/etoile-dev

Reply via email to