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 eu.svjatoslav.meviz.encoder.converters.*;
14 import java.util.ArrayList;
15 import java.util.List;
17 public class FormatsRegistry {
19 public ArrayList<AbstractConverter> encoders = new ArrayList<AbstractConverter>();
21 public FormatsRegistry() {
23 registerEncoder(new Ffmpeg2theora());
24 registerEncoder(new AvconvVideo());
27 registerEncoder(new Convert());
29 // image to text (OCR)
30 registerEncoder(new Ocr());
33 registerEncoder(new Ogg2Wav());
34 registerEncoder(new Flac());
35 registerEncoder(new AvconvAudio());
36 registerEncoder(new Midi2Wav());
39 public List<AbstractConverter> getEncoders(final String sourceFormat,
40 final String targetFormat) {
42 final String sourceFormatLowerCase = sourceFormat.toLowerCase();
43 final String targetFormatLowerCase = targetFormat.toLowerCase();
45 final ArrayList<AbstractConverter> encoders = new ArrayList<AbstractConverter>();
47 for (final AbstractConverter encoder : this.encoders)
48 if (encoder.supportsSource(sourceFormatLowerCase))
49 if (encoder.supportsTarget(targetFormatLowerCase)) {
50 encoders.add(encoder);
57 public void registerEncoder(final AbstractConverter encoder) {
58 encoders.add(encoder);