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.Ffmpeg2theora;
16 import eu.svjatoslav.meviz.encoder.converters.AbstractConverter;
17 import eu.svjatoslav.meviz.encoder.converters.AvconvVideo;
18 import eu.svjatoslav.meviz.encoder.converters.Ffmpeg;
19 import eu.svjatoslav.meviz.encoder.converters.AvconvAudio;
20 import eu.svjatoslav.meviz.encoder.converters.Ogg2Wav;
21 import eu.svjatoslav.meviz.encoder.converters.Convert;
22 import eu.svjatoslav.meviz.encoder.converters.Flac;
24 public class FormatsRegistry {
26 public ArrayList<AbstractConverter> encoders = new ArrayList<AbstractConverter>();
28 public FormatsRegistry() {
30 registerEncoder(new Ffmpeg2theora());
31 registerEncoder(new Ffmpeg());
32 registerEncoder(new AvconvVideo());
35 registerEncoder(new Convert());
38 registerEncoder(new Ogg2Wav());
39 registerEncoder(new Flac());
40 registerEncoder(new AvconvAudio());
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);