Skip to content

Commit aea0ed9

Browse files
committed
Merge pull request #217 from cchampet/dev_audioDecoderCheckIfExtractChannelIsNecessary
AudioDecoder: check if extract one channel is necessary
2 parents 4c480ce + dbfc050 commit aea0ed9

File tree

3 files changed

+22
-14
lines changed

3 files changed

+22
-14
lines changed

app/avPlay/Window.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
#include "Window.hpp"
22

3-
#include <AvTranscoder/properties/print.hpp>
4-
53
#ifdef __APPLE__
64
#include <OpenGL/gl.h>
75
#include <GLUT/glut.h>

src/AvTranscoder/decoder/AudioDecoder.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,12 @@ bool AudioDecoder::decodeNextFrame(Frame& frameBuffer, const size_t channelIndex
116116
{
117117
AudioFrame& audioBuffer = static_cast<AudioFrame&>(frameBuffer);
118118

119+
// if no need to extract one channel in the audio stream
120+
if(audioBuffer.getNbChannels() == 1 && channelIndex == 0)
121+
{
122+
return decodeNextFrame(frameBuffer);
123+
}
124+
119125
// decode all data of the next frame
120126
AudioFrame allDataOfNextFrame(audioBuffer);
121127
if(!decodeNextFrame(allDataOfNextFrame))

test/pyTest/testOutputFile.py

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,14 @@ def testCreateOutputFileWithExtension():
77
"""
88
Create an OutputFile with a filename with extension.
99
"""
10-
ext = "mov"
11-
outputFileName = "testCreateOutputFileWithExtension." + ext
10+
formatName = "mov"
11+
formatLongName = "QuickTime / MOV"
12+
outputFileName = "testCreateOutputFileWithExtension." + formatName
1213
ouputFile = av.OutputFile( outputFileName )
1314

1415
assert_equals( ouputFile.getFilename(), outputFileName )
15-
assert_equals( ouputFile.getFormatName(), ext )
16+
assert_equals( ouputFile.getFormatName(), formatName )
17+
assert_equals( ouputFile.getFormatLongName(), formatLongName )
1618

1719

1820
@raises(IOError)
@@ -21,22 +23,22 @@ def testCreateOutputFileWithoutExtension():
2123
Create an OutputFile with a filename without extension.
2224
"""
2325
outputFileName = "testCreateOutputFileWithoutExtension"
24-
ouputFile = av.OutputFile( outputFileName )
25-
26-
assert_equals( ouputFile.getFilename(), outputFileName )
26+
av.OutputFile( outputFileName )
2727

2828

2929
def testCreateOutputFileWithoutExtensionWithFormat():
3030
"""
3131
Create an OutputFile with a filename without extension.
3232
Indicate the format.
3333
"""
34-
format = "mov"
34+
formatName = "mov"
35+
formatLongName = "QuickTime / MOV"
3536
outputFileName = "testCreateOutputFileWithoutExtensionWithFormat"
36-
ouputFile = av.OutputFile( outputFileName, format )
37+
ouputFile = av.OutputFile( outputFileName, formatName )
3738

3839
assert_equals( ouputFile.getFilename(), outputFileName )
39-
assert_equals( ouputFile.getFormatName(), format )
40+
assert_equals( ouputFile.getFormatName(), formatName )
41+
assert_equals( ouputFile.getFormatLongName(), formatLongName )
4042

4143

4244
def testCreateOutputFileWithoutExtensionWithMimeType():
@@ -58,11 +60,13 @@ def testCreateOutputFileWithoutExtensionWithInconsistentFormatAndMimeType():
5860
Indicate inconsistent format and Mime Type.
5961
The OutputFile should by-pass the Mime Type.
6062
"""
61-
format = "mov"
63+
formatName = "mov"
64+
formatLongName = "QuickTime / MOV"
6265
mimeType = "application/mp4"
6366
outputFileName = "testCreateOutputFileWithoutExtensionWithInconsistentFormatAndMimeType"
64-
ouputFile = av.OutputFile( outputFileName, format, mimeType )
67+
ouputFile = av.OutputFile( outputFileName, formatName, mimeType )
6568

6669
assert_equals( ouputFile.getFilename(), outputFileName )
67-
assert_equals( ouputFile.getFormatName(), format )
70+
assert_equals( ouputFile.getFormatName(), formatName )
71+
assert_equals( ouputFile.getFormatLongName(), formatLongName )
6872

0 commit comments

Comments
 (0)