Skip to content

Commit 19d9b3c

Browse files
committed
Merge pull request #147 from mikrosimage/develop
Up to v0.6.0 (MIK fork)
2 parents 13554eb + 50eed64 commit 19d9b3c

22 files changed

+1147
-1047
lines changed

cmake/AvTranscoderMacros.cmake

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,16 @@ file(GLOB_RECURSE AVTRANSCODER_SRC_FILES "AvTranscoder/*.cpp" "AvTranscoder/*.hp
1010
# AVTRANSCODER_VERSION
1111
file(STRINGS "${AVTRANSCODER_SRC_PATH}/AvTranscoder/common.hpp" _avtranscoder_VERSION_HPP_CONTENTS REGEX "#define AVTRANSCODER_VERSION_")
1212
foreach(v MAJOR MINOR MICRO)
13-
if("${_avtranscoder_VERSION_HPP_CONTENTS}" MATCHES "#define AVTRANSCODER_VERSION_${v} ([0-9]+)")
14-
set(AVTRANSCODER_VERSION_${v} "${CMAKE_MATCH_1}")
15-
else()
16-
set(AVTRANSCODER_RETRIEVE_VERSION_FAILED 1)
17-
endif()
13+
if("${_avtranscoder_VERSION_HPP_CONTENTS}" MATCHES "#define AVTRANSCODER_VERSION_${v} ([0-9]+)")
14+
set(AVTRANSCODER_VERSION_${v} "${CMAKE_MATCH_1}")
15+
else()
16+
set(AVTRANSCODER_RETRIEVE_VERSION_FAILED 1)
17+
endif()
1818
endforeach()
1919
unset(_avtranscoder_VERSION_HPP_CONTENTS)
2020

2121
set(AVTRANSCODER_VERSION "${AVTRANSCODER_VERSION_MAJOR}.${AVTRANSCODER_VERSION_MINOR}.${AVTRANSCODER_VERSION_MICRO}")
2222

2323
if(AVTRANSCODER_RETRIEVE_VERSION_FAILED)
24-
message(SEND_ERROR "Failed to retrieve AvTranscoder version: ${AVTRANSCODER_VERSION}")
24+
message(SEND_ERROR "Failed to retrieve AvTranscoder version: ${AVTRANSCODER_VERSION}")
2525
endif()

cmake/FindFFmpeg.cmake

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,9 @@ macro(manage_components)
100100
set(FFMPEG_INCLUDE_DIR ${${COMPONENT}_INCLUDE_DIR})
101101
set(FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} ${${COMPONENT}_LIBRARIES})
102102
set(FFMPEG_DEFINITIONS ${FFMPEG_DEFINITIONS} ${${COMPONENT}_DEFINITIONS})
103-
else()
104-
set(${COMPONENT}_FOUND FALSE)
103+
else()
104+
message(STATUS "Skip ${COMPONENT} component because it was found elsewhere ('${${COMPONENT}_INCLUDE_DIR}' instead of '${FFMPEG_INCLUDE_DIR}').")
105+
set(${COMPONENT}_FOUND FALSE)
105106
endif()
106107
else()
107108
if(FFmpeg_FIND_REQUIRED)
@@ -121,12 +122,12 @@ endmacro()
121122

122123
# Check FFmpeg version
123124
if(DEFINED FFmpeg_FIND_VERSION)
124-
check_ffmpeg_version()
125+
check_ffmpeg_version()
125126
endif()
126127

127128
# Get basic components if no one is indicated
128129
if(NOT FFmpeg_FIND_COMPONENTS)
129-
set(FFmpeg_FIND_COMPONENTS avcodec avformat avutil)
130+
set(FFmpeg_FIND_COMPONENTS avcodec avformat avutil)
130131
endif()
131132

132133
# Check each component

src/AvTranscoder/common.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
#define _AV_TRANSCODER_COMMON_HPP_
33

44
#define AVTRANSCODER_VERSION_MAJOR 0
5-
#define AVTRANSCODER_VERSION_MINOR 5
6-
#define AVTRANSCODER_VERSION_MICRO 12
5+
#define AVTRANSCODER_VERSION_MINOR 6
6+
#define AVTRANSCODER_VERSION_MICRO 0
77

88
#include <AvTranscoder/system.hpp>
99

