Skip to content

Manage "rewrap" of stream in case of demultiplexing #126

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 7 commits into from
Nov 12, 2014
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
10 changes: 6 additions & 4 deletions src/AvTranscoder/ProfileLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,17 @@ void ProfileLoader::loadProfiles( const std::string& avProfilesPath )

void ProfileLoader::update( const Profile& profile )
{
std::string profileId( profile.find( constants::avProfileIdentificator )->second );
Profile::const_iterator profileIt = profile.find( constants::avProfileIdentificator );
if( profileIt == profile.end() )
throw std::runtime_error( "Invalid profile: can't get identificator" );

std::string profileId( profileIt->second );
size_t profileIndex = 0;
for( Profiles::iterator it = _profiles.begin(); it != _profiles.end(); ++it )
{
// profile already exists
if( (*it).find( constants::avProfileIdentificator )->second == profileId )
{
_profiles.at( profileIndex ) = profile;
return;
}
++profileIndex;
}
// profile not found: add the new profile
Expand Down
29 changes: 16 additions & 13 deletions src/AvTranscoder/mediaProperty/AudioStreamProperty.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,22 +43,25 @@ avtranscoder::AudioProperties audioStreamInfo( const AVFormatContext* formatCont
if( channelDescription )
ap.channelDescription = std::string( channelDescription );
#endif

const char* fmtName = av_get_sample_fmt_name( codec_context->sample_fmt );
if( fmtName )
ap.sampleFormatName = std::string( fmtName );

std::string sampleFormat = "";
switch( codec_context->sample_fmt )
{
case AV_SAMPLE_FMT_NONE : ap.sampleFormat = "none"; break;
case AV_SAMPLE_FMT_U8 : ap.sampleFormat = "unsigned 8 bits"; break;
case AV_SAMPLE_FMT_S16 : ap.sampleFormat = "signed 16 bits"; break;
case AV_SAMPLE_FMT_S32 : ap.sampleFormat = "signed 32 bits"; break;
case AV_SAMPLE_FMT_FLT : ap.sampleFormat = "float"; break;
case AV_SAMPLE_FMT_DBL : ap.sampleFormat = "double"; break;
case AV_SAMPLE_FMT_U8P : ap.sampleFormat = "unsigned 8 bits, planar"; break;
case AV_SAMPLE_FMT_S16P : ap.sampleFormat = "signed 16 bits, planar"; break;
case AV_SAMPLE_FMT_S32P : ap.sampleFormat = "signed 32 bits, planar"; break;
case AV_SAMPLE_FMT_FLTP : ap.sampleFormat = "float, planar"; break;
case AV_SAMPLE_FMT_DBLP : ap.sampleFormat = "double, planar"; break;
case AV_SAMPLE_FMT_NB : ap.sampleFormat = "Number of sample formats."; break;
case AV_SAMPLE_FMT_NONE : ap.sampleFormatLongName = "none"; break;
case AV_SAMPLE_FMT_U8 : ap.sampleFormatLongName = "unsigned 8 bits"; break;
case AV_SAMPLE_FMT_S16 : ap.sampleFormatLongName = "signed 16 bits"; break;
case AV_SAMPLE_FMT_S32 : ap.sampleFormatLongName = "signed 32 bits"; break;
case AV_SAMPLE_FMT_FLT : ap.sampleFormatLongName = "float"; break;
case AV_SAMPLE_FMT_DBL : ap.sampleFormatLongName = "double"; break;
case AV_SAMPLE_FMT_U8P : ap.sampleFormatLongName = "unsigned 8 bits, planar"; break;
case AV_SAMPLE_FMT_S16P : ap.sampleFormatLongName = "signed 16 bits, planar"; break;
case AV_SAMPLE_FMT_S32P : ap.sampleFormatLongName = "signed 32 bits, planar"; break;
case AV_SAMPLE_FMT_FLTP : ap.sampleFormatLongName = "float, planar"; break;
case AV_SAMPLE_FMT_DBLP : ap.sampleFormatLongName = "double, planar"; break;
case AV_SAMPLE_FMT_NB : ap.sampleFormatLongName = "Number of sample formats."; break;
}

return ap;
Expand Down
3 changes: 2 additions & 1 deletion src/AvTranscoder/mediaProperty/mediaProperty.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ MetadatasMap AudioProperties::getDataMap() const
detail::add( dataMap, "codec id", codecId );
detail::add( dataMap, "codec name", codecName );
detail::add( dataMap, "codec long name", codecLongName );
detail::add( dataMap, "sample format", sampleFormat );
detail::add( dataMap, "sample format name", sampleFormatName );
detail::add( dataMap, "sample format long name", sampleFormatLongName );
detail::add( dataMap, "sample rate", sampleRate );
detail::add( dataMap, "bit rate", bit_rate );
detail::add( dataMap, "channels", channels );
Expand Down
3 changes: 2 additions & 1 deletion src/AvTranscoder/mediaProperty/mediaProperty.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ struct AvExport AudioProperties
{
std::string codecName;
std::string codecLongName;
std::string sampleFormat;
std::string sampleFormatName;
std::string sampleFormatLongName;
std::string channelLayout;
std::string channelName;
std::string channelDescription;
Expand Down
20 changes: 1 addition & 19 deletions src/AvTranscoder/transcoder/StreamTranscoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -283,11 +283,7 @@ bool StreamTranscoder::processFrame()

if( ! _inputEssence )
{
if( _subStreamIndex < 0 )
{
return processRewrap();
}
return processRewrap( _subStreamIndex );
return processRewrap();
}

if( _subStreamIndex < 0 )
Expand All @@ -311,20 +307,6 @@ bool StreamTranscoder::processRewrap()
return true;
}

bool StreamTranscoder::processRewrap( const int subStreamIndex )
{
assert( _inputStream != NULL );
assert( _outputStream != NULL );

CodedData data;

if( ! _inputStream->readNextPacket( data ) )
return false;
_outputStream->wrap( data );

return true;
}

bool StreamTranscoder::processTranscode()
{
assert( _inputEssence != NULL );
Expand Down
1 change: 0 additions & 1 deletion src/AvTranscoder/transcoder/StreamTranscoder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ class AvExport StreamTranscoder

private:
bool processRewrap();
bool processRewrap( const int subStreamIndex );
bool processTranscode();
bool processTranscode( const int subStreamIndex );

Expand Down
Loading