Skip to content

Swig flags #185

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 6, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/AvTranscoder/avTranscoder.i
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
%include "AvTranscoder/swig/avMediaType.i"
%include "AvTranscoder/swig/avRational.i"
%include "AvTranscoder/swig/avLogLevel.i"
%include "AvTranscoder/swig/avOperator.i"

%{
#include <AvTranscoder/Library.hpp>
Expand Down
2 changes: 1 addition & 1 deletion src/AvTranscoder/codec/ICodec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ ICodec::~ICodec()
_avCodecContext = NULL;
}

void ICodec::open()
void ICodec::openCodec()
{
if( ! _avCodecContext )
throw std::runtime_error( "unable to open a codec with no codec context" );
Expand Down
2 changes: 1 addition & 1 deletion src/AvTranscoder/codec/ICodec.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class AvExport ICodec
virtual ~ICodec() = 0;

/// Initialize the codec context.
void open();
void openCodec();

std::string getCodecName() const;
AVCodecID getCodecId() const;
Expand Down
2 changes: 1 addition & 1 deletion src/AvTranscoder/decoder/AudioDecoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ AudioDecoder::~AudioDecoder()

void AudioDecoder::setup()
{
_inputStream->getAudioCodec().open();
_inputStream->getAudioCodec().openCodec();
}

bool AudioDecoder::decodeNextFrame( Frame& frameBuffer )
Expand Down
2 changes: 1 addition & 1 deletion src/AvTranscoder/decoder/VideoDecoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ VideoDecoder::~VideoDecoder()

void VideoDecoder::setup()
{
_inputStream->getVideoCodec().open();
_inputStream->getVideoCodec().openCodec();
}

bool VideoDecoder::decodeNextFrame( Frame& frameBuffer )
Expand Down
2 changes: 1 addition & 1 deletion src/AvTranscoder/encoder/AudioEncoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ AudioEncoder::~AudioEncoder()

void AudioEncoder::setup()
{
_codec.open();
_codec.openCodec();
}

bool AudioEncoder::encodeFrame( const Frame& sourceFrame, Frame& codedFrame )
Expand Down
2 changes: 1 addition & 1 deletion src/AvTranscoder/encoder/VideoEncoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ VideoEncoder::~VideoEncoder()

void VideoEncoder::setup()
{
_codec.open();
_codec.openCodec();
}


Expand Down
4 changes: 3 additions & 1 deletion src/AvTranscoder/frame/Frame.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ class AvExport Frame
/// Create a frame with a the given buffer size
Frame( const size_t dataSize );

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

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

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

#ifndef SWIG
AVPacket& getAVPacket() { return _packet; }
const AVPacket& getAVPacket() const { return _packet; }
const unsigned char* getData() const { return _packet.data; }
#endif
Expand Down
7 changes: 7 additions & 0 deletions src/AvTranscoder/swig/avOperator.i
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#if SWIGPYTHON
%rename(__assign__) *::operator=;
#endif

#if SWIGJAVA
%rename(clone) *::operator=;
#endif
8 changes: 4 additions & 4 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ if(SWIG_FOUND)
set(AVTRANSCODER_BINDING_FILE "AvTranscoder/avTranscoder.i")
set_source_files_properties(${AVTRANSCODER_BINDING_FILE} PROPERTIES CPLUSPLUS ON)

# Swig flags
set(CMAKE_SWIG_FLAGS -c++ -fcompact -small -O -Werror)

### PYTHON BINDING
if(AVTRANSCODER_DISABLE_PYTHON_BINDING)
message("PYTHON binding disabled, will not build python binding.")
Expand All @@ -84,9 +87,6 @@ if(SWIG_FOUND)
if(PYTHONLIBS_FOUND)
include_directories(${PYTHON_INCLUDE_PATH})

# Swig flags
set(CMAKE_SWIG_FLAGS -c++ -fcompact)

# Create '_avtranscoder' shared lib (python)
swig_add_module(avtranscoder-py python ${AVTRANSCODER_BINDING_FILE})
# For Python binding, need to compile the wrapper into a lib called "_<module_name>.so"
Expand Down Expand Up @@ -131,7 +131,7 @@ if(SWIG_FOUND)
include_directories(${JNI_INCLUDE_DIRS})

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

# Create 'avtranscoder-java' shared lib
swig_add_module(avtranscoder-java java ${AVTRANSCODER_BINDING_FILE})
Expand Down