Skip to content

Commit 21a8473

Browse files
Merge pull request #138 from mikrosimage/release/v0.5.5
updates from Mikros: up to v0.5.5
2 parents b06a78f + 469f4d8 commit 21a8473

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+509
-656
lines changed

.travis.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
1+
env:
2+
matrix:
3+
- DEPENDENCY_MODE=libav
4+
- DEPENDENCY_MODE=ffmpeg
5+
6+
language: cpp
7+
18
os:
29
- linux
310
- osx
411

5-
language: cpp
6-
712
compiler:
813
- gcc
914
- clang
@@ -28,4 +33,4 @@ script:
2833
# Launch tests
2934
- cd ..
3035
- chmod +x tools/travis.python.nosetests.sh
31-
- if [ "${TRAVIS_OS_NAME}" = "linux" ]; then ./tools/travis.python.nosetests.sh; fi
36+
- if [ "${TRAVIS_OS_NAME}" = "linux" && "${DEPENDENCY_MODE}" = "ffmpeg" ]; then ./tools/travis.python.nosetests.sh; fi

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ project(AvTranscoder)
55
# Set AvTranscoder versions
66
set(AVTRANSCODER_VERSION_MAJOR "0")
77
set(AVTRANSCODER_VERSION_MINOR "5")
8-
set(AVTRANSCODER_VERSION_MICRO "4")
8+
set(AVTRANSCODER_VERSION_MICRO "5")
99
set(AVTRANSCODER_VERSION ${AVTRANSCODER_VERSION_MAJOR}.${AVTRANSCODER_VERSION_MINOR}.${AVTRANSCODER_VERSION_MICRO})
1010

1111
# Define AvTranscoder versions

ressource/v_h264.prf

Lines changed: 0 additions & 5 deletions
This file was deleted.

ressource/v_h264_hq.prf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
avProfileName=h264-hq
2+
avProfileLongName=H.264 High Quality
3+
avProfileType=avProfileTypeVideo
4+
codec=h264
5+
pix_fmt=yuv422p
6+
profile=high422
7+
preset=slow
8+
tune=fastdecode,zerolatency
9+
level=5

ressource/v_h264_lq.prf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
avProfileName=h264-lq
2+
avProfileLongName=H.264 Low Quality
3+
avProfileType=avProfileTypeVideo
4+
codec=h264
5+
pix_fmt=yuv420p
6+
profile=baseline
7+
preset=ultrafast
8+
tune=fastdecode,zerolatency
9+
level=3

src/AvTranscoder/avTranscoder.i

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,19 @@
1616

1717
%{
1818
#include <AvTranscoder/Library.hpp>
19-
#include <AvTranscoder/Option.hpp>
2019
#include <AvTranscoder/log.hpp>
2120
%}
2221

23-
namespace std {
24-
%template(IntPair) pair< size_t, size_t >;
25-
}
26-
2722
%include "AvTranscoder/progress/progress.i"
2823
%include "AvTranscoder/mediaProperty/mediaProperty.i"
2924
%include "AvTranscoder/frame/frame.i"
3025
%include "AvTranscoder/profile/profile.i"
3126

3227
%include <AvTranscoder/Library.hpp>
33-
%include <AvTranscoder/Option.hpp>
3428
%include <AvTranscoder/log.hpp>
3529

30+
%include "AvTranscoder/option.i"
31+
%include "AvTranscoder/util.i"
3632
%include "AvTranscoder/codec/codec.i"
3733
%include "AvTranscoder/stream/stream.i"
3834
%include "AvTranscoder/decoder/decoder.i"

src/AvTranscoder/decoder/AudioDecoder.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,8 @@ bool AudioDecoder::decodeNextFrame()
147147

148148
void AudioDecoder::setProfile( const ProfileLoader::Profile& profile )
149149
{
150+
LOG_DEBUG( "Set profile of audio decoder with:\n" << profile )
151+
150152
AudioCodec& codec = _inputStream->getAudioCodec();
151153

152154
// set threads before any other options

src/AvTranscoder/decoder/VideoDecoder.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,9 @@ void VideoDecoder::flushDecoder()
105105
}
106106

107107
void VideoDecoder::setProfile( const ProfileLoader::Profile& profile )
108-
{
108+
{
109+
LOG_DEBUG( "Set profile of video decoder with:\n" << profile )
110+
109111
VideoCodec& codec = _inputStream->getVideoCodec();
110112

111113
// set threads before any other options

src/AvTranscoder/encoder/AudioEncoder.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,8 @@ bool AudioEncoder::encodeFrame( Frame& codedFrame )
135135

136136
void AudioEncoder::setProfile( const ProfileLoader::Profile& profile, const AudioFrameDesc& frameDesc )
137137
{
138+
LOG_DEBUG( "Set profile of audio encoder with:\n" << profile )
139+
138140
// set sampleRate, number of channels, sample format
139141
_codec.setAudioParameters( frameDesc );
140142

src/AvTranscoder/encoder/VideoEncoder.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,8 @@ bool VideoEncoder::encodeFrame( Frame& codedFrame )
128128

129129
void VideoEncoder::setProfile( const ProfileLoader::Profile& profile, const avtranscoder::VideoFrameDesc& frameDesc )
130130
{
131+
LOG_DEBUG( "Set profile of video encoder with:\n" << profile )
132+
131133
// set width, height, pixel format, fps
132134
_codec.setImageParameters( frameDesc );
133135

src/AvTranscoder/file/InputFile.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,9 @@ double InputFile::getFps()
199199
}
200200

201201
void InputFile::setProfile( const ProfileLoader::Profile& profile )
202-
{
202+
{
203+
LOG_DEBUG( "Set profile of input file with:\n" << profile )
204+
203205
for( ProfileLoader::Profile::const_iterator it = profile.begin(); it != profile.end(); ++it )
204206
{
205207
if( (*it).first == constants::avProfileIdentificator ||

src/AvTranscoder/file/OutputFile.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,9 @@ bool OutputFile::endWrap( )
132132
return true;
133133
}
134134

135-
void OutputFile::addMetadata( const PropertiesMap& dataMap )
135+
void OutputFile::addMetadata( const PropertyVector& data )
136136
{
137-
for( PropertiesMap::const_iterator it = dataMap.begin(); it != dataMap.end(); ++it )
137+
for( PropertyVector::const_iterator it = data.begin(); it != data.end(); ++it )
138138
{
139139
addMetadata( it->first, it->second );
140140
}
@@ -147,6 +147,8 @@ void OutputFile::addMetadata( const std::string& key, const std::string& value )
147147

148148
void OutputFile::setProfile( const ProfileLoader::Profile& profile )
149149
{
150+
LOG_DEBUG( "Set profile of output file with:\n" << profile )
151+
150152
// check if output format indicated is valid with the filename extension
151153
if( ! matchFormat( profile.find( constants::avProfileFormat )->second, _filename ) )
152154
{

src/AvTranscoder/file/OutputFile.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class AvExport OutputFile : public IOutputFile
4141
* @brief Add metadata to the output file.
4242
* @note Depending on the format, you are not sure to find your metadata after the transcode.
4343
*/
44-
void addMetadata( const PropertiesMap& dataMap );
44+
void addMetadata( const PropertyVector& data );
4545
void addMetadata( const std::string& key, const std::string& value );
4646

4747
IOutputStream& getStream( const size_t streamId );

src/AvTranscoder/mediaProperty/AttachementProperties.cpp

Lines changed: 0 additions & 44 deletions
This file was deleted.

src/AvTranscoder/mediaProperty/AttachementProperties.hpp

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,17 @@
11
#ifndef _AV_TRANSCODER_MEDIA_PROPERTY_ATTACHEMENT_PROPERTIES_HPP
22
#define _AV_TRANSCODER_MEDIA_PROPERTY_ATTACHEMENT_PROPERTIES_HPP
33

4-
#include <AvTranscoder/common.hpp>
5-
#include <AvTranscoder/mediaProperty/util.hpp>
6-
#include <AvTranscoder/file/FormatContext.hpp>
4+
#include <AvTranscoder/mediaProperty/StreamProperties.hpp>
75

86
namespace avtranscoder
97
{
108

11-
class AvExport AttachementProperties
9+
class AvExport AttachementProperties: public StreamProperties
1210
{
1311
public:
14-
AttachementProperties( const FormatContext& formatContext, const size_t index );
15-
16-
size_t getStreamIndex() const { return _streamIndex; }
17-
size_t getStreamId() const;
18-
PropertiesMap& getMetadatas() { return _metadatas; }
19-
20-
#ifndef SWIG
21-
const AVFormatContext& getAVFormatContext() { return *_formatContext; }
22-
#endif
23-
24-
PropertiesMap getPropertiesAsMap() const; ///< Return all attachement properties as a map (name of property: value)
25-
26-
private:
27-
const AVFormatContext* _formatContext; ///< Has link (no ownership)
28-
29-
size_t _streamIndex;
30-
PropertiesMap _metadatas;
12+
AttachementProperties( const FormatContext& formatContext, const size_t index )
13+
: StreamProperties( formatContext, index )
14+
{}
3115
};
3216

3317
}

src/AvTranscoder/mediaProperty/AudioProperties.cpp

Lines changed: 24 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,7 @@ namespace avtranscoder
1414
{
1515

1616
AudioProperties::AudioProperties( const FormatContext& formatContext, const size_t index )
17-
: _formatContext( &formatContext.getAVFormatContext() )
18-
, _codecContext( NULL )
19-
, _codec( NULL )
20-
, _streamIndex( index )
17+
: StreamProperties( formatContext, index )
2118
{
2219
if( _formatContext )
2320
_codecContext = _formatContext->streams[index]->codec;
@@ -202,33 +199,34 @@ double AudioProperties::getDuration() const
202199
return duration;
203200
}
204201

205-
PropertiesMap AudioProperties::getPropertiesAsMap() const
206-
{
207-
PropertiesMap dataMap;
208-
209-
addProperty( dataMap, "streamId", &AudioProperties::getStreamId );
210-
addProperty( dataMap, "codecId", &AudioProperties::getCodecId );
211-
addProperty( dataMap, "codecName", &AudioProperties::getCodecName );
212-
addProperty( dataMap, "codecLongName", &AudioProperties::getCodecLongName );
213-
addProperty( dataMap, "sampleFormatName", &AudioProperties::getSampleFormatName );
214-
addProperty( dataMap, "sampleFormatLongName", &AudioProperties::getSampleFormatLongName );
215-
addProperty( dataMap, "sampleRate", &AudioProperties::getSampleRate );
216-
addProperty( dataMap, "bitRate", &AudioProperties::getBitRate );
217-
addProperty( dataMap, "nbSamples", &AudioProperties::getNbSamples );
218-
addProperty( dataMap, "channels", &AudioProperties::getChannels );
219-
addProperty( dataMap, "channelLayout", &AudioProperties::getChannelLayout );
220-
addProperty( dataMap, "channelName", &AudioProperties::getChannelName );
221-
addProperty( dataMap, "channelDescription", &AudioProperties::getChannelDescription );
222-
addProperty( dataMap, "ticksPerFrame", &AudioProperties::getTicksPerFrame );
223-
addProperty( dataMap, "timeBase", &AudioProperties::getTimeBase );
224-
addProperty( dataMap, "duration", &AudioProperties::getDuration );
202+
PropertyVector AudioProperties::getPropertiesAsVector() const
203+
{
204+
PropertyVector data;
205+
206+
addProperty( data, "streamId", &AudioProperties::getStreamId );
207+
detail::add( data, "streamIndex", getStreamIndex() );
208+
addProperty( data, "codecId", &AudioProperties::getCodecId );
209+
addProperty( data, "codecName", &AudioProperties::getCodecName );
210+
addProperty( data, "codecLongName", &AudioProperties::getCodecLongName );
211+
addProperty( data, "sampleFormatName", &AudioProperties::getSampleFormatName );
212+
addProperty( data, "sampleFormatLongName", &AudioProperties::getSampleFormatLongName );
213+
addProperty( data, "sampleRate", &AudioProperties::getSampleRate );
214+
addProperty( data, "bitRate", &AudioProperties::getBitRate );
215+
addProperty( data, "nbSamples", &AudioProperties::getNbSamples );
216+
addProperty( data, "channels", &AudioProperties::getChannels );
217+
addProperty( data, "channelLayout", &AudioProperties::getChannelLayout );
218+
addProperty( data, "channelName", &AudioProperties::getChannelName );
219+
addProperty( data, "channelDescription", &AudioProperties::getChannelDescription );
220+
addProperty( data, "ticksPerFrame", &AudioProperties::getTicksPerFrame );
221+
addProperty( data, "timeBase", &AudioProperties::getTimeBase );
222+
addProperty( data, "duration", &AudioProperties::getDuration );
225223

226224
for( size_t metadataIndex = 0; metadataIndex < _metadatas.size(); ++metadataIndex )
227225
{
228-
detail::add( dataMap, _metadatas.at( metadataIndex ).first, _metadatas.at( metadataIndex ).second );
226+
detail::add( data, _metadatas.at( metadataIndex ).first, _metadatas.at( metadataIndex ).second );
229227
}
230228

231-
return dataMap;
229+
return data;
232230
}
233231

234232
}

src/AvTranscoder/mediaProperty/AudioProperties.hpp

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
11
#ifndef _AV_TRANSCODER_MEDIA_PROPERTY_AUDIO_PROPERTIES_HPP
22
#define _AV_TRANSCODER_MEDIA_PROPERTY_AUDIO_PROPERTIES_HPP
33

4-
#include <AvTranscoder/common.hpp>
5-
#include <AvTranscoder/mediaProperty/util.hpp>
6-
#include <AvTranscoder/file/FormatContext.hpp>
4+
#include <AvTranscoder/mediaProperty/StreamProperties.hpp>
75

86
#include <string>
97

108
namespace avtranscoder
119
{
1210

13-
class AvExport AudioProperties
11+
class AvExport AudioProperties : public StreamProperties
1412
{
1513
public:
1614
AudioProperties( const FormatContext& formatContext, const size_t index );
@@ -23,7 +21,6 @@ class AvExport AudioProperties
2321
std::string getChannelName() const;
2422
std::string getChannelDescription() const;
2523

26-
size_t getStreamIndex() const { return _streamIndex; }
2724
size_t getStreamId() const;
2825
size_t getCodecId() const;
2926
size_t getSampleRate() const;
@@ -35,38 +32,31 @@ class AvExport AudioProperties
3532
Rational getTimeBase() const;
3633
double getDuration() const;
3734

38-
PropertiesMap& getMetadatas() { return _metadatas; }
39-
4035
#ifndef SWIG
41-
const AVFormatContext& getAVFormatContext() { return *_formatContext; }
4236
AVCodecContext& getAVCodecContext() { return *_codecContext; }
4337
#endif
4438

45-
PropertiesMap getPropertiesAsMap() const; ///< Return all audio properties as a map (name of property: value)
39+
PropertyVector getPropertiesAsVector() const;
4640

4741
private:
4842
#ifndef SWIG
4943
template<typename T>
50-
void addProperty( PropertiesMap& dataMap, const std::string& key, T (AudioProperties::*getter)(void) const ) const
44+
void addProperty( PropertyVector& data, const std::string& key, T (AudioProperties::*getter)(void) const ) const
5145
{
5246
try
5347
{
54-
detail::add( dataMap, key, (this->*getter)() );
48+
detail::add( data, key, (this->*getter)() );
5549
}
5650
catch( const std::exception& e )
5751
{
58-
detail::add( dataMap, key, e.what() );
52+
detail::add( data, key, e.what() );
5953
}
6054
}
6155
#endif
6256

6357
private:
64-
const AVFormatContext* _formatContext; ///< Has link (no ownership)
6558
AVCodecContext* _codecContext; ///< Has link (no ownership)
6659
AVCodec* _codec; ///< Has link (no ownership)
67-
68-
size_t _streamIndex;
69-
PropertiesMap _metadatas;
7060
};
7161

7262
}

0 commit comments

Comments
 (0)