mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-10-03 01:02:19 +00:00
add audio metadata
Add some audio metadata to describe a downmix matrix. Add metadata to media type document.
This commit is contained in:
parent
e6b2b8b7d0
commit
7505b7a55c
5 changed files with 130 additions and 0 deletions
|
@ -16,6 +16,13 @@ Media Types
|
||||||
channel-positions, G_TYPE_VALUE_ARRAY
|
channel-positions, G_TYPE_VALUE_ARRAY
|
||||||
An array with a channel position for each channel. The number of items in
|
An array with a channel position for each channel. The number of items in
|
||||||
this array must be the same as the channels property.
|
this array must be the same as the channels property.
|
||||||
|
|
||||||
|
|
||||||
|
Metadata
|
||||||
|
--------
|
||||||
|
|
||||||
|
"GstAudioDownmixMeta"
|
||||||
|
A matrix for downmixing multichannel audio to mono or stereo.
|
||||||
|
|
||||||
|
|
||||||
Formats
|
Formats
|
||||||
|
|
|
@ -59,6 +59,21 @@ Media Types
|
||||||
The format of the video, see the Formats section for a list of valid format
|
The format of the video, see the Formats section for a list of valid format
|
||||||
strings.
|
strings.
|
||||||
|
|
||||||
|
Metadata
|
||||||
|
--------
|
||||||
|
|
||||||
|
"GstVideoMeta"
|
||||||
|
contains the description of one video field or frame. It has
|
||||||
|
stride support and support for having multiple memory regions per frame.
|
||||||
|
|
||||||
|
Multiple GstVideoMeta can be added to a buffer and can be identified with a
|
||||||
|
unique id. This id can be used to select fields in interlaced formats or
|
||||||
|
views in multiview formats.
|
||||||
|
|
||||||
|
"GstVideoCropMeta"
|
||||||
|
Contains the cropping region of the video.
|
||||||
|
|
||||||
|
|
||||||
Formats
|
Formats
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,7 @@ libgstaudio_@GST_MAJORMINOR@_la_SOURCES = \
|
||||||
gstaudiobasesink.c \
|
gstaudiobasesink.c \
|
||||||
gstaudiobasesrc.c \
|
gstaudiobasesrc.c \
|
||||||
gstaudiofilter.c \
|
gstaudiofilter.c \
|
||||||
|
gstaudiometa.c \
|
||||||
gstaudiosink.c \
|
gstaudiosink.c \
|
||||||
gstaudiosrc.c \
|
gstaudiosrc.c \
|
||||||
streamvolume.c \
|
streamvolume.c \
|
||||||
|
@ -52,6 +53,7 @@ libgstaudio_@GST_MAJORMINOR@include_HEADERS = \
|
||||||
gstaudioencoder.h \
|
gstaudioencoder.h \
|
||||||
gstaudiobasesink.h \
|
gstaudiobasesink.h \
|
||||||
gstaudiobasesrc.h \
|
gstaudiobasesrc.h \
|
||||||
|
gstaudiometa.h \
|
||||||
gstaudiosink.h \
|
gstaudiosink.h \
|
||||||
gstaudiosrc.h \
|
gstaudiosrc.h \
|
||||||
mixer.h \
|
mixer.h \
|
||||||
|
|
49
gst-libs/gst/audio/gstaudiometa.c
Normal file
49
gst-libs/gst/audio/gstaudiometa.c
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
/* GStreamer
|
||||||
|
* Copyright (C) <2011> Wim Taymans <wim.taymans@gmail.com>
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "gstaudiometa.h"
|
||||||
|
|
||||||
|
static void
|
||||||
|
gst_audio_downmix_meta_copy (GstBuffer * dest, GstMeta * meta,
|
||||||
|
GstBuffer * buffer, gsize offset, gsize size)
|
||||||
|
{
|
||||||
|
GstAudioDownmixMeta *dmeta, *smeta;
|
||||||
|
|
||||||
|
smeta = (GstAudioDownmixMeta *) meta;
|
||||||
|
dmeta = gst_buffer_add_audio_downmix_meta (dest);
|
||||||
|
|
||||||
|
memcpy (dmeta, smeta, sizeof (GstAudioDownmixMeta));
|
||||||
|
}
|
||||||
|
|
||||||
|
const GstMetaInfo *
|
||||||
|
gst_audio_downmix_meta_get_info (void)
|
||||||
|
{
|
||||||
|
static const GstMetaInfo *audio_downmix_meta_info = NULL;
|
||||||
|
|
||||||
|
if (audio_downmix_meta_info == NULL) {
|
||||||
|
audio_downmix_meta_info =
|
||||||
|
gst_meta_register (GST_AUDIO_DOWNMIX_META_API, "GstAudioDownmixMeta",
|
||||||
|
sizeof (GstAudioDownmixMeta), (GstMetaInitFunction) NULL,
|
||||||
|
(GstMetaFreeFunction) NULL, gst_audio_downmix_meta_copy,
|
||||||
|
(GstMetaTransformFunction) NULL);
|
||||||
|
}
|
||||||
|
return audio_downmix_meta_info;
|
||||||
|
}
|
57
gst-libs/gst/audio/gstaudiometa.h
Normal file
57
gst-libs/gst/audio/gstaudiometa.h
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
/* GStreamer
|
||||||
|
* Copyright (C) <2011> Wim Taymans <wim.taymans@gmail.com>
|
||||||
|
*
|
||||||
|
* 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_AUDIO_META_H__
|
||||||
|
#define __GST_AUDIO_META_H__
|
||||||
|
|
||||||
|
#include <gst/gst.h>
|
||||||
|
|
||||||
|
#include <gst/audio/audio.h>
|
||||||
|
|
||||||
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
#define GST_AUDIO_DOWNMIX_META_API "GstAudioDownmixMeta"
|
||||||
|
#define GST_AUDIO_DOWNMIX_META_INFO (gst_audio_downmix_meta_get_info())
|
||||||
|
typedef struct _GstAudioDownmixMeta GstAudioDownmixMeta;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GstAudioDownmixMeta:
|
||||||
|
* @meta: parent #GstMeta
|
||||||
|
* @channels: the number of channels of the destination
|
||||||
|
* @matrix: the matrix coefficients.
|
||||||
|
*
|
||||||
|
* Extra buffer metadata describing audio downmixing matrix. This metadata is
|
||||||
|
* attached to audio buffers and contains a matrix to downmix the buffer number
|
||||||
|
* of channels to @channels.
|
||||||
|
*/
|
||||||
|
struct _GstAudioDownmixMeta {
|
||||||
|
GstMeta meta;
|
||||||
|
|
||||||
|
guint channels;
|
||||||
|
gfloat matrix[64];
|
||||||
|
};
|
||||||
|
|
||||||
|
const GstMetaInfo * gst_audio_downmix_meta_get_info (void);
|
||||||
|
|
||||||
|
#define gst_buffer_get_audio_downmix_meta(b) ((GstAudioDownmixMeta*)gst_buffer_get_meta((b),GST_AUDIO_DOWNMIX_META_INFO))
|
||||||
|
#define gst_buffer_add_audio_downmix_meta(b) ((GstAudioDownmixMeta*)gst_buffer_add_meta((b),GST_AUDIO_DOWNMIX_META_INFO, NULL))
|
||||||
|
|
||||||
|
G_END_DECLS
|
||||||
|
|
||||||
|
#endif /* __GST_AUDIO_META_H__ */
|
Loading…
Reference in a new issue