baseparse: rename GstBaseFormat to GstBaseFormatFlags and fix up associated API

Also change gst_base_parse_set_format(parse,flags,switch_on) to
gst_base_parse_set_format_flags(parse,flags) which is more in line
with the rest of our API and how the function is used.
This commit is contained in:
Tim-Philipp Müller 2011-03-24 17:30:53 +00:00
parent f691be223e
commit de16d5adb3
2 changed files with 27 additions and 31 deletions

View file

@ -227,7 +227,7 @@ struct _GstBaseParsePrivate
gint64 estimated_duration;
guint min_frame_size;
guint format;
GstBaseParseFormatFlags format_flags;
guint fps_num, fps_den;
gint update_interval;
guint bitrate;
@ -309,9 +309,9 @@ typedef struct _GstBaseParseSeek
} GstBaseParseSeek;
#define GST_BASE_PARSE_PASSTHROUGH(parse) \
(parse->priv->format & GST_BASE_PARSE_FORMAT_PASSTHROUGH)
(parse->priv->format_flags & GST_BASE_PARSE_FORMAT_FLAG_PASSTHROUGH)
#define GST_BASE_PARSE_HAS_TIME(parse) \
(parse->priv->format & GST_BASE_PARSE_FORMAT_HAS_TIME)
(parse->priv->format_flags & GST_BASE_PARSE_FORMAT_FLAG_HAS_TIME)
static GstElementClass *parent_class = NULL;
@ -596,7 +596,7 @@ gst_base_parse_reset (GstBaseParse * parse)
parse->priv->first_frame_offset = -1;
parse->priv->estimated_duration = -1;
parse->priv->next_ts = 0;
parse->priv->format = 0;
parse->priv->format_flags = 0;
parse->priv->post_min_bitrate = TRUE;
parse->priv->post_avg_bitrate = TRUE;
parse->priv->post_max_bitrate = TRUE;
@ -2817,24 +2817,21 @@ gst_base_parse_set_min_frame_size (GstBaseParse * parse, guint min_size)
}
/**
* gst_base_parse_set_format:
* @parse: the #GstBaseParseFormat to set or unset
* @flags: format flag to enable or disable
* @on: whether or not to enable
* gst_base_parse_set_format_flags:
* @parse: #GstBaseParse
* @flags: the #GstBaseParseFormatFlags to set
*
* Set flags describing characteristics of parsed format.
* Set flags describing characteristics of parsed format. This overrides
* any previous flags set (ie. it's not a bitwise OR operation).
*/
void
gst_base_parse_set_format (GstBaseParse * parse, GstBaseParseFormat flag,
gboolean on)
gst_base_parse_set_format_flags (GstBaseParse * parse,
GstBaseParseFormatFlags flags)
{
g_return_if_fail (parse != NULL);
GST_LOG_OBJECT (parse, "set flag %d to %d", flag, on);
if (on)
parse->priv->format |= flag;
else
parse->priv->format &= ~flag;
GST_LOG_OBJECT (parse, "setting flags 0x%02x", flags);
parse->priv->format_flags = flags;
}
/**

View file

@ -140,26 +140,26 @@ typedef struct {
#define GST_BASE_PARSE_FRAME_DRAIN(frame) (!!(frame->flags & GST_BASE_PARSE_FRAME_FLAG_DRAIN))
/**
* GstBaseParseFormat:
* @GST_BASE_PARSE_FORMAT_NONE: default setting
* @GST_BASE_PARSE_FORMAT_PASSTHROUGH: nature of format or configuration
* GstBaseParseFormatFlags:
* @GST_BASE_PARSE_FORMAT_FLAG_NONE: default setting
* @GST_BASE_PARSE_FORMAT_FLAG_PASSTHROUGH: nature of format or configuration
* does not allow (much) parsing, so parser should operate in passthrough mode
* (which only applies operating in pull mode). That is, incoming buffers
* are pushed through unmodified, i.e. no @check_valid_frame or @parse_frame
* callbacks will be invoked. On the other hand, @pre_push_buffer is still invoked,
* where subclass can perform as much or as little is appropriate for
* callbacks will be invoked. On the other hand, @pre_push_buffer is still
* invoked, where subclass can perform as much or as little is appropriate for
* "passthrough" semantics.
* @GST_BASE_PARSE_FORMAT_HAS_TIME: frames carry timing info which subclass
* @GST_BASE_PARSE_FORMAT_FLAG_HAS_TIME: frames carry timing info which subclass
* can (generally) parse and provide. In particular, intrinsic time
* (rather than estimated) can be obtained following seek.
* (rather than estimated) can be obtained following a seek.
*
* Since: 0.10.x
*/
typedef enum _GstBaseParseFormat {
GST_BASE_PARSE_FORMAT_NONE = 0,
GST_BASE_PARSE_FORMAT_PASSTHROUGH = (1 << 0),
GST_BASE_PARSE_FORMAT_HAS_TIME = (1 << 1),
} GstBaseParseFormat;
typedef enum {
GST_BASE_PARSE_FORMAT_FLAG_NONE = 0,
GST_BASE_PARSE_FORMAT_FLAG_PASSTHROUGH = (1 << 0),
GST_BASE_PARSE_FORMAT_FLAG_HAS_TIME = (1 << 1),
} GstBaseParseFormatFlags;
/**
* GstBaseParseSeekable:
@ -298,9 +298,8 @@ void gst_base_parse_set_seek (GstBaseParse * parse,
void gst_base_parse_set_min_frame_size (GstBaseParse * parse,
guint min_size);
void gst_base_parse_set_format (GstBaseParse * parse,
GstBaseParseFormat flag,
gboolean on);
void gst_base_parse_set_format_flags (GstBaseParse * parse,
GstBaseParseFormatFlags flag);
void gst_base_parse_set_frame_props (GstBaseParse * parse,
guint fps_num,