You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
1.7 KiB
49 lines
1.7 KiB
#include "basicLIBAV.h"
|
|
#ifdef WIN32
|
|
#pragma comment(lib, "avcodec.lib")
|
|
#pragma comment(lib, "avdevice.lib")
|
|
#pragma comment(lib, "avfilter.lib")
|
|
#pragma comment(lib, "avformat.lib")
|
|
#pragma comment(lib, "avutil.lib")
|
|
#pragma comment(lib, "postproc.lib")
|
|
#pragma comment(lib, "swresample.lib")
|
|
#pragma comment(lib, "swscale.lib")
|
|
#endif
|
|
|
|
#define LOG( X ) basicLogCollection::getInstance()->Log( "basicLibAV", NULL, X )
|
|
|
|
bool _FFD_REGISTER_ALL_FLAG;
|
|
|
|
FrameAspectRatio detectAspectRatio(int width, int height){
|
|
FrameAspectRatio RetVal = FAR_UNKNOWN;
|
|
/*if (((width / 4) * 3) == height) RetVal = FAR_4X3;
|
|
if (((width / 5) * 4) == height) RetVal = FAR_5X4;
|
|
if (((width / 16) * 9) == height) RetVal = FAR_16X9;
|
|
if (RetVal == FAR_UNKNOWN)RetVal = FAR_NOT_STANDARD;
|
|
*/
|
|
RetVal = (float) width / (float)height;
|
|
return RetVal;
|
|
};
|
|
|
|
bool initLibAV(void){
|
|
if (!_FFD_REGISTER_ALL_FLAG){
|
|
char Buffer[256];
|
|
_FFD_REGISTER_ALL_FLAG = true;
|
|
LOG("Init LIBAV");
|
|
sprintf(Buffer, "LibAV Codec: %d.%d.%d", LIBAVCODEC_VERSION_MAJOR, LIBAVCODEC_VERSION_MINOR, LIBAVCODEC_VERSION_MICRO);
|
|
LOG(Buffer);
|
|
sprintf(Buffer, "LibAV Device: %d.%d.%d", LIBAVDEVICE_VERSION_MAJOR, LIBAVDEVICE_VERSION_MINOR, LIBAVDEVICE_VERSION_MICRO);
|
|
LOG(Buffer);
|
|
sprintf(Buffer, "LibAV Format: %d.%d.%d", LIBAVFORMAT_VERSION_MAJOR, LIBAVFORMAT_VERSION_MINOR, LIBAVFORMAT_VERSION_MICRO);
|
|
LOG(Buffer);
|
|
sprintf(Buffer, "LibAV SWScale: %d.%d.%d", LIBSWSCALE_VERSION_MAJOR, LIBSWSCALE_VERSION_MINOR, LIBSWSCALE_VERSION_MICRO);
|
|
LOG(Buffer);
|
|
av_register_all();
|
|
avcodec_register_all();
|
|
avdevice_register_all();
|
|
avformat_network_init();
|
|
};
|
|
return _FFD_REGISTER_ALL_FLAG;
|
|
};
|
|
|
|
#undef LOG
|