Hello Quentin,

On Thu, May 21, 2009 at 06:32:24PM +0200, Quentin Mathé wrote:
> I just tested this patch on Ubuntu 9.04. With a little adjustment it  
> works:
> NEW_AVFORMAT_INCLUDE_DIR=`if [ -n $$(pkg-config --cflags-only-I  
> libavformat) ]; then\
>                                                                         ^ 
> ^^
> -n option must be removed here exactly as in the previous libavcodec  
> test, since pkg-config returns a new line and not a zero string when  
> the include path is /usr/include.

You're right. That's an oversight on my part.

> However I'm not sure to understand why the patch is needed, does the  
> current version refuses to build on your Debian system because the  
> explicit include
> 'ADDITIONAL_OBJCFLAGS += -I/usr/include/libavcodec -I/usr/include/ 
> libavformat' prevents the header to be corrrectly searched in /usr/ 
> include/ffmepg/libav*?

Somethink like that: pkg-config returns "/usr/include/ffmpeg" and
expects ffmpeg's new convention of including <libavcodec/libavcodec.h>
instead of <libavcodec.h>. So previously, I had "/usr/include/ffmpeg"
and (per workaround) "/usr/include/libav(codec|format)" in the search
path: The latter is non-existant and neither of which contain the
relevant header files for the old include style.
"/usr/include/ffmpeg/libav(codec|format)" was never even considered.

> This GNUmakefile as it is was working for me on older Ubuntu systems  
> using the same include path as yours.

That's odd. I really think it shouldn't. Unless of course Ubuntu did
modify the .pc-file to point to the "correct" include paths.
 
> Looks far better than the current hack :-) I still need to test this  
> patch and the previous one on an old Ubuntu system though.
> I think the comment with the Ubuntu bug reference should be moved to  
> MKMediaFile.m too since this problem is Ubuntu specific. Do you have  
> the same issue on Debian too?

On re-reading the bug-report, I'm starting to wonder what has been the
issue there: The ffmpeg APIs are a moving target, so marking stuff as
deprecated that will go away in the foreseeable future is actually a
good thing. I'd only consider it a bug if the warnings are issued even
if the deprecated features aren't used.
If this is the case here, removing the deprecation-hack was probably
jumping to conclusions. Especially since I just saw that
avcodec_decode_audio2() was deprecated very recently. For now it seems
expedient to keep the "#define attribute_deprecated". Perhaps it could
be made conditional on a broken libavcodec version? 

Anyways, thank you very much for your feedback. I have refined the
patches accordingly. Result attached.

Kind regards,


Niels
Index: Frameworks/MediaKit/GNUmakefile
===================================================================
--- Frameworks/MediaKit/GNUmakefile	(revision 4673)
+++ 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 [ $$(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 4673)
+++ Frameworks/MediaKit/MKMediaFile.m	(working copy)
@@ -167,7 +167,12 @@
 		return -1;
 	}
 	timestamp = pkt.pts;
+	#if LIBAVCODEC_VERSION_INT  < ((52<<16)+(25<<8)+0)
 	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;
 }
_______________________________________________
Etoile-dev mailing list
Etoile-dev@gna.org
https://mail.gna.org/listinfo/etoile-dev

Reply via email to