net.datacrow.util.movie
Class FilePropertiesMovie

java.lang.Object
  extended by net.datacrow.util.movie.FilePropertiesMovie

public class FilePropertiesMovie
extends java.lang.Object


Constructor Summary
FilePropertiesMovie(java.lang.String filename)
          Initializes the movie file properties.
 
Method Summary
protected  int changeEndianness(int num)
          Reverses the byte order
protected  java.lang.String findName(java.io.InputStream stream, java.lang.String id)
          Searches in the inputStream stream the name following the string id (separated by a \t).
protected  java.lang.String fromByteToAscii(int j, int numberOfBytes)
          Returns the ASCII value of id
 int getAudioBitRate()
          Returns the audio bit rate.
 int getAudioChannels()
          Returns the audio channels.
 java.lang.String getAudioCodec()
          Returns the audio codec.
 int getAudioRate()
          Returns the audio rate.
protected  int[] getBits(int value, int numberOfBytes)
          Returns an array containing the bits from the value.
protected  java.lang.String getContainer()
          Returns the container.
protected  int getDecimalValue(int[] bits, int start, int stop, boolean printBits)
          Returns the decimal value of a specified number of bytes from a specific part of a byte.
 int getDuration()
          Returns the duration.
 java.lang.String getFilename()
           
 java.lang.String getLanguage()
           
protected  java.lang.String getMediaType()
          Returns the Media Type.
protected  java.util.List<java.lang.String> getMetaData()
          Returns the meta data ArrayList.
 java.lang.String getMetaDataTagInfo(java.lang.String tag)
           
 java.lang.String getName()
           
 java.lang.String getSubtitles()
          Returns the subtitles.
protected  int getUnsignedInt16(byte byte1, byte byte2)
          Returns a 16-bit integer.
protected  int getUnsignedInt16(int byte1, int byte2)
          Returns a 16-bit integer.
protected  int getUnsignedInt32(byte byte1, byte byte2)
          Returns an unsigned 32-bit integer.
protected  int getUnsignedInt32(int byte1, int byte2)
          Returns an unsigned 32-bit integer.
 int getVideoBitRate()
          Returns the video bit rate.
 java.lang.String getVideoCodec()
          Returns the video codec.
 int getVideoHeight()
           
 double getVideoRate()
          Returns the video rate.
 java.lang.String getVideoResolution()
          Returns the resolution.
 int getVideoWidth()
           
protected  void process(java.io.RandomAccessFile dataStream, java.lang.String filename)
          Processes a file from the given DataInputStream.
protected  int readUnsignedByte(byte[] b, int offset)
          Reads an unsigned 8-bit integer.
protected  int readUnsignedByte(java.io.RandomAccessFile dataStream)
          Reads an unsigned byte and returns its int representation.
protected  int[] readUnsignedBytes(java.io.RandomAccessFile dataStream, int n)
          Reads n unsigned bytes and returns it in an int[n].
protected  int readUnsignedInt16(byte[] b, int offset)
          Reads an unsigned 16-bit integer.
protected  int readUnsignedInt16(java.io.RandomAccessFile dataStream)
          Reads an unsigned 16-bit integer.
protected  int readUnsignedInt32(byte[] b, int offset)
          Reads an unsigned 32-bit integer.
protected  int readUnsignedInt32(java.io.RandomAccessFile dataStream)
          Reads an unsigned 32-bit integer.
protected  void setAudioBitRate(int audioBitRate)
          Sets the audio bit rate.
protected  void setAudioChannels(int audioChannels)
          Sets the audio channels.
protected  void setAudioCodec(java.lang.String audioCodec)
          Sets the audio Codec (auda handler).
protected  void setAudioRate(int audioRate)
          Sets the audio rate.
protected  void setContainer(java.lang.String container)
          Sets the container.
protected  void setDuration(int duration)
          Sets the duration.
 void setFilename(java.lang.String filename)
           
 void setLanguage(java.lang.String language)
           
protected  void setMediaType(java.lang.String mediaType)
          Sets the Media Type.
protected  void setMetaData(java.util.List<java.lang.String> metaData)
          Sets the meta data ArrayList.
 void setName(java.lang.String name)
           
protected  void setSubtitles(java.lang.String subtitles)
          Sets the subtitles.
protected  void setVideoBitRate(int videoBitRate)
          Sets the video bit rate.
protected  void setVideoCodec(java.lang.String videoCodec)
          Sets the video codec (video handler).
protected  void setVideoRate(double videoRate)
          Sets the video rate.
protected  void setVideoResolution(java.lang.String videoResolution)
          Sets the resolution.
protected  void skipBytes(java.io.RandomAccessFile dataStream, int n)
          Discards n bytes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FilePropertiesMovie

public FilePropertiesMovie(java.lang.String filename)
                    throws java.lang.Exception
Initializes the movie file properties.

Parameters:
filename -
Throws:
java.lang.Exception
Method Detail

getVideoWidth

public int getVideoWidth()

getVideoHeight

public int getVideoHeight()

getMetaDataTagInfo

public java.lang.String getMetaDataTagInfo(java.lang.String tag)

getFilename

public java.lang.String getFilename()

setFilename

public void setFilename(java.lang.String filename)

getLanguage

public java.lang.String getLanguage()

setLanguage

public void setLanguage(java.lang.String language)

getName

public java.lang.String getName()

setName

public void setName(java.lang.String name)

getSubtitles

public java.lang.String getSubtitles()
Returns the subtitles.


getVideoResolution

public java.lang.String getVideoResolution()
Returns the resolution.


getVideoCodec

