Skip to content

Audio processing #3

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
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
19 changes: 18 additions & 1 deletion src/AvTranscoder/DatasStructures/AudioDesc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ void AudioDesc::setAudioCodec( const AVCodecID codecId )
initCodecContext();
}

void AudioDesc::setAudioParameters( const size_t sampleRate, const size_t channels, const AVSampleFormat& sampleFormat )
void AudioDesc::setAudioParameters( const size_t sampleRate, const size_t channels, const AVSampleFormat sampleFormat )
{
m_codecContext->sample_rate = sampleRate;
m_codecContext->channels = channels;
Expand Down Expand Up @@ -193,4 +193,21 @@ AVCodecID AudioDesc::getAudioCodecId() const
return m_codecContext->codec_id;
}


const size_t AudioDesc::getSampleRate() const
{
return m_codecContext->sample_rate;
}

const size_t AudioDesc::getChannels() const
{
return m_codecContext->channels;
}

const AVSampleFormat AudioDesc::getSampleFormat() const
{
return m_codecContext->sample_fmt;
}


}
6 changes: 5 additions & 1 deletion src/AvTranscoder/DatasStructures/AudioDesc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class AvExport AudioDesc
void setAudioCodec( const std::string& codecName );
void setAudioCodec( const AVCodecID codecId );

void setAudioParameters( const size_t sampleRate, const size_t channels, const AVSampleFormat& sampleFormat );
void setAudioParameters( const size_t sampleRate, const size_t channels, const AVSampleFormat sampleFormat );
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pourquoi retirer la reférence si l'objet est const ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

car ce n'est pas un objet, mais une valeur d'enum ...

Le 2 juin 2014 12:06, Fabien Castan notifications@github.com a écrit :

In src/AvTranscoder/DatasStructures/AudioDesc.hpp:

@@ -27,7 +27,7 @@ class AvExport AudioDesc
void setAudioCodec( const std::string& codecName );
void setAudioCodec( const AVCodecID codecId );

  • void setAudioParameters( const size_t sampleRate, const size_t channels, const AVSampleFormat& sampleFormat );
  • void setAudioParameters( const size_t sampleRate, const size_t channels, const AVSampleFormat sampleFormat );

Pourquoi retirer la reférence si l'objet est const ?


Reply to this email directly or view it on GitHub
https://github.com/MarcAntoine-Arnaud/avTranscoder/pull/3/files#r13277664
.

[image: Mikros Image - Pub Evian Spider-man the amazing babyme 2]
http://www.mikrosimage.eu/realisations/pub-l-evian-spider-man-the-amazing-babyme-2/
Marc-Antoine ARNAUD
R&D Software Developer -
Image Processing & Media Technology Expert

+33 1 55 63 11 00
mrn@mikrosimage.eu

Mikros Image /
Digital Post-Production for Video and Film

www.mikrosimage.eu

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok


void set( const std::string& key, const std::string& flag, const bool enable );
void set( const std::string& key, const bool value );
Expand All @@ -38,6 +38,10 @@ class AvExport AudioDesc

std::string getAudioCodec() const;
AVCodecID getAudioCodecId() const;

const size_t getSampleRate() const;
const size_t getChannels() const;
const AVSampleFormat getSampleFormat() const;

#ifndef SWIG
AVCodec* getCodec() const { return m_codec; }
Expand Down
2 changes: 2 additions & 0 deletions src/AvTranscoder/InputStreamAudio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ InputStreamAudio::InputStreamAudio( const InputStream& inputStream )
{
throw std::runtime_error( "unable to find context for codec" );
}

m_codecContext->channels = m_inputStream->getAudioDesc().getChannels();

std::cout << "Audio codec Id : " << m_codecContext->codec_id << std::endl;
std::cout << "Audio codec Id : " << m_codec->long_name << std::endl;
Expand Down