xref: /haiku/src/add-ons/media/plugins/ffmpeg/DemuxerTable.cpp (revision da4dbfa47a47beb355289f3dd685797cee69ab77)
1 /*
2  * Copyright 2009-2010 Stephan Aßmus <superstippi@gmx.de>
3  * All rights reserved. Distributed under the terms of the MIT license.
4  */
5 
6 #include "DemuxerTable.h"
7 #include "MuxerTable.h"
8 
9 extern "C" {
10 	#include "avformat.h"
11 }
12 
13 
14 // NOTE: AVFormatReader uses this table only for better pretty names and
15 // the MIME type info, the latter which is unavailable from AVInputFormat.
16 
17 
18 const media_file_format*
19 demuxer_format_for(const AVInputFormat* format)
20 {
21 	for (uint32 i = 0; i < gMuxerCount; i++) {
22 		const media_file_format* demuxerFormat = &gMuxerTable[i];
23 
24 		if (!(demuxerFormat->capabilities & media_file_format::B_READABLE))
25 			continue;
26 
27 		if (strstr(format->name, demuxerFormat->short_name) != NULL)
28 			return demuxerFormat;
29 	}
30 	return NULL;
31 }
32 
33