Skip to content

Update API and builds #13

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 16 commits into from
Jul 2, 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
27 changes: 27 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
os:
- linux

language: cpp

compiler:
- gcc
- clang

before_script:
- date -u
- uname -a
- lsb_release -a
- ln -s tools/scons.travis.cfg scons.cfg
- sudo apt-add-repository "deb http://archive.ubuntu.com/ubuntu trusty main restricted universe multiverse"
- sudo apt-add-repository "deb http://archive.ubuntu.com/ubuntu trusty-updates main restricted universe multiverse"
- sudo apt-add-repository "deb http://security.ubuntu.com/ubuntu trusty-security main restricted universe multiverse"
- sudo apt-get update -qq
- sudo apt-get install -qq gcc g++ scons swig swig2.0
- sudo apt-get install -qq libavdevice-dev libavformat-dev libavcodec-dev libavutil-dev libswscale-dev libavresample-dev python-dev freeglut3-dev doxygen

script:
- scons

after_failure:
- cat config.log

2 changes: 2 additions & 0 deletions app/avplay/AvReader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ class AvReader : public Reader

m_inputVideo = new avtranscoder::InputVideo( m_inputFile.getStream( m_videoStream ) );

m_inputVideo->setup();

m_sourceImage = new avtranscoder::Image( m_inputFile.getStream( m_videoStream ).getVideoDesc().getImageDesc() );

pixel.setBitsPerPixel( getComponents() * getBitDepth() );
Expand Down
41 changes: 29 additions & 12 deletions app/genericProcessor/genericProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@
#include <sstream>
#include <cstdlib>

bool verbose = false;

void parseConfigFile( const std::string& configFilename, avtranscoder::Transcoder::InputStreamsDesc& streams )
void parseConfigFile( const std::string& configFilename, avtranscoder::Transcoder& transcoder, avtranscoder::Profile& profile )
{
std::ifstream configFile( configFilename.c_str(), std::ifstream::in );

Expand All @@ -25,8 +26,9 @@ void parseConfigFile( const std::string& configFilename, avtranscoder::Transcode
{
std::string transcodeProfile;
std::getline( is_line, transcodeProfile );
std::cout << filename << " ( " << streamId << " ) : " << transcodeProfile << std::endl;
streams.push_back( avtranscoder::Transcoder::InputStreamDesc( atoi( streamId.c_str() ), filename, transcodeProfile ) );
if( verbose )
std::cout << filename << " ( " << streamId << " ) : " << transcodeProfile << std::endl;
transcoder.add( filename, atoi( streamId.c_str() ), transcodeProfile );
}
}
}
Expand All @@ -44,33 +46,48 @@ int main( int argc, char** argv )

av_log_set_level( AV_LOG_FATAL );

if( verbose )
av_log_set_level( AV_LOG_DEBUG );

try
{
std::cout << "start ..." << std::endl;
if( verbose )
std::cout << "start ..." << std::endl;

std::string inputConfigFile( argv[1] );
avtranscoder::OutputFile outputFile( argv[2] );
avtranscoder::Profile profiles( true );

avtranscoder::Transcoder::InputStreamsDesc streams;
if( verbose )
std::cout << "output file: " << argv[2] << std::endl;

parseConfigFile( inputConfigFile, streams );
std::string inputConfigFile( argv[1] );
avtranscoder::OutputFile outputFile( argv[2] );

avtranscoder::Transcoder transcoder( outputFile );
transcoder.setVerbose( verbose );

transcoder.add( streams );
if( verbose )
std::cout << "parse config file" << std::endl;
parseConfigFile( inputConfigFile, transcoder, profiles );

std::cout << "start Transcode" << std::endl;
if( verbose )
std::cout << "start Transcode" << std::endl;

avtranscoder::ProgressListener progress;

// video re-wrapping or transcoding if necessary
transcoder.process( progress );

std::cout << std::endl << "end ..." << std::endl;
std::cout << std::endl;
if( verbose )
std::cout << "end ..." << std::endl;
}
catch( std::exception& e )
{
std::cerr << "ERROR: during process, an error occured:" << std::endl << e.what() << std::endl;
std::cerr << "ERROR: during process, an error occured: " << e.what() << std::endl;
}
catch( ... )
{
std::cerr << "ERROR: during process, an unknown error occured" << std::endl;
}

}
1 change: 1 addition & 0 deletions src/AvTranscoder/CodedStream/AvInputStream.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class AvExport AvInputStream : public InputStream
void addPacket( AVPacket& packet );

