<commit_before>/* GStreamer
 * Copyright (C) 2008 Nokia Corporation. All rights reserved.
 *
 * Contact: <NAME> <<EMAIL>>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 */

#ifndef __GST_BASE_PARSE_H__
#define __GST_BASE_PARSE_H__

#include <gst/gst.h>

G_BEGIN_DECLS

#define GST_TYPE_BASE_PARSE            (gst_base_parse_get_type())
#define GST_BASE_PARSE(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_BASE_PARSE,GstBaseParse))
#define GST_BASE_PARSE_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_BASE_PARSE,GstBaseParseClass))
#define GST_BASE_PARSE_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj),GST_TYPE_BASE_PARSE,GstBaseParseClass))
#define GST_IS_BASE_PARSE(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_BASE_PARSE))
#define GST_IS_BASE_PARSE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_BASE_PARSE))
#define GST_BASE_PARSE_CAST(obj)       ((GstBaseParse *)(obj))

/**
 * GST_BASE_PARSE_SRC_PAD:
 * @obj: base parse instance
 *
 * Gives the pointer to the source #GstPad object of the element.
 *
 * Since: 0.10.33
 */
#define GST_BASE_PARSE_SRC_PAD(obj)    (GST_BASE_PARSE_CAST (obj)->srcpad)

/**
 * GST_BASE_PARSE_SINK_PAD:
 * @obj: base parse instance
 *
 * Gives the pointer to the sink #GstPad object of the element.
 *
 * Since: 0.10.33
 */
#define GST_BASE_PARSE_SINK_PAD(obj)    (GST_BASE_PARSE_CAST (obj)->sinkpad)

/**
 * GST_BASE_PARSE_FLOW_DROPPED:
 *
 * A #GstFlowReturn that can be returned from parse_frame to
 * indicate that no output buffer was generated, or from pre_push_buffer to
 * to forego pushing buffer.
 *
 * Since: 0.10.33
 */
#define GST_BASE_PARSE_FLOW_DROPPED     GST_FLOW_CUSTOM_SUCCESS

/**
 * GST_BASE_PARSE_FLOW_QUEUED:
 * A #GstFlowReturn that can be returned from parse frame to indicate that
 * the buffer will be queued to be pushed when the next OK
 *
 * Since: 0.10.33
 */
#define GST_BASE_PARSE_FLOW_QUEUED      GST_FLOW_CUSTOM_SUCCESS_1

/**
 * 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
 *   conversions are maintained.
 * @GST_BASE_PARSE_FRAME_FLAG_CLIP: @pre_push_buffer can set this to indicate
 *    that regular segment clipping can still be performed (as opposed to
 *    any custom one having been done).
 *
 * Flags to be used in a #GstBaseParseFrame.
 *
 * Since: 0.10.33
 */
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)
} GstBaseParseFrameFlags;

/**
 * GstBaseParseFrame:
 * @buffer: data to check for valid frame or parsed frame.
 *   Subclass is allowed to replace this buffer.
 * @overhead: subclass can set this to indicates the metadata overhead
 *   for the given frame, which is then used to enable more accurate bitrate
 *   computations. If this is -1, it is assumed that this frame should be
 *   skipped in bitrate calculation.
 * @flags: a combination of input and output #GstBaseParseFrameFlags that
 *  convey additional context to subclass or allow subclass to tune
 *  subsequent #GstBaseParse actions.
 *
 * Frame (context) data passed to each frame parsing virtual methods.  In
 * addition to providing the data to be checked for a valid frame or an already
 * identified frame, it conveys additional metadata or control information
 * from and to the subclass w.r.t. the particular frame in question (rather
 * than global parameters).  Some of these may apply to each parsing stage, others
 * only to some a particular one.  These parameters are effectively zeroed at start
 * of each frame's processing, i.e. parsing virtual method invocation sequence.
 *
 * Since: 0.10.33
 */
typedef struct {
  GstBuffer * buffer;
  guint       flags;
  gint        overhead;
} 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
 * @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
 *   "passthrough" semantics.
 * @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 a seek.
 * @GST_BASE_PARSE_FORMAT_FLAG_SYNCABLE: frame starts can be identified. This
 *   set by default, and determines whether seeking based on bitrate averages
 *   is possible for a format/stream.
 *
 * Since: 0.10.33
 */
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),<commit_msg>baseparse: fix typo in docs for GST_BASE_PARSE_FORMAT_FLAG_PASSTHROUGH<commit_after>/* GStreamer
 * Copyright (C) 2008 Nokia Corporation. All rights reserved.
 *
 * Contact: <NAME> <<EMAIL>>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 */

