Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Class MPEGFilter  view MPEGFilter download

  extended byorg.xml.sax.helpers.XMLFilterImpl
      extended byorg.esau.ptarmigan.impl.filter.BaseFilter
          extended byorg.esau.ptarmigan.impl.filter.BinaryFilter
              extended byorg.esau.ptarmigan.impl.filter.MPEGFilter
All Implemented Interfaces:
org.esau.ptarmigan.impl.ByteStreamSource, org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler, org.xml.sax.XMLFilter, org.xml.sax.XMLReader

public final class MPEGFilter
extends BinaryFilter

Extract metadata from MPEG frame data, if present

TODO: add VBR calculation


$Revision: 1.6 $ $Date: 2002/10/03 20:56:11 $

Field Summary
(package private) static int HEADER_SIZE
(package private) static org.apache.commons.logging.Log log
          logging object
(package private) static java.lang.String NS_PREFIX
(package private) static java.lang.String NS_URI
Fields inherited from class org.esau.ptarmigan.impl.filter.BinaryFilter
ERROR_MSG, m_cis, m_limit_to_impose
Fields inherited from class org.esau.ptarmigan.impl.filter.BaseFilter
EMPTY_ATTRS, m_media_properties
Fields inherited from class org.xml.sax.helpers.XMLFilterImpl
Constructor Summary
Method Summary
 void doParse()
          SAX-Invoked parse of a 'document' from an input stream.
(package private)  java.lang.String getNamespacePrefix()
(package private)  java.lang.String getNamespaceURI()
(package private)  boolean locateNextHeader(org.esau.ptarmigan.impl.MPEGFrameHeader header, int max_bytes)
          Read as many as max_bytes to locate the next 'valid' MPEGFrameHeader.
(package private)  void writeSAX(org.esau.ptarmigan.impl.MPEGFrameHeader header, int avg_bitrate)
          build the xml content from the first good header
Methods inherited from class org.esau.ptarmigan.impl.filter.BinaryFilter
counter, doParse, fastForward, read, read, read, readCharBE, readCharLE, readInt16BE, readInt16LE, readInt24BE, readInt24LE, readInt32BE, readInt32LE, remaining, rewind, setCounterLimit, skip
Methods inherited from class org.esau.ptarmigan.impl.filter.BaseFilter
characters, getByteStream, getChars, getMediaProperties, parse, setMediaProperties, sourceIsXML, write, write, write, write, write, write, write, write, write, write, write, writeDate, writeDate, writeDate, writeDate, writeInteger, writeInteger, writeInteger, writeInteger, writeInteger, writeString, writeString, writeString, writeString, writeString
Methods inherited from class org.xml.sax.helpers.XMLFilterImpl
endDocument, endElement, endPrefixMapping, error, fatalError, getContentHandler, getDTDHandler, getEntityResolver, getErrorHandler, getFeature, getParent, getProperty, ignorableWhitespace, notationDecl, parse, processingInstruction, resolveEntity, setContentHandler, setDocumentLocator, setDTDHandler, setEntityResolver, setErrorHandler, setFeature, setParent, setProperty, skippedEntity, startDocument, startElement, startPrefixMapping, unparsedEntityDecl, warning
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Detail


static final int HEADER_SIZE
See Also:
Constant Field Values


static final java.lang.String NS_URI
See Also:
Constant Field Values


static final java.lang.String NS_PREFIX
See Also:
Constant Field Values


static org.apache.commons.logging.Log log
logging object

Constructor Detail


public MPEGFilter()
           throws org.xml.sax.SAXException
Method Detail


java.lang.String getNamespaceURI()
Specified by:
getNamespaceURI in class BaseFilter


java.lang.String getNamespacePrefix()
Specified by:
getNamespacePrefix in class BaseFilter


public void doParse()
             throws org.xml.sax.SAXException,
SAX-Invoked parse of a 'document' from an input stream.

Read available bytes to try to find consecutive MPEG frames. If successful, we'll position at the start of the first one.

If not successful, we'll reset() the input stream.

Specified by:
doParse in class BinaryFilter


boolean locateNextHeader(org.esau.ptarmigan.impl.MPEGFrameHeader header,
                         int max_bytes)
Read as many as max_bytes to locate the next 'valid' MPEGFrameHeader. Note that it though it is valid, it may not actually be the real header (i.e., it could be random noise at the start of the stream).

true is returned if a valid frame is found, the stream is positioned one byte beyond the header.

false is returned if no header could be found before max_bytes or the bytes available in the stream were exhausted.


void writeSAX(org.esau.ptarmigan.impl.MPEGFrameHeader header,
              int avg_bitrate)
build the xml content from the first good header