public java.lang.String getVideoCodec()
Returns the video codec.


getVideoRate

public double getVideoRate()
Returns the video rate.


getVideoBitRate

public int getVideoBitRate()
Returns the video bit rate.


getDuration

public int getDuration()
Returns the duration.


getAudioCodec

public java.lang.String getAudioCodec()
Returns the audio codec.


getAudioRate

public int getAudioRate()
Returns the audio rate.


getAudioBitRate

public int getAudioBitRate()
Returns the audio bit rate.


getAudioChannels

public int getAudioChannels()
Returns the audio channels.


setSubtitles

protected void setSubtitles(java.lang.String subtitles)
Sets the subtitles.


setVideoResolution

protected void setVideoResolution(java.lang.String videoResolution)
Sets the resolution.


setVideoCodec

protected void setVideoCodec(java.lang.String videoCodec)
Sets the video codec (video handler).


setVideoRate

protected void setVideoRate(double videoRate)
Sets the video rate.


setVideoBitRate

protected void setVideoBitRate(int videoBitRate)
Sets the video bit rate.


setDuration

protected void setDuration(int duration)
Sets the duration.


setAudioCodec

protected void setAudioCodec(java.lang.String audioCodec)
Sets the audio Codec (auda handler).


setAudioRate

protected void setAudioRate(int audioRate)
Sets the audio rate.


setAudioBitRate

protected void setAudioBitRate(int audioBitRate)
Sets the audio bit rate.


setAudioChannels

protected void setAudioChannels(int audioChannels)
Sets the audio channels.


setContainer

protected void setContainer(java.lang.String container)
Sets the container.


getContainer

protected java.lang.String getContainer()
Returns the container.


setMediaType

protected void setMediaType(java.lang.String mediaType)
Sets the Media Type.


getMediaType

protected java.lang.String getMediaType()
Returns the Media Type.


setMetaData

protected void setMetaData(java.util.List<java.lang.String> metaData)
Sets the meta data ArrayList.


getMetaData

protected java.util.List<java.lang.String> getMetaData()
Returns the meta data ArrayList.


process

protected void process(java.io.RandomAccessFile dataStream,
                       java.lang.String filename)
                throws java.lang.Exception
Processes a file from the given DataInputStream.

Throws:
java.lang.Exception

readUnsignedByte

protected int readUnsignedByte(byte[] b,
                               int offset)
                        throws java.lang.Exception
Reads an unsigned 8-bit integer.

Throws:
java.lang.Exception

readUnsignedInt16

protected int readUnsignedInt16(byte[] b,
                                int offset)
                         throws java.lang.Exception
Reads an unsigned 16-bit integer.

Throws:
java.lang.Exception

readUnsignedInt32

protected int readUnsignedInt32(byte[] b,
                                int offset)
                         throws java.lang.Exception
Reads an unsigned 32-bit integer.

Throws:
java.lang.Exception

getUnsignedInt16

protected int getUnsignedInt16(int byte1,
                               int byte2)
                        throws java.lang.Exception
Returns a 16-bit integer.

Throws:
java.lang.Exception

getUnsignedInt16

protected int getUnsignedInt16(byte byte1,
                               byte byte2)
                        throws java.lang.Exception
Returns a 16-bit integer.

Throws:
java.lang.Exception

getUnsignedInt32

protected int getUnsignedInt32(byte byte1,
                               byte byte2)
                        throws java.lang.Exception
Returns an unsigned 32-bit integer.

Throws:
java.lang.Exception

getUnsignedInt32

protected int getUnsignedInt32(int byte1,
                               int byte2)
                        throws java.lang.Exception
Returns an unsigned 32-bit integer.

Throws:
java.lang.Exception

readUnsignedByte

protected int readUnsignedByte(java.io.RandomAccessFile dataStream)
                        throws java.lang.Exception
Reads an unsigned byte and returns its int representation.

Throws:
java.lang.Exception

readUnsignedBytes

protected int[] readUnsignedBytes(java.io.RandomAccessFile dataStream,
                                  int n)
                           throws java.lang.Exception
Reads n unsigned bytes and returns it in an int[n].

Throws:
java.lang.Exception

readUnsignedInt16

protected int readUnsignedInt16(java.io.RandomAccessFile dataStream)
                         throws java.lang.Exception
Reads an unsigned 16-bit integer.

Throws:
java.lang.Exception

readUnsignedInt32

protected int readUnsignedInt32(java.io.RandomAccessFile dataStream)
                         throws java.lang.Exception
Reads an unsigned 32-bit integer.

Throws:
java.lang.Exception

skipBytes

protected void skipBytes(java.io.RandomAccessFile dataStream,
                         int n)
                  throws java.lang.Exception
Discards n bytes.

Throws:
java.lang.Exception

changeEndianness

protected int changeEndianness(int num)
Reverses the byte order


fromByteToAscii

protected java.lang.String fromByteToAscii(int j,
                                           int numberOfBytes)
                                    throws java.lang.Exception
Returns the ASCII value of id

Throws:
java.lang.Exception

getDecimalValue

protected int getDecimalValue(int[] bits,
                              int start,
                              int stop,
                              boolean printBits)
Returns the decimal value of a specified number of bytes from a specific part of a byte.


getBits

protected int[] getBits(int value,
                        int numberOfBytes)
Returns an array containing the bits from the value.


findName

protected java.lang.String findName(java.io.InputStream stream,
                                    java.lang.String id)
                             throws java.lang.Exception
Searches in the inputStream stream the name following the string id (separated by a \t).

Throws:
java.lang.Exception