Hi Robert

Primary change is just in FindFFmpeg.cmake to handle
header location on Fedora 10. ffmpeg header are located in
- /usr/include/ffmpeg/libavcodec/
- /usr/include/ffmpeg/libavformat/
- etc


After J-S message, I dig the code (ffmpeg plugin and CMakeLists.txt) to
understand exactly
what is wrong in my first submission.

Finally, just add a line in FIND_PATH(FFMPEG_${varname}_INCLUDE_DIRS
lib${shortname}/${headername}
fix the problem.

BTW I supposed the 3rd FIND_PATH and the
  INCLUDE_DIRECTORIES(  ...  ${FFMPEG_LIBAVFORMAT_INCLUDE_DIRS}/ffmpeg ... )
in CMakeLists.txt is redundant code. And not really simplify reading and
maintaining.
so I remove them and just add a line in the first FIND_PATH macro.

        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/
            /usr/include/ffmpeg  #                         <<-- this line
            /sw/include # Fink
            /opt/local/include # DarwinPorts
            /opt/csw/include # Blastwave
            /opt/include
            /usr/freeware/include
        )

This have the same result of the previous code.
Am I wrong ?



2009/3/12 Robert Osfield <[email protected]>

> Hi David,
>
> We'll need to maintain support for ffmpeg directory containing all the
> headers for backwards compatibility with older revs of Ubuntu and
> other distro's that have chosen a similar packaging.  A little
> complexity in the find scripts is a small price to pay for better
> compatibility.
>
Right.


>
> I'm curious to why you've need to change the FindFFmpeg.cmake
> ffmpeg/CMakeLists.txt as I've tested against Kubuntu 8.10's version of
> ffmpeg and it worked find.  Exactly which version of Linux are you
> using?  What happens if you delete your CMakeCache.txt and then run
> ccmake to force a new search for headers?
>

With the fix, header are properly found.

David










>
> Robert.
>
> On Thu, Mar 12, 2009 at 5:23 PM, David Callu <[email protected]> wrote:
> > Hi all
> >
> >
> > After little dig in ubuntu packages on packages.ubuntu.com (really nice
> web
> > page to found package informations):
> >
> > Hardy, Hardy-update use cvs 20070307 version and Intrepid use svn
> 20080206
> > version
> > this package store ffmpeg header in /usr/include/ffmpeg
> >
> > Jaunty use svn 20090204 version and the package store ffmpeg header in
> > /usr/include /libavcodec
> > /usr/include /libavformat
> > etc
> >
> > So just wait some month and every body use the same directory, then
> > FindFFmpeg.cmake and ffmpeg plugin CMakeLists.txt
> > will become more simple.
> >
> >
> > Cheer
> > David
> >
> >
> > 2009/3/12 David Callu <[email protected]>
> >>
> >> 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
> >>
> >
> >
> > _______________________________________________
> > osg-submissions mailing list
> > [email protected]
> >
> http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
> >
> >
> _______________________________________________
> osg-submissions mailing list
> [email protected]
>
> http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
>
_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org

Reply via email to