audio: fix headers

Add const to some methods.
Add padding.
Add GType for GstAudioInfo and GstAudioFormatInfo.
Add new/copy/free for GstAudioInfo.
This commit is contained in:
Wim Taymans 2011-11-11 17:53:03 +01:00
parent b12aabc9da
commit b645287775
7 changed files with 85 additions and 20 deletions

View file

@ -129,6 +129,8 @@ static GstAudioFormatInfo formats[] = {
SILENT_0) SILENT_0)
}; };
G_DEFINE_POINTER_TYPE (GstAudioFormatInfo, gst_audio_format_info);
/** /**
* gst_audio_format_build_integer: * gst_audio_format_build_integer:
* @sign: signed or unsigned format * @sign: signed or unsigned format
@ -262,6 +264,54 @@ gst_audio_format_fill_silence (const GstAudioFormatInfo * info,
} }
} }
/**
* gst_audio_info_copy:
* @info: a #GstAudioInfo
*
* Copy a GstAudioInfo structure.
*
* Returns: a new #GstAudioInfo. free with gst_audio_info_free.
*/
GstAudioInfo *
gst_audio_info_copy (const GstAudioInfo * info)
{
return g_slice_dup (GstAudioInfo, info);
}
/**
* gst_audio_info_free:
* @info: a #GstAudioInfo
*
* Free a GstAudioInfo structure previously allocated with gst_audio_info_new()
* or gst_audio_info_copy().
*/
void
gst_audio_info_free (GstAudioInfo * info)
{
g_slice_free (GstAudioInfo, info);
}
G_DEFINE_BOXED_TYPE (GstAudioInfo, gst_audio_info,
(GBoxedCopyFunc) gst_audio_info_copy, (GBoxedFreeFunc) gst_audio_info_free);
/**
* gst_audio_info_new:
*
* Allocate a new #GstAudioInfo that is also initialized with
* gst_audio_info_init().
*
* Returns: a new #GstAudioInfo. free with gst_audio_info_free().
*/
GstAudioInfo *
gst_audio_info_new (void)
{
GstAudioInfo *info;
info = g_slice_new (GstAudioInfo);
gst_audio_info_init (info);
return info;
}
/** /**
* gst_audio_info_init: * gst_audio_info_init:
@ -426,7 +476,7 @@ incoherent_channels:
* info of @info. * info of @info.
*/ */
GstCaps * GstCaps *
gst_audio_info_to_caps (GstAudioInfo * info) gst_audio_info_to_caps (const GstAudioInfo * info)
{ {
GstCaps *caps; GstCaps *caps;
const gchar *format; const gchar *format;
@ -485,7 +535,7 @@ gst_audio_info_to_caps (GstAudioInfo * info)
* Returns: TRUE if the conversion was successful. * Returns: TRUE if the conversion was successful.
*/ */
gboolean gboolean
gst_audio_info_convert (GstAudioInfo * info, gst_audio_info_convert (const GstAudioInfo * info,
GstFormat src_fmt, gint64 src_val, GstFormat dest_fmt, gint64 * dest_val) GstFormat src_fmt, gint64 src_val, GstFormat dest_fmt, gint64 * dest_val)
{ {
gboolean res = TRUE; gboolean res = TRUE;

View file

@ -141,7 +141,7 @@ typedef enum {
GST_AUDIO_FORMAT_F64 = _GST_AUDIO_FORMAT_NE(F64) GST_AUDIO_FORMAT_F64 = _GST_AUDIO_FORMAT_NE(F64)
} GstAudioFormat; } GstAudioFormat;
/* FIXME: need GTypes */
typedef struct _GstAudioFormatInfo GstAudioFormatInfo; typedef struct _GstAudioFormatInfo GstAudioFormatInfo;
typedef struct _GstAudioInfo GstAudioInfo; typedef struct _GstAudioInfo GstAudioInfo;
@ -174,7 +174,7 @@ typedef enum
* interleaved. @dest should at least be big enough to hold @length * * interleaved. @dest should at least be big enough to hold @length *
* channels * size(unpack_format) bytes. * channels * size(unpack_format) bytes.
*/ */
typedef void (*GstAudioFormatUnpack) (GstAudioFormatInfo *info, gpointer dest, typedef void (*GstAudioFormatUnpack) (const GstAudioFormatInfo *info, gpointer dest,
const gpointer data, gint length); const gpointer data, gint length);
/** /**
* GstAudioFormatPack: * GstAudioFormatPack:
@ -187,7 +187,7 @@ typedef void (*GstAudioFormatUnpack) (GstAudioFormatInfo *info, gpointer
* The samples from source have each channel interleaved * The samples from source have each channel interleaved
* and will be packed into @data. * and will be packed into @data.
*/ */
typedef void (*GstAudioFormatPack) (GstAudioFormatInfo *info, const gpointer src, typedef void (*GstAudioFormatPack) (const GstAudioFormatInfo *info, const gpointer src,
gpointer data, gint length); gpointer data, gint length);
/** /**
@ -219,8 +219,12 @@ struct _GstAudioFormatInfo {
GstAudioFormat unpack_format; GstAudioFormat unpack_format;
GstAudioFormatUnpack unpack_func; GstAudioFormatUnpack unpack_func;
GstAudioFormatPack pack_func; GstAudioFormatPack pack_func;
gpointer _gst_reserved[GST_PADDING];
}; };
GType gst_audio_format_info_get_type (void);
#define GST_AUDIO_FORMAT_INFO_FORMAT(info) ((info)->format) #define GST_AUDIO_FORMAT_INFO_FORMAT(info) ((info)->format)
#define GST_AUDIO_FORMAT_INFO_NAME(info) ((info)->name) #define GST_AUDIO_FORMAT_INFO_NAME(info) ((info)->name)
#define GST_AUDIO_FORMAT_INFO_FLAGS(info) ((info)->flags) #define GST_AUDIO_FORMAT_INFO_FLAGS(info) ((info)->flags)
@ -282,8 +286,12 @@ struct _GstAudioInfo {
gint channels; gint channels;
gint bpf; gint bpf;
GstAudioChannelPosition position[64]; GstAudioChannelPosition position[64];
gpointer _gst_reserved[GST_PADDING];
}; };
GType gst_audio_info_get_type (void);
#define GST_AUDIO_INFO_FORMAT(i) (GST_AUDIO_FORMAT_INFO_FORMAT((i)->finfo)) #define GST_AUDIO_INFO_FORMAT(i) (GST_AUDIO_FORMAT_INFO_FORMAT((i)->finfo))
#define GST_AUDIO_INFO_NAME(i) (GST_AUDIO_FORMAT_INFO_NAME((i)->finfo)) #define GST_AUDIO_INFO_NAME(i) (GST_AUDIO_FORMAT_INFO_NAME((i)->finfo))
#define GST_AUDIO_INFO_WIDTH(i) (GST_AUDIO_FORMAT_INFO_WIDTH((i)->finfo)) #define GST_AUDIO_INFO_WIDTH(i) (GST_AUDIO_FORMAT_INFO_WIDTH((i)->finfo))
@ -306,16 +314,20 @@ struct _GstAudioInfo {
#define GST_AUDIO_INFO_BPF(info) ((info)->bpf) #define GST_AUDIO_INFO_BPF(info) ((info)->bpf)
#define GST_AUDIO_INFO_POSITION(info,c) ((info)->position[c]) #define GST_AUDIO_INFO_POSITION(info,c) ((info)->position[c])
void gst_audio_info_init (GstAudioInfo *info); GstAudioInfo * gst_audio_info_new (void);
void gst_audio_info_set_format (GstAudioInfo *info, GstAudioFormat format, void gst_audio_info_init (GstAudioInfo *info);
gint rate, gint channels); GstAudioInfo * gst_audio_info_copy (const GstAudioInfo *info);
void gst_audio_info_free (GstAudioInfo *info);
gboolean gst_audio_info_from_caps (GstAudioInfo *info, const GstCaps *caps); void gst_audio_info_set_format (GstAudioInfo *info, GstAudioFormat format,
GstCaps * gst_audio_info_to_caps (GstAudioInfo *info); gint rate, gint channels);
gboolean gst_audio_info_convert (GstAudioInfo * info, gboolean gst_audio_info_from_caps (GstAudioInfo *info, const GstCaps *caps);
GstFormat src_fmt, gint64 src_val, GstCaps * gst_audio_info_to_caps (const GstAudioInfo *info);
GstFormat dest_fmt, gint64 * dest_val);
gboolean gst_audio_info_convert (const GstAudioInfo * info,
GstFormat src_fmt, gint64 src_val,
GstFormat dest_fmt, gint64 * dest_val);

View file

@ -61,12 +61,12 @@ typedef struct _GstAudioBaseSrcPrivate GstAudioBaseSrcPrivate;
/** /**
* GstAudioBaseSrcSlaveMethod: * GstAudioBaseSrcSlaveMethod:
* @GST_AUDIO_BASE_SRC_SLAVE_RESAMPLE: Resample to match the master clock. * @GST_AUDIO_BASE_SRC_SLAVE_RESAMPLE: Resample to match the master clock.
* @GST_AUDIO_BASE_SRC_SLAVE_RETIMESTAMP: Retimestamp output buffers with master * @GST_AUDIO_BASE_SRC_SLAVE_RETIMESTAMP: Retimestamp output buffers with master
* clock time. * clock time.
* @GST_AUDIO_BASE_SRC_SLAVE_SKEW: Adjust capture pointer when master clock * @GST_AUDIO_BASE_SRC_SLAVE_SKEW: Adjust capture pointer when master clock
* drifts too much. * drifts too much.
* @GST_AUDIO_BASE_SRC_SLAVE_NONE: No adjustment is done. * @GST_AUDIO_BASE_SRC_SLAVE_NONE: No adjustment is done.
* *
* Different possible clock slaving algorithms when the internal audio clock was * Different possible clock slaving algorithms when the internal audio clock was
* not selected as the pipeline clock. * not selected as the pipeline clock.
@ -106,7 +106,7 @@ struct _GstAudioBaseSrc {
/*< private >*/ /*< private >*/
GstAudioBaseSrcPrivate *priv; GstAudioBaseSrcPrivate *priv;
gpointer _gst_reserved[GST_PADDING - 1]; gpointer _gst_reserved[GST_PADDING];
}; };
/** /**

View file

@ -158,6 +158,7 @@ struct _GstAudioDecoder
/*< private >*/ /*< private >*/
GstAudioDecoderPrivate *priv; GstAudioDecoderPrivate *priv;
gpointer _gst_reserved[GST_PADDING_LARGE]; gpointer _gst_reserved[GST_PADDING_LARGE];
}; };

