org.gagravarr.flac
Class FlacOggFile

java.lang.Object
  extended by org.gagravarr.flac.FlacFile
      extended by org.gagravarr.flac.FlacOggFile

public class FlacOggFile
extends FlacFile

This lets you work with FLAC files that are contained in an Ogg Stream


Field Summary
 
Fields inherited from class org.gagravarr.flac.FlacFile
info, otherMetadata, tags
 
Constructor Summary
FlacOggFile(File f)
          Opens the given file for reading
FlacOggFile(OggFile ogg)
          Opens the given file for reading
FlacOggFile(OggPacketReader r)
          Loads a Vorbis File from the given packet reader.
FlacOggFile(OutputStream out)
          Opens for writing.
FlacOggFile(OutputStream out, FlacInfo info, FlacTags tags)
          Opens for writing, based on the settings from a pre-read file.
FlacOggFile(OutputStream out, int sid, FlacInfo info, FlacTags tags)
          Opens for writing, based on the settings from a pre-read file, with a specific Steam ID (SID).
 
Method Summary
 void close()
          In Reading mode, will close the underlying ogg file and free its resources.
 FlacFirstOggPacket getFirstPacket()
          Returns the first Ogg Packet, which has some metadata in it
 FlacAudioFrame getNextAudioPacket()
           
 OggFile getOggFile()
          Returns the underlying Ogg File instance
 int getSid()
          Returns the Ogg Stream ID
 void skipToGranule(long granulePosition)
          Skips the audio data to the next packet with a granule of at least the given granule position.
 void writeAudioData(FlacAudioFrame data)
          Buffers the given audio ready for writing out.
 
Methods inherited from class org.gagravarr.flac.FlacFile
getInfo, getTags, open, open, open
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FlacOggFile

public FlacOggFile(File f)
            throws IOException,
                   FileNotFoundException
Opens the given file for reading

Throws:
IOException
FileNotFoundException

FlacOggFile

public FlacOggFile(OggFile ogg)
            throws IOException
Opens the given file for reading

Throws:
IOException

FlacOggFile

public FlacOggFile(OggPacketReader r)
            throws IOException
Loads a Vorbis File from the given packet reader.

Throws:
IOException

FlacOggFile

public FlacOggFile(OutputStream out)
Opens for writing.


FlacOggFile

public FlacOggFile(OutputStream out,
                   FlacInfo info,
                   FlacTags tags)
Opens for writing, based on the settings from a pre-read file. The Steam ID (SID) is automatically allocated for you.


FlacOggFile

public FlacOggFile(OutputStream out,
                   int sid,
                   FlacInfo info,
                   FlacTags tags)
Opens for writing, based on the settings from a pre-read file, with a specific Steam ID (SID). You should only set the SID when copying one file to another!

Method Detail

getFirstPacket

public FlacFirstOggPacket getFirstPacket()
Returns the first Ogg Packet, which has some metadata in it


getNextAudioPacket

public FlacAudioFrame getNextAudioPacket()
                                  throws IOException
Specified by:
getNextAudioPacket in class FlacFile
Throws:
IOException

skipToGranule

public void skipToGranule(long granulePosition)
                   throws IOException
Skips the audio data to the next packet with a granule of at least the given granule position. Note that skipping backwards is not currently supported!

Specified by:
skipToGranule in class FlacFile
Throws:
IOException

getSid

public int getSid()
Returns the Ogg Stream ID


writeAudioData

public void writeAudioData(FlacAudioFrame data)
Buffers the given audio ready for writing out. Data won't be written out yet, you need to call close() to do that, because we assume you'll still be populating the Info/Comment/Setup objects


close

public void close()
           throws IOException
In Reading mode, will close the underlying ogg file and free its resources. In Writing mode, will write out the Info, Comments and Setup objects, and then the audio data.

Specified by:
close in class FlacFile
Throws:
IOException

getOggFile

public OggFile getOggFile()
Returns the underlying Ogg File instance

Returns:


Copyright © 2012. All Rights Reserved.