Skip to content

Commit 13554eb

Browse files
committed
Merge pull request #146 from mikrosimage/develop
Pull develop branch of MIK fork
2 parents e653228 + c391609 commit 13554eb

29 files changed

+206
-103
lines changed

CMakeLists.txt

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,6 @@ cmake_minimum_required(VERSION 2.8.11)
22

33
project(AvTranscoder)
44

5-
# Set AvTranscoder versions
6-
set(AVTRANSCODER_VERSION_MAJOR "0")
7-
set(AVTRANSCODER_VERSION_MINOR "5")
8-
set(AVTRANSCODER_VERSION_MICRO "10")
9-
set(AVTRANSCODER_VERSION ${AVTRANSCODER_VERSION_MAJOR}.${AVTRANSCODER_VERSION_MINOR}.${AVTRANSCODER_VERSION_MICRO})
10-
11-
# Define AvTranscoder versions
12-
add_definitions(-DAVTRANSCODER_VERSION_MAJOR=${AVTRANSCODER_VERSION_MAJOR})
13-
add_definitions(-DAVTRANSCODER_VERSION_MINOR=${AVTRANSCODER_VERSION_MINOR})
14-
add_definitions(-DAVTRANSCODER_VERSION_MICRO=${AVTRANSCODER_VERSION_MICRO})
15-
165
# Define AvTranscoder default path to profiles
176
add_definitions(-DAVTRANSCODER_DEFAULT_AVPROFILES="${CMAKE_INSTALL_PREFIX}/share/avprofiles")
187

@@ -37,8 +26,10 @@ if(AVTRANSCODER_COVERAGE)
3726
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage")
3827
endif()
3928

29+
# Build library
4030
add_subdirectory(src)
4131

32+
# Build apps
4233
if(AVTRANSCODER_DISABLE_APPS)
4334
message("Apps disabled, will not build applications.")
4435
else()

cmake/AvTranscoderMacros.cmake

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,24 @@
22
set(AVTRANSCODER_APP_PATH "${PROJECT_SOURCE_DIR}/app")
33
set(AVTRANSCODER_SRC_PATH "${PROJECT_SOURCE_DIR}/src")
44
file(GLOB_RECURSE AVTRANSCODER_SRC_FILES "AvTranscoder/*.cpp" "AvTranscoder/*.hpp")
5+
6+
# Get AvTranscoder versions
7+
# AVTRANSCODER_VERSION_MAJOR
8+
# AVTRANSCODER_VERSION_MINOR
9+
# AVTRANSCODER_VERSION_MICRO
10+
# AVTRANSCODER_VERSION
11+
file(STRINGS "${AVTRANSCODER_SRC_PATH}/AvTranscoder/common.hpp" _avtranscoder_VERSION_HPP_CONTENTS REGEX "#define AVTRANSCODER_VERSION_")
12+
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()
18+
endforeach()
19+
unset(_avtranscoder_VERSION_HPP_CONTENTS)
20+
21+
set(AVTRANSCODER_VERSION "${AVTRANSCODER_VERSION_MAJOR}.${AVTRANSCODER_VERSION_MINOR}.${AVTRANSCODER_VERSION_MICRO}")
22+
23+
if(AVTRANSCODER_RETRIEVE_VERSION_FAILED)
24+
message(SEND_ERROR "Failed to retrieve AvTranscoder version: ${AVTRANSCODER_VERSION}")
25+
endif()

src/AvTranscoder/common.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
#ifndef _AV_TRANSCODER_COMMON_HPP_
22
#define _AV_TRANSCODER_COMMON_HPP_
33

4+
#define AVTRANSCODER_VERSION_MAJOR 0
5+
#define AVTRANSCODER_VERSION_MINOR 5
6+
#define AVTRANSCODER_VERSION_MICRO 12
7+
48
#include <AvTranscoder/system.hpp>
59

610
extern "C" {

src/AvTranscoder/decoder/AudioDecoder.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,10 @@ void AudioDecoder::setupDecoder( const ProfileLoader::Profile& profile )
6262
throw std::runtime_error( msg );
6363
}
6464

65-
LOG_INFO( "Setup audio decoder with:\n" << profile )
65+
if( ! profile.empty() )
66+
{
67+
LOG_INFO( "Setup audio decoder with:\n" << profile )
68+
}
6669

6770
AudioCodec& codec = _inputStream->getAudioCodec();
6871

src/AvTranscoder/decoder/VideoDecoder.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,10 @@ void VideoDecoder::setupDecoder( const ProfileLoader::Profile& profile )
6060
throw std::runtime_error( msg );
6161
}
6262

