[Libav-user] integrating ffmpeg (libavcodec) with CMake project?

ashika umanga umanga.forums at gmail.com
Tue Mar 13 10:30:11 CET 2012


Greetings all,

I am trying to create an CMake project and want to integrate FFMpeg
libraries with it.
My CMakeLists.txt is pasted at the bottom.

 Value for $ENV{FFMPEG_DIR} is set as an environment variable (eg -
C:\svn\ffmpeg)
I have compiled FFMpeg using Mingw as shared libraries in this FFMPEG_DIR.

But when I compile it gives errors as follows,
what am i doing wrong ?

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
[100%] Building CXX object CMakeFiles/EncDec.dir/main.cpp.obj
C:\MinGW\bin\g++.exe    -D__STDC_CONSTANT_MACROS -g
@CMakeFiles/EncDec.dir/includes_CXX.rsp   -o
CMakeFiles\EncDec.dir\main.cpp.obj -c C:\work\encdec-test\main.cpp
C:\work\encdec-test\main.cpp: In function 'void audio_encode_example(const
char*)':
C:\work\encdec-test\main.cpp:80:50: error: invalid conversion from 'void*'
to 'short int*' [-fpermissive]
C:\work\encdec-test\main.cpp:82:32: error: invalid conversion from 'void*'
to 'uint8_t* {aka unsigned char*}' [-fpermissive]
C:\work\encdec-test\main.cpp:100:20: warning: 'int
avcodec_encode_audio(AVCodecContext*, uint8_t*, int, const short int*)' is
deprecated (declared at c:/svn/ffmpeg-git/ffmpeg/libavcodec/avcodec.h:3953)
[-Wdeprecated-declarations]
C:\work\encdec-test\main.cpp:100:72: warning: 'int
avcodec_encode_audio(AVCodecContext*, uint8_t*, int, const short int*)' is
deprecated (declared at c:/svn/ffmpeg-git/ffmpeg/libavcodec/avcodec.h:3953)
[-Wdeprecated-declarations]
C:\work\encdec-test\main.cpp: In function 'void video_encode_example(const
char*, int)':
C:\work\encdec-test\main.cpp:222:42: error: invalid conversion from 'int'
to 'CodecID' [-fpermissive]
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

CMAKELISTS.TXT file
******************************************************************************************************************************************************************************************
CMAKE_MINIMUM_REQUIRED (VERSION 2.6)
PROJECT (EncDecProject CXX C)


SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__STDC_CONSTANT_MACROS")

#Include folders
INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR})
SET (FFMPEG_DIRS
  $ENV{FFMPEG_DIR}
  $ENV{FFMPEG_DIR}/libavcodec
  $ENV{FFMPEG_DIR}/libavdevice
  $ENV{FFMPEG_DIR}/libavfilter
  $ENV{FFMPEG_DIR}/libavformat
  $ENV{FFMPEG_DIR}/libavutil
  $ENV{FFMPEG_DIR}/libavswresample
  $ENV{FFMPEG_DIR}/libswscale
  )
INCLUDE_DIRECTORIES(${FFMPEG_DIRS})
INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR})

LINK_DIRECTORIES(${FFMPEG_DIRS})


#Here we add our source files
SET (myprj_src
 main.cpp)

SET (FFMPEG_LIBRARIES
  libavcodec
  libavformat
  libavutil
  libavswresample
  libswscale
 )

 ADD_EXECUTABLE(EncDec ${myprj_src})
TARGET_LINK_LIBRARIES(EncDec ${FFMPEG_LIBRARIES})
******************************************************************************************************************************************************************************************
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20120313/448b67a0/attachment.html>


More information about the Libav-user mailing list