@@ -36,40 +36,41 @@ void StreamTranscoder::init( const std::string& profile )
36
36
_inputStreamReader = new InputStreamVideo ( *_stream );
37
37
_inputStreamReader->setup ();
38
38
39
- if ( ! profile.empty () )
40
- {
41
- _outputStreamWriter = new OutputStreamVideo ();
42
- OutputStreamVideo* outputStreamVideo = static_cast <OutputStreamVideo*>( _outputStreamWriter );
43
-
44
- outputStreamVideo->setProfile ( profile );
45
- _outputFile->addVideoStream ( outputStreamVideo->getVideoDesc () );
46
- _frameBuffer = new Image ( outputStreamVideo->getVideoDesc ().getImageDesc () );
47
- }
48
- else
39
+ // re-wrap only, get output descriptor from input
40
+ if ( profile.empty () )
49
41
{
50
42
_outputFile->addVideoStream ( _stream->getVideoDesc () );
43
+ break ;
51
44
}
52
45
46
+ OutputStreamVideo* outputStreamVideo = new OutputStreamVideo ();
47
+ _outputStreamWriter = outputStreamVideo;
48
+
49
+ _outputStreamWriter->setProfile ( profile );
50
+ _outputFile->addVideoStream ( outputStreamVideo->getVideoDesc () );
51
+ _frameBuffer = new Image ( outputStreamVideo->getVideoDesc ().getImageDesc () );
52
+
53
53
break ;
54
54
}
55
55
case AVMEDIA_TYPE_AUDIO :
56
56
{
57
57
_inputStreamReader = new InputStreamAudio ( *_stream );
58
58
_inputStreamReader->setup ();
59
- if ( ! profile.empty () )
60
- {
61
- _outputStreamWriter = new OutputStreamAudio ();
62
- OutputStreamAudio* outputStreamAudio = static_cast <OutputStreamAudio*>( _outputStreamWriter );
63
59
64
- outputStreamAudio->setProfile ( profile );
65
- _outputFile->addAudioStream ( outputStreamAudio->getAudioDesc () );
66
- _frameBuffer = new AudioFrame ( outputStreamAudio->getAudioDesc ().getFrameDesc () );
67
- }
68
- else
60
+ // re-wrap only, get output descriptor from input
61
+ if ( profile.empty () )
69
62
{
70
63
_outputFile->addAudioStream ( _stream->getAudioDesc () );
64
+ break ;
71
65
}
66
+
67
+ OutputStreamAudio* outputStreamAudio = new OutputStreamAudio ();
68
+ _outputStreamWriter = outputStreamAudio;
72
69
70
+ outputStreamAudio->setProfile ( profile );
71
+ _outputFile->addAudioStream ( outputStreamAudio->getAudioDesc () );
72
+ _frameBuffer = new AudioFrame ( outputStreamAudio->getAudioDesc ().getFrameDesc () );
73
+
73
74
break ;
74
75
}
75
76
default :
0 commit comments