MCPcopy Create free account
hub / github.com/OpenShot/libopenshot / CreateReader

Method CreateReader

src/Clip.cpp:241–276  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

239}
240
241ReaderBase* Clip::CreateReader(std::string path, bool inspect_reader)
242{
243 // Get file extension (and convert to lower case)
244 std::string ext = get_file_extension(path);
245 std::transform(ext.begin(), ext.end(), ext.begin(), ::tolower);
246
247 // Determine if common video formats (or image sequences)
248 if (ext=="avi" || ext=="mov" || ext=="mkv" || ext=="mpg" || ext=="mpeg" || ext=="mp3" || ext=="mp4" || ext=="mts" ||
249 ext=="ogg" || ext=="wav" || ext=="wmv" || ext=="webm" || ext=="vob" || ext=="gif" || path.find("%") != std::string::npos)
250 {
251 try
252 {
253 return new openshot::FFmpegReader(path, inspect_reader);
254 } catch(...) { }
255 }
256 if (ext=="osp")
257 {
258 try
259 {
260 return new openshot::Timeline(path, true);
261 } catch(...) { }
262 }
263
264 // If no video found, try each reader
265 try
266 {
267 return new openshot::QtImageReader(path, inspect_reader);
268 } catch(...) {
269 try
270 {
271 return new openshot::FFmpegReader(path, inspect_reader);
272 } catch(...) { }
273 }
274
275 return NULL;
276}
277
278// Destructor
279Clip::~Clip()

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected