Skip to content

minor fixes #17

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 6 commits into from
Jul 3, 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
30 changes: 19 additions & 11 deletions src/AvTranscoder/Transcoder/Transcoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@ Transcoder::Transcoder( OutputFile& outputFile )

Transcoder::~Transcoder()
{
for( std::vector< InputFile* >::iterator it = _inputFiles.begin(); it != _inputFiles.end(); ++it )
{
delete (*it);
}
for( std::vector< StreamTranscoder* >::iterator it = _streamTranscoders.begin(); it != _streamTranscoders.end(); ++it )
{
delete (*it);
}
}

void Transcoder::add( const std::string& filename, const size_t streamIndex, const std::string& profileName )
Expand Down Expand Up @@ -54,7 +62,7 @@ bool Transcoder::processFrame()
std::cout << "process frame" << std::endl;
for( size_t streamIndex = 0; streamIndex < _streamTranscoders.size(); ++streamIndex )
{
if( ! _streamTranscoders.at( streamIndex ).processFrame() )
if( ! _streamTranscoders.at( streamIndex )->processFrame() )
{
_streamTranscoders.clear();
}
Expand Down Expand Up @@ -117,7 +125,7 @@ void Transcoder::addRewrapStream( const std::string& filename, const size_t stre
{
InputFile* referenceFile = addInputFile( filename, streamIndex );

_streamTranscoders.push_back( StreamTranscoder( referenceFile->getStream( streamIndex ), _outputFile ) );
_streamTranscoders.push_back( new StreamTranscoder( referenceFile->getStream( streamIndex ), _outputFile ) );
_inputStreams.push_back( &referenceFile->getStream( streamIndex ) );
}

Expand All @@ -129,13 +137,13 @@ void Transcoder::addTranscodeStream( const std::string& filename, const size_t s
{
case AVMEDIA_TYPE_VIDEO:
{
_streamTranscoders.push_back( StreamTranscoder( referenceFile->getStream( streamIndex ), _outputFile, profile ) );
_streamTranscoders.push_back( new StreamTranscoder( referenceFile->getStream( streamIndex ), _outputFile, profile ) );
_inputStreams.push_back( &referenceFile->getStream( streamIndex ) );
break;
}
case AVMEDIA_TYPE_AUDIO:
{
_streamTranscoders.push_back( StreamTranscoder( referenceFile->getStream( streamIndex ), _outputFile, profile ) );
_streamTranscoders.push_back( new StreamTranscoder( referenceFile->getStream( streamIndex ), _outputFile, profile ) );
_inputStreams.push_back( &referenceFile->getStream( streamIndex ) );
break;
}
Expand All @@ -157,25 +165,25 @@ void Transcoder::addDummyStream( Profile::ProfileDesc& profile )
if( profile.find( Profile::avProfileType )->second == Profile::avProfileTypeAudio )
{
_dummyAudio.push_back( DummyAudio() );
_streamTranscoders.push_back( StreamTranscoder( _dummyAudio.back(), _outputFile, profile ) );
_streamTranscoders.push_back( new StreamTranscoder( _dummyAudio.back(), _outputFile, profile ) );
}

if( profile.find( Profile::avProfileType )->second == Profile::avProfileTypeVideo )
{
_dummyVideo.push_back( DummyVideo() );
_streamTranscoders.push_back( StreamTranscoder( _dummyVideo.back(), _outputFile, profile ) );
_streamTranscoders.push_back( new StreamTranscoder( _dummyVideo.back(), _outputFile, profile ) );
}
}

InputFile* Transcoder::addInputFile( const std::string& filename, const size_t streamIndex )
{
InputFile* referenceFile = NULL;

for( std::vector< InputFile >::iterator it = _inputFiles.begin(); it != _inputFiles.end(); ++it )
for( std::vector< InputFile* >::iterator it = _inputFiles.begin(); it != _inputFiles.end(); ++it )
{
if( (*it).getFilename() == filename )
if( (*it)->getFilename() == filename )
{
referenceFile = &(*it);
referenceFile = (*it);
break;
}
}
Expand All @@ -184,8 +192,8 @@ InputFile* Transcoder::addInputFile( const std::string& filename, const size_t s
{
if( _verbose )
std::cout << "new InputFile for " << filename << std::endl;
_inputFiles.push_back( InputFile( filename ) );
referenceFile = &_inputFiles.back();
_inputFiles.push_back( new InputFile( filename ) );
referenceFile = _inputFiles.back();
}

referenceFile->readStream( streamIndex );
Expand Down
4 changes: 2 additions & 2 deletions src/AvTranscoder/Transcoder/Transcoder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ class Transcoder

private:
OutputFile& _outputFile;
std::vector< InputFile > _inputFiles;
std::vector< InputFile* > _inputFiles;

std::vector< InputStream* > _inputStreams;
std::vector< StreamTranscoder > _streamTranscoders;
std::vector< StreamTranscoder* > _streamTranscoders;

std::vector< DummyAudio > _dummyAudio;
std::vector< DummyVideo > _dummyVideo;
Expand Down