Copyright 2012-04-26 Werner Randelshofer

org.monte.media
Class Registry

java.lang.Object
  extended by org.monte.media.Registry
Direct Known Subclasses:
DefaultRegistry

public abstract class Registry
extends java.lang.Object

The Registry for audio and video codecs.

Version:
$Id: Registry.java 188 2012-03-28 14:03:19Z werner $
Author:
Werner Randelshofer

Constructor Summary
Registry()
           
 
Method Summary
 Codec getCodec(Format inputFormat, Format outputFormat)
          Gets a codec which can transcode from the specified input format to the specified output format.
abstract  java.lang.String[] getCodecClasses(Format inputFormat, Format outputFormat)
          Gets all codecs which can transcode from the specified input format to the specified output format.
 Codec[] getCodecs(Format inputFormat, Format outputFormat)
          Gets all codecs which can transcode from the specified input format to the specified output format.
 Codec getDecoder(Format inputFormat)
          Gets the first codec which can decode the specified format.
 java.lang.String[] getDecoderClasses(Format format)
          Gets all codecs which can decode the specified format.
 Codec[] getDecoders(Format inputFormat)
          Gets all codecs which can decode the specified format.
 Codec getEncoder(Format outputFormat)
          Gets the first codec which can encode the specified foramt.
 java.lang.String[] getEncoderClasses(Format format)
          Gets all codecs which can decode the specified format.
 Codec[] getEncoders(Format outputFormat)
          Gets all codecs which can encode the specified format.
abstract  java.lang.String getExtension(Format ff)
           
abstract  Format getFileFormat(java.io.File file)
           
abstract  Format[] getFileFormats()
           
static Registry getInstance()
           
 MovieReader getReader(java.io.File file)
           
 MovieReader getReader(Format fileFormat, java.io.File file)
           
abstract  java.lang.String[] getReaderClasses(Format fileFormat)
          Gets all reader class names from the registry for the specified file format.
abstract  Format[] getReaderFormats()
           
 MovieWriter getWriter(java.io.File file)
           
 MovieWriter getWriter(Format fileFormat, java.io.File file)
           
abstract  java.lang.String[] getWriterClasses(Format fileFormat)
          Gets all writer class names from the registry for the specified file format.
abstract  Format[] getWriterFormats()
           
protected abstract  void init()
          Initializes the registry.
abstract  void putCodec(Format inputFormat, Format outputFormat, java.lang.String codecClass)
          Puts a codec into the registry.
abstract  void putFileFormat(java.lang.String extension, Format format)
           
abstract  void putReader(Format fileFormat, java.lang.String readerClass)
          Puts a reader into the registry.
abstract  void putWriter(Format fileFormat, java.lang.String writerClass)
          Puts a writer into the registry.
 java.util.ArrayList<Format> suggestOutputFormats(Format inputMediaFormat, Format outputFileFormat)
          Suggests output formats for the given input media format and specified file format.
abstract  void unregisterCodec(java.lang.String codecClass)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Registry

public Registry()
Method Detail

getInstance

public static Registry getInstance()

init

protected abstract void init()
Initializes the registry.


putCodec

public abstract void putCodec(Format inputFormat,
                              Format outputFormat,
                              java.lang.String codecClass)
Puts a codec into the registry.

Parameters:
inputFormat - The input format. Must not be null.
outputFormat - The output format. Must not be null.
codecClass - The codec class name. Must not be null.

getDecoderClasses

public final java.lang.String[] getDecoderClasses(Format format)
Gets all codecs which can decode the specified format.

Parameters:
format - The format.
Returns:
An array of codec class names. If no codec was found, an empty array is returned.

getEncoderClasses

public final java.lang.String[] getEncoderClasses(Format format)
Gets all codecs which can decode the specified format.

Parameters:
format - The format.
Returns:
An array of codec class names. If no codec was found, an empty array is returned.

getCodecClasses

public abstract java.lang.String[] getCodecClasses(Format inputFormat,
                                                   Format outputFormat)
