mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 18:21:04 +00:00
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:
parent
b12aabc9da
commit
b645287775
7 changed files with 85 additions and 20 deletions
|
@ -129,6 +129,8 @@ static GstAudioFormatInfo formats[] = {
|
|||
SILENT_0)
|
||||
};
|
||||
|
||||
G_DEFINE_POINTER_TYPE (GstAudioFormatInfo, gst_audio_format_info);
|
||||
|
||||
/**
|
||||
* gst_audio_format_build_integer:
|
||||
* @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:
|
||||
|
@ -426,7 +476,7 @@ incoherent_channels:
|
|||
* info of @info.
|
||||
*/
|
||||
GstCaps *
|
||||
gst_audio_info_to_caps (GstAudioInfo * info)
|
||||
gst_audio_info_to_caps (const GstAudioInfo * info)
|
||||
{
|
||||
GstCaps *caps;
|
||||
const gchar *format;
|
||||
|
@ -485,7 +535,7 @@ gst_audio_info_to_caps (GstAudioInfo * info)
|
|||
* Returns: TRUE if the conversion was successful.
|
||||
*/
|
||||
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)
|
||||
{
|
||||
gboolean res = TRUE;
|
||||
|
|
|
@ -141,7 +141,7 @@ typedef enum {
|
|||
GST_AUDIO_FORMAT_F64 = _GST_AUDIO_FORMAT_NE(F64)
|
||||
} GstAudioFormat;
|
||||
|
||||
/* FIXME: need GTypes */
|
||||
|
||||
typedef struct _GstAudioFormatInfo GstAudioFormatInfo;
|
||||
typedef struct _GstAudioInfo GstAudioInfo;
|
||||
|
||||
|
@ -174,7 +174,7 @@ typedef enum
|
|||
* interleaved. @dest should at least be big enough to hold @length *
|
||||
* 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);
|
||||
/**
|
||||
* GstAudioFormatPack:
|
||||
|
@ -187,7 +187,7 @@ typedef void (*GstAudioFormatUnpack) (GstAudioFormatInfo *info, gpointer
|
|||
* The samples from source have each channel interleaved
|
||||
* 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);
|
||||
|
||||
/**
|
||||
|
@ -219,8 +219,12 @@ struct _GstAudioFormatInfo {
|
|||
GstAudioFormat unpack_format;
|
||||
GstAudioFormatUnpack unpack_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_NAME(info) ((info)->name)
|
||||
#define GST_AUDIO_FORMAT_INFO_FLAGS(info) ((info)->flags)
|
||||
|
@ -282,8 +286,12 @@ struct _GstAudioInfo {
|
|||
gint channels;
|
||||
gint bpf;
|
||||
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_NAME(i) (GST_AUDIO_FORMAT_INFO_NAME((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_POSITION(info,c) ((info)->position[c])
|
||||
|
||||
void gst_audio_info_init (GstAudioInfo *info);
|
||||
void gst_audio_info_set_format (GstAudioInfo *info, GstAudioFormat format,
|
||||
gint rate, gint channels);
|
||||
GstAudioInfo * gst_audio_info_new (void);
|
||||
void gst_audio_info_init (GstAudioInfo *info);
|
||||
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);
|
||||
GstCaps * gst_audio_info_to_caps (GstAudioInfo *info);
|
||||
void gst_audio_info_set_format (GstAudioInfo *info, GstAudioFormat format,
|
||||
gint rate, gint channels);
|
||||
|
||||
gboolean gst_audio_info_convert (GstAudioInfo * info,
|
||||
GstFormat src_fmt, gint64 src_val,
|
||||
GstFormat dest_fmt, gint64 * dest_val);
|
||||
gboolean gst_audio_info_from_caps (GstAudioInfo *info, const GstCaps *caps);
|
||||
GstCaps * gst_audio_info_to_caps (const GstAudioInfo *info);
|
||||
|
||||
gboolean gst_audio_info_convert (const GstAudioInfo * info,
|
||||
GstFormat src_fmt, gint64 src_val,
|
||||
GstFormat dest_fmt, gint64 * dest_val);
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -106,7 +106,7 @@ struct _GstAudioBaseSrc {
|
|||
/*< private >*/
|
||||
GstAudioBaseSrcPrivate *priv;
|
||||
|
||||
gpointer _gst_reserved[GST_PADDING - 1];
|
||||
gpointer _gst_reserved[GST_PADDING];
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -158,6 +158,7 @@ struct _GstAudioDecoder
|
|||
|
||||
/*< private >*/
|
||||
GstAudioDecoderPrivate *priv;
|
||||
|
||||
gpointer _gst_reserved[GST_PADDING_LARGE];
|
||||
};
|
||||
|
||||
|
|
|
@ -120,6 +120,7 @@ struct _GstAudioEncoder {
|
|||
|
||||
/*< private >*/
|
||||
GstAudioEncoderPrivate *priv;
|
||||
|
||||
gpointer _gst_reserved[GST_PADDING_LARGE];
|
||||
};
|
||||
|
||||
|
|
|
@ -24,8 +24,9 @@
|
|||
|
||||
#include <gst/audio/gstaudioringbuffer.h>
|
||||
|
||||
guint gst_audio_iec61937_frame_size (const GstAudioRingBufferSpec * spec);
|
||||
gboolean gst_audio_iec61937_payload (const guint8 * src, guint src_n,
|
||||
guint8 * dst, guint dst_n, const GstAudioRingBufferSpec * spec);
|
||||
guint gst_audio_iec61937_frame_size (const GstAudioRingBufferSpec * spec);
|
||||
gboolean gst_audio_iec61937_payload (const guint8 * src, guint src_n,
|
||||
guint8 * dst, guint dst_n,
|
||||
const GstAudioRingBufferSpec * spec);
|
||||
|
||||
#endif /* __GST_AUDIO_IEC61937_H__ */
|
||||
|
|
Loading…
Reference in a new issue