src/AvTranscoder/file/FormatContext.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,12 +191,12 @@ void FormatContext::setOutputFormat( const std::string& filename, const std::str
191191
msg += filename;
192192
if( ! shortName.empty() )
193193
{
194-
msg += ", ";
194+
msg += ", formatName = ";
195195
msg += shortName;
196196
}
197197
if( ! mimeType.empty() )
198198
{
199-
msg += ", ";
199+
msg += ", mimeType = ";
200200
msg += mimeType;
201201
}
202202
throw std::ios_base::failure( msg );

src/AvTranscoder/file/OutputFile.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@
1111
namespace avtranscoder
1212
{
1313

14-
OutputFile::OutputFile( const std::string& filename )
14+
OutputFile::OutputFile( const std::string& filename, const std::string& formatName, const std::string& mimeType )
1515
: _formatContext( AV_OPT_FLAG_ENCODING_PARAM )
1616
, _outputStreams()
1717
, _frameCount()
1818
, _previousProcessedStreamDuration( 0.0 )
1919
, _profile()
2020
{
2121
_formatContext.setFilename( filename );
22-
_formatContext.setOutputFormat( filename );
22+
_formatContext.setOutputFormat( filename, formatName, mimeType );
2323
}
2424

2525
OutputFile::~OutputFile()

src/AvTranscoder/file/OutputFile.hpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,15 @@ class AvExport OutputFile : public IOutputFile
2222

2323
public:
2424
/**
25-
* @brief Open an output media file
25+
* @brief Create an output media file.
2626
* @param filename resource to access
27+
* @param formatName should matches with the names of the registered formats
28+
* @param mimeType should matches with the MIME type of the registered formats
29+
* @note The caller should indicate formatName and/or mimeType if the filename has no extension.
30+
* @note The ressource is allocated when beginWrap.
31+
* @see beginWrap
2732
**/
28-
OutputFile( const std::string& filename = "" );
33+
OutputFile( const std::string& filename, const std::string& formatName = "", const std::string& mimeType = "" );
2934

3035
~OutputFile();
3136

src/AvTranscoder/mediaProperty/PixelProperties.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,21 @@ size_t PixelProperties::getBitsPerPixel() const
5656
return av_get_bits_per_pixel( _pixelDesc );
5757
}
5858

59+
size_t PixelProperties::getMaxNbBitsInChannels() const
60+
{
61+
if( ! _pixelDesc )
62+
throw std::runtime_error( "unable to find pixel description." );
63+
64+
size_t maxNbBitsInChannels = 0;
65+
for( unsigned int channelIndex = 0; channelIndex < _pixelDesc->nb_components; ++channelIndex )
66+
{
67+
const size_t nbBits = _pixelDesc->comp[channelIndex].depth_minus1 + 1;
68+
if( nbBits > maxNbBitsInChannels )
69+
maxNbBitsInChannels = nbBits;
70+
}
71+
return maxNbBitsInChannels;
72+
}
73+
5974
size_t PixelProperties::getNbComponents() const
6075
{
6176
if( ! _pixelDesc )
@@ -230,6 +245,7 @@ PropertyVector PixelProperties::getPropertiesAsVector() const
230245
addProperty( data, "pixelName", &PixelProperties::getPixelName );
231246
addProperty( data, "pixelFormatName", &PixelProperties::getPixelFormatName );
232247
addProperty( data, "bitDepth", &PixelProperties::getBitsPerPixel );
248+
addProperty( data, "maxNbBitsInChannels", &PixelProperties::getMaxNbBitsInChannels );
233249
addProperty( data, "nbComponents", &PixelProperties::getNbComponents );
234250
addProperty( data, "chromaWidth", &PixelProperties::getChromaWidth );
235251
addProperty( data, "chromaHeight", &PixelProperties::getChromaHeight );

src/AvTranscoder/mediaProperty/PixelProperties.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ class AvExport PixelProperties
5555
std::string getPixelName() const;
5656
std::string getPixelFormatName() const;
5757

58-
size_t getBitsPerPixel() const;
58+
size_t getBitsPerPixel() const; ///< padding bits are not counted
59+
size_t getMaxNbBitsInChannels() const;
5960
size_t getNbComponents() const;
6061
size_t getChromaWidth() const;
6162
size_t getChromaHeight() const;

src/CMakeLists.txt

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ message(STATUS "AvTranscoder version is ${AVTRANSCODER_VERSION}")
99
find_package(FFmpeg COMPONENTS avcodec avformat avutil swscale swresample avresample)
1010
if(swresample_FOUND)
1111
add_definitions(-DAVTRANSCODER_FFMPEG_DEPENDENCY)
12-
message(STATUS "Build avTranscoder with dependency to ffmpeg.")
12+
message(STATUS "Build avTranscoder with dependency to ffmpeg.")
1313
elseif(avresample_FOUND)
1414
add_definitions(-DAVTRANSCODER_LIBAV_DEPENDENCY)
1515
message(STATUS "Build avTranscoder with dependency to libav.")
1616
else()
17-
message(SEND_ERROR "Can't define if you depend on ffmpeg or libav.")
17+
message(SEND_ERROR "Can't define if you depend on ffmpeg or libav.")
1818
endif()
1919

2020
# Include AvTranscoder and FFmpeg
@@ -38,8 +38,7 @@ set_target_properties(avtranscoder-shared PROPERTIES SOVERSION ${AVTRANSCODER_VE
3838
set_target_properties(avtranscoder-shared PROPERTIES VERSION ${AVTRANSCODER_VERSION})
3939
set_target_properties(avtranscoder-shared PROPERTIES INSTALL_RPATH_USE_LINK_PATH 1)
4040
target_link_libraries(avtranscoder-shared ${FFMPEG_LIBRARIES})
41-
target_include_directories(avtranscoder-shared PUBLIC
42-
${AVTRANSCODER_SRC_PATH} ${FFMPEG_INCLUDE_DIR})
41+
target_include_directories(avtranscoder-shared PUBLIC ${AVTRANSCODER_SRC_PATH} ${FFMPEG_INCLUDE_DIR})
4342

4443

4544
### Install AvTranscoder libs and include
@@ -120,12 +119,12 @@ if(SWIG_FOUND)
120119
else()
121120
message("PYTHON not found, will not build python binding.")
122121
endif()
123-
endif()
122+
endif()
124123

125124
### JAVA BINDING
126-
if(AVTRANSCODER_DISABLE_JAVA_BINDING)
125+
if(AVTRANSCODER_DISABLE_JAVA_BINDING)
127126
message("JAVA binding disabled, will not build java binding.")
128-
else()
127+
else()
129128
find_package(Java)
130129
find_package(JNI)
131130
if(JAVA_FOUND AND JNI_FOUND)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy