From e57546de6faca13b3baba7ab96da3fdda8bd87d7 Mon Sep 17 00:00:00 2001 From: Valentin NOEL Date: Thu, 9 Oct 2014 18:55:37 +0200 Subject: [PATCH 01/13] Windows: fix static const members unresolved reference SWIG binding problem --- src/AvTranscoder/Profile.cpp | 16 ++++++- src/AvTranscoder/Profile.hpp | 48 +++++++++++++------ src/AvTranscoder/avTranscoder.i | 19 -------- .../essenceStructures/AudioFrame.hpp | 4 +- .../essenceStructures/VideoFrame.hpp | 4 +- 5 files changed, 52 insertions(+), 39 deletions(-) diff --git a/src/AvTranscoder/Profile.cpp b/src/AvTranscoder/Profile.cpp index d28df5e5..79d36b3e 100644 --- a/src/AvTranscoder/Profile.cpp +++ b/src/AvTranscoder/Profile.cpp @@ -18,12 +18,10 @@ namespace avtranscoder const std::string Profile::avProfileIdentificator( "avProfile" ); const std::string Profile::avProfileIdentificatorHuman( "avProfileLong" ); - const std::string Profile::avProfileType( "avProfileType" ); const std::string Profile::avProfileTypeFormat( "avProfileTypeFormat" ); const std::string Profile::avProfileTypeVideo( "avProfileTypeVideo" ); const std::string Profile::avProfileTypeAudio( "avProfileTypeAudio" ); - const std::string Profile::avProfileFormat( "format" ); const std::string Profile::avProfileCodec( "codec" ); const std::string Profile::avProfilePixelFormat( "pix_fmt" ); @@ -172,4 +170,18 @@ Profile::ProfileDesc& Profile::getProfile( const std::string& searchProfile ) throw std::runtime_error( "unable to find profile: " + searchProfile ); } +const std::string & Profile::getAvProfileIdentificatorKey() { return avProfileIdentificator; }; +const std::string & Profile::getAvProfileIdentificatorHumanKey() { return avProfileIdentificatorHuman; }; +const std::string & Profile::getAvProfileTypeKey() { return avProfileType; }; +const std::string & Profile::getAvProfileTypeFormatKey() { return avProfileTypeFormat; }; +const std::string & Profile::getAvProfileTypeVideoKey() { return avProfileTypeVideo; }; +const std::string & Profile::getAvProfileTypeAudioKey() { return avProfileTypeAudio; }; +const std::string & Profile::getAvProfileFormatKey() { return avProfileFormat; }; +const std::string & Profile::getAvProfileCodecKey() { return avProfileCodec; }; +const std::string & Profile::getAvProfilePixelFormatKey() { return avProfilePixelFormat; }; +const std::string & Profile::getAvProfileSampleFormatKey() { return avProfileSampleFormat; }; +const std::string & Profile::getAvProfileFrameRateKey() { return avProfileFrameRate; }; +const std::string & Profile::getAvProfileSampleRateKey() { return avProfileSampleRate; }; +const std::string & Profile::getAvProfileChannelKey() { return avProfileChannel; }; + } diff --git a/src/AvTranscoder/Profile.hpp b/src/AvTranscoder/Profile.hpp index 3e5b62b8..fcfa2faa 100644 --- a/src/AvTranscoder/Profile.hpp +++ b/src/AvTranscoder/Profile.hpp @@ -14,21 +14,7 @@ namespace avtranscoder class AvExport Profile { public: - static const std::string avProfileIdentificator; - static const std::string avProfileIdentificatorHuman; - static const std::string avProfileType; - static const std::string avProfileTypeFormat; - static const std::string avProfileTypeVideo; - static const std::string avProfileTypeAudio; - - static const std::string avProfileFormat; - static const std::string avProfileCodec; - static const std::string avProfilePixelFormat; - static const std::string avProfileSampleFormat; - static const std::string avProfileFrameRate; - static const std::string avProfileSampleRate; - static const std::string avProfileChannel; public: // typedef std::pair< std::string, std::string > KeyDesc; @@ -51,9 +37,43 @@ class AvExport Profile ProfileDesc& getProfile( const std::string& searchProfile ); + static const std::string & getAvProfileIdentificatorKey(); + static const std::string & getAvProfileIdentificatorHumanKey(); + static const std::string & getAvProfileTypeKey(); + static const std::string & getAvProfileTypeFormatKey(); + static const std::string & getAvProfileTypeVideoKey(); + static const std::string & getAvProfileTypeAudioKey(); + static const std::string & getAvProfileFormatKey(); + static const std::string & getAvProfileCodecKey(); + static const std::string & getAvProfilePixelFormatKey(); + static const std::string & getAvProfileSampleFormatKey(); + static const std::string & getAvProfileFrameRateKey(); + static const std::string & getAvProfileSampleRateKey(); + static const std::string & getAvProfileChannelKey(); + private: ProfilesDesc _profiles; + +#ifndef SWIG +public: + static const std::string avProfileIdentificator; + static const std::string avProfileIdentificatorHuman; + static const std::string avProfileType; + static const std::string avProfileTypeFormat; + static const std::string avProfileTypeVideo; + static const std::string avProfileTypeAudio; + static const std::string avProfileFormat; + static const std::string avProfileCodec; + static const std::string avProfilePixelFormat; + static const std::string avProfileSampleFormat; + static const std::string avProfileFrameRate; + static const std::string avProfileSampleRate; + static const std::string avProfileChannel; +#endif + }; + + } #endif \ No newline at end of file diff --git a/src/AvTranscoder/avTranscoder.i b/src/AvTranscoder/avTranscoder.i index 0be7699e..cb18bfd2 100644 --- a/src/AvTranscoder/avTranscoder.i +++ b/src/AvTranscoder/avTranscoder.i @@ -49,25 +49,6 @@ #include #include - -/* initialize static const members for binding */ -namespace avtranscoder { -const std::string Profile::avProfileIdentificator = "avProfile"; -const std::string Profile::avProfileIdentificatorHuman = "avProfileLong"; - -const std::string Profile::avProfileType = "avProfileType"; -const std::string Profile::avProfileTypeFormat = "avProfileTypeFormat"; -const std::string Profile::avProfileTypeVideo = "avProfileTypeVideo"; -const std::string Profile::avProfileTypeAudio = "avProfileTypeAudio"; - -const std::string Profile::avProfileFormat = "format"; -const std::string Profile::avProfileCodec = "codec"; -const std::string Profile::avProfilePixelFormat = "pix_fmt"; -const std::string Profile::avProfileSampleFormat = "sample_fmt"; -const std::string Profile::avProfileFrameRate = "r"; -const std::string Profile::avProfileSampleRate = "ar"; -const std::string Profile::avProfileChannel = "ac"; -} %} namespace std { diff --git a/src/AvTranscoder/essenceStructures/AudioFrame.hpp b/src/AvTranscoder/essenceStructures/AudioFrame.hpp index 99f01d76..5c0dfddb 100644 --- a/src/AvTranscoder/essenceStructures/AudioFrame.hpp +++ b/src/AvTranscoder/essenceStructures/AudioFrame.hpp @@ -31,8 +31,8 @@ class AvExport AudioFrameDesc void setParameters( const Profile::ProfileDesc& desc ) { - if( desc.find( Profile::avProfileSampleFormat ) != desc.end() ) - setSampleFormat( desc.find( Profile::avProfileSampleFormat )->second ); + if( desc.find( Profile::getAvProfileSampleFormatKey() ) != desc.end() ) + setSampleFormat( desc.find( Profile::getAvProfileSampleFormatKey() )->second ); } size_t getSampleRate() const { return _sampleRate; } diff --git a/src/AvTranscoder/essenceStructures/VideoFrame.hpp b/src/AvTranscoder/essenceStructures/VideoFrame.hpp index 5817b5bc..e35f66e9 100644 --- a/src/AvTranscoder/essenceStructures/VideoFrame.hpp +++ b/src/AvTranscoder/essenceStructures/VideoFrame.hpp @@ -51,8 +51,8 @@ class AvExport VideoFrameDesc void setParameters( const Profile::ProfileDesc& desc ) { - if( desc.find( Profile::avProfilePixelFormat ) != desc.end() ) - setPixel( Pixel( desc.find( Profile::avProfilePixelFormat )->second.c_str() ) ); + if( desc.find( Profile::getAvProfilePixelFormatKey() ) != desc.end() ) + setPixel( Pixel( desc.find( Profile::getAvProfilePixelFormatKey() )->second.c_str() ) ); } size_t getWidth () const { return _width; } From 06573169662eee2303dde0270b585575078a6b5d Mon Sep 17 00:00:00 2001 From: Valentin NOEL Date: Thu, 9 Oct 2014 18:58:02 +0200 Subject: [PATCH 02/13] Windows: fix nMake app installing (version and extension problems) --- app/avInfo/CMakeLists.txt | 19 ++++++++++++++----- app/avMeta/CMakeLists.txt | 19 ++++++++++++++----- app/avTranscoder/CMakeLists.txt | 19 ++++++++++++++----- app/genericProcessor/CMakeLists.txt | 19 ++++++++++++++----- app/optionChecker/CMakeLists.txt | 18 +++++++++++++----- app/presetChecker/CMakeLists.txt | 19 ++++++++++++++----- 6 files changed, 83 insertions(+), 30 deletions(-) diff --git a/app/avInfo/CMakeLists.txt b/app/avInfo/CMakeLists.txt index cf437fa1..2cf9680f 100644 --- a/app/avInfo/CMakeLists.txt +++ b/app/avInfo/CMakeLists.txt @@ -11,11 +11,20 @@ set_target_properties(avinfo PROPERTIES VERSION ${AVTRANSCODER_VERSION}) target_link_libraries(avinfo avtranscoder-shared) # Install app -install( - FILES "${CMAKE_CURRENT_BINARY_DIR}/avinfo" "${CMAKE_CURRENT_BINARY_DIR}/avinfo-${AVTRANSCODER_VERSION}" - PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_READ WORLD_EXECUTE - DESTINATION "bin/" -) +if(WIN32) + install( + FILES "${CMAKE_CURRENT_BINARY_DIR}/avinfo.exe" + PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_READ WORLD_EXECUTE + DESTINATION "bin/" + ) +else() + install( + FILES "${CMAKE_CURRENT_BINARY_DIR}/avinfo" "${CMAKE_CURRENT_BINARY_DIR}/avinfo-${AVTRANSCODER_VERSION}" + PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_READ WORLD_EXECUTE + DESTINATION "bin/" + ) +endif() + install( FILES ${CMAKE_CURRENT_SOURCE_DIR}/avinfo.man RENAME "avinfo.1" diff --git a/app/avMeta/CMakeLists.txt b/app/avMeta/CMakeLists.txt index ea01da99..2bcb9983 100644 --- a/app/avMeta/CMakeLists.txt +++ b/app/avMeta/CMakeLists.txt @@ -11,11 +11,20 @@ set_target_properties(avmeta PROPERTIES VERSION ${AVTRANSCODER_VERSION}) target_link_libraries(avmeta avtranscoder-shared) # Install app -install( - FILES "${CMAKE_CURRENT_BINARY_DIR}/avmeta" "${CMAKE_CURRENT_BINARY_DIR}/avmeta-${AVTRANSCODER_VERSION}" - PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_READ WORLD_EXECUTE - DESTINATION "bin/" -) +if(WIN32) + install( + FILES "${CMAKE_CURRENT_BINARY_DIR}/avmeta.exe" + PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_READ WORLD_EXECUTE + DESTINATION "bin/" + ) +else() + install( + FILES "${CMAKE_CURRENT_BINARY_DIR}/avmeta" "${CMAKE_CURRENT_BINARY_DIR}/avmeta-${AVTRANSCODER_VERSION}" + PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_READ WORLD_EXECUTE + DESTINATION "bin/" + ) +endif() + install( FILES ${CMAKE_CURRENT_SOURCE_DIR}/avmeta.man RENAME "avmeta.1" diff --git a/app/avTranscoder/CMakeLists.txt b/app/avTranscoder/CMakeLists.txt index f312fc2e..cf97466e 100644 --- a/app/avTranscoder/CMakeLists.txt +++ b/app/avTranscoder/CMakeLists.txt @@ -11,11 +11,20 @@ set_target_properties(avtranscoder PROPERTIES VERSION ${AVTRANSCODER_VERSION}) target_link_libraries(avtranscoder avtranscoder-shared) # Install app -install( - FILES "${CMAKE_CURRENT_BINARY_DIR}/avtranscoder" "${CMAKE_CURRENT_BINARY_DIR}/avtranscoder-${AVTRANSCODER_VERSION}" - PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_READ WORLD_EXECUTE - DESTINATION "bin/" -) +if(WIN32) + install( + FILES "${CMAKE_CURRENT_BINARY_DIR}/avtranscoder.exe" + PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_READ WORLD_EXECUTE + DESTINATION "bin/" + ) +else() + install( + FILES "${CMAKE_CURRENT_BINARY_DIR}/avtranscoder" "${CMAKE_CURRENT_BINARY_DIR}/avtranscoder-${AVTRANSCODER_VERSION}" + PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_READ WORLD_EXECUTE + DESTINATION "bin/" + ) +endif() + install( FILES ${CMAKE_CURRENT_SOURCE_DIR}/av++.man RENAME av++.1 diff --git a/app/genericProcessor/CMakeLists.txt b/app/genericProcessor/CMakeLists.txt index 6a1fe4fe..69a4e0ba 100644 --- a/app/genericProcessor/CMakeLists.txt +++ b/app/genericProcessor/CMakeLists.txt @@ -11,11 +11,20 @@ set_target_properties(avprocessor PROPERTIES VERSION ${AVTRANSCODER_VERSION}) target_link_libraries(avprocessor avtranscoder-shared) # Install app -install( - FILES "${CMAKE_CURRENT_BINARY_DIR}/avprocessor" "${CMAKE_CURRENT_BINARY_DIR}/avprocessor-${AVTRANSCODER_VERSION}" - PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_READ WORLD_EXECUTE - DESTINATION "bin/" -) +if(WIN32) + install( + FILES "${CMAKE_CURRENT_BINARY_DIR}/avprocessor.exe" + PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_READ WORLD_EXECUTE + DESTINATION "bin/" + ) +else() + install( + FILES "${CMAKE_CURRENT_BINARY_DIR}/avprocessor" "${CMAKE_CURRENT_BINARY_DIR}/avprocessor-${AVTRANSCODER_VERSION}" + PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_READ WORLD_EXECUTE + DESTINATION "bin/" + ) +endif() + install( FILES ${CMAKE_CURRENT_SOURCE_DIR}/avprocessor.man RENAME avprocessor.1 diff --git a/app/optionChecker/CMakeLists.txt b/app/optionChecker/CMakeLists.txt index 0372fb90..fa446a36 100644 --- a/app/optionChecker/CMakeLists.txt +++ b/app/optionChecker/CMakeLists.txt @@ -13,8 +13,16 @@ set_target_properties(avoptionchecker PROPERTIES VERSION ${AVTRANSCODER_VERSION} target_link_libraries(avoptionchecker avtranscoder-shared) # Install app -install( - FILES "${CMAKE_CURRENT_BINARY_DIR}/avoptionchecker" "${CMAKE_CURRENT_BINARY_DIR}/avoptionchecker-${AVTRANSCODER_VERSION}" - PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_READ WORLD_EXECUTE - DESTINATION "bin/" -) +if(WIN32) + install( + FILES "${CMAKE_CURRENT_BINARY_DIR}/avoptionchecker.exe" + PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_READ WORLD_EXECUTE + DESTINATION "bin/" + ) +else() + install( + FILES "${CMAKE_CURRENT_BINARY_DIR}/avoptionchecker" "${CMAKE_CURRENT_BINARY_DIR}/avoptionchecker-${AVTRANSCODER_VERSION}" + PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_READ WORLD_EXECUTE + DESTINATION "bin/" + ) +endif() diff --git a/app/presetChecker/CMakeLists.txt b/app/presetChecker/CMakeLists.txt index 763c6031..50246fcf 100644 --- a/app/presetChecker/CMakeLists.txt +++ b/app/presetChecker/CMakeLists.txt @@ -13,11 +13,20 @@ set_target_properties(avpresetchecker PROPERTIES VERSION ${AVTRANSCODER_VERSION} target_link_libraries(avpresetchecker avtranscoder-shared) # Install app -install( - FILES "${CMAKE_CURRENT_BINARY_DIR}/avpresetchecker" "${CMAKE_CURRENT_BINARY_DIR}/avpresetchecker-${AVTRANSCODER_VERSION}" - PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_READ WORLD_EXECUTE - DESTINATION "bin/" -) +if(WIN32) + install( + FILES "${CMAKE_CURRENT_BINARY_DIR}/avpresetchecker.exe" + PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_READ WORLD_EXECUTE + DESTINATION "bin/" + ) +else() + install( + FILES "${CMAKE_CURRENT_BINARY_DIR}/avpresetchecker" "${CMAKE_CURRENT_BINARY_DIR}/avpresetchecker-${AVTRANSCODER_VERSION}" + PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_READ WORLD_EXECUTE + DESTINATION "bin/" + ) +endif() + install( FILES ${CMAKE_CURRENT_SOURCE_DIR}/avprofiles.man RENAME avprofiles.1 From babccda35a93dfd667ff56052a377e842d21bc9e Mon Sep 17 00:00:00 2001 From: Valentin NOEL Date: Mon, 13 Oct 2014 18:56:15 +0200 Subject: [PATCH 03/13] Windows: export missing classes and methods --- app/presetChecker/presetChecker.cpp | 4 ++-- src/AvTranscoder/Library.hpp | 12 ++++++------ src/AvTranscoder/option/Option.hpp | 4 +++- src/AvTranscoder/option/OptionLoader.hpp | 2 +- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/app/presetChecker/presetChecker.cpp b/app/presetChecker/presetChecker.cpp index dc231041..6bc2b833 100644 --- a/app/presetChecker/presetChecker.cpp +++ b/app/presetChecker/presetChecker.cpp @@ -25,13 +25,13 @@ int main( int argc, char** argv ) std::cout << std::setw(35) << key.first << key.second << std::endl; try{ - if( profile.find( avtranscoder::Profile::avProfileType )->second == avtranscoder::Profile::avProfileTypeVideo ) + if( profile.find( avtranscoder::Profile::getAvProfileTypeKey() )->second == avtranscoder::Profile::getAvProfileTypeVideoKey() ) { avtranscoder::AvOutputVideo outputVideo; outputVideo.setProfile( profile, outputVideo.getVideoDesc().getVideoFrameDesc() ); } - if( profile.find( avtranscoder::Profile::avProfileType )->second == avtranscoder::Profile::avProfileTypeAudio ) + if( profile.find( avtranscoder::Profile::getAvProfileTypeKey() )->second == avtranscoder::Profile::getAvProfileTypeAudioKey() ) { avtranscoder::AvOutputAudio outputAudio; outputAudio.setProfile( profile, outputAudio.getAudioDesc().getFrameDesc() ); diff --git a/src/AvTranscoder/Library.hpp b/src/AvTranscoder/Library.hpp index cd943d98..82219878 100644 --- a/src/AvTranscoder/Library.hpp +++ b/src/AvTranscoder/Library.hpp @@ -1,15 +1,15 @@ #ifndef _AV_TRANSCODER_DESCRIPTION_HPP_ #define _AV_TRANSCODER_DESCRIPTION_HPP_ +#include "common.hpp" + #include #include -#include "common.hpp" - namespace avtranscoder { -class Library +class AvExport Library { public: Library( const std::string& name, const std::string& license, const size_t major, const size_t minor, const size_t release ); @@ -33,11 +33,11 @@ class Library typedef std::vector< Library > Libraries; -Libraries getLibraries(); +Libraries AvExport getLibraries(); -std::vector getInputExtensions(); +std::vector AvExport getInputExtensions(); -std::vector getOutputExtensions(); +std::vector AvExport getOutputExtensions(); } diff --git a/src/AvTranscoder/option/Option.hpp b/src/AvTranscoder/option/Option.hpp index e039cdfd..dac0dcb8 100644 --- a/src/AvTranscoder/option/Option.hpp +++ b/src/AvTranscoder/option/Option.hpp @@ -1,6 +1,8 @@ #ifndef _AV_TRANSCODER_OPTION_HPP #define _AV_TRANSCODER_OPTION_HPP +#include + extern "C" { #ifndef __STDC_CONSTANT_MACROS #define __STDC_CONSTANT_MACROS @@ -33,7 +35,7 @@ enum OptionType * Get its type to know what the option is about: Int, Double, Ratio, Choice... * Parse its array of options to get the potential childs (Choice and Group). */ -class Option +class AvExport Option { public: static OptionType getTypeFromAVOption( const char* unit, AVOptionType avType ); diff --git a/src/AvTranscoder/option/OptionLoader.hpp b/src/AvTranscoder/option/OptionLoader.hpp index 6e5e244b..05833f0a 100644 --- a/src/AvTranscoder/option/OptionLoader.hpp +++ b/src/AvTranscoder/option/OptionLoader.hpp @@ -22,7 +22,7 @@ namespace avtranscoder * @brief Manage Options. * Get a list of options by calling a load****Options(), depending on which FFMpeg / LibAV object you want to analyse. */ -class OptionLoader +class AvExport OptionLoader { public: typedef std::vector