Skip to content

Dev audio decoder check if extract channel is necessary #217

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
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
2 changes: 0 additions & 2 deletions app/avPlay/Window.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#include "Window.hpp"

#include <AvTranscoder/properties/print.hpp>

#ifdef __APPLE__
#include <OpenGL/gl.h>
#include <GLUT/glut.h>
Expand Down
6 changes: 6 additions & 0 deletions src/AvTranscoder/decoder/AudioDecoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,12 @@ bool AudioDecoder::decodeNextFrame(Frame& frameBuffer, const size_t channelIndex
{
AudioFrame& audioBuffer = static_cast<AudioFrame&>(frameBuffer);

// if no need to extract one channel in the audio stream
if(audioBuffer.getNbChannels() == 1 && channelIndex == 0)
{
return decodeNextFrame(frameBuffer);
}

// decode all data of the next frame
AudioFrame allDataOfNextFrame(audioBuffer);
if(!decodeNextFrame(allDataOfNextFrame))
Expand Down
28 changes: 16 additions & 12 deletions test/pyTest/testOutputFile.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@ def testCreateOutputFileWithExtension():
"""
Create an OutputFile with a filename with extension.
"""
ext = "mov"
outputFileName = "testCreateOutputFileWithExtension." + ext
formatName = "mov"
formatLongName = "QuickTime / MOV"
outputFileName = "testCreateOutputFileWithExtension." + formatName
ouputFile = av.OutputFile( outputFileName )

assert_equals( ouputFile.getFilename(), outputFileName )
assert_equals( ouputFile.getFormatName(), ext )
assert_equals( ouputFile.getFormatName(), formatName )
assert_equals( ouputFile.getFormatLongName(), formatLongName )


@raises(IOError)
Expand All @@ -21,22 +23,22 @@ def testCreateOutputFileWithoutExtension():
Create an OutputFile with a filename without extension.
"""
outputFileName = "testCreateOutputFileWithoutExtension"
ouputFile = av.OutputFile( outputFileName )

assert_equals( ouputFile.getFilename(), outputFileName )
av.OutputFile( outputFileName )


def testCreateOutputFileWithoutExtensionWithFormat():
"""
Create an OutputFile with a filename without extension.
Indicate the format.
"""
format = "mov"
formatName = "mov"
formatLongName = "QuickTime / MOV"
outputFileName = "testCreateOutputFileWithoutExtensionWithFormat"
ouputFile = av.OutputFile( outputFileName, format )
ouputFile = av.OutputFile( outputFileName, formatName )

assert_equals( ouputFile.getFilename(), outputFileName )
assert_equals( ouputFile.getFormatName(), format )
assert_equals( ouputFile.getFormatName(), formatName )
assert_equals( ouputFile.getFormatLongName(), formatLongName )


def testCreateOutputFileWithoutExtensionWithMimeType():
Expand All @@ -58,11 +60,13 @@ def testCreateOutputFileWithoutExtensionWithInconsistentFormatAndMimeType():
Indicate inconsistent format and Mime Type.
The OutputFile should by-pass the Mime Type.
"""
format = "mov"
formatName = "mov"
formatLongName = "QuickTime / MOV"
mimeType = "application/mp4"
outputFileName = "testCreateOutputFileWithoutExtensionWithInconsistentFormatAndMimeType"
ouputFile = av.OutputFile( outputFileName, format, mimeType )
ouputFile = av.OutputFile( outputFileName, formatName, mimeType )

assert_equals( ouputFile.getFilename(), outputFileName )
assert_equals( ouputFile.getFormatName(), format )
assert_equals( ouputFile.getFormatName(), formatName )
assert_equals( ouputFile.getFormatLongName(), formatLongName )