File tree Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -142,7 +142,18 @@ AVMediaType InputFile::getStreamType( size_t index )
142
142
143
143
AvInputStream& InputFile::getStream ( size_t index )
144
144
{
145
- return *_inputStreams.at ( index );
145
+ try
146
+ {
147
+ return *_inputStreams.at ( index );
148
+ }
149
+ catch ( const std::out_of_range& e )
150
+ {
151
+ std::stringstream msg;
152
+ msg << getFilename ();
153
+ msg << " has no stream at index " ;
154
+ msg << index;
155
+ throw std::runtime_error ( msg.str () );
156
+ }
146
157
}
147
158
148
159
bool InputFile::readNextPacket ( CodedData& data, const size_t streamIndex )
@@ -196,12 +207,12 @@ void InputFile::seekAtFrame( const size_t frame )
196
207
197
208
void InputFile::activateStream ( const size_t streamIndex, bool activate )
198
209
{
199
- _inputStreams. at ( streamIndex )-> activate ( activate );
210
+ getStream ( streamIndex ). activate ( activate );
200
211
}
201
212
202
213
bool InputFile::isStreamActivated ( const size_t streamIndex )
203
214
{
204
- return _inputStreams. at ( streamIndex )-> isActivated ();
215
+ return getStream ( streamIndex ). isActivated ();
205
216
}
206
217
207
218
void InputFile::setProfile ( const ProfileLoader::Profile& profile )
You can’t perform that action at this time.
0 commit comments