Gets all codecs which can transcode from the specified input format to the specified output format.

Parameters:
inputFormat - The input format.
outputFormat - The output format.
Returns:
An array of codec class names. If no codec was found, an empty array is returned.

getDecoders

public final Codec[] getDecoders(Format inputFormat)
Gets all codecs which can decode the specified format.

Parameters:
inputFormat - The input format.
Returns:
An array of codec class names. If no codec was found, an empty array is returned.

getDecoder

public Codec getDecoder(Format inputFormat)
Gets the first codec which can decode the specified format.

Parameters:
inputFormat - The output format.
Returns:
A codec. Returns null if no codec was found.

getEncoders

public final Codec[] getEncoders(Format outputFormat)
Gets all codecs which can encode the specified format.

Parameters:
outputFormat - The output format.
Returns:
An array of codecs. If no codec was found, an empty array is returned.

getEncoder

public Codec getEncoder(Format outputFormat)
Gets the first codec which can encode the specified foramt.

Parameters:
outputFormat - The output format.
Returns:
A codec. Returns null if no codec was found.

getCodecs

public Codec[] getCodecs(Format inputFormat,
                         Format outputFormat)
Gets all codecs which can transcode from the specified input format to the specified output format.

Parameters:
inputFormat - The input format.
outputFormat - The output format.
Returns:
An array of codec class names. If no codec was found, an empty array is returned.

getCodec

public Codec getCodec(Format inputFormat,
                      Format outputFormat)
Gets a codec which can transcode from the specified input format to the specified output format.

Parameters:
inputFormat - The input format.
outputFormat - The output format.
Returns:
A codec or null.

putReader

public abstract void putReader(Format fileFormat,
                               java.lang.String readerClass)
Puts a reader into the registry.

Parameters:
fileFormat - The file format, e.g."video/avi", "video/quicktime". Use "Java" for formats which are not tied to a file format. Must not be null.
readerClass - The reader class name. Must not be null.

putWriter

public abstract void putWriter(Format fileFormat,
                               java.lang.String writerClass)
Puts a writer into the registry.

Parameters:
fileFormat - The file format, e.g."video/avi", "video/quicktime". Use "Java" for formats which are not tied to a file format. Must not be null.
writerClass - The writer class name. Must not be null.

getReaderClasses

public abstract java.lang.String[] getReaderClasses(Format fileFormat)
Gets all reader class names from the registry for the specified file format.

Parameters:
fileFormat - The file format, e.g."AVI", "QuickTime".
Returns:
The reader class names.

getWriterClasses

public abstract java.lang.String[] getWriterClasses(Format fileFormat)
Gets all writer class names from the registry for the specified file format.

Parameters:
fileFormat - The file format, e.g."AVI", "QuickTime".
Returns:
The writer class names.

getReader

public MovieReader getReader(Format fileFormat,
                             java.io.File file)

getWriter

public MovieWriter getWriter(java.io.File file)

getWriter

public MovieWriter getWriter(Format fileFormat,
                             java.io.File file)

getReader

public MovieReader getReader(java.io.File file)

putFileFormat

public abstract void putFileFormat(java.lang.String extension,
                                   Format format)

getFileFormat

public abstract Format getFileFormat(java.io.File file)

getReaderFormats

public abstract Format[] getReaderFormats()

getWriterFormats

public abstract Format[] getWriterFormats()

getFileFormats

public abstract Format[] getFileFormats()

getExtension

public abstract java.lang.String getExtension(Format ff)

suggestOutputFormats

public java.util.ArrayList<Format> suggestOutputFormats(Format inputMediaFormat,
                                                        Format outputFileFormat)
Suggests output formats for the given input media format and specified file format.

Parameters:
inputMediaFormat -
outputFileFormat -
Returns:
List of output media formats.

unregisterCodec

public abstract void unregisterCodec(java.lang.String codecClass)

Copyright 2012-04-26 Werner Randelshofer