// map with mimetype as key and content descriptor as value to avoid multiple descriptors
Map mimeTypes = new HashMap();
int i = 1;
AVInputFormat avInputFormat = AVFORMAT.av_find_input_format(FIRST_FFMPEG_DEMUX_NAME);
//AVInputFormat avInputFormat = new AVInputFormat((Pointer)AVFormatLibrary.first_iformat.getValue());
while (avInputFormat != null) {
String mimeType = null;
// we look for an encoder with same name and add mime_type of this
AVOutputFormat avOutputFormat = AVFORMAT.guess_format(avInputFormat.name, null,null);
if (avOutputFormat != null && avOutputFormat.mime_type != null && avOutputFormat.mime_type.length() > 0) {
mimeType = avOutputFormat.mime_type;
mimeTypes.put(mimeType, new ContentDescriptor(ContentDescriptor.mimeTypeToPackageName(mimeType)));
logger.log(Level.FINEST, i + ". " + avInputFormat.long_name + " : " + mimeType);
}
String[] additionalMimeTypes = (String[])additionalFormatMimeTypes.get(avInputFormat.name);
if (additionalMimeTypes != null) {
if (additionalMimeTypes == NOT_SUPPORTED_FORMAT) {
logger.log(Level.FINE, "Ignoring input format: " + avInputFormat.name + " (" + avInputFormat.long_name + ")");
} else {
for (int j = 0; j < additionalMimeTypes.length; j++) {
mimeType = additionalMimeTypes[j];
mimeTypes.put(mimeType, new ContentDescriptor(ContentDescriptor.mimeTypeToPackageName(mimeType)));
logger.log(Level.FINEST, i + ". " + avInputFormat.long_name + " : " + additionalMimeTypes[j]);
}
}
}
if (mimeType == null && additionalMimeTypes == null){
mimeType = "ffmpeg/"+avInputFormat.name;
mimeTypes.put(mimeType, new ContentDescriptor(ContentDescriptor.mimeTypeToPackageName(mimeType)));
}
i++;
if (avInputFormat.next != null /*&& avInputFormat.next.isValid()*/) {
avInputFormat = new AVInputFormat(avInputFormat.next);
}else{
avInputFormat = null;
}
}