From de16d5adb33566dfa81fa0824d893fc81ee84b7b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim-Philipp=20M=C3=BCller?= Date: Thu, 24 Mar 2011 17:30:53 +0000 Subject: [PATCH] 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. --- libs/gst/base/gstbaseparse.c | 29 +++++++++++++---------------- libs/gst/base/gstbaseparse.h | 29 ++++++++++++++--------------- 2 files changed, 27 insertions(+), 31 deletions(-) diff --git a/libs/gst/base/gstbaseparse.c b/libs/gst/base/gstbaseparse.c index 86dfb72..f412e84 100644 --- a/libs/gst/base/gstbaseparse.c +++ b/libs/gst/base/gstbaseparse.c @@ -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; } /** diff --git a/libs/gst/base/gstbaseparse.h b/libs/gst/base/gstbaseparse.h index aec09c3..0c4be0d 100644 --- a/libs/gst/base/gstbaseparse.h +++ b/libs/gst/base/gstbaseparse.h @@ -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, -- 2.7.4