2014年10月6日 星期一

QT with ffmpeg issue (updating)


  •  Linking problem : Linker can't find ffmpeg function. Because ffmpeg exports C function, QT works in C++.

Linker encounters problem in decorated functions names.
Solution :


  • using extern "C" {}
extern "C" {
#include "libavutil/mathematics.h"
#include "libavformat/avformat.h"
#include "libswscale/swscale.h"
.....
}
  • modify *.pro

INCLUDEPATH += /usr/local/include
LIBS += -LC:/usr/local/lib -lavcodec -lavutil -lavformat -lavdevice -lavfilter -lswscale

unix: CONFIG += link_pkgconfig
unix: PKGCONFIG += libavcodec
unix: PKGCONFIG += libavutil
unix: PKGCONFIG += libavformat
unix: PKGCONFIG += libavdevice
unix: PKGCONFIG += libavfilter
unix: PKGCONFIG += libswscale

adding ffmpeg lib, follow below method
http://doc.qt.digia.com/qtcreator-2.1/creator-project-qmake-libraries.html




  • #error missing -D__STDC_CONSTANT_MACROS / #define __STDC_CONSTANT_MACROS
Solution : __STDC_LIMIT_MACROS and __STDC_CONSTANT_MACROS are a workaround to allow C++ programs to use stdint.h macros specified in the C99 standard that aren't in the C++ standard. The macros, such as UINT8_MAX, INT64_MIN, and INT32_C() may be defined already in C++ applications in other ways. To allow the user to decide if they want the macros defined as C99 does, many implementations require that __STDC_LIMIT_MACROS and __STDC_CONSTANT_MACROS be defined before stdint.h is included.
This isn't part of the C++ standard, but it has been adopted by more than one implementation.