Hi JS Thanks for help.
I just add the path /usr/include/ffmpeg in
"FIND_PATH(FFMPEG_${varname}_INCLUDE_DIRS lib${shortname}/${headername}"
All work fine.
On Fedora, ffmpeg library internally use
#include "libavcodec/avcodec.h"
#include "libavutil/avutil.h"
and so on
But on Ubuntu, ffmpeg library internally use
#include "avcodec.h"
#include "avutil.h"
I can't check the original code, ffmpeg.org site seem to be down,
but, as Robert said in previous message, original path seem to be
"libavcodec/avcodec.h", "libavutil/avutil.h", etc
So we have to search path which contain "libavcodec/avcodec.h" (common
case)
If not found, search path which contain "avcodec.h"
(special case for Ubuntu)
in src/osgPlugins/ffmpeg/CMakeLists.txt
INCLUDE_DIRECTORIES(
${FFMPEG_LIBAVFORMAT_INCLUDE_DIRS}/
${FFMPEG_LIBAVFORMAT_INCLUDE_DIRS}/libavformat
${FFMPEG_LIBAVFORMAT_INCLUDE_DIRS} is usefull for
- original ffmpeg header when FFMPEG_LIBAVFORMAT_INCLUDE_DIRS =
/usr/include/
- ubuntu special case ffmpeg header when FFMPEG_LIBAVFORMAT_INCLUDE_DIRS =
/usr/include/ffmpeg
- osg plugin code on ubuntu when FFMPEG_LIBAVFORMAT_INCLUDE_DIRS =
/usr/include/ffmpeg
${FFMPEG_LIBAVFORMAT_INCLUDE_DIRS}/libavformat is usefull for
- osg plugin code with original header when
FFMPEG_LIBAVFORMAT_INCLUDE_DIRS = /usr/include/
finally in the osg plugin code we use
#include "avcodec.h"
#include "avutil.h"
which is the smallest common denominator
In future, if Ubuntu maintainer don't do a special case, we could just
search path containing "libavcodec", "libavdevice" , etc directory.
then in src/osgPlugins/ffmpeg/CMakeLists.txt
just include directory :
INCLUDE_DIRECTORIES( ${FFMPEG_LIBAVFORMAT_INCLUDE_DIRS}
${FFMPEG_LIBAVDEVICE_INCLUDE_DIRS}
${FFMPEG_LIBAVCODEC_INCLUDE_DIRS}
${FFMPEG_LIBAVUTIL_INCLUDE_DIRS}
${FFMPEG_LIBSWSCALE_INCLUDE_DIRS}
)
and finally use
#include "libavcodec/avcodec.h"
in the osg plugin code
Last thing I don't understand is this search
FIND_PATH(FFMPEG_${varname}_INCLUDE_DIRS ffmpeg/${headername}
and this line in INCLUDE_DIRECTORIES macro
${FFMPEG_LIBAVFORMAT_INCLUDE_DIRS}/ffmpeg
this case could be easily handle by the first search:
FIND_PATH(FFMPEG_${varname}_INCLUDE_DIRS ${headername}
${FFMPEG_ROOT}/include
$ENV{FFMPEG_DIR}/include
$ENV{OSGDIR}/include
$ENV{OSG_ROOT}/include
~/Library/Frameworks
/Library/Frameworks
/usr/local/include
/usr/include/
/sw/include # Fink
/opt/local/include # DarwinPorts
/opt/csw/include # Blastwave
/opt/include
/usr/freeware/include
)
by adding /usr/include/ffmpeg and so on.
Then we can remove extra include path
${FFMPEG_LIBAVFORMAT_INCLUDE_DIRS}/ffmpeg in INCLUDE_DIRECTORIES macro
What a complex code just for handle Ubuntu modification ...
I will email the ubuntu maintainer for more information on
this strange modification of headers and headers location.
I join FindFFmpeg.cmake and CMakeLists.txt of ffmpeg plugin.
Cheer
David
2009/3/12 Jean-Sébastien Guay <[email protected]>
> Hi David,
>
> Check src/osgPlugins/ffmpeg/CMakeLists.txt, you will see lines like this:
>
> INCLUDE_DIRECTORIES(
> ${FFMPEG_LIBAVFORMAT_INCLUDE_DIRS}
> ${FFMPEG_LIBAVFORMAT_INCLUDE_DIRS}/libavformat
> ${FFMPEG_LIBAVFORMAT_INCLUDE_DIRS}/ffmpeg
> ...
>
> That means that the three cases in FIND_PATH are added to the lib path.
>
> In your case, you would need to add ffmpeg/lib${shortname}/${headername} to
> the FIND_PATH macro, and
> ${FFMPEG_LIBAVFORMAT_INCLUDE_DIRS}/ffmpeg/libavformat to the
> INCLUDE_DIRECTORIES... Or we could just make it search for ${headername} and
> use the complete directory it finds it in to the INCLUDE_DIRECTORIES, so we
> can add new cases to a single place instead of two places.
>
> J-S
> --
> ______________________________________________________
> Jean-Sebastien Guay [email protected]
> http://www.cm-labs.com/
> http://whitestar02.webhop.org/
>
> _______________________________________________
> osg-submissions mailing list
> [email protected]
>
> http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
>
# INCLUDE_DIRECTORIES( ${FFMPEG_INCLUDE_DIRS} )
IF (FFMPEG_LIBSWSCALE_FOUND)
INCLUDE_DIRECTORIES(
${FFMPEG_LIBAVFORMAT_INCLUDE_DIRS}
${FFMPEG_LIBAVFORMAT_INCLUDE_DIRS}/libavformat
${FFMPEG_LIBAVDEVICE_INCLUDE_DIRS}
${FFMPEG_LIBAVDEVICE_INCLUDE_DIRS}/libavdevice
${FFMPEG_LIBAVCODEC_INCLUDE_DIRS}
${FFMPEG_LIBAVCODEC_INCLUDE_DIRS}/libavcodec
${FFMPEG_LIBAVUTIL_INCLUDE_DIRS}
${FFMPEG_LIBAVUTIL_INCLUDE_DIRS}/libavcodec
${FFMPEG_LIBSWSCALE_INCLUDE_DIRS}
${FFMPEG_LIBSWSCALE_INCLUDE_DIRS}/libswscale
)
ADD_DEFINITIONS(-DUSE_SWSCALE)
LINK_DIRECTORIES(${FFMPEG_LIBRARY_DIRS})
SET(TARGET_EXTERNAL_LIBRARIES ${FFMPEG_LIBRARIES}
${FFMPEG_LIBSWSCALE_LIBRARIES})
ELSE(FFMPEG_LIBSWSCALE_FOUND)
INCLUDE_DIRECTORIES(
${FFMPEG_LIBAVFORMAT_INCLUDE_DIRS}
${FFMPEG_LIBAVFORMAT_INCLUDE_DIRS}/libavformat
${FFMPEG_LIBAVDEVICE_INCLUDE_DIRS}
${FFMPEG_LIBAVDEVICE_INCLUDE_DIRS}/libavdevice
${FFMPEG_LIBAVCODEC_INCLUDE_DIRS}
${FFMPEG_LIBAVCODEC_INCLUDE_DIRS}/libavcodec
${FFMPEG_LIBAVUTIL_INCLUDE_DIRS}
${FFMPEG_LIBAVUTIL_INCLUDE_DIRS}/libavcodec
)
LINK_DIRECTORIES(${FFMPEG_LIBRARY_DIRS})
SET(TARGET_EXTERNAL_LIBRARIES ${FFMPEG_LIBRARIES} )
ENDIF()
# MESSAGE("FFMPEG_LIBAVFORMAT_INCLUDE_DIRS = "
${FFMPEG_LIBAVFORMAT_INCLUDE_DIRS} )
# MESSAGE("FFMPEG_LIBAVDEVICE_INCLUDE_DIRS = "
${FFMPEG_LIBAVDEVICE_INCLUDE_DIRS} )
# MESSAGE("FFMPEG_LIBAVCODEC_INCLUDE_DIRS = "
${FFMPEG_LIBAVCODEC_INCLUDE_DIRS} )
# MESSAGE("FFMPEG_LIBAVUTIL_INCLUDE_DIRS = " ${FFMPEG_LIBAVUTIL_INCLUDE_DIRS} )
# MESSAGE("FFMPEG_LIBRARIES = " ${FFMPEG_LIBRARIES} )
SET(TARGET_SRC
FFmpegClocks.cpp
FFmpegDecoderAudio.cpp
FFmpegDecoder.cpp
FFmpegDecoderVideo.cpp
FFmpegImageStream.cpp
FFmpegAudioStream.cpp
ReaderWriterFFmpeg.cpp
)
SET(TARGET_H
BoundedMessageQueue.hpp
FFmpegClocks.hpp
FFmpegDecoderAudio.hpp
FFmpegDecoder.hpp
FFmpegDecoderVideo.hpp
FFmpegHeaders.hpp
FFmpegPacket.hpp
FFmpegImageStream.hpp
FFmpegAudioStream.hpp
MessageQueue.hpp
)
#### end var setup ###
SETUP_PLUGIN(ffmpeg ffmpeg)
FindFFmpeg.cmake
Description: Binary data
_______________________________________________ osg-submissions mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
