Skip to content

Commit a08947d

Browse files
committed
Merge pull request #69 from mikrosimage/minor_build_fixes
Minor build fixes
2 parents 8f83509 + 5a806fa commit a08947d

File tree

5 files changed

+11
-5
lines changed

5 files changed

+11
-5
lines changed

src/AvTranscoder/Option.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
extern "C" {
44
#include <libavutil/error.h>
5+
#include <libavutil/mem.h>
56
}
67

78
#include <iostream>

src/AvTranscoder/codec/AudioCodec.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#include "AudioCodec.hpp"
22

3+
#include <cmath>
34
#include <cassert>
45

56
namespace avtranscoder
@@ -25,7 +26,7 @@ AudioFrameDesc AudioCodec::getAudioFrameDesc() const
2526
assert( _avCodecContext != NULL );
2627
AudioFrameDesc audioFrameDesc( _avCodecContext->sample_rate, _avCodecContext->channels, _avCodecContext->sample_fmt );
2728
double fps = 1.0 * _avCodecContext->time_base.den / ( _avCodecContext->time_base.num * _avCodecContext->ticks_per_frame );
28-
if( ! isinf( fps ) )
29+
if( ! std::isinf( fps ) )
2930
audioFrameDesc.setFps( fps );
3031
return audioFrameDesc;
3132
}

src/AvTranscoder/codec/VideoCodec.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#include "VideoCodec.hpp"
22

3+
#include <cmath>
34
#include <cassert>
45

56
namespace avtranscoder
@@ -25,7 +26,7 @@ VideoFrameDesc VideoCodec::getVideoFrameDesc() const
2526
assert( _avCodecContext != NULL );
2627
VideoFrameDesc videoFrameDesc( _avCodecContext->width, _avCodecContext->height, _avCodecContext->pix_fmt );
2728
double fps = 1.0 * _avCodecContext->time_base.den / ( _avCodecContext->time_base.num * _avCodecContext->ticks_per_frame );
28-
if( ! isinf( fps ) )
29+
if( ! std::isinf( fps ) )
2930
videoFrameDesc.setFps( fps );
3031
return videoFrameDesc;
3132
}

src/AvTranscoder/file/FormatContext.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,8 @@ void FormatContext::addMetaData( const std::string& key, const std::string& valu
133133

134134
AVStream& FormatContext::addAVStream( const AVCodec& avCodec )
135135
{
136-
AVStream* stream = avformat_new_stream( _avFormatContext, &avCodec );
136+
// Need const_cast<AVCodec*> for libav versions < 54.34.
137+
AVStream* stream = avformat_new_stream( _avFormatContext, const_cast<AVCodec*>(&avCodec) );
137138
if( stream == NULL )
138139
{
139140
throw std::runtime_error( "unable to add new video stream" );

src/CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@ find_package(FFmpeg
77
COMPONENTS avcodec avformat avutil swscale swresample avresample)
88

99
# Check if FFmpeg or libav dependency
10-
if(EXISTS "${FFMPEG_INCLUDE_DIR}/libavresample/avresample.h")
10+
if(avresample_VERSION)
1111
add_definitions(-DAV_RESAMPLE_LIBRARY)
12-
else()
12+
elseif(swresample_VERSION)
1313
add_definitions(-DFF_RESAMPLE_LIBRARY)
14+
else()
15+
message(SEND_ERROR, "Need 'swresample' or 'avresample'.")
1416
endif()
1517

1618
# Include AvTranscoder and FFmpeg

0 commit comments

Comments
 (0)