|
| 1 | + |
| 2 | +#include "StreamTranscoder.hpp" |
| 3 | + |
| 4 | + |
| 5 | +/* |
| 6 | +InputFile : fichier |
| 7 | +
|
| 8 | +InputStream : déwrapper virtuel |
| 9 | +AvInputStream : déwrapper AV |
| 10 | +DummyInputStream : generate silence |
| 11 | +
|
| 12 | +InputStreamAudio : décoder audio |
| 13 | +InputStreamVideo : décoder video |
| 14 | +
|
| 15 | +OutputStreamAudio : encoder audio |
| 16 | +OutputStreamVideo : encoder video |
| 17 | +
|
| 18 | +OutputStream : encoder vide (futur: wrapper) |
| 19 | +OutputFile : fichier + wrapper virtuel |
| 20 | +
|
| 21 | +*/ |
| 22 | + |
| 23 | +namespace avtranscoder |
| 24 | +{ |
| 25 | + |
| 26 | +StreamTranscoder::StreamTranscoder( AvInputStream& stream, const bool isVideoStream ) |
| 27 | + : _stream( &stream ) |
| 28 | + , _inputStreamVideo( NULL ) |
| 29 | + , _outputStreamVideo( NULL ) |
| 30 | + , _inputStreamAudio( NULL ) |
| 31 | + , _outputStreamAudio( NULL ) |
| 32 | + , _isVideoStream( isVideoStream ) |
| 33 | + , _transcodeStream( false ) |
| 34 | +{ |
| 35 | + // std::cout << "[StreamTranscoder::StreamTranscoder]" << std::endl; |
| 36 | +} |
| 37 | + |
| 38 | +StreamTranscoder::~StreamTranscoder() |
| 39 | +{ |
| 40 | + if( _inputStreamVideo ) |
| 41 | + delete _inputStreamVideo; |
| 42 | + if( _outputStreamVideo ) |
| 43 | + delete _outputStreamVideo; |
| 44 | + |
| 45 | + if( _inputStreamAudio ) |
| 46 | + delete _inputStreamAudio; |
| 47 | + if( _outputStreamAudio ) |
| 48 | + delete _outputStreamAudio; |
| 49 | +} |
| 50 | + |
| 51 | +void StreamTranscoder::init( const std::string& profile ) |
| 52 | +{ |
| 53 | + std::cout << "[StreamTranscoder::init] isVideoStream: " << _isVideoStream << std::endl; |
| 54 | + std::cout << "[StreamTranscoder::init] profile: " << profile << std::endl; |
| 55 | + |
| 56 | + if( ! profile.empty() ) |
| 57 | + { |
| 58 | + _transcodeStream = true; |
| 59 | + if( _isVideoStream ) |
| 60 | + { |
| 61 | + std::cout << "[StreamTranscoder::init] video stream..." << std::endl; |
| 62 | + _inputStreamVideo = new InputStreamVideo( *_stream ); |
| 63 | + _outputStreamVideo = new OutputStreamVideo(); |
| 64 | + _outputStreamVideo->setProfile( profile ); |
| 65 | + } |
| 66 | + else |
| 67 | + { |
| 68 | + std::cout << "[StreamTranscoder::init] audio stream..." << std::endl; |
| 69 | + _inputStreamAudio = new InputStreamAudio( *_stream ); |
| 70 | + _outputStreamAudio = new OutputStreamAudio(); |
| 71 | + _outputStreamAudio->setProfile( profile ); |
| 72 | + } |
| 73 | + } |
| 74 | +} |
| 75 | + |
| 76 | +bool StreamTranscoder::processFrame() |
| 77 | +{ |
| 78 | + if( _transcodeStream ) |
| 79 | + { |
| 80 | + // transcodes |
| 81 | + |
| 82 | + } |
| 83 | + // wraps |
| 84 | + |
| 85 | + return true; |
| 86 | +} |
| 87 | + |
| 88 | +} |
0 commit comments