GstBaseVideoCodec

GstBaseVideoCodec — Base class for video codecs

Synopsis

#define             GST_BASE_VIDEO_CODEC_SINK_NAME
#define             GST_BASE_VIDEO_CODEC_SRC_NAME
#define             GST_BASE_VIDEO_CODEC_SRC_PAD        (obj)
#define             GST_BASE_VIDEO_CODEC_SINK_PAD       (obj)
#define             GST_BASE_VIDEO_CODEC_FLOW_NEED_DATA
#define             GST_BASE_VIDEO_CODEC_STREAM_LOCK    (codec)
#define             GST_BASE_VIDEO_CODEC_STREAM_UNLOCK  (codec)
struct              GstVideoState;
struct              GstVideoFrameState;
struct              GstBaseVideoCodec;
struct              GstBaseVideoCodecClass;
GstVideoFrameState * gst_base_video_codec_new_frame     (GstBaseVideoCodec *base_video_codec);
void                gst_base_video_codec_append_frame   (GstBaseVideoCodec *codec,
                                                         GstVideoFrameState *frame);
void                gst_base_video_codec_remove_frame   (GstBaseVideoCodec *codec,
                                                         GstVideoFrameState *frame);
GType               gst_video_frame_state_get_type      (void);
GstVideoFrameState * gst_video_frame_state_ref          (GstVideoFrameState *frame);
void                gst_video_frame_state_unref         (GstVideoFrameState *frame);

Description

Details

GST_BASE_VIDEO_CODEC_SINK_NAME

#define GST_BASE_VIDEO_CODEC_SINK_NAME    "sink"

The name of the templates for the sink pad.


GST_BASE_VIDEO_CODEC_SRC_NAME

#define GST_BASE_VIDEO_CODEC_SRC_NAME     "src"

The name of the templates for the source pad.


GST_BASE_VIDEO_CODEC_SRC_PAD()

#define GST_BASE_VIDEO_CODEC_SRC_PAD(obj)         (((GstBaseVideoCodec *) (obj))->srcpad)

Gives the pointer to the source GstPad object of the element.

obj :

base video codec instance

GST_BASE_VIDEO_CODEC_SINK_PAD()

#define GST_BASE_VIDEO_CODEC_SINK_PAD(obj)        (((GstBaseVideoCodec *) (obj))->sinkpad)

Gives the pointer to the sink GstPad object of the element.

obj :

base video codec instance

GST_BASE_VIDEO_CODEC_FLOW_NEED_DATA

#define GST_BASE_VIDEO_CODEC_FLOW_NEED_DATA GST_FLOW_CUSTOM_SUCCESS

Returned while parsing to indicate more data is needed.


GST_BASE_VIDEO_CODEC_STREAM_LOCK()

#define GST_BASE_VIDEO_CODEC_STREAM_LOCK(codec) g_rec_mutex_lock (&GST_BASE_VIDEO_CODEC (codec)->stream_lock)

Obtain a lock to protect the codec function from concurrent access.

codec :

video codec instance

Since 0.10.22


GST_BASE_VIDEO_CODEC_STREAM_UNLOCK()

#define GST_BASE_VIDEO_CODEC_STREAM_UNLOCK(codec) g_rec_mutex_unlock (&GST_BASE_VIDEO_CODEC (codec)->stream_lock)

Release the lock that protects the codec function from concurrent access.

codec :

video codec instance

Since 0.10.22


struct GstVideoState

struct GstVideoState {
  GstCaps *caps;
  GstVideoFormat format;
  int width, height;
  int fps_n, fps_d;
  int par_n, par_d;

  gboolean have_interlaced;
  gboolean interlaced;
  gboolean top_field_first;

  int clean_width, clean_height;
  int clean_offset_left, clean_offset_top;

  int bytes_per_picture;

  GstBuffer *codec_data;
};

Information about compressed video stream. FIXME: Re-use GstVideoInfo for more fields.

GstCaps *caps;

GstVideoFormat format;

int width;

Width in pixels (including borders)

int height;

Height in pixels (including borders)

int fps_n;

Numerator of framerate

int fps_d;

Denominator of framerate

int par_n;

Numerator of Pixel Aspect Ratio

int par_d;

Denominator of Pixel Aspect Ratio

gboolean have_interlaced;

The content of the interlaced field is present and valid

gboolean interlaced;

TRUE if the stream is interlaced

gboolean top_field_first;

TRUE if the interlaced frame is top-field-first

int clean_width;

