Skip to content

Commit c59b98b

Browse files
committed
Merge pull request #185 from cchampet/dev_SWIG_flags
Swig flags
2 parents 848460e + 0173f83 commit c59b98b

File tree

10 files changed

+21
-11
lines changed

10 files changed

+21
-11
lines changed

src/AvTranscoder/avTranscoder.i

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
%include "AvTranscoder/swig/avMediaType.i"
1414
%include "AvTranscoder/swig/avRational.i"
1515
%include "AvTranscoder/swig/avLogLevel.i"
16+
%include "AvTranscoder/swig/avOperator.i"
1617

1718
%{
1819
#include <AvTranscoder/Library.hpp>

src/AvTranscoder/codec/ICodec.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ ICodec::~ICodec()
5151
_avCodecContext = NULL;
5252
}
5353

54-
void ICodec::open()
54+
void ICodec::openCodec()
5555
{
5656
if( ! _avCodecContext )
5757
throw std::runtime_error( "unable to open a codec with no codec context" );

src/AvTranscoder/codec/ICodec.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class AvExport ICodec
3636
virtual ~ICodec() = 0;
3737

3838
/// Initialize the codec context.
39-
void open();
39+
void openCodec();
4040

4141
std::string getCodecName() const;
4242
AVCodecID getCodecId() const;

src/AvTranscoder/decoder/AudioDecoder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ AudioDecoder::~AudioDecoder()
5252

5353
void AudioDecoder::setup()
5454
{
55-
_inputStream->getAudioCodec().open();
55+
_inputStream->getAudioCodec().openCodec();
5656
}
5757

5858
bool AudioDecoder::decodeNextFrame( Frame& frameBuffer )

src/AvTranscoder/decoder/VideoDecoder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ VideoDecoder::~VideoDecoder()
5050

5151
void VideoDecoder::setup()
5252
{
53-
_inputStream->getVideoCodec().open();
53+
_inputStream->getVideoCodec().openCodec();
5454
}
5555

5656
bool VideoDecoder::decodeNextFrame( Frame& frameBuffer )

src/AvTranscoder/encoder/AudioEncoder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ AudioEncoder::~AudioEncoder()
3737

3838
void AudioEncoder::setup()
3939
{
40-
_codec.open();
40+
_codec.openCodec();
4141
}
4242

4343
bool AudioEncoder::encodeFrame( const Frame& sourceFrame, Frame& codedFrame )

src/AvTranscoder/encoder/VideoEncoder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ VideoEncoder::~VideoEncoder()
3838

3939
void VideoEncoder::setup()
4040
{
41-
_codec.open();
41+
_codec.openCodec();
4242
}
4343

4444

src/AvTranscoder/frame/Frame.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,10 @@ class AvExport Frame
1919
/// Create a frame with a the given buffer size
2020
Frame( const size_t dataSize );
2121

22+
#ifndef SWIG
2223
/// Create a frame from the given AVPAcket (copy data of given packet)
2324
Frame( const AVPacket& avPacket );
25+
#endif
2426

2527
/// Override copy constructor in order to copy AVPacket data
2628
Frame( const Frame& other );
@@ -52,11 +54,11 @@ class AvExport Frame
5254
/// Clear existing data and set size to 0
5355
void clear();
5456

55-
AVPacket& getAVPacket() { return _packet; }
5657
unsigned char* getData() { return _packet.data; }
5758
size_t getSize() const { return _packet.size; }
5859

5960
#ifndef SWIG
61+
AVPacket& getAVPacket() { return _packet; }
6062
const AVPacket& getAVPacket() const { return _packet; }
6163
const unsigned char* getData() const { return _packet.data; }
6264
#endif

src/AvTranscoder/swig/avOperator.i

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#if SWIGPYTHON
2+
%rename(__assign__) *::operator=;
3+
#endif
4+
5+
#if SWIGJAVA
6+
%rename(clone) *::operator=;
7+
#endif

src/CMakeLists.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ if(SWIG_FOUND)
7676
set(AVTRANSCODER_BINDING_FILE "AvTranscoder/avTranscoder.i")
7777
set_source_files_properties(${AVTRANSCODER_BINDING_FILE} PROPERTIES CPLUSPLUS ON)
7878

79+
# Swig flags
80+
set(CMAKE_SWIG_FLAGS -c++ -fcompact -small -O -Werror)
81+
7982
### PYTHON BINDING
8083
if(AVTRANSCODER_DISABLE_PYTHON_BINDING)
8184
message("PYTHON binding disabled, will not build python binding.")
@@ -84,9 +87,6 @@ if(SWIG_FOUND)
8487
if(PYTHONLIBS_FOUND)
8588
include_directories(${PYTHON_INCLUDE_PATH})
8689

87-
# Swig flags
88-
set(CMAKE_SWIG_FLAGS -c++ -fcompact)
89-
9090
# Create '_avtranscoder' shared lib (python)
9191
swig_add_module(avtranscoder-py python ${AVTRANSCODER_BINDING_FILE})
9292
# For Python binding, need to compile the wrapper into a lib called "_<module_name>.so"
@@ -131,7 +131,7 @@ if(SWIG_FOUND)
131131
include_directories(${JNI_INCLUDE_DIRS})
132132

133133
# Swig flags
134-
set(CMAKE_SWIG_FLAGS -c++ -fcompact -package org.avtranscoder)
134+
set(CMAKE_SWIG_FLAGS ${CMAKE_SWIG_FLAGS} -package org.avtranscoder)
135135

136136
# Create 'avtranscoder-java' shared lib
137137
swig_add_module(avtranscoder-java java ${AVTRANSCODER_BINDING_FILE})

0 commit comments

Comments
 (0)