Skip to content

Commit 73d2900

Browse files
author
Clement Champetier
committed
CMake: add arguments AVTRANSCODER_ LIBAV/FFMPEG _DEPENDENCY
* Which replace AV/FF_RESAMPLE_LIBRARY.
1 parent bbf2d62 commit 73d2900

File tree

4 files changed

+13
-12
lines changed

4 files changed

+13
-12
lines changed

src/AvTranscoder/Library.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ extern "C" {
55
#include <libavcodec/version.h>
66
#include <libswscale/version.h>
77
#include <libswscale/swscale.h>
8-
#ifdef AV_RESAMPLE_LIBRARY
8+
#ifdef AVTRANSCODER_LIBAV_DEPENDENCY
99
#include <libavresample/version.h>
1010
#else
1111
#include <libswresample/version.h>
@@ -80,7 +80,7 @@ Libraries getLibraries()
8080
libs.push_back( Library( "avutil", avutil_license(), LIBAVUTIL_VERSION_MAJOR, LIBAVUTIL_VERSION_MINOR, LIBAVUTIL_VERSION_MICRO ) );
8181
libs.push_back( Library( "avformat", avformat_license(), LIBAVFORMAT_VERSION_MAJOR, LIBAVFORMAT_VERSION_MINOR, LIBAVFORMAT_VERSION_MICRO ) );
8282
libs.push_back( Library( "avcodec", avcodec_license(), LIBAVCODEC_VERSION_MAJOR, LIBAVCODEC_VERSION_MINOR, LIBAVCODEC_VERSION_MICRO ) );
83-
#ifdef AV_RESAMPLE_LIBRARY
83+
#ifdef AVTRANSCODER_LIBAV_DEPENDENCY
8484
libs.push_back( Library( "avresample", avutil_license(), LIBAVRESAMPLE_VERSION_MAJOR, LIBAVRESAMPLE_VERSION_MINOR, LIBAVRESAMPLE_VERSION_MICRO ) );
8585
#else
8686
libs.push_back( Library( "swresample", avutil_license(), LIBSWRESAMPLE_VERSION_MAJOR, LIBSWRESAMPLE_VERSION_MINOR, LIBSWRESAMPLE_VERSION_MICRO ) );

src/AvTranscoder/transform/AudioTransform.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ extern "C" {
66
#include <libavcodec/avcodec.h>
77
#include <libavutil/opt.h>
88

9-
#ifdef AV_RESAMPLE_LIBRARY
9+
#ifdef AVTRANSCODER_LIBAV_DEPENDENCY
1010
#include <libavresample/avresample.h>
1111
#define AllocResampleContext avresample_alloc_context
1212
#define FreeResampleContext avresample_free
@@ -98,7 +98,7 @@ void AudioTransform::convert( const Frame& srcFrame, Frame& dstFrame )
9898
unsigned char* dstData = dstFrame.getData();
9999

100100
int nbOutputSamplesPerChannel;
101-
#ifdef AV_RESAMPLE_LIBRARY
101+
#ifdef AVTRANSCODER_LIBAV_DEPENDENCY
102102
nbOutputSamplesPerChannel = avresample_convert( _audioConvertContext, (uint8_t**)&dstData, 0, dstFrame.getSize(), (uint8_t**)&srcData, 0, srcFrame.getSize() );
103103
#else
104104
nbOutputSamplesPerChannel = swr_convert( _audioConvertContext, &dstData, dstFrame.getSize(), &srcData, srcFrame.getSize() );

src/AvTranscoder/transform/AudioTransform.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#include <AvTranscoder/common.hpp>
77
#include <AvTranscoder/frame/Frame.hpp>
88

9-
#ifdef AV_RESAMPLE_LIBRARY
9+
#ifdef AVTRANSCODER_LIBAV_DEPENDENCY
1010
#define ResampleContext AVAudioResampleContext
1111
#else
1212
#define ResampleContext SwrContext

src/CMakeLists.txt

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,16 @@
22
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
33
include(AvTranscoderMacros)
44

5-
##find_package(FFmpeg)
6-
find_package(FFmpeg
7-
COMPONENTS avcodec avformat avutil swscale swresample avresample)
5+
# find package ffmpeg/libav
6+
find_package(FFmpeg COMPONENTS avcodec avformat avutil swscale swresample avresample)
87

98
# Check if FFmpeg or libav dependency
10-
if(avresample_VERSION)
11-
add_definitions(-DAV_RESAMPLE_LIBRARY)
12-
elseif(swresample_VERSION)
13-
add_definitions(-DFF_RESAMPLE_LIBRARY)
9+
if(avresample_FOUND)
10+
add_definitions(-DAVTRANSCODER_LIBAV_DEPENDENCY)
11+
message("Build avTranscoder with dependency to libav.")
12+
elseif(swresample_FOUND)
13+
add_definitions(-DAVTRANSCODER_FFMPEG_DEPENDENCY)
14+
message("Build avTranscoder with dependency to ffmpeg.")
1415
else()
1516
message(SEND_ERROR, "Need 'swresample' or 'avresample'.")
1617
endif()

0 commit comments

Comments
 (0)