Commit 1874d638 authored by Tim-Philipp Müller's avatar Tim-Philipp Müller
Browse files

baseparse: make DRAIN and SYNC flags on baseparse, not the frame, and change...

baseparse: make DRAIN and SYNC flags on baseparse, not the frame, and change to DRAINING and LOST_SYNC

The first because it seems a better fit conceptually, the second
to express booleanness. Also change the accessor macros for subclasses
to GST_BASE_PARSE_DRAINING and GST_BASE_PARSE_LOST_SYNC.

https://bugzilla.gnome.org/show_bug.cgi?id=518857
parent 242e077e
......@@ -593,17 +593,16 @@ gst_base_parse_frame_update (GstBaseParse * parse, GstBaseParseFrame * frame,
GstBuffer * buf)
{
gst_buffer_replace (&frame->buffer, buf);
if (parse->priv->drain) {
frame->flags |= GST_BASE_PARSE_FRAME_FLAG_DRAIN;
} else {
frame->flags &= ~(GST_BASE_PARSE_FRAME_FLAG_DRAIN);
}
parse->flags = 0;
/* set flags one by one for clarity */
if (G_UNLIKELY (parse->priv->drain))
parse->flags |= GST_BASE_PARSE_FLAG_DRAINING;
/* losing sync is pretty much a discont (and vice versa), no ? */
if (!parse->priv->discont) {
frame->flags |= GST_BASE_PARSE_FRAME_FLAG_SYNC;
} else {
frame->flags &= ~(GST_BASE_PARSE_FRAME_FLAG_SYNC);
}
if (G_UNLIKELY (parse->priv->discont))
parse->flags |= GST_BASE_PARSE_FLAG_LOST_SYNC;
}
static void
......
......@@ -74,12 +74,34 @@ G_BEGIN_DECLS
*/
#define GST_BASE_PARSE_FLOW_QUEUED GST_FLOW_CUSTOM_SUCCESS_1
/* not public API, use accessor macros below */
#define GST_BASE_PARSE_FLAG_LOST_SYNC (1 << 0)
#define GST_BASE_PARSE_FLAG_DRAINING (1 << 1)
/**
* GST_BASE_PARSE_LOST_SYNC:
* @parse: base parse instance
*
* Obtains current sync status.
*
* Since: 0.10.33
*/
#define GST_BASE_PARSE_LOST_SYNC(parse) (!!(GST_BASE_PARSE_CAST(parse)->flags & GST_BASE_PARSE_FLAG_LOST_SYNC))
/**
* GST_BASE_PARSE_DRAINING:
* @parse: base parse instance
*
* Obtains current drain status (ie. whether EOS has been received and
* the parser is now processing the frames at the end of the stream)
*
* Since: 0.10.33
*/
#define GST_BASE_PARSE_DRAINING(parse) (!!(GST_BASE_PARSE_CAST(parse)->flags & GST_BASE_PARSE_FLAG_DRAINING))
/**
* GstBaseParseFrameFlags:
* @GST_BASE_PARSE_FRAME_FLAG_NONE: no flag
* @GST_BASE_PARSE_FRAME_FLAG_SYNC: indicates if parsing is 'in sync'
* @GST_BASE_PARSE_FRAME_FLAG_DRAIN: indicates if parser is 'draining'.
* That is, leftover data (e.g. in FLUSH or EOS situation) is being parsed.
* @GST_BASE_PARSE_FRAME_FLAG_NO_FRAME: set to indicate this buffer should not be
* counted as frame, e.g. if this frame is dependent on a previous one.
* As it is not counted as a frame, bitrate increases but frame to time
......@@ -94,10 +116,8 @@ G_BEGIN_DECLS
*/
typedef enum {
GST_BASE_PARSE_FRAME_FLAG_NONE = 0,
GST_BASE_PARSE_FRAME_FLAG_SYNC = (1 << 0),
GST_BASE_PARSE_FRAME_FLAG_DRAIN = (1 << 1),
GST_BASE_PARSE_FRAME_FLAG_NO_FRAME = (1 << 2),
GST_BASE_PARSE_FRAME_FLAG_CLIP = (1 << 3)
GST_BASE_PARSE_FRAME_FLAG_NO_FRAME = (1 << 0),
GST_BASE_PARSE_FRAME_FLAG_CLIP = (1 << 1)
} GstBaseParseFrameFlags;
/**
......@@ -131,26 +151,6 @@ typedef struct {
gpointer _gst_reserved_p[2];
} GstBaseParseFrame;
/**
* GST_BASE_PARSE_FRAME_SYNC:
* @frame: base parse frame instance
*
* Obtains current sync status indicated in frame.
*
* Since: 0.10.33
*/
#define GST_BASE_PARSE_FRAME_SYNC(frame) (!!(frame->flags & GST_BASE_PARSE_FRAME_FLAG_SYNC))
/**
* GST_BASE_PARSE_FRAME_DRAIN:
* @frame: base parse frame instance
*
* Obtains current drain status indicated in frame.
*
* Since: 0.10.33
*/
#define GST_BASE_PARSE_FRAME_DRAIN(frame) (!!(frame->flags & GST_BASE_PARSE_FRAME_FLAG_DRAIN))
/**
* GstBaseParseFormatFlags:
* @GST_BASE_PARSE_FORMAT_FLAG_NONE: no flags active
......@@ -195,6 +195,8 @@ struct _GstBaseParse {
GstPad *sinkpad;
GstPad *srcpad;
guint flags;
/* MT-protected (with STREAM_LOCK) */
GstSegment segment;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment