Skip to content

Commit cc6d03f

Browse files
author
Clement Champetier
committed
Merge branch 'develop' of https://github.com/avTranscoder/avTranscoder into dev_transcoderUseComplexFilterToMapAudio
Conflicts: test/pyTest/testSetFrame.py
2 parents 24f820f + d09cc28 commit cc6d03f

16 files changed

+180
-47
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,7 @@ CMakeFiles
2121
Makefile
2222
cmake_install.cmake
2323
install_manifest.txt
24+
25+
# Python
26+
*.pyc
27+

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ env:
3131
- FDKAAC_VERSION=0.1.3
3232
- OGG_VERSION=1.3.2
3333
- VORBIS_VERSION=1.3.4
34+
- THEORA_VERSION=1.1.1
3435
- VPX_VERSION=1.4.0
3536
matrix:
3637
- DEPENDENCY_NAME=libav DEPENDENCY_VERSION=11.3 ENABLE_COVERAGE=true

app/avProcessor/avProcessor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ void parseConfigFile(const std::string& configFilename, avtranscoder::Transcoder
4141

4242
// generated stream
4343
if(!filename.length())
44-
transcoder.addGeneratedStream(transcodeProfile);
44+
transcoder.addGenerateStream(transcodeProfile);
4545
else
4646
{
4747
avtranscoder::InputStreamDesc inputDesc(filename, streamIndex, channelIndexArray);

src/AvTranscoder/Library.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#ifndef _AV_TRANSCODER_DESCRIPTION_HPP_
22
#define _AV_TRANSCODER_DESCRIPTION_HPP_
33

4-
#include "common.hpp"
4+
#include <AvTranscoder/common.hpp>
55

66
#include <vector>
77
#include <string>

src/AvTranscoder/Option.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,11 @@ class AvExport Option
5050

5151
// flags
5252
int getFlags() const { return _avOption->flags; }
53-
bool isEncodingOpt() const { return (_avOption->flags & AV_OPT_FLAG_ENCODING_PARAM) == AV_OPT_FLAG_ENCODING_PARAM; }
54-
bool isDecodingOpt() const { return (_avOption->flags & AV_OPT_FLAG_DECODING_PARAM) == AV_OPT_FLAG_DECODING_PARAM; }
55-
bool isAudioOpt() const { return (_avOption->flags & AV_OPT_FLAG_AUDIO_PARAM) == AV_OPT_FLAG_AUDIO_PARAM; }
56-
bool isVideoOpt() const { return (_avOption->flags & AV_OPT_FLAG_VIDEO_PARAM) == AV_OPT_FLAG_VIDEO_PARAM; }
57-
bool isSubtitleOpt() const { return (_avOption->flags & AV_OPT_FLAG_SUBTITLE_PARAM) == AV_OPT_FLAG_SUBTITLE_PARAM; }
53+
bool isEncodingOpt() const { return (getFlags() & AV_OPT_FLAG_ENCODING_PARAM) == AV_OPT_FLAG_ENCODING_PARAM; }
54+
bool isDecodingOpt() const { return (getFlags() & AV_OPT_FLAG_DECODING_PARAM) == AV_OPT_FLAG_DECODING_PARAM; }
55+
bool isAudioOpt() const { return (getFlags() & AV_OPT_FLAG_AUDIO_PARAM) == AV_OPT_FLAG_AUDIO_PARAM; }
56+
bool isVideoOpt() const { return (getFlags() & AV_OPT_FLAG_VIDEO_PARAM) == AV_OPT_FLAG_VIDEO_PARAM; }
57+
bool isSubtitleOpt() const { return (getFlags() & AV_OPT_FLAG_SUBTITLE_PARAM) == AV_OPT_FLAG_SUBTITLE_PARAM; }
5858

5959
// get default value
6060
bool getDefaultBool() const;

src/AvTranscoder/avTranscoder.i

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,14 @@
1616
%include "AvTranscoder/swig/avSeek.i"
1717
%include "AvTranscoder/swig/avOperator.i"
1818

19-
%{
20-
#include <AvTranscoder/log.hpp>
21-
%}
22-
19+
%include "AvTranscoder/log.i"
20+
%include "AvTranscoder/library.i"
21+
%include "AvTranscoder/option.i"
22+
%include "AvTranscoder/util.i"
2323
%include "AvTranscoder/progress/progress.i"
2424
%include "AvTranscoder/properties/properties.i"
2525
%include "AvTranscoder/profile/profile.i"
2626
%include "AvTranscoder/data/data.i"
27-
28-
%include <AvTranscoder/log.hpp>
29-
30-
%include "AvTranscoder/library.i"
31-
%include "AvTranscoder/option.i"
32-
%include "AvTranscoder/util.i"
3327
%include "AvTranscoder/codec/codec.i"
3428
%include "AvTranscoder/stream/stream.i"
3529
%include "AvTranscoder/decoder/decoder.i"

src/AvTranscoder/log.i

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
%{
2+
#include <AvTranscoder/common.hpp>
3+
#include <AvTranscoder/log.hpp>
4+
%}
5+
6+
%include <AvTranscoder/common.hpp>
7+
%include <AvTranscoder/log.hpp>

src/AvTranscoder/transcoder/Transcoder.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,13 @@ void Transcoder::addStream(const std::vector<InputStreamDesc>& inputStreamDescAr
8383
addTranscodeStream(inputStreamDescArray, profile, offset);
8484
}
8585

86-
void Transcoder::addGeneratedStream(const std::string& encodingProfileName)
86+
void Transcoder::addGenerateStream(const std::string& encodingProfileName)
8787
{
8888
const ProfileLoader::Profile& encodingProfile = _profileLoader.getProfile(encodingProfileName);
89-
addGeneratedStream(encodingProfile);
89+
addGenerateStream(encodingProfile);
9090
}
9191

92-
void Transcoder::addGeneratedStream(const ProfileLoader::Profile& encodingProfile)
92+
void Transcoder::addGenerateStream(const ProfileLoader::Profile& encodingProfile)
9393
{
9494
// Add profile
9595
if(!_profileLoader.hasProfile(encodingProfile))

src/AvTranscoder/transcoder/Transcoder.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ class AvExport Transcoder
7474

7575
//@{
7676
// @brief Add a new generated stream to the output file, created from the given encoding profile.
77-
void addGeneratedStream(const std::string& encodingProfileName);
78-
void addGeneratedStream(const ProfileLoader::Profile& encodingProfile);
77+
void addGenerateStream(const std::string& encodingProfileName);
78+
void addGenerateStream(const ProfileLoader::Profile& encodingProfile);
7979
//@}
8080

8181
/**

test/pyTest/testLog.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import os
2+
from nose.tools import *
3+
4+
from pyAvTranscoder import avtranscoder as av
5+
6+
7+
def _logMessages(logger):
8+
"""
9+
Local function to log several messages.
10+
"""
11+
logger.log(av.AV_LOG_DEBUG, 'This is a debug message!')
12+
logger.log(av.AV_LOG_INFO, 'This is an info message!')
13+
logger.log(av.AV_LOG_WARNING, 'This is a warning message!')
14+
logger.log(av.AV_LOG_ERROR, 'This is an error message!')
15+
16+
17+
def testLogInFile():
18+
"""
19+
Check the behavior of the logger file.
20+
"""
21+
logger = av.Logger()
22+
# log several messages in the standard output
23+
_logMessages(logger)
24+
25+
# redirect the output of the logging messages
26+
logger.logInFile()
27+
# the logger message should exist and be empty
28+
assert_equals(os.stat(av.LOG_FILE).st_size, 0)
29+
30+
# log several messages in the logger file
31+
_logMessages(logger)
32+
# the logger message should exist and be filled
33+
assert_greater(os.stat(av.LOG_FILE).st_size, 0)

test/pyTest/testOffset.py

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,6 @@
1515
from pyAvTranscoder import avtranscoder as av
1616

1717

18-
@raises(RuntimeError)
19-
def testRewrapVideoPositiveOffsetWithoutGenerator():
20-
"""
21-
Add a positive offset supposed to have a generator.
22-
Depending on the codec and the given parameters, the generator could not be instanciate.
23-
"""
24-
inputFileName = os.environ['AVTRANSCODER_TEST_VIDEO_RAW_FILE']
25-
outputFileName = "testPositiveOffsetWithoutGenerator.h264"
26-
offset = 10
27-
28-
ouputFile = av.OutputFile( outputFileName )
29-
transcoder = av.Transcoder( ouputFile )
30-
31-
transcoder.addStream( av.InputStreamDesc(inputFileName, 0), "", offset )
32-
33-
3418
def testTranscodeAudioPositiveOffset():
3519
"""
3620
Transcode one audio stream (profile wave24b48kmono) with offset at the beginning of the process.

test/pyTest/testOption.py

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
import os
2+
3+
# Check if environment is setup to run the tests
4+
if os.environ.get('AVTRANSCODER_TEST_AUDIO_WAVE_FILE') is None or \
5+
os.environ.get('AVTRANSCODER_TEST_AUDIO_MOV_FILE') is None:
6+
from nose.plugins.skip import SkipTest
7+
raise SkipTest("Need to define environment variables "
8+
"AVTRANSCODER_TEST_AUDIO_WAVE_FILE and "
9+
"AVTRANSCODER_TEST_AUDIO_MOV_FILE")
10+
11+
from nose.tools import *
12+
13+
from pyAvTranscoder import avtranscoder as av
14+
15+
16+
@raises(IndexError)
17+
def testAccessOfUnknownAudioCodecOptions():
18+
"""
19+
Check access to an unknown codec option.
20+
"""
21+
optionName = 'a'
22+
inputFileName = os.environ['AVTRANSCODER_TEST_AUDIO_WAVE_FILE']
23+
inputFile = av.InputFile(inputFileName)
24+
audioProperties = inputFile.getProperties().getAudioProperties()[0]
25+
26+
audioProperties.getCodecOption(optionName)
27+
28+
29+
def testAccessOfKnownCodecOptionInAudioStream():
30+
"""
31+
Check access to a known codec option from an audio stream.
32+
"""
33+
optionName = 'b'
34+
inputFileName = os.environ['AVTRANSCODER_TEST_AUDIO_WAVE_FILE']
35+
inputFile = av.InputFile(inputFileName)
36+
audioProperties = inputFile.getProperties().getAudioProperties()[0]
37+
38+
option = audioProperties.getCodecOption(optionName)
39+
40+
# common attributes
41+
assert_equals(option.getName(), optionName)
42+
assert_equals(option.getHelp(), 'set bitrate (in bits/s)')
43+
assert_equals(option.getType(), av.eOptionBaseTypeInt)
44+
assert_greater(option.getOffset(), 0)
45+
assert_equals(option.getMin(), 0.0)
46+
assert_greater(option.getMax(), 0.0)
47+
assert_greater(option.getMax(), 0.0)
48+
49+
# flags
50+
assert_equals(option.isEncodingOpt(), True)
51+
assert_equals(option.isDecodingOpt(), False)
52+
assert_equals(option.isAudioOpt(), True)
53+
assert_equals(option.isVideoOpt(), True)
54+
assert_equals(option.isSubtitleOpt(), False)
55+
56+
# value
57+
assert_equals(option.getInt(), audioProperties.getBitRate())
58+
assert_equals(option.getDefaultInt(), 200000) # see AV_CODEC_DEFAULT_BITRATE
59+
60+
# childs
61+
assert_equals(option.hasChild(), False)
62+
assert_equals(len(option.getChilds()), 0)
63+
64+
65+
def testAccessOfKnownCodecOptionInVideoStream():
66+
"""
67+
Check access to a known codec option from a video stream.
68+
"""
69+
optionName = 'flags'
70+
inputFileName = os.environ['AVTRANSCODER_TEST_AUDIO_MOV_FILE']
71+
inputFile = av.InputFile(inputFileName)
72+
videoProperties = inputFile.getProperties().getVideoProperties()[0]
73+
74+
option = videoProperties.getCodecOption(optionName)
75+
76+
# common attributes
77+
assert_equals(option.getName(), optionName)
78+
assert_equals(option.getUnit(), optionName)
79+
assert_equals(option.getType(), av.eOptionBaseTypeGroup)
80+
81+
# flags
82+
assert_equals(option.isEncodingOpt(), True)
83+
assert_equals(option.isDecodingOpt(), True)
84+
assert_equals(option.isAudioOpt(), True)
85+
assert_equals(option.isVideoOpt(), True)
86+
assert_equals(option.isSubtitleOpt(), True)
87+
88+
# value
89+
assert_equals(option.getInt(), 0)
90+
assert_equals(option.getDefaultInt(), 0)
91+
92+
# childs
93+
assert_equals(option.hasChild(), True)
94+
assert_greater(len(option.getChilds()), 0)
95+
# check if all the childs have a name
96+
for child in option.getChilds():
97+
assert_greater(len(child.getName()), 0)

test/pyTest/testSetFrame.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def testSetVideoFrame():
2323

2424
# create transcoder and add a video stream
2525
transcoder = av.Transcoder( ouputFile )
26-
transcoder.addGeneratedStream( encodingProfile )
26+
transcoder.addGenerateStream( encodingProfile )
2727
videoDecoder = transcoder.getStreamTranscoder( 0 ).getCurrentDecoder()
2828

2929
# start process
@@ -69,7 +69,7 @@ def testSetAudioFrame():
6969

7070
# create transcoder and add a video stream
7171
transcoder = av.Transcoder( ouputFile )
72-
transcoder.addGeneratedStream( "wave24b48kmono" )
72+
transcoder.addGenerateStream( "wave24b48kmono" )
7373
audioDecoder = transcoder.getStreamTranscoder( 0 ).getCurrentDecoder()
7474

7575
# start process

test/pyTest/testTranscoderGenerateStream.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def testGenerateVideoWithIncompleteProfile():
3535
av.avProfileIdentificatorHuman : "New video preset",
3636
av.avProfileType : av.avProfileTypeVideo,
3737
}
38-
transcoder.addGeneratedStream( encodingProfile )
38+
transcoder.addGenerateStream( encodingProfile )
3939

4040
transcoder.process()
4141

@@ -59,7 +59,7 @@ def testGenerateAudioWithIncompleteProfile():
5959
av.avProfileIdentificatorHuman : "New audio preset",
6060
av.avProfileType : av.avProfileTypeAudio,
6161
}
62-
transcoder.addGeneratedStream( encodingProfile )
62+
transcoder.addGenerateStream( encodingProfile )
6363

6464
transcoder.process()
6565

@@ -73,7 +73,7 @@ def testTranscodeDummyAudio():
7373
transcoder = av.Transcoder( ouputFile )
7474

7575
# generate an audio stream
76-
transcoder.addGeneratedStream( "wave24b48kmono" )
76+
transcoder.addGenerateStream( "wave24b48kmono" )
7777

7878
ouputFile.beginWrap()
7979
transcoder.processFrame()
@@ -89,7 +89,7 @@ def testTranscodeDummyVideo():
8989
transcoder = av.Transcoder( ouputFile )
9090

9191
# generate a video stream
92-
transcoder.addGeneratedStream( "dnxhd120" )
92+
transcoder.addGenerateStream( "dnxhd120" )
9393

9494
ouputFile.beginWrap()
9595
transcoder.processFrame()

test/pyTest/testTranscoderTranscodeAudioMov.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def testTranscodeMovVariableNbSamplesPerFrame():
5252
def testTranscodeMovExtractChannels():
5353
"""
5454
Transcode the audio stream of a MOV file which contains a video stream.
55-
Extract channel one and third of the audio stream (5.1), and create two output streams.
55+
Extract first and fourth channels of the audio stream (5.1), and create two output streams.
5656
The encoding profile will be found from from input.
5757
"""
5858
inputFileName = os.environ['AVTRANSCODER_TEST_AUDIO_MOV_FILE']
@@ -83,7 +83,7 @@ def testTranscodeMovExtractChannels():
8383
def testTranscodeMovExtractChannelsToOneOutput():
8484
"""
8585
Transcode the audio stream of a MOV file which contains a video stream.
86-
Extract channel one, third and fifth of the audio stream (5.1), and create one output streams.
86+
Extract first, third and last channels of the audio stream (5.1), and create one output streams.
8787
The encoding profile will be found from from input.
8888
"""
8989
inputFileName = os.environ['AVTRANSCODER_TEST_AUDIO_MOV_FILE']

tools/travis/linux.install.deps.sh

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,19 @@ if [ -z ${TRAVIS_JOB_ID} ] || [ ! -d "${DEPENDENCY_INSTALL_PATH}/lib/" ]; then
114114
make install && \
115115
rm -rf ${DIR}
116116

117+
# libtheora
118+
echo ""
119+
echo "Building libtheora (${THEORA_VERSION})"
120+
DIR=$(mktemp -d libtheoraXXX) && cd ${DIR} && \
121+
curl -O http://downloads.xiph.org/releases/theora/libtheora-${THEORA_VERSION}.tar.bz2 && \
122+
tar xvjf libtheora-${THEORA_VERSION}.tar.bz2 && \
123+
cd libtheora-${THEORA_VERSION} && \
124+
./configure --prefix="${DEPENDENCY_INSTALL_PATH}" && \
125+
make -k > ${DEPENDENCY_LOG_FILE} 2>&1 && \
126+
make install && \
127+
make check && \
128+
rm -rf ${DIR}
129+
117130
# libvpx
118131
# https://trac.ffmpeg.org/ticket/4956
119132
echo ""
@@ -144,7 +157,7 @@ if [ -z ${TRAVIS_JOB_ID} ] || [ ! -d "${DEPENDENCY_INSTALL_PATH}/lib/" ]; then
144157
export RELEASE_OPTIONS=--disable-debug
145158
export DEBUG_OPTIONS=--enable-debug=3\ --disable-optimizations\ --disable-sse\ --disable-stripping
146159
export LICENSING_OPTIONS=--enable-gpl\ --enable-nonfree
147-
export THIRD_PARTIES_OPTIONS=--enable-libfaac\ --enable-libmp3lame\ --enable-libx264\ --enable-libxvid\ --enable-avresample\ --enable-libfdk_aac\ --enable-libvorbis\ --enable-libvpx
160+
export THIRD_PARTIES_OPTIONS=--enable-libfaac\ --enable-libmp3lame\ --enable-libx264\ --enable-libxvid\ --enable-avresample\ --enable-libfdk_aac\ --enable-libvorbis\ --enable-libtheora\ --enable-libvpx
148161

149162
if [[ ${DEPENDENCY_NAME} == "ffmpeg" ]]; then
150163

0 commit comments

Comments
 (0)