@@ -54,8 +54,7 @@ void Transcoder::add( const std::string& filename, const size_t streamIndex, Pro
54
54
if ( ! filename.length () )
55
55
{
56
56
if ( _verbose )
57
- std::cout << " add encoding stream for dummy input" << std::endl;
58
- addDummyStream ( profileDesc );
57
+ std::cerr << " can't add a stream with no filename indicated" << std::endl;
59
58
return ;
60
59
}
61
60
@@ -64,6 +63,22 @@ void Transcoder::add( const std::string& filename, const size_t streamIndex, Pro
64
63
addTranscodeStream ( filename, streamIndex, profileDesc );
65
64
}
66
65
66
+ void Transcoder::add ( const std::string& filename, const size_t streamIndex, Profile::ProfileDesc& profileDesc, EssenceDesc& essenceDesc )
67
+ {
68
+ _profile.update ( profileDesc );
69
+ if ( ! filename.length () )
70
+ {
71
+ if ( _verbose )
72
+ std::cout << " add dummy stream" << std::endl;
73
+ addDummyStream ( profileDesc, essenceDesc );
74
+ return ;
75
+ }
76
+
77
+ if ( _verbose )
78
+ std::cout << " add transcoding stream" << std::endl;
79
+ addTranscodeStream ( filename, streamIndex, profileDesc );
80
+ }
81
+
67
82
void Transcoder::add ( const std::string& filename, const size_t streamIndex, const int subStreamIndex, const std::string& profileName )
68
83
{
69
84
if ( subStreamIndex < 0 )
@@ -87,18 +102,41 @@ void Transcoder::add( const std::string& filename, const size_t streamIndex, con
87
102
88
103
void Transcoder::add ( const std::string& filename, const size_t streamIndex, const int subStreamIndex, Profile::ProfileDesc& profileDesc )
89
104
{
105
+ _profile.update ( profileDesc );
106
+
90
107
if ( subStreamIndex < 0 )
91
108
{
92
109
add ( filename, streamIndex, profileDesc );
93
110
return ;
94
111
}
112
+
113
+ if ( ! filename.length () )
114
+ {
115
+ if ( _verbose )
116
+ std::cerr << " can't add a stream with no filename indicated" << std::endl;
117
+ return ;
118
+ }
119
+
120
+ if ( _verbose )
121
+ std::cout << " add transcoding stream for substream " << subStreamIndex << std::endl;
122
+ addTranscodeStream ( filename, streamIndex, subStreamIndex, profileDesc );
123
+ }
95
124
125
+ void Transcoder::add ( const std::string& filename, const size_t streamIndex, const int subStreamIndex, Profile::ProfileDesc& profileDesc, EssenceDesc& essenceDesc )
126
+ {
96
127
_profile.update ( profileDesc );
128
+
129
+ if ( subStreamIndex < 0 )
130
+ {
131
+ add ( filename, streamIndex, profileDesc );
132
+ return ;
133
+ }
134
+
97
135
if ( ! filename.length () )
98
136
{
99
137
if ( _verbose )
100
- std::cout << " add encoding stream for dummy input " << std::endl;
101
- addDummyStream ( profileDesc );
138
+ std::cout << " add dummy stream " << std::endl;
139
+ addDummyStream ( profileDesc, essenceDesc );
102
140
return ;
103
141
}
104
142
@@ -253,20 +291,24 @@ void Transcoder::addTranscodeStream( const std::string& filename, const size_t s
253
291
}
254
292
}
255
293
256
- void Transcoder::addDummyStream ( Profile::ProfileDesc& profile )
294
+ void Transcoder::addDummyStream ( const Profile::ProfileDesc& profile, EssenceDesc& essenceDesc )
257
295
{
258
296
if ( ! profile.count ( Profile::avProfileType ) )
259
297
throw std::runtime_error ( " unable to found stream type (audio, video, etc.)" );
260
298
261
299
if ( profile.find ( Profile::avProfileType )->second == Profile::avProfileTypeAudio )
262
300
{
263
301
_dummyAudio.push_back ( new DummyAudio () );
302
+ _dummyAudio.back ()->setAudioDesc ( static_cast <AudioDesc>( essenceDesc ) );
303
+
264
304
_streamTranscoders.push_back ( new StreamTranscoder ( *_dummyAudio.back (), _outputFile, profile ) );
265
305
}
266
306
267
307
if ( profile.find ( Profile::avProfileType )->second == Profile::avProfileTypeVideo )
268
308
{
269
309
_dummyVideo.push_back ( new DummyVideo () );
310
+ _dummyVideo.back ()->setVideoDesc ( static_cast <VideoDesc>( essenceDesc ) );
311
+
270
312
_streamTranscoders.push_back ( new StreamTranscoder ( *_dummyVideo.back (), _outputFile, profile ) );
271
313
}
272
314
}
0 commit comments