Blame gst/rawparse/gstrawaudioparse.h

Packit 971217
/* GStreamer
Packit 971217
 * Copyright (C) <2016> Carlos Rafael Giani <dv at pseudoterminal dot org>
Packit 971217
 *
Packit 971217
 * This library is free software; you can redistribute it and/or
Packit 971217
 * modify it under the terms of the GNU Library General Public
Packit 971217
 * License as published by the Free Software Foundation; either
Packit 971217
 * version 2 of the License, or (at your option) any later version.
Packit 971217
 *
Packit 971217
 * This library is distributed in the hope that it will be useful,
Packit 971217
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 971217
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 971217
 * Library General Public License for more details.
Packit 971217
 *
Packit 971217
 * You should have received a copy of the GNU Library General Public
Packit 971217
 * License along with this library; if not, write to the
Packit 971217
 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
Packit 971217
 * Boston, MA 02110-1301, USA.
Packit 971217
 */
Packit 971217
Packit 971217
#ifndef __GST_RAW_AUDIO_PARSE_H__
Packit 971217
#define __GST_RAW_AUDIO_PARSE_H__
Packit 971217
Packit 971217
#include <gst/gst.h>
Packit 971217
#include <gst/audio/audio.h>
Packit 971217
#include "gstrawbaseparse.h"
Packit 971217
Packit 971217
G_BEGIN_DECLS
Packit 971217
Packit 971217
#define GST_TYPE_RAW_AUDIO_PARSE \
Packit 971217
  (gst_raw_audio_parse_get_type())
Packit 971217
#define GST_RAW_AUDIO_PARSE(obj) \
Packit 971217
  (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_RAW_AUDIO_PARSE, GstRawAudioParse))
Packit 971217
#define GST_RAW_AUDIO_PARSE_CAST(obj) \
Packit 971217
  ((GstRawAudioParse *)(obj))
Packit 971217
#define GST_RAW_AUDIO_PARSE_CLASS(klass) \
Packit 971217
  (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_RAW_AUDIO_PARSE, GstRawAudioParseClass))
Packit 971217
#define GST_IS_RAW_AUDIO_PARSE(obj) \
Packit 971217
  (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_RAW_AUDIO_PARSE))
Packit 971217
#define GST_IS_RAW_AUDIO_PARSE_CLASS(klass) \
Packit 971217
  (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_RAW_AUDIO_PARSE))
Packit 971217
Packit 971217
typedef enum _GstRawAudioParseFormat GstRawAudioParseFormat;
Packit 971217
Packit 971217
typedef struct _GstRawAudioParseConfig GstRawAudioParseConfig;
Packit 971217
typedef struct _GstRawAudioParse GstRawAudioParse;
Packit 971217
typedef struct _GstRawAudioParseClass GstRawAudioParseClass;
Packit 971217
Packit 971217
enum _GstRawAudioParseFormat
Packit 971217
{
Packit 971217
  GST_RAW_AUDIO_PARSE_FORMAT_PCM,
Packit 971217
  GST_RAW_AUDIO_PARSE_FORMAT_MULAW,
Packit 971217
  GST_RAW_AUDIO_PARSE_FORMAT_ALAW
Packit 971217
};
Packit 971217
Packit 971217
/* Contains information about the sample rate, format, and channel count to use. */
Packit 971217
struct _GstRawAudioParseConfig
Packit 971217
{
Packit 971217
  /* If TRUE, then this configuration is ready to use */
Packit 971217
  gboolean ready;
Packit 971217
  /* Format of the configuration. Can be PCM, a-law, mu-law. */
Packit 971217
  GstRawAudioParseFormat format;
Packit 971217
  /* If format is set to PCM, this specifies the exact PCM format in use.
Packit 971217
   * Meaningless if format is set to anything other than PCM. */
Packit 971217
  GstAudioFormat pcm_format;
Packit 971217
  /* Bytes per frame. Calculated as: bpf = bytes_per_sample * num_channels
Packit 971217
   * Must be nonzero. This is the size of one frame, the value returned
Packit 971217
   * by the GstRawBaseParseClass get_config_frame_size() vfunc. */
Packit 971217
  guint bpf;
Packit 971217
  /* Sample rate in Hz - must be nonzero */
Packit 971217
  guint sample_rate;
Packit 971217
  /* Number of channels - must be nonzero */
Packit 971217
  guint num_channels;
Packit 971217
  /* TRUE if the data is interleaved, FALSE otherwise */
Packit 971217
  gboolean interleaved;
Packit 971217
Packit 971217
  /* Array of channel positions, one position per channel; its first
Packit 971217
   * num_channels values are valid. They are computed out of the number
Packit 971217
   * of channels if no positions are explicitely given. */
Packit 971217
  GstAudioChannelPosition channel_positions[64];
Packit 971217
Packit 971217
  /* If the channel_positions are in a valid GStreamer channel order, then
Packit 971217
   * this is not used, and needs_channel_reordering is FALSE. Otherwise,
Packit 971217
   * this contains the same positions as in channel_positions, but in the
Packit 971217
   * order GStreamer expects. needs_channel_reordering will be TRUE in that
Packit 971217
   * case. This is used for reordering samples in outgoing buffers if
Packit 971217
   * necessary. */
Packit 971217
  GstAudioChannelPosition reordered_channel_positions[64];
Packit 971217
Packit 971217
  /* TRUE if channel reordering is necessary, FALSE otherwise. See above
Packit 971217
   * for details. */
Packit 971217
  gboolean needs_channel_reordering;
Packit 971217
};
Packit 971217
Packit 971217
struct _GstRawAudioParse
Packit 971217
{
Packit 971217
  GstRawBaseParse parent;
Packit 971217
Packit 971217
  /*< private > */
Packit 971217
Packit 971217
  /* Configuration controlled by the object properties. Its ready value
Packit 971217
   * is set to TRUE from the start, so it can be used right away.
Packit 971217
   */
Packit 971217
  GstRawAudioParseConfig properties_config;
Packit 971217
  /* Configuration controlled by the sink caps. Its ready value is
Packit 971217
   * initially set to FALSE until valid sink caps come in. It is set to
Packit 971217
   * FALSE again when the stream-start event is observed.
Packit 971217
   */
Packit 971217
  GstRawAudioParseConfig sink_caps_config;
Packit 971217
  /* Currently active configuration. Points either to properties_config
Packit 971217
   * or to sink_caps_config. This is never NULL. */
Packit 971217
  GstRawAudioParseConfig *current_config;
Packit 971217
};
Packit 971217
Packit 971217
struct _GstRawAudioParseClass
Packit 971217
{
Packit 971217
  GstRawBaseParseClass parent_class;
Packit 971217
};
Packit 971217
Packit 971217
GType gst_raw_audio_parse_get_type (void);
Packit 971217
GType gst_raw_audio_parse_format_get_type (void);
Packit 971217
Packit 971217
G_END_DECLS
Packit 971217
Packit 971217
#endif