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.Avi2Ogv;
16 import eu.svjatoslav.meviz.encoder.converters.Converter;
17 import eu.svjatoslav.meviz.encoder.converters.Jpeg2Png;
18 import eu.svjatoslav.meviz.encoder.converters.Mkv2Mp4;
19 import eu.svjatoslav.meviz.encoder.converters.Mp42Ogv;
20 import eu.svjatoslav.meviz.encoder.converters.Mts2Mkv;
21 import eu.svjatoslav.meviz.encoder.converters.Mts2Mp4;
22 import eu.svjatoslav.meviz.encoder.converters.Ogg2Mp3;
23 import eu.svjatoslav.meviz.encoder.converters.Ogg2Wav;
24 import eu.svjatoslav.meviz.encoder.converters.Png2Tiff;
25 import eu.svjatoslav.meviz.encoder.converters.Tiff2Png;
26 import eu.svjatoslav.meviz.encoder.converters.Wav2flac;
27 import eu.svjatoslav.meviz.encoder.converters.Wav2mp3;
29 public class FormatsRegistry {
31 public ArrayList<Converter> encoders = new ArrayList<Converter>();
33 public FormatsRegistry() {
35 registerEncoder(new Avi2Ogv());
36 registerEncoder(new Mp42Ogv());
37 registerEncoder(new Mts2Mp4());
38 registerEncoder(new Mts2Mkv());
39 registerEncoder(new Mkv2Mp4());
42 registerEncoder(new Jpeg2Png());
43 registerEncoder(new Png2Tiff());
44 registerEncoder(new Tiff2Png());
47 registerEncoder(new Ogg2Wav());
48 registerEncoder(new Wav2mp3());
49 registerEncoder(new Wav2flac());
50 registerEncoder(new Ogg2Mp3());
53 public List<Converter> getEncoders(final String sourceFormat,
54 final String targetFormat) {
56 final String sourceFormatLowerCase = sourceFormat.toLowerCase();
57 final String targetFormatLowerCase = targetFormat.toLowerCase();
59 final ArrayList<Converter> encoders = new ArrayList<Converter>();
61 for (final Converter encoder : this.encoders)
62 if (encoder.getSourceFileExtension().equals(sourceFormatLowerCase))
63 if (encoder.getTargetFileExtension().equals(
64 targetFormatLowerCase)) {
65 encoders.add(encoder);
72 public void registerEncoder(final Converter encoder) {
73 encoders.add(encoder);