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; gint64 estimated_duration;
guint min_frame_size; guint min_frame_size;
guint format; GstBaseParseFormatFlags format_flags;
guint fps_num, fps_den; guint fps_num, fps_den;
gint update_interval; gint update_interval;
guint bitrate; guint bitrate;
@ -309,9 +309,9 @@ typedef struct _GstBaseParseSeek
} GstBaseParseSeek; } GstBaseParseSeek;
#define GST_BASE_PARSE_PASSTHROUGH(parse) \ #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) \ #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; static GstElementClass *parent_class = NULL;
@ -596,7 +596,7 @@ gst_base_parse_reset (GstBaseParse * parse)
parse->priv->first_frame_offset = -1; parse->priv->first_frame_offset = -1;
parse->priv->estimated_duration = -1; parse->priv->estimated_duration = -1;
parse->priv->next_ts = 0; parse->priv->next_ts = 0;
parse->priv->format = 0; parse->priv->format_flags = 0;
parse->priv->post_min_bitrate = TRUE; parse->priv->post_min_bitrate = TRUE;
parse->priv->post_avg_bitrate = TRUE; parse->priv->post_avg_bitrate = TRUE;
parse->priv->post_max_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: * gst_base_parse_set_format_flags:
* @parse: the #GstBaseParseFormat to set or unset * @parse: #GstBaseParse
* @flags: format flag to enable or disable * @flags: the #GstBaseParseFormatFlags to set
* @on: whether or not to enable
* *
* 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 void
gst_base_parse_set_format (GstBaseParse * parse, GstBaseParseFormat flag, gst_base_parse_set_format_flags (GstBaseParse * parse,
gboolean on) GstBaseParseFormatFlags flags)
{ {
g_return_if_fail (parse != NULL); g_return_if_fail (parse != NULL);
GST_LOG_OBJECT (parse, "set flag %d to %d", flag, on); GST_LOG_OBJECT (parse, "setting flags 0x%02x", flags);
if (on) parse->priv->format_flags = flags;
parse->priv->format |= flag;
else
parse->priv->format &= ~flag;
} }
/** /**

View file

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