63-
LOG_INFO( "Setup video decoder with:\n" << profile )
63+
if( ! profile.empty() )
64+
{
65+
LOG_INFO( "Setup video decoder with:\n" << profile )
66+
}
6467

6568
VideoCodec& codec = _inputStream->getVideoCodec();
6669

src/AvTranscoder/encoder/AudioEncoder.cpp

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

3838
void AudioEncoder::setupAudioEncoder( const AudioFrameDesc& frameDesc, const ProfileLoader::Profile& profile )
3939
{
40-
LOG_INFO( "Setup audio encoder with:\n" << profile )
40+
if( ! profile.empty() )
41+
{
42+
LOG_INFO( "Setup audio encoder with:\n" << profile )
43+
}
4144

4245
// set sampleRate, number of channels, sample format
4346
_codec.setAudioParameters( frameDesc );

src/AvTranscoder/encoder/VideoEncoder.cpp

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

3939
void VideoEncoder::setupVideoEncoder( const VideoFrameDesc& frameDesc, const ProfileLoader::Profile& profile )
4040
{
41-
LOG_INFO( "Setup video encoder with:\n" << profile )
41+
if( ! profile.empty() )
42+
{
43+
LOG_INFO( "Setup video encoder with:\n" << profile )
44+
}
4245

4346
// set width, height, pixel format, fps
4447
_codec.setImageParameters( frameDesc );

src/AvTranscoder/file/FormatContext.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,11 +142,9 @@ AVStream& FormatContext::addAVStream( const AVCodec& avCodec )
142142
return *stream;
143143
}
144144

145-
bool FormatContext::seek( uint64_t position, const int flag )
145+
bool FormatContext::seek( const uint64_t position, const int flag )
146146
{
147-
if( (int)getStartTime() != AV_NOPTS_VALUE )
148-
position += getStartTime();
149-
147+
LOG_INFO( "Seek in '" << _avFormatContext->filename << "' at " << position << " (in AV_TIME_BASE units)" )
150148
int err = av_seek_frame( _avFormatContext, -1, position, flag );
151149
if( err < 0 )
152150
{

src/AvTranscoder/file/FormatContext.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,10 @@ class AvExport FormatContext
7777
* @brief Seek at a specific position
7878
* @param position: can be in AV_TIME_BASE units, in frames... depending on the flag value
7979
* @param flag: seeking mode (AVSEEK_FLAG_xxx)
80-
* @note before seek, add offset of start time
8180
* @return seek status
81+
* @see flushDecoder
8282
*/
83-
bool seek( uint64_t position, const int flag );
83+
bool seek( const uint64_t position, const int flag );
8484

8585
size_t getNbStreams() const { return _avFormatContext->nb_streams; }
8686
/// Get duration of the program, in seconds

src/AvTranscoder/file/IOutputFile.hpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ class AvExport IOutputFile
2626

2727
/**
2828
* @brief Add a video output stream
29-
* @note call setup() before adding any stream
3029
* @param videoCodec description of output stream
3130
**/
3231
virtual IOutputStream& addVideoStream( const VideoCodec& videoCodec )
@@ -36,7 +35,6 @@ class AvExport IOutputFile
3635

3736
/**
3837
* @brief Add an audio output stream
39-
* @note call setup() before adding any stream
4038
* @param audioCodec description of output stream
4139
**/
4240
virtual IOutputStream& addAudioStream( const AudioCodec& audioCodec )
@@ -46,7 +44,6 @@ class AvExport IOutputFile
4644

4745
/**
4846
* @brief Add a data output stream
49-
* @note call setup() before adding any stream
5047
* @param dataCodec description of output stream
5148
**/
5249
virtual IOutputStream& addDataStream( const DataCodec& dataCodec )
@@ -62,7 +59,9 @@ class AvExport IOutputFile
6259
/**
6360
* @brief Wrap a packet of data in the output ressource
6461
* @param data coded packet information for the current stream
65-
* @param streamId refers to the stream in output ressource
62+
* @param streamIndex refers to the stream in output ressource
63+
* @return the wrapping status after wrapping
64+
* @see EWrappingStatus
6665
**/
6766
virtual IOutputStream::EWrappingStatus wrap( const CodedData& data, const size_t streamIndex ) = 0;
6867

@@ -73,7 +72,7 @@ class AvExport IOutputFile
7372

7473
/**
7574
* @brief Get the output stream
76-
* @param streamId select the output stream
75+
* @param streamIndex select the output stream
7776
* @return the output stream reference
7877
**/
7978
virtual IOutputStream& getStream( const size_t streamIndex ) = 0;

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