#ifndef __GST_BASE_PARSE_H__
#define __GST_BASE_PARSE_H__

#include <gst/gst.h>

G_BEGIN_DECLS

#define GST_TYPE_BASE_PARSE            (gst_base_parse_get_type())
#define GST_BASE_PARSE(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_BASE_PARSE,GstBaseParse))
#define GST_BASE_PARSE_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_BASE_PARSE,GstBaseParseClass))
#define GST_BASE_PARSE_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj),GST_TYPE_BASE_PARSE,GstBaseParseClass))
#define GST_IS_BASE_PARSE(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_BASE_PARSE))
#define GST_IS_BASE_PARSE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_BASE_PARSE))
#define GST_BASE_PARSE_CAST(obj)       ((GstBaseParse *)(obj))

/**
 * GST_BASE_PARSE_SRC_PAD:
 * @obj: base parse instance
 *
 * Gives the pointer to the source #GstPad object of the element.
 *
 * Since: 0.10.33
 */
#define GST_BASE_PARSE_SRC_PAD(obj)    (GST_BASE_PARSE_CAST (obj)->srcpad)

/**
 * GST_BASE_PARSE_SINK_PAD:
 * @obj: base parse instance
 *
 * Gives the pointer to the sink #GstPad object of the element.
 *
 * Since: 0.10.33
 */
#define GST_BASE_PARSE_SINK_PAD(obj)    (GST_BASE_PARSE_CAST (obj)->sinkpad)

/**
 * GST_BASE_PARSE_FLOW_DROPPED:
 *
 * A #GstFlowReturn that can be returned from parse_frame to
 * indicate that no output buffer was generated, or from pre_push_buffer to
 * to forego pushing buffer.
 *
 * Since: 0.10.33
 */
#define GST_BASE_PARSE_FLOW_DROPPED     GST_FLOW_CUSTOM_SUCCESS

/**
 * GST_BASE_PARSE_FLOW_QUEUED:
 * A #GstFlowReturn that can be returned from parse frame to indicate that
 * the buffer will be queued to be pushed when the next OK
 *
 * Since: 0.10.33
 */
#define GST_BASE_PARSE_FLOW_QUEUED      GST_FLOW_CUSTOM_SUCCESS_1

/**
 * 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
 *   conversions are maintained.
 * @GST_BASE_PARSE_FRAME_FLAG_CLIP: @pre_push_buffer can set this to indicate
 *    that regular segment clipping can still be performed (as opposed to
 *    any custom one having been done).
 *
 * Flags to be used in a #GstBaseParseFrame.
 *
 * Since: 0.10.33
 */
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)
} GstBaseParseFrameFlags;

/**
 * GstBaseParseFrame:
 * @buffer: data to check for valid frame or parsed frame.
 *   Subclass is allowed to replace this buffer.
 * @overhead: subclass can set this to indicates the metadata overhead
 *   for the given frame, which is then used to enable more accurate bitrate
 *   computations. If this is -1, it is assumed that this frame should be
 *   skipped in bitrate calculation.
 * @flags: a combination of input and output #GstBaseParseFrameFlags that
 *  convey additional context to subclass or allow subclass to tune
 *  subsequent #GstBaseParse actions.
 *
 * Frame (context) data passed to each frame parsing virtual methods.  In
 * addition to providing the data to be checked for a valid frame or an already
 * identified frame, it conveys additional metadata or control information
 * from and to the subclass w.r.t. the particular frame in question (rather
 * than global parameters).  Some of these may apply to each parsing stage, others
 * only to some a particular one.  These parameters are effectively zeroed at start
 * of each frame's processing, i.e. parsing virtual method invocation sequence.
 *
 * Since: 0.10.33
 */
typedef struct {
  GstBuffer * buffer;
  guint       flags;
  gint        overhead;
} 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
 * @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 push 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
 *   "passthrough" semantics.
 * @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 a seek.
 * @GST_BASE_PARSE_FORMAT_FLAG_SYNCABLE: frame starts can be identified. This
 *   set by default, and determines whether seeking based on bitrate averages
 *   is possible for a format/stream.
 *
 * Since: 0.10.33
 */
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),
{'fraction_non_alphanumeric': 0.07677529003177418, 'fraction_numerical': 0.011822951304219316, 'mean_word_length': 4.159740754860846, 'pattern_counts': {'":': 0, '<': 35, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5143801', 'n_tokens_mistral': 4571, 'n_tokens_neox': 4376, 'n_words': 1449}