Skip to content

Up to v0.6.0 (MIK fork) #147

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 18 commits into from
Nov 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
12 changes: 6 additions & 6 deletions cmake/AvTranscoderMacros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ file(GLOB_RECURSE AVTRANSCODER_SRC_FILES "AvTranscoder/*.cpp" "AvTranscoder/*.hp
# AVTRANSCODER_VERSION
file(STRINGS "${AVTRANSCODER_SRC_PATH}/AvTranscoder/common.hpp" _avtranscoder_VERSION_HPP_CONTENTS REGEX "#define AVTRANSCODER_VERSION_")
foreach(v MAJOR MINOR MICRO)
if("${_avtranscoder_VERSION_HPP_CONTENTS}" MATCHES "#define AVTRANSCODER_VERSION_${v} ([0-9]+)")
set(AVTRANSCODER_VERSION_${v} "${CMAKE_MATCH_1}")
else()
set(AVTRANSCODER_RETRIEVE_VERSION_FAILED 1)
endif()
if("${_avtranscoder_VERSION_HPP_CONTENTS}" MATCHES "#define AVTRANSCODER_VERSION_${v} ([0-9]+)")
set(AVTRANSCODER_VERSION_${v} "${CMAKE_MATCH_1}")
else()
set(AVTRANSCODER_RETRIEVE_VERSION_FAILED 1)
endif()
endforeach()
unset(_avtranscoder_VERSION_HPP_CONTENTS)

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

if(AVTRANSCODER_RETRIEVE_VERSION_FAILED)
message(SEND_ERROR "Failed to retrieve AvTranscoder version: ${AVTRANSCODER_VERSION}")
message(SEND_ERROR "Failed to retrieve AvTranscoder version: ${AVTRANSCODER_VERSION}")
endif()
9 changes: 5 additions & 4 deletions cmake/FindFFmpeg.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,9 @@ macro(manage_components)
set(FFMPEG_INCLUDE_DIR ${${COMPONENT}_INCLUDE_DIR})
set(FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} ${${COMPONENT}_LIBRARIES})
set(FFMPEG_DEFINITIONS ${FFMPEG_DEFINITIONS} ${${COMPONENT}_DEFINITIONS})
else()
set(${COMPONENT}_FOUND FALSE)
else()
message(STATUS "Skip ${COMPONENT} component because it was found elsewhere ('${${COMPONENT}_INCLUDE_DIR}' instead of '${FFMPEG_INCLUDE_DIR}').")
set(${COMPONENT}_FOUND FALSE)
endif()
else()
if(FFmpeg_FIND_REQUIRED)
Expand All @@ -121,12 +122,12 @@ endmacro()

# Check FFmpeg version
if(DEFINED FFmpeg_FIND_VERSION)
check_ffmpeg_version()
check_ffmpeg_version()
endif()

# Get basic components if no one is indicated
if(NOT FFmpeg_FIND_COMPONENTS)
set(FFmpeg_FIND_COMPONENTS avcodec avformat avutil)
set(FFmpeg_FIND_COMPONENTS avcodec avformat avutil)
endif()

# Check each component
Expand Down
4 changes: 2 additions & 2 deletions src/AvTranscoder/common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
#define _AV_TRANSCODER_COMMON_HPP_

#define AVTRANSCODER_VERSION_MAJOR 0
#define AVTRANSCODER_VERSION_MINOR 5
#define AVTRANSCODER_VERSION_MICRO 12
#define AVTRANSCODER_VERSION_MINOR 6
#define AVTRANSCODER_VERSION_MICRO 0

#include <AvTranscoder/system.hpp>