Useful width of video in pixels (i.e. without borders)

int clean_height;

Useful height of video in pixels (i.e. without borders)

int clean_offset_left;

Horizontal offset (from the left) of useful region in pixels

int clean_offset_top;

Vertical offset (from the top) of useful region in pixels

int bytes_per_picture;

Size in bytes of each picture

GstBuffer *codec_data;

Optional Codec Data for the stream

struct GstVideoFrameState

struct GstVideoFrameState {
  GstClockTime decode_timestamp;
  GstClockTime presentation_timestamp;
  GstClockTime presentation_duration;

  gint system_frame_number;
  gint decode_frame_number;
  gint presentation_frame_number;

  int distance_from_sync;
  gboolean is_sync_point;
  gboolean is_eos;

  /* Frames that should not be pushed downstream and are
   * not meant for display */
  gboolean decode_only;

  GstBuffer *sink_buffer;
  GstBuffer *src_buffer;

  int field_index;
  int n_fields;

  void *coder_hook;
  GDestroyNotify coder_hook_destroy_notify;

  GstClockTime deadline;

  gboolean force_keyframe;
  gboolean force_keyframe_headers;

  /* Events that should be pushed downstream *before*
   * the next src_buffer */
  GList *events;
};

State of a video frame going through the codec

GstClockTime decode_timestamp;

Decoding timestamp (aka DTS)

GstClockTime presentation_timestamp;

Presentation timestamp (aka PTS)

GstClockTime presentation_duration;

Duration of frame

gint system_frame_number;

unique ID attributed when GstVideoFrameState is created

gint decode_frame_number;

Decoded frame number, increases in decoding order

gint presentation_frame_number;

Presentation frame number, increases in presentation order.

int distance_from_sync;

Distance of the frame from a sync point, in number of frames.

gboolean is_sync_point;

TRUE if the frame is a synchronization point (like a keyframe)

gboolean is_eos;

TRUE if the frame is the last one of a segment.

gboolean decode_only;

If TRUE, the frame is only meant to be decoded but not pushed downstream

GstBuffer *sink_buffer;

input buffer

GstBuffer *src_buffer;

output buffer

int field_index;

Number of fields since beginning of stream

int n_fields;

Number of fields present in frame (default 2)

void *coder_hook;

Private data called with coder_hook_destroy_notify

GDestroyNotify coder_hook_destroy_notify;

Called when frame is destroyed

GstClockTime deadline;

Target clock time for display (running time)

gboolean force_keyframe;

For encoders, if TRUE a keyframe must be generated

gboolean force_keyframe_headers;

For encoders, if TRUE new headers must be generated

GList *events;

List of GstEvent that must be pushed before the next src_buffer

struct GstBaseVideoCodec

struct GstBaseVideoCodec {
};

The opaque GstBaseVideoCodec data structure.


struct GstBaseVideoCodecClass

struct GstBaseVideoCodecClass {
};

The opaque GstBaseVideoCodecClass data structure.


gst_base_video_codec_new_frame ()

GstVideoFrameState * gst_base_video_codec_new_frame     (GstBaseVideoCodec *base_video_codec);

Creates a new GstVideoFrameState for usage in decoders or encoders.

base_video_codec :

a GstBaseVideoCodec

Returns :

The new GstVideoFrameState, call #gst_video_frame_state_unref() when done with it. [transfer full]

gst_base_video_codec_append_frame ()

void                gst_base_video_codec_append_frame   (GstBaseVideoCodec *codec,
                                                         GstVideoFrameState *frame);

Appends a frame to the list of frames handled by the codec.

Note: This should normally not be used by implementations.

codec :

a GstBaseVideoCodec

frame :

the GstVideoFrameState to append

gst_base_video_codec_remove_frame ()

void                gst_base_video_codec_remove_frame   (GstBaseVideoCodec *codec,
                                                         GstVideoFrameState *frame);

gst_video_frame_state_get_type ()

GType               gst_video_frame_state_get_type      (void);

gst_video_frame_state_ref ()

GstVideoFrameState * gst_video_frame_state_ref          (GstVideoFrameState *frame);

Increases the refcount of the given frame by one.

frame :

a GstVideoFrameState

Returns :

buf

gst_video_frame_state_unref ()

void                gst_video_frame_state_unref         (GstVideoFrameState *frame);

Decreases the refcount of the frame. If the refcount reaches 0, the frame will be freed.

frame :

a GstVideoFrameState

See Also

GstBaseVideoDecoder , GstBaseVideoEncoder