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.Ogg2Wav;
24 public class FormatsRegistry {
26 public ArrayList<AbstractConverter> encoders = new ArrayList<AbstractConverter>();
28 public FormatsRegistry() {
30 registerEncoder(new Ffmpeg2theora());
31 registerEncoder(new AvconvVideo());
34 registerEncoder(new Convert());
37 registerEncoder(new Ogg2Wav());
38 registerEncoder(new Flac());
39 registerEncoder(new AvconvAudio());
40 registerEncoder(new Midi2Wav());
43 public List<AbstractConverter> getEncoders(final String sourceFormat,
44 final String targetFormat) {
46 final String sourceFormatLowerCase = sourceFormat.toLowerCase();
47 final String targetFormatLowerCase = targetFormat.toLowerCase();
49 final ArrayList<AbstractConverter> encoders = new ArrayList<AbstractConverter>();
51 for (final AbstractConverter encoder : this.encoders)
52 if (encoder.supportsSource(sourceFormatLowerCase))
53 if (encoder.supportsTarget(targetFormatLowerCase)) {
54 encoders.add(encoder);
61 public void registerEncoder(final AbstractConverter encoder) {
62 encoders.add(encoder);