2 * Meviz - Various tools collection to work with multimedia.
3 * Copyright (C) 2012, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of version 2 of the GNU General Public License
7 * as published by the Free Software Foundation.
10 package eu.svjatoslav.meviz.encoder;
12 import java.util.ArrayList;
13 import java.util.List;
15 import eu.svjatoslav.meviz.encoder.converters.AbstractConverter;
16 import eu.svjatoslav.meviz.encoder.converters.AvconvAudio;
17 import eu.svjatoslav.meviz.encoder.converters.AvconvVideo;
18 import eu.svjatoslav.meviz.encoder.converters.Convert;
19 import eu.svjatoslav.meviz.encoder.converters.Ffmpeg2theora;
20 import eu.svjatoslav.meviz.encoder.converters.Flac;
21 import eu.svjatoslav.meviz.encoder.converters.Midi2Wav;
22 import eu.svjatoslav.meviz.encoder.converters.Ocr;
23 import eu.svjatoslav.meviz.encoder.converters.Ogg2Wav;
25 public class FormatsRegistry {
27 public ArrayList<AbstractConverter> encoders = new ArrayList<AbstractConverter>();
29 public FormatsRegistry() {
31 registerEncoder(new Ffmpeg2theora());
32 registerEncoder(new AvconvVideo());
35 registerEncoder(new Convert());
37 // image to text (OCR)
38 registerEncoder(new Ocr());
41 registerEncoder(new Ogg2Wav());
42 registerEncoder(new Flac());
43 registerEncoder(new AvconvAudio());
44 registerEncoder(new Midi2Wav());
47 public List<AbstractConverter> getEncoders(final String sourceFormat,
48 final String targetFormat) {
50 final String sourceFormatLowerCase = sourceFormat.toLowerCase();
51 final String targetFormatLowerCase = targetFormat.toLowerCase();
53 final ArrayList<AbstractConverter> encoders = new ArrayList<AbstractConverter>();
55 for (final AbstractConverter encoder : this.encoders)
56 if (encoder.supportsSource(sourceFormatLowerCase))
57 if (encoder.supportsTarget(targetFormatLowerCase)) {
58 encoders.add(encoder);
65 public void registerEncoder(final AbstractConverter encoder) {
66 encoders.add(encoder);