View file

@ -120,6 +120,7 @@ struct _GstAudioEncoder {
/*< private >*/ /*< private >*/
GstAudioEncoderPrivate *priv; GstAudioEncoderPrivate *priv;
gpointer _gst_reserved[GST_PADDING_LARGE]; gpointer _gst_reserved[GST_PADDING_LARGE];
}; };

View file

@ -24,8 +24,9 @@
#include <gst/audio/gstaudioringbuffer.h> #include <gst/audio/gstaudioringbuffer.h>
guint gst_audio_iec61937_frame_size (const GstAudioRingBufferSpec * spec); guint gst_audio_iec61937_frame_size (const GstAudioRingBufferSpec * spec);
gboolean gst_audio_iec61937_payload (const guint8 * src, guint src_n, gboolean gst_audio_iec61937_payload (const guint8 * src, guint src_n,
guint8 * dst, guint dst_n, const GstAudioRingBufferSpec * spec); guint8 * dst, guint dst_n,
const GstAudioRingBufferSpec * spec);
#endif /* __GST_AUDIO_IEC61937_H__ */ #endif /* __GST_AUDIO_IEC61937_H__ */

View file

@ -40,7 +40,7 @@ typedef struct _GstAudioSinkClass GstAudioSinkClass;
/** /**
* GstAudioSink: * GstAudioSink:
* *
* Opaque #GstAudioSink. * Opaque #GstAudioSink.
*/ */
struct _GstAudioSink { struct _GstAudioSink {