Gecko:MediaRecorder: Difference between revisions

Line 25: Line 25:
== API draft ==
== API draft ==
<code>
<code>
/**
  * Implement a queue-like interface between MediaStream and encoder
  * since encoded may take long time to process one segment while new
  * segment comes.
  */
  class MediaSegmentAdapter {
  class MediaSegmentAdapter {
  public:
  public:
Line 46: Line 51:
  }
  }


/**
  * A base class for video type adapters, which provide basic implementation
  * e.g, copy the frame
  */
  class VideoAdapter : MediaSegmentAdapter {
  class VideoAdapter : MediaSegmentAdapter {
  public:
  public:
Line 52: Line 61:
  }
  }


/**
  * In FirefoxOS, we have hardware encoder and camera output platform-specific
  * buffer which may give better performance
  */
  class GrallocAdapter : MediaSegmentAdapter {
  class GrallocAdapter : MediaSegmentAdapter {
  public:  
  public:  
Line 60: Line 73:
  }
  }


/**
  * Similar to VideoAdapter, and since audio codecs may need |collect| enough data
  * then real encode it, we may implement raw buffer with some specific length and
  * collect data into the buffer
  */
  class AudioAdapter : MediaSegmentAdapter {
  class AudioAdapter : MediaSegmentAdapter {
  public:  
  public:  
Line 66: Line 84:
  }
  }


/**
  * This class is similar to MediaStreamGraph.
  * It take response to initialize all the component and link them together.
  */
  class MediaEncoder : MediaStreamListener {
  class MediaEncoder : MediaStreamListener {
  public:
  public:
Line 138: Line 160:
  }
  }


  class CodecParams {
  /**
    /* key value pair for detailed codec settings */
  * Different codecs usually support some codec specific parameters which
     Map<Key, Value> mMap;
  * we may take advantage of.
  *
  * Let each implementation provide its own parameter set, and use common
  * params if no special params requested.
  */
union CodecParams {
    OpusParams opusParams;
     TheoraParams theoraParams;
    MPEG4Params mpeg4Params;
    // etc.
  }
  }


  /* base class for general codecs */
  /**
  * base class for general codecs:
  *
  * we generally do not implement codec ourself, but we need a generic interface
  * to capsulate it.
  *
  * For example, if we want to support opus, we should create a OpusCodec and let
  * it inherit this base class(by inherit AudioCodec), and implement OpusCodec by
  * utilize libopus API.
  */
  class MediaCodec {
  class MediaCodec {
  public:
  public:
Line 208: Line 248:
  }
  }


/**
  * Generic base class for container writer
  *
  * Similar to MediaCodec and we separate container and codec for future extension.
  */
  class MediaWriter {
  class MediaWriter {
  public:
  public:
Confirmed users
157

edits