Expand Down
4 changes: 2 additions & 2 deletions src/AvTranscoder/file/FormatContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,12 +191,12 @@ void FormatContext::setOutputFormat( const std::string& filename, const std::str
msg += filename;
if( ! shortName.empty() )
{
msg += ", ";
msg += ", formatName = ";
msg += shortName;
}
if( ! mimeType.empty() )
{
msg += ", ";
msg += ", mimeType = ";
msg += mimeType;
}
throw std::ios_base::failure( msg );
Expand Down
4 changes: 2 additions & 2 deletions src/AvTranscoder/file/OutputFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@
namespace avtranscoder
{

OutputFile::OutputFile( const std::string& filename )
OutputFile::OutputFile( const std::string& filename, const std::string& formatName, const std::string& mimeType )
: _formatContext( AV_OPT_FLAG_ENCODING_PARAM )
, _outputStreams()
, _frameCount()
, _previousProcessedStreamDuration( 0.0 )
, _profile()
{
_formatContext.setFilename( filename );
_formatContext.setOutputFormat( filename );
_formatContext.setOutputFormat( filename, formatName, mimeType );
}

OutputFile::~OutputFile()
Expand Down
9 changes: 7 additions & 2 deletions src/AvTranscoder/file/OutputFile.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,15 @@ class AvExport OutputFile : public IOutputFile

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

~OutputFile();

Expand Down
16 changes: 16 additions & 0 deletions src/AvTranscoder/mediaProperty/PixelProperties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,21 @@ size_t PixelProperties::getBitsPerPixel() const
return av_get_bits_per_pixel( _pixelDesc );
}

size_t PixelProperties::getMaxNbBitsInChannels() const
{
if( ! _pixelDesc )
throw std::runtime_error( "unable to find pixel description." );

size_t maxNbBitsInChannels = 0;
for( unsigned int channelIndex = 0; channelIndex < _pixelDesc->nb_components; ++channelIndex )
{
const size_t nbBits = _pixelDesc->comp[channelIndex].depth_minus1 + 1;
if( nbBits > maxNbBitsInChannels )
maxNbBitsInChannels = nbBits;
}
return maxNbBitsInChannels;
}

size_t PixelProperties::getNbComponents() const
{
if( ! _pixelDesc )
Expand Down Expand Up @@ -230,6 +245,7 @@ PropertyVector PixelProperties::getPropertiesAsVector() const
addProperty( data, "pixelName", &PixelProperties::getPixelName );
addProperty( data, "pixelFormatName", &PixelProperties::getPixelFormatName );
addProperty( data, "bitDepth", &PixelProperties::getBitsPerPixel );
addProperty( data, "maxNbBitsInChannels", &PixelProperties::getMaxNbBitsInChannels );
addProperty( data, "nbComponents", &PixelProperties::getNbComponents );
addProperty( data, "chromaWidth", &PixelProperties::getChromaWidth );
addProperty( data, "chromaHeight", &PixelProperties::getChromaHeight );
Expand Down
3 changes: 2 additions & 1 deletion src/AvTranscoder/mediaProperty/PixelProperties.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ class AvExport PixelProperties
std::string getPixelName() const;
std::string getPixelFormatName() const;

size_t getBitsPerPixel() const;
size_t getBitsPerPixel() const; ///< padding bits are not counted
size_t getMaxNbBitsInChannels() const;
size_t getNbComponents() const;
size_t getChromaWidth() const;
size_t getChromaHeight() const;
Expand Down
13 changes: 6 additions & 7 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ message(STATUS "AvTranscoder version is ${AVTRANSCODER_VERSION}")
find_package(FFmpeg COMPONENTS avcodec avformat avutil swscale swresample avresample)
if(swresample_FOUND)
add_definitions(-DAVTRANSCODER_FFMPEG_DEPENDENCY)
message(STATUS "Build avTranscoder with dependency to ffmpeg.")
message(STATUS "Build avTranscoder with dependency to ffmpeg.")
elseif(avresample_FOUND)
add_definitions(-DAVTRANSCODER_LIBAV_DEPENDENCY)
message(STATUS "Build avTranscoder with dependency to libav.")
else()
message(SEND_ERROR "Can't define if you depend on ffmpeg or libav.")
message(SEND_ERROR "Can't define if you depend on ffmpeg or libav.")
endif()

# Include AvTranscoder and FFmpeg
Expand All @@ -38,8 +38,7 @@ set_target_properties(avtranscoder-shared PROPERTIES SOVERSION ${AVTRANSCODER_VE
set_target_properties(avtranscoder-shared PROPERTIES VERSION ${AVTRANSCODER_VERSION})
set_target_properties(avtranscoder-shared PROPERTIES INSTALL_RPATH_USE_LINK_PATH 1)
target_link_libraries(avtranscoder-shared ${FFMPEG_LIBRARIES})
target_include_directories(avtranscoder-shared PUBLIC
${AVTRANSCODER_SRC_PATH} ${FFMPEG_INCLUDE_DIR})
target_include_directories(avtranscoder-shared PUBLIC ${AVTRANSCODER_SRC_PATH} ${FFMPEG_INCLUDE_DIR})


### Install AvTranscoder libs and include
Expand Down Expand Up @@ -120,12 +119,12 @@ if(SWIG_FOUND)
else()
message("PYTHON not found, will not build python binding.")
endif()
endif()
endif()

### JAVA BINDING
if(AVTRANSCODER_DISABLE_JAVA_BINDING)
if(AVTRANSCODER_DISABLE_JAVA_BINDING)
message("JAVA binding disabled, will not build java binding.")
else()
else()
find_package(Java)
find_package(JNI)
if(JAVA_FOUND AND JNI_FOUND)
Expand Down
Loading