void setBufferred( const bool bufferized ){ _bufferized = bufferized; };
bool getBufferred() const { return _bufferized; };

void clearBuffering();

Expand Down
11 changes: 9 additions & 2 deletions src/AvTranscoder/CodedStream/AvOutputStream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,22 @@

#include <AvTranscoder/File/OutputFile.hpp>

#include <cassert>
#include <iostream>

namespace avtranscoder
{

AvOutputStream::AvOutputStream( )
: _outputFile( NULL )
: OutputStream()
, _outputFile( NULL )
, _streamIndex( 0 )
{
}

AvOutputStream::AvOutputStream( OutputFile& outputFile, const size_t streamIndex )
: _outputFile( &outputFile )
: OutputStream()
, _outputFile( &outputFile )
, _streamIndex( streamIndex )
{
}
Expand All @@ -23,6 +28,8 @@ AvOutputStream::~AvOutputStream()

bool AvOutputStream::wrap( DataStream& data )
{
assert( _outputFile != NULL );

return _outputFile->wrap( data, _streamIndex );
}

Expand Down
78 changes: 0 additions & 78 deletions src/AvTranscoder/DummyInputStream.cpp

This file was deleted.

51 changes: 0 additions & 51 deletions src/AvTranscoder/DummyInputStream.hpp

This file was deleted.

74 changes: 74 additions & 0 deletions src/AvTranscoder/EssenceStream/DummyAudio.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
#include "DummyAudio.hpp"

#include <cassert>
#include <cstring>

namespace avtranscoder
{

DummyAudio::DummyAudio( )
: InputEssence( )
{
}

DummyAudio::~DummyAudio( )
{
}

void DummyAudio::setAudioDesc( AudioDesc& audioDesc )
{
_audioDesc = audioDesc;
_frameDesc.setSampleRate ( _audioDesc.getCodecContext()->sample_rate );
_frameDesc.setChannels ( _audioDesc.getCodecContext()->channels );
_frameDesc.setFps ( 25.0 );
_frameDesc.setSampleFormat( _audioDesc.getCodecContext()->sample_fmt );
}

AudioDesc DummyAudio::getAudioDesc() const
{
return _audioDesc;
}

bool DummyAudio::readNextFrame( Frame& frameBuffer )
{
frameBuffer.getBuffer().resize( _frameDesc.getDataSize() );

AudioFrame& audioFrameBuffer = static_cast<AudioFrame&>( frameBuffer );
audioFrameBuffer.setNbSamples( 1.0 * _frameDesc.getSampleRate() / _frameDesc.getFps() );

//av_samples_set_silence( data.getPtr(), offset, nb_samples, nb_channels, sample_fmt );
int fill_char = (
_frameDesc.getSampleFormat() == AV_SAMPLE_FMT_U8 ||
_frameDesc.getSampleFormat() == AV_SAMPLE_FMT_U8P
) ? 0x80 : 0x00;

memset( frameBuffer.getPtr(), fill_char, frameBuffer.getSize() );

return true;
}

bool DummyAudio::readNextFrame( std::vector<Frame>& frameBuffer )
{
if( frameBuffer.size() != _frameDesc.getChannels() )
{
frameBuffer.resize( _frameDesc.getChannels() );
}

size_t dataSizeOneChannel = _frameDesc.getDataSize() / _frameDesc.getChannels();
int fill_char = (
_frameDesc.getSampleFormat() == AV_SAMPLE_FMT_U8 ||
_frameDesc.getSampleFormat() == AV_SAMPLE_FMT_U8P
) ? 0x80 : 0x00;

for( size_t channel = 0; channel < _frameDesc.getChannels(); ++channel )
{
AudioFrame& audioFrameBuffer = static_cast<AudioFrame&>( frameBuffer.at( channel ) );
audioFrameBuffer.setNbSamples( 1.0 * _frameDesc.getSampleRate() / _frameDesc.getFps() );
frameBuffer.at( channel).getBuffer().resize( dataSizeOneChannel );
memset( frameBuffer.at( channel).getPtr(), fill_char, frameBuffer.at( channel).getSize() );
}

return true;
}

}
Loading