2003-04-14 01:20:30 +00:00
|
|
|
/* GStreamer
|
|
|
|
* Copyright (C) 2003 Benjamin Otte <in7y118@public.uni-hamburg.de>
|
|
|
|
*
|
|
|
|
* gstaudioconvert.c: Convert audio to different audio formats automatically
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
2004-01-27 09:00:01 +00:00
|
|
|
/* Element-Checklist-Version: 5 */
|
2003-04-14 01:20:30 +00:00
|
|
|
|
2004-03-06 15:31:25 +00:00
|
|
|
/*
|
|
|
|
* design decisions:
|
|
|
|
* - audioconvert converts buffers in a set of supported caps. If it supports
|
|
|
|
* a caps, it supports conversion from these caps to any other caps it
|
|
|
|
* supports. (example: if it does A=>B and A=>C, it also does B=>C)
|
|
|
|
* - audioconvert does not save state between buffers. Every incoming buffer is
|
|
|
|
* converted and the converted buffer is pushed out.
|
|
|
|
* conclusion:
|
|
|
|
* audioconvert is not supposed to be a one-element-does-anything solution for
|
|
|
|
* audio conversions.
|
|
|
|
*/
|
|
|
|
|
2003-06-29 19:46:12 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
2004-02-25 18:02:19 +00:00
|
|
|
#include "config.h"
|
2003-06-29 19:46:12 +00:00
|
|
|
#endif
|
2003-07-19 22:58:41 +00:00
|
|
|
|
2003-04-14 01:20:30 +00:00
|
|
|
#include <gst/gst.h>
|
Surround sound support.
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_channels), (gst_a52dec_push),
(gst_a52dec_reneg), (gst_a52dec_loop), (plugin_init):
* ext/alsa/gstalsa.c: (gst_alsa_get_caps):
* ext/alsa/gstalsaplugin.c: (plugin_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_channels),
(gst_dtsdec_renegotiate), (gst_dtsdec_loop), (plugin_init):
* ext/faad/gstfaad.c: (gst_faad_init), (gst_faad_chanpos_from_gst),
(gst_faad_chanpos_to_gst), (gst_faad_sinkconnect),
(gst_faad_srcgetcaps), (gst_faad_srcconnect), (gst_faad_chain),
(gst_faad_change_state), (plugin_init):
* ext/faad/gstfaad.h:
* ext/vorbis/vorbis.c: (plugin_init):
* ext/vorbis/vorbisdec.c: (vorbis_dec_chain):
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/audio.c: (plugin_init):
* gst-libs/gst/audio/multichannel.c:
(gst_audio_check_channel_positions),
(gst_audio_get_channel_positions),
(gst_audio_set_channel_positions),
(gst_audio_set_structure_channel_positions_list),
(add_list_to_struct), (gst_audio_set_caps_channel_positions_list),
(gst_audio_fixate_channel_positions):
* gst-libs/gst/audio/multichannel.h:
* gst-libs/gst/audio/testchannels.c: (main):
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_getcaps),
(gst_audio_convert_parse_caps), (gst_audio_convert_link),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
* gst/audioconvert/plugin.c: (plugin_init):
Surround sound support.
2004-11-25 20:36:29 +00:00
|
|
|
#include <gst/audio/multichannel.h>
|
2003-04-14 01:20:30 +00:00
|
|
|
#include <string.h>
|
gst/audioconvert/: Implement a channel mixer.
Original commit message from CVS:
* gst/audioconvert/Makefile.am:
* gst/audioconvert/gstaudioconvert.c: (gst_audio_convert_init),
(gst_audio_convert_link), (gst_audio_convert_change_state),
(gst_audio_convert_channels):
* gst/audioconvert/gstchannelmix.c:
(gst_audio_convert_unset_matrix),
(gst_audio_convert_fill_identical),
(gst_audio_convert_fill_compatible),
(gst_audio_convert_detect_pos), (gst_audio_convert_fill_one_other),
(gst_audio_convert_fill_others),
(gst_audio_convert_fill_normalize),
(gst_audio_convert_fill_matrix), (gst_audio_convert_setup_matrix),
(gst_audio_convert_passthrough), (gst_audio_convert_mix):
* gst/audioconvert/gstchannelmix.h:
Implement a channel mixer.
2004-11-28 16:09:13 +00:00
|
|
|
#include "gstchannelmix.h"
|
2004-04-09 12:39:30 +00:00
|
|
|
#include "plugin.h"
|
2003-04-14 01:20:30 +00:00
|
|
|
|
gst/audioconvert/: Implement a channel mixer.
Original commit message from CVS:
* gst/audioconvert/Makefile.am:
* gst/audioconvert/gstaudioconvert.c: (gst_audio_convert_init),
(gst_audio_convert_link), (gst_audio_convert_change_state),
(gst_audio_convert_channels):
* gst/audioconvert/gstchannelmix.c:
(gst_audio_convert_unset_matrix),
(gst_audio_convert_fill_identical),
(gst_audio_convert_fill_compatible),
(gst_audio_convert_detect_pos), (gst_audio_convert_fill_one_other),
(gst_audio_convert_fill_others),
(gst_audio_convert_fill_normalize),
(gst_audio_convert_fill_matrix), (gst_audio_convert_setup_matrix),
(gst_audio_convert_passthrough), (gst_audio_convert_mix):
* gst/audioconvert/gstchannelmix.h:
Implement a channel mixer.
2004-11-28 16:09:13 +00:00
|
|
|
GST_DEBUG_CATEGORY (audio_convert_debug);
|
2004-01-12 19:46:45 +00:00
|
|
|
|
2003-04-14 01:20:30 +00:00
|
|
|
/*** DEFINITIONS **************************************************************/
|
|
|
|
|
2003-11-01 11:41:42 +00:00
|
|
|
static GstElementDetails audio_convert_details = {
|
|
|
|
"Audio Conversion",
|
2003-11-16 22:02:21 +00:00
|
|
|
"Filter/Converter/Audio",
|
2003-11-01 11:41:42 +00:00
|
|
|
"Convert audio to different formats",
|
2004-02-20 14:17:57 +00:00
|
|
|
"Benjamin Otte <in7y118@public.uni-hamburg.de>",
|
2003-11-01 11:41:42 +00:00
|
|
|
};
|
|
|
|
|
2003-04-14 01:20:30 +00:00
|
|
|
/* type functions */
|
2004-03-14 22:34:34 +00:00
|
|
|
static void gst_audio_convert_base_init (gpointer g_class);
|
|
|
|
static void gst_audio_convert_class_init (GstAudioConvertClass * klass);
|
|
|
|
static void gst_audio_convert_init (GstAudioConvert * audio_convert);
|
Surround sound support.
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_channels), (gst_a52dec_push),
(gst_a52dec_reneg), (gst_a52dec_loop), (plugin_init):
* ext/alsa/gstalsa.c: (gst_alsa_get_caps):
* ext/alsa/gstalsaplugin.c: (plugin_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_channels),
(gst_dtsdec_renegotiate), (gst_dtsdec_loop), (plugin_init):
* ext/faad/gstfaad.c: (gst_faad_init), (gst_faad_chanpos_from_gst),
(gst_faad_chanpos_to_gst), (gst_faad_sinkconnect),
(gst_faad_srcgetcaps), (gst_faad_srcconnect), (gst_faad_chain),
(gst_faad_change_state), (plugin_init):
* ext/faad/gstfaad.h:
* ext/vorbis/vorbis.c: (plugin_init):
* ext/vorbis/vorbisdec.c: (vorbis_dec_chain):
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/audio.c: (plugin_init):
* gst-libs/gst/audio/multichannel.c:
(gst_audio_check_channel_positions),
(gst_audio_get_channel_positions),
(gst_audio_set_channel_positions),
(gst_audio_set_structure_channel_positions_list),
(add_list_to_struct), (gst_audio_set_caps_channel_positions_list),
(gst_audio_fixate_channel_positions):
* gst-libs/gst/audio/multichannel.h:
* gst-libs/gst/audio/testchannels.c: (main):
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_getcaps),
(gst_audio_convert_parse_caps), (gst_audio_convert_link),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
* gst/audioconvert/plugin.c: (plugin_init):
Surround sound support.
2004-11-25 20:36:29 +00:00
|
|
|
static void gst_audio_convert_dispose (GObject * obj);
|
2003-07-19 22:58:41 +00:00
|
|
|
|
|
|
|
/* gstreamer functions */
|
2005-03-31 09:43:49 +00:00
|
|
|
static GstFlowReturn gst_audio_convert_chain (GstPad * pad, GstBuffer * buffer);
|
2005-05-23 17:28:02 +00:00
|
|
|
static gboolean gst_audio_convert_link_src (GstAudioConvert * this,
|
|
|
|
GstCaps * sinkcaps, GstAudioConvertCaps * sink_ac_caps);
|
2005-03-31 09:43:49 +00:00
|
|
|
static gboolean gst_audio_convert_setcaps (GstPad * pad, GstCaps * caps);
|
|
|
|
static GstCaps *gst_audio_convert_fixate (GstPad * pad, GstCaps * caps);
|
2004-03-14 22:34:34 +00:00
|
|
|
static GstCaps *gst_audio_convert_getcaps (GstPad * pad);
|
|
|
|
static GstElementStateReturn gst_audio_convert_change_state (GstElement *
|
|
|
|
element);
|
2003-04-14 01:20:30 +00:00
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
static GstBuffer *gst_audio_convert_buffer_to_default_format (GstAudioConvert *
|
|
|
|
this, GstBuffer * buf);
|
|
|
|
static GstBuffer *gst_audio_convert_buffer_from_default_format (GstAudioConvert
|
|
|
|
* this, GstBuffer * buf);
|
2003-04-14 01:20:30 +00:00
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
static GstBuffer *gst_audio_convert_channels (GstAudioConvert * this,
|
|
|
|
GstBuffer * buf);
|
2003-04-14 01:20:30 +00:00
|
|
|
|
|
|
|
/* AudioConvert signals and args */
|
2004-03-14 22:34:34 +00:00
|
|
|
enum
|
|
|
|
{
|
2003-04-14 01:20:30 +00:00
|
|
|
/* FILL ME */
|
|
|
|
LAST_SIGNAL
|
|
|
|
};
|
2003-07-19 22:58:41 +00:00
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
enum
|
|
|
|
{
|
2003-04-14 01:20:30 +00:00
|
|
|
ARG_0,
|
2004-05-21 22:39:30 +00:00
|
|
|
ARG_AGGRESSIVE
|
2003-04-14 01:20:30 +00:00
|
|
|
};
|
|
|
|
|
2004-01-26 03:54:21 +00:00
|
|
|
#define DEBUG_INIT(bla) \
|
|
|
|
GST_DEBUG_CATEGORY_INIT (audio_convert_debug, "audioconvert", 0, "audio conversion element");
|
2004-03-14 22:34:34 +00:00
|
|
|
|
|
|
|
GST_BOILERPLATE_FULL (GstAudioConvert, gst_audio_convert, GstElement,
|
|
|
|
GST_TYPE_ELEMENT, DEBUG_INIT);
|
2003-07-19 22:58:41 +00:00
|
|
|
|
2003-04-14 01:20:30 +00:00
|
|
|
/*** GSTREAMER PROTOTYPES *****************************************************/
|
|
|
|
|
2004-03-06 13:26:12 +00:00
|
|
|
#define STATIC_CAPS \
|
|
|
|
GST_STATIC_CAPS ( \
|
|
|
|
"audio/x-raw-int, " \
|
|
|
|
"rate = (int) [ 1, MAX ], " \
|
Surround sound support.
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_channels), (gst_a52dec_push),
(gst_a52dec_reneg), (gst_a52dec_loop), (plugin_init):
* ext/alsa/gstalsa.c: (gst_alsa_get_caps):
* ext/alsa/gstalsaplugin.c: (plugin_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_channels),
(gst_dtsdec_renegotiate), (gst_dtsdec_loop), (plugin_init):
* ext/faad/gstfaad.c: (gst_faad_init), (gst_faad_chanpos_from_gst),
(gst_faad_chanpos_to_gst), (gst_faad_sinkconnect),
(gst_faad_srcgetcaps), (gst_faad_srcconnect), (gst_faad_chain),
(gst_faad_change_state), (plugin_init):
* ext/faad/gstfaad.h:
* ext/vorbis/vorbis.c: (plugin_init):
* ext/vorbis/vorbisdec.c: (vorbis_dec_chain):
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/audio.c: (plugin_init):
* gst-libs/gst/audio/multichannel.c:
(gst_audio_check_channel_positions),
(gst_audio_get_channel_positions),
(gst_audio_set_channel_positions),
(gst_audio_set_structure_channel_positions_list),
(add_list_to_struct), (gst_audio_set_caps_channel_positions_list),
(gst_audio_fixate_channel_positions):
* gst-libs/gst/audio/multichannel.h:
* gst-libs/gst/audio/testchannels.c: (main):
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_getcaps),
(gst_audio_convert_parse_caps), (gst_audio_convert_link),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
* gst/audioconvert/plugin.c: (plugin_init):
Surround sound support.
2004-11-25 20:36:29 +00:00
|
|
|
"channels = (int) [ 1, 8 ], " \
|
2004-03-06 13:26:12 +00:00
|
|
|
"endianness = (int) { LITTLE_ENDIAN, BIG_ENDIAN }, " \
|
2004-05-25 20:14:10 +00:00
|
|
|
"width = (int) 8, " \
|
|
|
|
"depth = (int) [ 1, 8 ], " \
|
|
|
|
"signed = (boolean) { true, false }; " \
|
|
|
|
"audio/x-raw-int, " \
|
|
|
|
"rate = (int) [ 1, MAX ], " \
|
Surround sound support.
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_channels), (gst_a52dec_push),
(gst_a52dec_reneg), (gst_a52dec_loop), (plugin_init):
* ext/alsa/gstalsa.c: (gst_alsa_get_caps):
* ext/alsa/gstalsaplugin.c: (plugin_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_channels),
(gst_dtsdec_renegotiate), (gst_dtsdec_loop), (plugin_init):
* ext/faad/gstfaad.c: (gst_faad_init), (gst_faad_chanpos_from_gst),
(gst_faad_chanpos_to_gst), (gst_faad_sinkconnect),
(gst_faad_srcgetcaps), (gst_faad_srcconnect), (gst_faad_chain),
(gst_faad_change_state), (plugin_init):
* ext/faad/gstfaad.h:
* ext/vorbis/vorbis.c: (plugin_init):
* ext/vorbis/vorbisdec.c: (vorbis_dec_chain):
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/audio.c: (plugin_init):
* gst-libs/gst/audio/multichannel.c:
(gst_audio_check_channel_positions),
(gst_audio_get_channel_positions),
(gst_audio_set_channel_positions),
(gst_audio_set_structure_channel_positions_list),
(add_list_to_struct), (gst_audio_set_caps_channel_positions_list),
(gst_audio_fixate_channel_positions):
* gst-libs/gst/audio/multichannel.h:
* gst-libs/gst/audio/testchannels.c: (main):
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_getcaps),
(gst_audio_convert_parse_caps), (gst_audio_convert_link),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
* gst/audioconvert/plugin.c: (plugin_init):
Surround sound support.
2004-11-25 20:36:29 +00:00
|
|
|
"channels = (int) [ 1, 8 ], " \
|
2004-05-25 20:14:10 +00:00
|
|
|
"endianness = (int) { LITTLE_ENDIAN, BIG_ENDIAN }, " \
|
|
|
|
"width = (int) 16, " \
|
|
|
|
"depth = (int) [ 1, 16 ], " \
|
|
|
|
"signed = (boolean) { true, false }; " \
|
configure.ac: Add dvdlpcmdec
Original commit message from CVS:
* configure.ac:
Add dvdlpcmdec
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_reset),
(free_all_buffers), (gst_mpeg2dec_alloc_buffer):
Don't push buffers if the src pad isn't negotiated yet.
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_buffer_to_default_format),
(gst_audio_convert_buffer_from_default_format):
Add support for 24-bit width.
* gst/dvdlpcmdec/.cvsignore:
* gst/dvdlpcmdec/Makefile.am:
* gst/dvdlpcmdec/gstdvdlpcmdec.c: (gst_dvdlpcmdec_get_type),
(gst_dvdlpcmdec_base_init), (gst_dvdlpcmdec_class_init),
(gst_dvdlpcm_reset), (gst_dvdlpcmdec_init), (gst_dvdlpcmdec_link),
(gst_dvdlpcmdec_chain), (gst_dvdlpcmdec_change_state),
(plugin_init):
* gst/dvdlpcmdec/gstdvdlpcmdec.h:
New decoder for rearranging DVD LPCM into our audio/x-raw-int
format. Needs support for the channels maps if someone can find
a DVD LPCM track with > 2 channels.
* gst/mpegstream/gstdvddemux.c: (gst_dvd_demux_handle_dvd_event),
(gst_dvd_demux_send_discont), (gst_dvd_demux_handle_discont),
(gst_dvd_demux_get_audio_stream), (gst_dvd_demux_process_private):
* gst/mpegstream/gstdvddemux.h:
* gst/mpegstream/gstmpegdemux.c: (gst_mpeg_demux_send_discont),
(gst_mpeg_demux_new_output_pad), (gst_mpeg_demux_init_stream),
(gst_mpeg_demux_send_subbuffer), (gst_mpeg_demux_handle_src_query):
* gst/mpegstream/gstmpegdemux.h:
* gst/mpegstream/gstmpegparse.c: (gst_mpeg_parse_reset),
(gst_mpeg_parse_parse_packhead), (gst_mpeg_parse_loop),
(gst_mpeg_parse_get_rate), (gst_mpeg_parse_convert_src),
(gst_mpeg_parse_handle_src_query),
(gst_mpeg_parse_handle_src_event):
Use audio/x-dvd-lpcm for LPCM output.
Add DTS output.
2005-02-08 11:08:15 +00:00
|
|
|
"audio/x-raw-int, " \
|
|
|
|
"rate = (int) [ 1, MAX ], " \
|
|
|
|
"channels = (int) [ 1, 8 ], " \
|
|
|
|
"endianness = (int) { LITTLE_ENDIAN, BIG_ENDIAN }, " \
|
|
|
|
"width = (int) 24, " \
|
|
|
|
"depth = (int) [ 1, 24 ], " \
|
|
|
|
"signed = (boolean) { true, false }; " \
|
2004-05-25 20:14:10 +00:00
|
|
|
"audio/x-raw-int, " \
|
|
|
|
"rate = (int) [ 1, MAX ], " \
|
Surround sound support.
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_channels), (gst_a52dec_push),
(gst_a52dec_reneg), (gst_a52dec_loop), (plugin_init):
* ext/alsa/gstalsa.c: (gst_alsa_get_caps):
* ext/alsa/gstalsaplugin.c: (plugin_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_channels),
(gst_dtsdec_renegotiate), (gst_dtsdec_loop), (plugin_init):
* ext/faad/gstfaad.c: (gst_faad_init), (gst_faad_chanpos_from_gst),
(gst_faad_chanpos_to_gst), (gst_faad_sinkconnect),
(gst_faad_srcgetcaps), (gst_faad_srcconnect), (gst_faad_chain),
(gst_faad_change_state), (plugin_init):
* ext/faad/gstfaad.h:
* ext/vorbis/vorbis.c: (plugin_init):
* ext/vorbis/vorbisdec.c: (vorbis_dec_chain):
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/audio.c: (plugin_init):
* gst-libs/gst/audio/multichannel.c:
(gst_audio_check_channel_positions),
(gst_audio_get_channel_positions),
(gst_audio_set_channel_positions),
(gst_audio_set_structure_channel_positions_list),
(add_list_to_struct), (gst_audio_set_caps_channel_positions_list),
(gst_audio_fixate_channel_positions):
* gst-libs/gst/audio/multichannel.h:
* gst-libs/gst/audio/testchannels.c: (main):
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_getcaps),
(gst_audio_convert_parse_caps), (gst_audio_convert_link),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
* gst/audioconvert/plugin.c: (plugin_init):
Surround sound support.
2004-11-25 20:36:29 +00:00
|
|
|
"channels = (int) [ 1, 8 ], " \
|
2004-05-25 20:14:10 +00:00
|
|
|
"endianness = (int) { LITTLE_ENDIAN, BIG_ENDIAN }, " \
|
|
|
|
"width = (int) 32, " \
|
2004-03-06 13:26:12 +00:00
|
|
|
"depth = (int) [ 1, 32 ], " \
|
|
|
|
"signed = (boolean) { true, false }; " \
|
|
|
|
"audio/x-raw-float, " \
|
|
|
|
"rate = (int) [ 1, MAX ], " \
|
Surround sound support.
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_channels), (gst_a52dec_push),
(gst_a52dec_reneg), (gst_a52dec_loop), (plugin_init):
* ext/alsa/gstalsa.c: (gst_alsa_get_caps):
* ext/alsa/gstalsaplugin.c: (plugin_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_channels),
(gst_dtsdec_renegotiate), (gst_dtsdec_loop), (plugin_init):
* ext/faad/gstfaad.c: (gst_faad_init), (gst_faad_chanpos_from_gst),
(gst_faad_chanpos_to_gst), (gst_faad_sinkconnect),
(gst_faad_srcgetcaps), (gst_faad_srcconnect), (gst_faad_chain),
(gst_faad_change_state), (plugin_init):
* ext/faad/gstfaad.h:
* ext/vorbis/vorbis.c: (plugin_init):
* ext/vorbis/vorbisdec.c: (vorbis_dec_chain):
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/audio.c: (plugin_init):
* gst-libs/gst/audio/multichannel.c:
(gst_audio_check_channel_positions),
(gst_audio_get_channel_positions),
(gst_audio_set_channel_positions),
(gst_audio_set_structure_channel_positions_list),
(add_list_to_struct), (gst_audio_set_caps_channel_positions_list),
(gst_audio_fixate_channel_positions):
* gst-libs/gst/audio/multichannel.h:
* gst-libs/gst/audio/testchannels.c: (main):
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_getcaps),
(gst_audio_convert_parse_caps), (gst_audio_convert_link),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
* gst/audioconvert/plugin.c: (plugin_init):
Surround sound support.
2004-11-25 20:36:29 +00:00
|
|
|
"channels = (int) [ 1, 8 ], " \
|
2004-03-06 13:26:12 +00:00
|
|
|
"endianness = (int) BYTE_ORDER, " \
|
|
|
|
"width = (int) 32, " \
|
|
|
|
"buffer-frames = (int) [ 0, MAX ]" \
|
|
|
|
)
|
|
|
|
|
Surround sound support.
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_channels), (gst_a52dec_push),
(gst_a52dec_reneg), (gst_a52dec_loop), (plugin_init):
* ext/alsa/gstalsa.c: (gst_alsa_get_caps):
* ext/alsa/gstalsaplugin.c: (plugin_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_channels),
(gst_dtsdec_renegotiate), (gst_dtsdec_loop), (plugin_init):
* ext/faad/gstfaad.c: (gst_faad_init), (gst_faad_chanpos_from_gst),
(gst_faad_chanpos_to_gst), (gst_faad_sinkconnect),
(gst_faad_srcgetcaps), (gst_faad_srcconnect), (gst_faad_chain),
(gst_faad_change_state), (plugin_init):
* ext/faad/gstfaad.h:
* ext/vorbis/vorbis.c: (plugin_init):
* ext/vorbis/vorbisdec.c: (vorbis_dec_chain):
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/audio.c: (plugin_init):
* gst-libs/gst/audio/multichannel.c:
(gst_audio_check_channel_positions),
(gst_audio_get_channel_positions),
(gst_audio_set_channel_positions),
(gst_audio_set_structure_channel_positions_list),
(add_list_to_struct), (gst_audio_set_caps_channel_positions_list),
(gst_audio_fixate_channel_positions):
* gst-libs/gst/audio/multichannel.h:
* gst-libs/gst/audio/testchannels.c: (main):
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_getcaps),
(gst_audio_convert_parse_caps), (gst_audio_convert_link),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
* gst/audioconvert/plugin.c: (plugin_init):
Surround sound support.
2004-11-25 20:36:29 +00:00
|
|
|
static GstAudioChannelPosition *supported_positions;
|
|
|
|
|
2003-12-22 01:47:09 +00:00
|
|
|
static GstStaticPadTemplate gst_audio_convert_src_template =
|
2004-03-14 22:34:34 +00:00
|
|
|
GST_STATIC_PAD_TEMPLATE ("src",
|
|
|
|
GST_PAD_SRC,
|
|
|
|
GST_PAD_ALWAYS,
|
|
|
|
STATIC_CAPS);
|
2003-07-19 22:58:41 +00:00
|
|
|
|
2003-12-22 01:47:09 +00:00
|
|
|
static GstStaticPadTemplate gst_audio_convert_sink_template =
|
2004-03-14 22:34:34 +00:00
|
|
|
GST_STATIC_PAD_TEMPLATE ("sink",
|
|
|
|
GST_PAD_SINK,
|
|
|
|
GST_PAD_ALWAYS,
|
|
|
|
STATIC_CAPS);
|
2003-04-14 01:20:30 +00:00
|
|
|
|
|
|
|
/*** TYPE FUNCTIONS ***********************************************************/
|
|
|
|
|
2003-11-01 11:41:42 +00:00
|
|
|
static void
|
|
|
|
gst_audio_convert_base_init (gpointer g_class)
|
|
|
|
{
|
|
|
|
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
|
|
|
|
|
|
|
|
gst_element_class_add_pad_template (element_class,
|
2003-12-22 01:47:09 +00:00
|
|
|
gst_static_pad_template_get (&gst_audio_convert_src_template));
|
2003-11-01 11:41:42 +00:00
|
|
|
gst_element_class_add_pad_template (element_class,
|
2003-12-22 01:47:09 +00:00
|
|
|
gst_static_pad_template_get (&gst_audio_convert_sink_template));
|
2003-11-01 11:41:42 +00:00
|
|
|
gst_element_class_set_details (element_class, &audio_convert_details);
|
|
|
|
}
|
|
|
|
|
2003-04-14 01:20:30 +00:00
|
|
|
static void
|
2004-03-14 22:34:34 +00:00
|
|
|
gst_audio_convert_class_init (GstAudioConvertClass * klass)
|
2003-04-14 01:20:30 +00:00
|
|
|
{
|
2004-01-26 03:54:21 +00:00
|
|
|
GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass);
|
Surround sound support.
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_channels), (gst_a52dec_push),
(gst_a52dec_reneg), (gst_a52dec_loop), (plugin_init):
* ext/alsa/gstalsa.c: (gst_alsa_get_caps):
* ext/alsa/gstalsaplugin.c: (plugin_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_channels),
(gst_dtsdec_renegotiate), (gst_dtsdec_loop), (plugin_init):
* ext/faad/gstfaad.c: (gst_faad_init), (gst_faad_chanpos_from_gst),
(gst_faad_chanpos_to_gst), (gst_faad_sinkconnect),
(gst_faad_srcgetcaps), (gst_faad_srcconnect), (gst_faad_chain),
(gst_faad_change_state), (plugin_init):
* ext/faad/gstfaad.h:
* ext/vorbis/vorbis.c: (plugin_init):
* ext/vorbis/vorbisdec.c: (vorbis_dec_chain):
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/audio.c: (plugin_init):
* gst-libs/gst/audio/multichannel.c:
(gst_audio_check_channel_positions),
(gst_audio_get_channel_positions),
(gst_audio_set_channel_positions),
(gst_audio_set_structure_channel_positions_list),
(add_list_to_struct), (gst_audio_set_caps_channel_positions_list),
(gst_audio_fixate_channel_positions):
* gst-libs/gst/audio/multichannel.h:
* gst-libs/gst/audio/testchannels.c: (main):
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_getcaps),
(gst_audio_convert_parse_caps), (gst_audio_convert_link),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
* gst/audioconvert/plugin.c: (plugin_init):
Surround sound support.
2004-11-25 20:36:29 +00:00
|
|
|
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
|
|
|
gint i;
|
2003-04-14 01:20:30 +00:00
|
|
|
|
2004-01-12 19:46:45 +00:00
|
|
|
gstelement_class->change_state = gst_audio_convert_change_state;
|
Surround sound support.
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_channels), (gst_a52dec_push),
(gst_a52dec_reneg), (gst_a52dec_loop), (plugin_init):
* ext/alsa/gstalsa.c: (gst_alsa_get_caps):
* ext/alsa/gstalsaplugin.c: (plugin_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_channels),
(gst_dtsdec_renegotiate), (gst_dtsdec_loop), (plugin_init):
* ext/faad/gstfaad.c: (gst_faad_init), (gst_faad_chanpos_from_gst),
(gst_faad_chanpos_to_gst), (gst_faad_sinkconnect),
(gst_faad_srcgetcaps), (gst_faad_srcconnect), (gst_faad_chain),
(gst_faad_change_state), (plugin_init):
* ext/faad/gstfaad.h:
* ext/vorbis/vorbis.c: (plugin_init):
* ext/vorbis/vorbisdec.c: (vorbis_dec_chain):
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/audio.c: (plugin_init):
* gst-libs/gst/audio/multichannel.c:
(gst_audio_check_channel_positions),
(gst_audio_get_channel_positions),
(gst_audio_set_channel_positions),
(gst_audio_set_structure_channel_positions_list),
(add_list_to_struct), (gst_audio_set_caps_channel_positions_list),
(gst_audio_fixate_channel_positions):
* gst-libs/gst/audio/multichannel.h:
* gst-libs/gst/audio/testchannels.c: (main):
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_getcaps),
(gst_audio_convert_parse_caps), (gst_audio_convert_link),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
* gst/audioconvert/plugin.c: (plugin_init):
Surround sound support.
2004-11-25 20:36:29 +00:00
|
|
|
gobject_class->dispose = gst_audio_convert_dispose;
|
|
|
|
|
|
|
|
supported_positions = g_new0 (GstAudioChannelPosition,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NUM);
|
|
|
|
for (i = 0; i < GST_AUDIO_CHANNEL_POSITION_NUM; i++)
|
|
|
|
supported_positions[i] = i;
|
2004-01-12 19:46:45 +00:00
|
|
|
}
|
|
|
|
|
2003-04-14 01:20:30 +00:00
|
|
|
static void
|
2004-03-14 22:34:34 +00:00
|
|
|
gst_audio_convert_init (GstAudioConvert * this)
|
2003-04-14 01:20:30 +00:00
|
|
|
{
|
|
|
|
/* sinkpad */
|
2004-03-14 22:34:34 +00:00
|
|
|
this->sink =
|
|
|
|
gst_pad_new_from_template (gst_static_pad_template_get
|
|
|
|
(&gst_audio_convert_sink_template), "sink");
|
2004-01-15 21:05:17 +00:00
|
|
|
gst_pad_set_getcaps_function (this->sink, gst_audio_convert_getcaps);
|
2005-03-31 09:43:49 +00:00
|
|
|
gst_pad_set_setcaps_function (this->sink, gst_audio_convert_setcaps);
|
|
|
|
gst_pad_set_fixatecaps_function (this->sink, gst_audio_convert_fixate);
|
2004-03-14 22:34:34 +00:00
|
|
|
gst_element_add_pad (GST_ELEMENT (this), this->sink);
|
2003-07-19 22:58:41 +00:00
|
|
|
|
2003-04-14 01:20:30 +00:00
|
|
|
/* srcpad */
|
2004-03-14 22:34:34 +00:00
|
|
|
this->src =
|
|
|
|
gst_pad_new_from_template (gst_static_pad_template_get
|
|
|
|
(&gst_audio_convert_src_template), "src");
|
2004-01-15 21:05:17 +00:00
|
|
|
gst_pad_set_getcaps_function (this->src, gst_audio_convert_getcaps);
|
2005-05-23 17:28:02 +00:00
|
|
|
//gst_pad_set_setcaps_function (this->src, gst_audio_convert_setcaps);
|
2005-03-31 09:43:49 +00:00
|
|
|
gst_pad_set_fixatecaps_function (this->src, gst_audio_convert_fixate);
|
2004-03-14 22:34:34 +00:00
|
|
|
gst_element_add_pad (GST_ELEMENT (this), this->src);
|
2003-04-14 01:20:30 +00:00
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
gst_pad_set_chain_function (this->sink, gst_audio_convert_chain);
|
2003-07-19 22:58:41 +00:00
|
|
|
|
2003-04-14 01:20:30 +00:00
|
|
|
/* clear important variables */
|
2003-07-19 22:58:41 +00:00
|
|
|
this->convert_internal = NULL;
|
Surround sound support.
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_channels), (gst_a52dec_push),
(gst_a52dec_reneg), (gst_a52dec_loop), (plugin_init):
* ext/alsa/gstalsa.c: (gst_alsa_get_caps):
* ext/alsa/gstalsaplugin.c: (plugin_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_channels),
(gst_dtsdec_renegotiate), (gst_dtsdec_loop), (plugin_init):
* ext/faad/gstfaad.c: (gst_faad_init), (gst_faad_chanpos_from_gst),
(gst_faad_chanpos_to_gst), (gst_faad_sinkconnect),
(gst_faad_srcgetcaps), (gst_faad_srcconnect), (gst_faad_chain),
(gst_faad_change_state), (plugin_init):
* ext/faad/gstfaad.h:
* ext/vorbis/vorbis.c: (plugin_init):
* ext/vorbis/vorbisdec.c: (vorbis_dec_chain):
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/audio.c: (plugin_init):
* gst-libs/gst/audio/multichannel.c:
(gst_audio_check_channel_positions),
(gst_audio_get_channel_positions),
(gst_audio_set_channel_positions),
(gst_audio_set_structure_channel_positions_list),
(add_list_to_struct), (gst_audio_set_caps_channel_positions_list),
(gst_audio_fixate_channel_positions):
* gst-libs/gst/audio/multichannel.h:
* gst-libs/gst/audio/testchannels.c: (main):
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_getcaps),
(gst_audio_convert_parse_caps), (gst_audio_convert_link),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
* gst/audioconvert/plugin.c: (plugin_init):
Surround sound support.
2004-11-25 20:36:29 +00:00
|
|
|
this->sinkcaps.pos = NULL;
|
|
|
|
this->srccaps.pos = NULL;
|
gst/audioconvert/: Implement a channel mixer.
Original commit message from CVS:
* gst/audioconvert/Makefile.am:
* gst/audioconvert/gstaudioconvert.c: (gst_audio_convert_init),
(gst_audio_convert_link), (gst_audio_convert_change_state),
(gst_audio_convert_channels):
* gst/audioconvert/gstchannelmix.c:
(gst_audio_convert_unset_matrix),
(gst_audio_convert_fill_identical),
(gst_audio_convert_fill_compatible),
(gst_audio_convert_detect_pos), (gst_audio_convert_fill_one_other),
(gst_audio_convert_fill_others),
(gst_audio_convert_fill_normalize),
(gst_audio_convert_fill_matrix), (gst_audio_convert_setup_matrix),
(gst_audio_convert_passthrough), (gst_audio_convert_mix):
* gst/audioconvert/gstchannelmix.h:
Implement a channel mixer.
2004-11-28 16:09:13 +00:00
|
|
|
this->matrix = NULL;
|
Surround sound support.
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_channels), (gst_a52dec_push),
(gst_a52dec_reneg), (gst_a52dec_loop), (plugin_init):
* ext/alsa/gstalsa.c: (gst_alsa_get_caps):
* ext/alsa/gstalsaplugin.c: (plugin_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_channels),
(gst_dtsdec_renegotiate), (gst_dtsdec_loop), (plugin_init):
* ext/faad/gstfaad.c: (gst_faad_init), (gst_faad_chanpos_from_gst),
(gst_faad_chanpos_to_gst), (gst_faad_sinkconnect),
(gst_faad_srcgetcaps), (gst_faad_srcconnect), (gst_faad_chain),
(gst_faad_change_state), (plugin_init):
* ext/faad/gstfaad.h:
* ext/vorbis/vorbis.c: (plugin_init):
* ext/vorbis/vorbisdec.c: (vorbis_dec_chain):
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/audio.c: (plugin_init):
* gst-libs/gst/audio/multichannel.c:
(gst_audio_check_channel_positions),
(gst_audio_get_channel_positions),
(gst_audio_set_channel_positions),
(gst_audio_set_structure_channel_positions_list),
(add_list_to_struct), (gst_audio_set_caps_channel_positions_list),
(gst_audio_fixate_channel_positions):
* gst-libs/gst/audio/multichannel.h:
* gst-libs/gst/audio/testchannels.c: (main):
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_getcaps),
(gst_audio_convert_parse_caps), (gst_audio_convert_link),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
* gst/audioconvert/plugin.c: (plugin_init):
Surround sound support.
2004-11-25 20:36:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_audio_convert_dispose (GObject * obj)
|
|
|
|
{
|
|
|
|
GstAudioConvert *this = GST_AUDIO_CONVERT (obj);
|
|
|
|
|
|
|
|
if (this->sinkcaps.pos) {
|
|
|
|
g_free (this->sinkcaps.pos);
|
|
|
|
this->sinkcaps.pos = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this->srccaps.pos) {
|
|
|
|
g_free (this->srccaps.pos);
|
|
|
|
this->srccaps.pos = NULL;
|
|
|
|
}
|
2004-11-27 14:41:51 +00:00
|
|
|
G_OBJECT_CLASS (parent_class)->dispose (obj);
|
2003-04-14 01:20:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*** GSTREAMER FUNCTIONS ******************************************************/
|
|
|
|
|
2005-03-31 09:43:49 +00:00
|
|
|
static GstFlowReturn
|
|
|
|
gst_audio_convert_chain (GstPad * pad, GstBuffer * buf)
|
2003-04-14 01:20:30 +00:00
|
|
|
{
|
|
|
|
GstAudioConvert *this;
|
gst/: Don't ignore _push() return values.
Original commit message from CVS:
* gst/audioconvert/gstaudioconvert.c: (gst_audio_convert_chain),
(gst_audio_convert_caps_remove_format_info),
(gst_audio_convert_setcaps), (gst_audio_convert_fixate),
(gst_audio_convert_change_state), (gst_audio_convert_channels):
* gst/videotestsrc/gstvideotestsrc.c:
(gst_videotestsrc_src_negotiate), (gst_videotestsrc_src_link),
(gst_videotestsrc_parse_caps), (gst_videotestsrc_src_accept_caps),
(gst_videotestsrc_setcaps), (gst_videotestsrc_activate),
(gst_videotestsrc_init), (gst_videotestsrc_loop):
Don't ignore _push() return values.
Make sure no processing is done when shutting down.
Videotestsrc pad activation fix.
2005-05-05 09:49:08 +00:00
|
|
|
GstFlowReturn ret;
|
2003-04-14 01:20:30 +00:00
|
|
|
|
2004-01-12 19:46:45 +00:00
|
|
|
this = GST_AUDIO_CONVERT (GST_OBJECT_PARENT (pad));
|
2003-04-14 01:20:30 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Theory of operation:
|
2003-07-19 22:58:41 +00:00
|
|
|
* - convert the format (endianness, signedness, width, depth) to
|
2003-04-14 01:20:30 +00:00
|
|
|
* (G_BYTE_ORDER, TRUE, 32, 32)
|
|
|
|
* - convert rate and channels
|
|
|
|
* - convert back to output format
|
|
|
|
*/
|
2005-05-23 17:28:02 +00:00
|
|
|
if (!GST_RPAD_CAPS (this->sink)) {
|
|
|
|
goto not_negotiated;
|
|
|
|
} else if (!GST_RPAD_CAPS (this->src)) {
|
|
|
|
if (!gst_audio_convert_link_src (this,
|
|
|
|
GST_RPAD_CAPS (this->sink), &this->sinkcaps))
|
|
|
|
goto no_format;
|
|
|
|
} else if (!this->matrix) {
|
|
|
|
gst_audio_convert_setup_matrix (this);
|
|
|
|
}
|
|
|
|
|
2003-04-14 01:20:30 +00:00
|
|
|
buf = gst_audio_convert_buffer_to_default_format (this, buf);
|
|
|
|
buf = gst_audio_convert_channels (this, buf);
|
|
|
|
buf = gst_audio_convert_buffer_from_default_format (this, buf);
|
|
|
|
|
gst/: Don't ignore _push() return values.
Original commit message from CVS:
* gst/audioconvert/gstaudioconvert.c: (gst_audio_convert_chain),
(gst_audio_convert_caps_remove_format_info),
(gst_audio_convert_setcaps), (gst_audio_convert_fixate),
(gst_audio_convert_change_state), (gst_audio_convert_channels):
* gst/videotestsrc/gstvideotestsrc.c:
(gst_videotestsrc_src_negotiate), (gst_videotestsrc_src_link),
(gst_videotestsrc_parse_caps), (gst_videotestsrc_src_accept_caps),
(gst_videotestsrc_setcaps), (gst_videotestsrc_activate),
(gst_videotestsrc_init), (gst_videotestsrc_loop):
Don't ignore _push() return values.
Make sure no processing is done when shutting down.
Videotestsrc pad activation fix.
2005-05-05 09:49:08 +00:00
|
|
|
ret = gst_pad_push (this->src, buf);
|
|
|
|
|
|
|
|
return ret;
|
2005-05-23 17:28:02 +00:00
|
|
|
|
|
|
|
not_negotiated:
|
|
|
|
{
|
|
|
|
GST_ELEMENT_ERROR (this, CORE, NEGOTIATION, (NULL),
|
|
|
|
("Pad not negotiated before chain function was called"));
|
|
|
|
gst_buffer_unref (buf);
|
|
|
|
return GST_FLOW_NOT_NEGOTIATED;
|
|
|
|
}
|
|
|
|
no_format:
|
|
|
|
{
|
|
|
|
GST_ELEMENT_ERROR (this, CORE, NEGOTIATION, (NULL),
|
|
|
|
("Could not negotiate format"));
|
|
|
|
gst_buffer_unref (buf);
|
|
|
|
return GST_FLOW_ERROR;
|
|
|
|
}
|
2003-04-14 01:20:30 +00:00
|
|
|
}
|
2003-07-19 22:58:41 +00:00
|
|
|
|
2004-01-15 21:05:17 +00:00
|
|
|
static GstCaps *
|
2005-03-31 09:43:49 +00:00
|
|
|
gst_audio_convert_caps_remove_format_info (GstPad * pad, GstCaps * caps)
|
2004-01-15 21:05:17 +00:00
|
|
|
{
|
2004-02-25 13:25:44 +00:00
|
|
|
int i, size;
|
2005-03-31 09:43:49 +00:00
|
|
|
GstAudioConvert *this;
|
2004-01-15 21:05:17 +00:00
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
this = GST_AUDIO_CONVERT (GST_OBJECT_PARENT (pad));
|
2004-01-15 21:05:17 +00:00
|
|
|
|
2005-03-31 09:43:49 +00:00
|
|
|
size = gst_caps_get_size (caps);
|
2004-01-15 21:05:17 +00:00
|
|
|
|
2005-03-31 09:43:49 +00:00
|
|
|
caps = gst_caps_make_writable (caps);
|
2004-02-25 13:25:44 +00:00
|
|
|
|
2004-03-06 13:26:12 +00:00
|
|
|
for (i = size - 1; i >= 0; i--) {
|
2005-03-31 09:43:49 +00:00
|
|
|
GstStructure *structure;
|
|
|
|
|
|
|
|
structure = gst_caps_get_structure (caps, i);
|
2004-01-15 21:05:17 +00:00
|
|
|
gst_structure_remove_field (structure, "channels");
|
Surround sound support.
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_channels), (gst_a52dec_push),
(gst_a52dec_reneg), (gst_a52dec_loop), (plugin_init):
* ext/alsa/gstalsa.c: (gst_alsa_get_caps):
* ext/alsa/gstalsaplugin.c: (plugin_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_channels),
(gst_dtsdec_renegotiate), (gst_dtsdec_loop), (plugin_init):
* ext/faad/gstfaad.c: (gst_faad_init), (gst_faad_chanpos_from_gst),
(gst_faad_chanpos_to_gst), (gst_faad_sinkconnect),
(gst_faad_srcgetcaps), (gst_faad_srcconnect), (gst_faad_chain),
(gst_faad_change_state), (plugin_init):
* ext/faad/gstfaad.h:
* ext/vorbis/vorbis.c: (plugin_init):
* ext/vorbis/vorbisdec.c: (vorbis_dec_chain):
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/audio.c: (plugin_init):
* gst-libs/gst/audio/multichannel.c:
(gst_audio_check_channel_positions),
(gst_audio_get_channel_positions),
(gst_audio_set_channel_positions),
(gst_audio_set_structure_channel_positions_list),
(add_list_to_struct), (gst_audio_set_caps_channel_positions_list),
(gst_audio_fixate_channel_positions):
* gst-libs/gst/audio/multichannel.h:
* gst-libs/gst/audio/testchannels.c: (main):
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_getcaps),
(gst_audio_convert_parse_caps), (gst_audio_convert_link),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
* gst/audioconvert/plugin.c: (plugin_init):
Surround sound support.
2004-11-25 20:36:29 +00:00
|
|
|
gst_structure_remove_field (structure, "channel-positions");
|
2004-01-15 21:05:17 +00:00
|
|
|
gst_structure_remove_field (structure, "endianness");
|
|
|
|
gst_structure_remove_field (structure, "width");
|
2004-03-06 13:26:12 +00:00
|
|
|
gst_structure_remove_field (structure, "depth");
|
|
|
|
gst_structure_remove_field (structure, "signed");
|
|
|
|
structure = gst_structure_copy (structure);
|
2004-02-20 14:17:57 +00:00
|
|
|
if (strcmp (gst_structure_get_name (structure), "audio/x-raw-int") == 0) {
|
2004-03-06 13:26:12 +00:00
|
|
|
gst_structure_set_name (structure, "audio/x-raw-float");
|
2004-04-05 13:18:56 +00:00
|
|
|
if (pad == this->sink) {
|
|
|
|
gst_structure_set (structure, "buffer-frames", GST_TYPE_INT_RANGE, 0,
|
|
|
|
G_MAXINT, NULL);
|
|
|
|
} else {
|
|
|
|
gst_structure_set (structure, "buffer-frames", G_TYPE_INT, 0, NULL);
|
|
|
|
}
|
2004-02-20 14:17:57 +00:00
|
|
|
} else {
|
2004-03-06 13:26:12 +00:00
|
|
|
gst_structure_set_name (structure, "audio/x-raw-int");
|
2004-02-20 14:17:57 +00:00
|
|
|
gst_structure_remove_field (structure, "buffer-frames");
|
|
|
|
}
|
2005-03-31 09:43:49 +00:00
|
|
|
gst_caps_append_structure (caps, structure);
|
2004-01-15 21:05:17 +00:00
|
|
|
}
|
2005-03-31 09:43:49 +00:00
|
|
|
|
|
|
|
return caps;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* this function is complicated now, but it will be unnecessary when we convert
|
|
|
|
* rate. */
|
|
|
|
static GstCaps *
|
|
|
|
gst_audio_convert_getcaps (GstPad * pad)
|
|
|
|
{
|
|
|
|
GstAudioConvert *this;
|
|
|
|
GstPad *otherpad;
|
|
|
|
GstCaps *othercaps, *caps;
|
|
|
|
const GstCaps *templcaps;
|
|
|
|
|
|
|
|
this = GST_AUDIO_CONVERT (GST_OBJECT_PARENT (pad));
|
|
|
|
|
|
|
|
otherpad = (pad == this->src) ? this->sink : this->src;
|
|
|
|
|
|
|
|
/* we can do all our peer can */
|
|
|
|
othercaps = gst_pad_peer_get_caps (otherpad);
|
Fixed negotiation wrt _peer_get_caps()
Original commit message from CVS:
* gst/audioconvert/gstaudioconvert.c: (gst_audio_convert_chain),
(gst_audio_convert_caps_remove_format_info),
(gst_audio_convert_getcaps), (gst_audio_convert_setcaps),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
* gst/ffmpegcolorspace/gstffmpegcolorspace.c:
(gst_ffmpegcsp_getcaps), (gst_ffmpegcsp_configure_context),
(gst_ffmpegcsp_setcaps), (gst_ffmpegcsp_chain):
* gst/sine/Makefile.am:
* gst/sine/gstsinesrc.c: (gst_sinesrc_get_type),
(gst_sinesrc_class_init), (gst_sinesrc_init),
(gst_sinesrc_src_fixate), (gst_sinesrc_setcaps),
(gst_sinesrc_src_query), (gst_sinesrc_create), (gst_sinesrc_start),
(gst_sinesrc_update_freq):
* gst/sine/gstsinesrc.h:
* gst/tcp/gstmultifdsink.c:
* sys/xvimage/xvimagesink.c:
Fixed negotiation wrt _peer_get_caps()
Some cleanups.
2005-05-06 17:13:49 +00:00
|
|
|
if (othercaps != NULL) {
|
|
|
|
/* without the format info even */
|
|
|
|
othercaps = gst_audio_convert_caps_remove_format_info (pad, othercaps);
|
|
|
|
/* but filtered against our template */
|
|
|
|
templcaps = gst_pad_get_pad_template_caps (pad);
|
|
|
|
caps = gst_caps_intersect (othercaps, templcaps);
|
|
|
|
gst_caps_unref (othercaps);
|
|
|
|
} else {
|
|
|
|
/* no peer, then our template is enough */
|
|
|
|
caps = gst_caps_copy (gst_pad_get_pad_template_caps (pad));
|
|
|
|
}
|
2004-03-14 22:34:34 +00:00
|
|
|
|
Surround sound support.
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_channels), (gst_a52dec_push),
(gst_a52dec_reneg), (gst_a52dec_loop), (plugin_init):
* ext/alsa/gstalsa.c: (gst_alsa_get_caps):
* ext/alsa/gstalsaplugin.c: (plugin_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_channels),
(gst_dtsdec_renegotiate), (gst_dtsdec_loop), (plugin_init):
* ext/faad/gstfaad.c: (gst_faad_init), (gst_faad_chanpos_from_gst),
(gst_faad_chanpos_to_gst), (gst_faad_sinkconnect),
(gst_faad_srcgetcaps), (gst_faad_srcconnect), (gst_faad_chain),
(gst_faad_change_state), (plugin_init):
* ext/faad/gstfaad.h:
* ext/vorbis/vorbis.c: (plugin_init):
* ext/vorbis/vorbisdec.c: (vorbis_dec_chain):
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/audio.c: (plugin_init):
* gst-libs/gst/audio/multichannel.c:
(gst_audio_check_channel_positions),
(gst_audio_get_channel_positions),
(gst_audio_set_channel_positions),
(gst_audio_set_structure_channel_positions_list),
(add_list_to_struct), (gst_audio_set_caps_channel_positions_list),
(gst_audio_fixate_channel_positions):
* gst-libs/gst/audio/multichannel.h:
* gst-libs/gst/audio/testchannels.c: (main):
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_getcaps),
(gst_audio_convert_parse_caps), (gst_audio_convert_link),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
* gst/audioconvert/plugin.c: (plugin_init):
Surround sound support.
2004-11-25 20:36:29 +00:00
|
|
|
/* Get the channel positions in as well. */
|
|
|
|
gst_audio_set_caps_channel_positions_list (caps, supported_positions,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NUM);
|
|
|
|
|
2004-01-15 21:05:17 +00:00
|
|
|
return caps;
|
|
|
|
}
|
|
|
|
|
2004-01-26 03:54:21 +00:00
|
|
|
static gboolean
|
2004-03-14 22:34:34 +00:00
|
|
|
gst_audio_convert_parse_caps (const GstCaps * gst_caps,
|
|
|
|
GstAudioConvertCaps * caps)
|
2004-01-26 03:54:21 +00:00
|
|
|
{
|
|
|
|
GstStructure *structure = gst_caps_get_structure (gst_caps, 0);
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2005-03-31 09:43:49 +00:00
|
|
|
GST_DEBUG ("parse caps %p and %" GST_PTR_FORMAT, gst_caps, gst_caps);
|
|
|
|
|
2004-01-26 03:54:21 +00:00
|
|
|
g_return_val_if_fail (gst_caps_is_fixed (gst_caps), FALSE);
|
|
|
|
g_return_val_if_fail (caps != NULL, FALSE);
|
2004-03-14 22:34:34 +00:00
|
|
|
|
Surround sound support.
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_channels), (gst_a52dec_push),
(gst_a52dec_reneg), (gst_a52dec_loop), (plugin_init):
* ext/alsa/gstalsa.c: (gst_alsa_get_caps):
* ext/alsa/gstalsaplugin.c: (plugin_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_channels),
(gst_dtsdec_renegotiate), (gst_dtsdec_loop), (plugin_init):
* ext/faad/gstfaad.c: (gst_faad_init), (gst_faad_chanpos_from_gst),
(gst_faad_chanpos_to_gst), (gst_faad_sinkconnect),
(gst_faad_srcgetcaps), (gst_faad_srcconnect), (gst_faad_chain),
(gst_faad_change_state), (plugin_init):
* ext/faad/gstfaad.h:
* ext/vorbis/vorbis.c: (plugin_init):
* ext/vorbis/vorbisdec.c: (vorbis_dec_chain):
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/audio.c: (plugin_init):
* gst-libs/gst/audio/multichannel.c:
(gst_audio_check_channel_positions),
(gst_audio_get_channel_positions),
(gst_audio_set_channel_positions),
(gst_audio_set_structure_channel_positions_list),
(add_list_to_struct), (gst_audio_set_caps_channel_positions_list),
(gst_audio_fixate_channel_positions):
* gst-libs/gst/audio/multichannel.h:
* gst-libs/gst/audio/testchannels.c: (main):
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_getcaps),
(gst_audio_convert_parse_caps), (gst_audio_convert_link),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
* gst/audioconvert/plugin.c: (plugin_init):
Surround sound support.
2004-11-25 20:36:29 +00:00
|
|
|
/* cleanup old */
|
|
|
|
if (caps->pos) {
|
|
|
|
g_free (caps->pos);
|
|
|
|
caps->pos = NULL;
|
|
|
|
}
|
|
|
|
|
2004-01-26 03:54:21 +00:00
|
|
|
caps->endianness = G_BYTE_ORDER;
|
2004-03-14 22:34:34 +00:00
|
|
|
caps->is_int =
|
|
|
|
(strcmp (gst_structure_get_name (structure), "audio/x-raw-int") == 0);
|
|
|
|
if (!gst_structure_get_int (structure, "channels", &caps->channels)
|
Surround sound support.
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_channels), (gst_a52dec_push),
(gst_a52dec_reneg), (gst_a52dec_loop), (plugin_init):
* ext/alsa/gstalsa.c: (gst_alsa_get_caps):
* ext/alsa/gstalsaplugin.c: (plugin_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_channels),
(gst_dtsdec_renegotiate), (gst_dtsdec_loop), (plugin_init):
* ext/faad/gstfaad.c: (gst_faad_init), (gst_faad_chanpos_from_gst),
(gst_faad_chanpos_to_gst), (gst_faad_sinkconnect),
(gst_faad_srcgetcaps), (gst_faad_srcconnect), (gst_faad_chain),
(gst_faad_change_state), (plugin_init):
* ext/faad/gstfaad.h:
* ext/vorbis/vorbis.c: (plugin_init):
* ext/vorbis/vorbisdec.c: (vorbis_dec_chain):
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/audio.c: (plugin_init):
* gst-libs/gst/audio/multichannel.c:
(gst_audio_check_channel_positions),
(gst_audio_get_channel_positions),
(gst_audio_set_channel_positions),
(gst_audio_set_structure_channel_positions_list),
(add_list_to_struct), (gst_audio_set_caps_channel_positions_list),
(gst_audio_fixate_channel_positions):
* gst-libs/gst/audio/multichannel.h:
* gst-libs/gst/audio/testchannels.c: (main):
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_getcaps),
(gst_audio_convert_parse_caps), (gst_audio_convert_link),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
* gst/audioconvert/plugin.c: (plugin_init):
Surround sound support.
2004-11-25 20:36:29 +00:00
|
|
|
|| !(caps->pos = gst_audio_get_channel_positions (structure))
|
2004-03-14 22:34:34 +00:00
|
|
|
|| !gst_structure_get_int (structure, "width", &caps->width)
|
|
|
|
|| !gst_structure_get_int (structure, "rate", &caps->rate)
|
|
|
|
|| (caps->is_int
|
2004-03-15 19:32:28 +00:00
|
|
|
&& (!gst_structure_get_boolean (structure, "signed", &caps->sign)
|
|
|
|
|| !gst_structure_get_int (structure, "depth", &caps->depth)
|
|
|
|
|| (caps->width != 8
|
|
|
|
&& !gst_structure_get_int (structure, "endianness",
|
|
|
|
&caps->endianness)))) || (!caps->is_int
|
|
|
|
&& !gst_structure_get_int (structure, "buffer-frames",
|
|
|
|
&caps->buffer_frames))) {
|
2004-01-26 03:54:21 +00:00
|
|
|
GST_DEBUG ("could not get some values from structure");
|
Surround sound support.
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_channels), (gst_a52dec_push),
(gst_a52dec_reneg), (gst_a52dec_loop), (plugin_init):
* ext/alsa/gstalsa.c: (gst_alsa_get_caps):
* ext/alsa/gstalsaplugin.c: (plugin_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_channels),
(gst_dtsdec_renegotiate), (gst_dtsdec_loop), (plugin_init):
* ext/faad/gstfaad.c: (gst_faad_init), (gst_faad_chanpos_from_gst),
(gst_faad_chanpos_to_gst), (gst_faad_sinkconnect),
(gst_faad_srcgetcaps), (gst_faad_srcconnect), (gst_faad_chain),
(gst_faad_change_state), (plugin_init):
* ext/faad/gstfaad.h:
* ext/vorbis/vorbis.c: (plugin_init):
* ext/vorbis/vorbisdec.c: (vorbis_dec_chain):
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/audio.c: (plugin_init):
* gst-libs/gst/audio/multichannel.c:
(gst_audio_check_channel_positions),
(gst_audio_get_channel_positions),
(gst_audio_set_channel_positions),
(gst_audio_set_structure_channel_positions_list),
(add_list_to_struct), (gst_audio_set_caps_channel_positions_list),
(gst_audio_fixate_channel_positions):
* gst-libs/gst/audio/multichannel.h:
* gst-libs/gst/audio/testchannels.c: (main):
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_getcaps),
(gst_audio_convert_parse_caps), (gst_audio_convert_link),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
* gst/audioconvert/plugin.c: (plugin_init):
Surround sound support.
2004-11-25 20:36:29 +00:00
|
|
|
g_free (caps->pos);
|
|
|
|
caps->pos = NULL;
|
2004-01-26 03:54:21 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
2004-05-25 20:14:10 +00:00
|
|
|
if (caps->is_int && caps->depth > caps->width) {
|
|
|
|
GST_DEBUG ("width > depth, not allowed - make us advertise correct caps");
|
Surround sound support.
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_channels), (gst_a52dec_push),
(gst_a52dec_reneg), (gst_a52dec_loop), (plugin_init):
* ext/alsa/gstalsa.c: (gst_alsa_get_caps):
* ext/alsa/gstalsaplugin.c: (plugin_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_channels),
(gst_dtsdec_renegotiate), (gst_dtsdec_loop), (plugin_init):
* ext/faad/gstfaad.c: (gst_faad_init), (gst_faad_chanpos_from_gst),
(gst_faad_chanpos_to_gst), (gst_faad_sinkconnect),
(gst_faad_srcgetcaps), (gst_faad_srcconnect), (gst_faad_chain),
(gst_faad_change_state), (plugin_init):
* ext/faad/gstfaad.h:
* ext/vorbis/vorbis.c: (plugin_init):
* ext/vorbis/vorbisdec.c: (vorbis_dec_chain):
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/audio.c: (plugin_init):
* gst-libs/gst/audio/multichannel.c:
(gst_audio_check_channel_positions),
(gst_audio_get_channel_positions),
(gst_audio_set_channel_positions),
(gst_audio_set_structure_channel_positions_list),
(add_list_to_struct), (gst_audio_set_caps_channel_positions_list),
(gst_audio_fixate_channel_positions):
* gst-libs/gst/audio/multichannel.h:
* gst-libs/gst/audio/testchannels.c: (main):
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_getcaps),
(gst_audio_convert_parse_caps), (gst_audio_convert_link),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
* gst/audioconvert/plugin.c: (plugin_init):
Surround sound support.
2004-11-25 20:36:29 +00:00
|
|
|
g_free (caps->pos);
|
|
|
|
caps->pos = NULL;
|
2004-05-25 20:14:10 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
2004-01-26 03:54:21 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2005-03-31 09:43:49 +00:00
|
|
|
static gboolean
|
2005-05-23 17:28:02 +00:00
|
|
|
gst_audio_convert_link_src (GstAudioConvert * this,
|
|
|
|
GstCaps * sinkcaps, GstAudioConvertCaps * sink_ac_caps)
|
2003-04-14 01:20:30 +00:00
|
|
|
{
|
2005-03-31 09:43:49 +00:00
|
|
|
GstAudioConvertCaps ac_caps = { 0 };
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2005-05-23 17:28:02 +00:00
|
|
|
if (gst_pad_peer_accept_caps (this->src, sinkcaps)) {
|
2005-03-31 09:43:49 +00:00
|
|
|
/* great, so that will be our suggestion then */
|
2005-05-23 17:28:02 +00:00
|
|
|
this->src_prefered = gst_caps_ref (sinkcaps);
|
|
|
|
gst_caps_replace (&GST_RPAD_CAPS (this->src), sinkcaps);
|
|
|
|
ac_caps = *sink_ac_caps;
|
|
|
|
if (ac_caps.pos) {
|
|
|
|
ac_caps.pos = g_memdup (ac_caps.pos, sizeof (gint) * ac_caps.channels);
|
|
|
|
}
|
2004-05-24 19:19:29 +00:00
|
|
|
} else {
|
2005-03-31 09:43:49 +00:00
|
|
|
/* nope, find something we can convert to and the peer can
|
|
|
|
* accept. */
|
2005-05-23 17:28:02 +00:00
|
|
|
GstCaps *othercaps = gst_pad_peer_get_caps (this->src);
|
2005-03-31 09:43:49 +00:00
|
|
|
|
|
|
|
if (othercaps) {
|
|
|
|
/* peel off first one */
|
|
|
|
GstCaps *targetcaps = gst_caps_copy_nth (othercaps, 0);
|
|
|
|
GstStructure *structure = gst_caps_get_structure (targetcaps, 0);
|
|
|
|
|
|
|
|
gst_caps_unref (othercaps);
|
|
|
|
|
Make caps writable before writing to it.
Original commit message from CVS:
* ext/vorbis/vorbisenc.c: (gst_vorbisenc_sink_setcaps),
(gst_vorbisenc_src_query), (gst_vorbisenc_sink_query),
(gst_vorbisenc_set_header_on_caps), (gst_vorbisenc_sink_event),
(gst_vorbisenc_chain):
* gst/audioconvert/gstaudioconvert.c: (gst_audio_convert_chain),
(gst_audio_convert_caps_remove_format_info),
(gst_audio_convert_getcaps), (gst_audio_convert_setcaps),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
Make caps writable before writing to it.
Fix negotiation in audioconvert some more.
2005-05-09 17:07:27 +00:00
|
|
|
/* set the rate on the caps, this has to work */
|
2005-05-23 17:28:02 +00:00
|
|
|
gst_structure_set (structure,
|
|
|
|
"rate", G_TYPE_INT, sink_ac_caps->rate,
|
|
|
|
"channels", G_TYPE_INT, sink_ac_caps->channels, NULL);
|
Make caps writable before writing to it.
Original commit message from CVS:
* ext/vorbis/vorbisenc.c: (gst_vorbisenc_sink_setcaps),
(gst_vorbisenc_src_query), (gst_vorbisenc_sink_query),
(gst_vorbisenc_set_header_on_caps), (gst_vorbisenc_sink_event),
(gst_vorbisenc_chain):
* gst/audioconvert/gstaudioconvert.c: (gst_audio_convert_chain),
(gst_audio_convert_caps_remove_format_info),
(gst_audio_convert_getcaps), (gst_audio_convert_setcaps),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
Make caps writable before writing to it.
Fix negotiation in audioconvert some more.
2005-05-09 17:07:27 +00:00
|
|
|
|
2005-03-31 09:43:49 +00:00
|
|
|
if (strcmp (gst_structure_get_name (structure), "audio/x-raw-float") == 0) {
|
2005-05-23 17:28:02 +00:00
|
|
|
if (!sink_ac_caps->is_int) {
|
Make caps writable before writing to it.
Original commit message from CVS:
* ext/vorbis/vorbisenc.c: (gst_vorbisenc_sink_setcaps),
(gst_vorbisenc_src_query), (gst_vorbisenc_sink_query),
(gst_vorbisenc_set_header_on_caps), (gst_vorbisenc_sink_event),
(gst_vorbisenc_chain):
* gst/audioconvert/gstaudioconvert.c: (gst_audio_convert_chain),
(gst_audio_convert_caps_remove_format_info),
(gst_audio_convert_getcaps), (gst_audio_convert_setcaps),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
Make caps writable before writing to it.
Fix negotiation in audioconvert some more.
2005-05-09 17:07:27 +00:00
|
|
|
/* copy over */
|
2005-03-31 09:43:49 +00:00
|
|
|
gst_structure_set (structure, "buffer-frames", G_TYPE_INT,
|
|
|
|
ac_caps.buffer_frames, NULL);
|
|
|
|
} else {
|
Make caps writable before writing to it.
Original commit message from CVS:
* ext/vorbis/vorbisenc.c: (gst_vorbisenc_sink_setcaps),
(gst_vorbisenc_src_query), (gst_vorbisenc_sink_query),
(gst_vorbisenc_set_header_on_caps), (gst_vorbisenc_sink_event),
(gst_vorbisenc_chain):
* gst/audioconvert/gstaudioconvert.c: (gst_audio_convert_chain),
(gst_audio_convert_caps_remove_format_info),
(gst_audio_convert_getcaps), (gst_audio_convert_setcaps),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
Make caps writable before writing to it.
Fix negotiation in audioconvert some more.
2005-05-09 17:07:27 +00:00
|
|
|
/* set to anything */
|
|
|
|
gst_structure_set (structure, "buffer-frames", G_TYPE_INT, 0, NULL);
|
2005-03-31 09:43:49 +00:00
|
|
|
}
|
|
|
|
}
|
2004-02-20 14:17:57 +00:00
|
|
|
|
2005-03-31 09:43:49 +00:00
|
|
|
/* this will be our suggestion */
|
2005-05-23 17:28:02 +00:00
|
|
|
this->src_prefered = targetcaps;
|
|
|
|
if (!gst_audio_convert_parse_caps (targetcaps, &ac_caps))
|
2005-03-31 09:43:49 +00:00
|
|
|
return FALSE;
|
2005-05-23 17:28:02 +00:00
|
|
|
gst_caps_replace (&GST_RPAD_CAPS (this->src), targetcaps);
|
2005-03-31 09:43:49 +00:00
|
|
|
}
|
|
|
|
}
|
2005-05-23 17:28:02 +00:00
|
|
|
this->srccaps = ac_caps;
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (this, "negotiated pad to %" GST_PTR_FORMAT, sinkcaps);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gst_audio_convert_setcaps (GstPad * pad, GstCaps * caps)
|
|
|
|
{
|
|
|
|
GstAudioConvert *this;
|
|
|
|
GstAudioConvertCaps ac_caps = { 0 };
|
|
|
|
gboolean res;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GST_IS_PAD (pad), FALSE);
|
|
|
|
g_return_val_if_fail (GST_IS_AUDIO_CONVERT (GST_OBJECT_PARENT (pad)), FALSE);
|
|
|
|
g_return_val_if_fail (gst_caps_is_fixed (caps), FALSE);
|
|
|
|
|
|
|
|
this = GST_AUDIO_CONVERT (GST_OBJECT_PARENT (pad));
|
|
|
|
|
|
|
|
/* we'll need a new matrix after every new negotiation */
|
|
|
|
gst_audio_convert_unset_matrix (this);
|
|
|
|
|
|
|
|
ac_caps.pos = NULL;
|
|
|
|
if (!gst_audio_convert_parse_caps (caps, &ac_caps))
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
this->sink_prefered = caps;
|
|
|
|
|
|
|
|
if ((res = gst_audio_convert_link_src (this, caps, &ac_caps))) {
|
2004-01-26 03:54:21 +00:00
|
|
|
this->sinkcaps = ac_caps;
|
2005-05-23 17:28:02 +00:00
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (this, "negotiated pad to %" GST_PTR_FORMAT, caps);
|
2003-12-31 08:02:04 +00:00
|
|
|
}
|
2004-02-25 18:02:19 +00:00
|
|
|
|
2005-05-23 17:28:02 +00:00
|
|
|
return res;
|
2003-04-14 01:20:30 +00:00
|
|
|
}
|
2003-07-19 22:58:41 +00:00
|
|
|
|
2004-05-03 13:25:22 +00:00
|
|
|
/* tries to fixate the given field of the given caps to the given int value */
|
2004-03-21 02:54:37 +00:00
|
|
|
gboolean
|
|
|
|
_fixate_caps_to_int (GstCaps ** caps, const gchar * field, gint value)
|
|
|
|
{
|
2004-05-03 13:25:22 +00:00
|
|
|
GstCaps *try, *isect_lower, *isect_higher;
|
2004-03-21 02:54:37 +00:00
|
|
|
gboolean ret = FALSE;
|
|
|
|
guint i;
|
|
|
|
|
2004-05-03 13:25:22 +00:00
|
|
|
/* First try to see if we can fixate by intersecting given caps with
|
|
|
|
* simple audio caps with ranges starting/ending with value */
|
2004-04-09 18:55:10 +00:00
|
|
|
try = gst_caps_new_simple ("audio/x-raw-int", field, GST_TYPE_INT_RANGE,
|
|
|
|
G_MININT, value - 1, NULL);
|
|
|
|
gst_caps_append (try, gst_caps_new_simple ("audio/x-raw-float", field,
|
|
|
|
GST_TYPE_INT_RANGE, G_MININT, value - 1, NULL));
|
2004-05-03 13:25:22 +00:00
|
|
|
isect_lower = gst_caps_intersect (*caps, try);
|
2005-03-31 09:43:49 +00:00
|
|
|
gst_caps_unref (try);
|
2004-05-03 13:25:22 +00:00
|
|
|
|
|
|
|
if (!gst_caps_is_empty (isect_lower)) {
|
2004-04-09 18:55:10 +00:00
|
|
|
try = gst_caps_new_simple ("audio/x-raw-int", field, GST_TYPE_INT_RANGE,
|
|
|
|
value, G_MAXINT, NULL);
|
|
|
|
gst_caps_append (try, gst_caps_new_simple ("audio/x-raw-float", field,
|
|
|
|
GST_TYPE_INT_RANGE, value, G_MAXINT, NULL));
|
2004-05-03 13:25:22 +00:00
|
|
|
isect_higher = gst_caps_intersect (*caps, try);
|
2005-03-31 09:43:49 +00:00
|
|
|
gst_caps_unref (try);
|
2004-05-03 13:25:22 +00:00
|
|
|
/* FIXME: why choose to end up with the higher range, and not the fixed
|
|
|
|
* value ? */
|
|
|
|
if (!gst_caps_is_empty (isect_higher)) {
|
2005-03-31 09:43:49 +00:00
|
|
|
gst_caps_unref (*caps);
|
2004-05-03 13:25:22 +00:00
|
|
|
*caps = isect_higher;
|
2004-03-21 02:54:37 +00:00
|
|
|
ret = TRUE;
|
|
|
|
} else {
|
2005-03-31 09:43:49 +00:00
|
|
|
gst_caps_unref (isect_higher);
|
2004-03-21 02:54:37 +00:00
|
|
|
}
|
|
|
|
}
|
2005-03-31 09:43:49 +00:00
|
|
|
gst_caps_unref (isect_lower);
|
2004-05-03 13:25:22 +00:00
|
|
|
|
|
|
|
/* FIXME: why don't we already return here when ret == TRUE ? */
|
2004-03-21 02:54:37 +00:00
|
|
|
for (i = 0; i < gst_caps_get_size (*caps); i++) {
|
|
|
|
GstStructure *structure = gst_caps_get_structure (*caps, i);
|
|
|
|
|
|
|
|
if (gst_structure_has_field (structure, field))
|
|
|
|
ret |=
|
|
|
|
gst_caps_structure_fixate_field_nearest_int (structure, field, value);
|
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static GstCaps *
|
2005-03-31 09:43:49 +00:00
|
|
|
gst_audio_convert_fixate (GstPad * pad, GstCaps * caps)
|
2004-03-21 02:54:37 +00:00
|
|
|
{
|
Surround sound support.
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_channels), (gst_a52dec_push),
(gst_a52dec_reneg), (gst_a52dec_loop), (plugin_init):
* ext/alsa/gstalsa.c: (gst_alsa_get_caps):
* ext/alsa/gstalsaplugin.c: (plugin_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_channels),
(gst_dtsdec_renegotiate), (gst_dtsdec_loop), (plugin_init):
* ext/faad/gstfaad.c: (gst_faad_init), (gst_faad_chanpos_from_gst),
(gst_faad_chanpos_to_gst), (gst_faad_sinkconnect),
(gst_faad_srcgetcaps), (gst_faad_srcconnect), (gst_faad_chain),
(gst_faad_change_state), (plugin_init):
* ext/faad/gstfaad.h:
* ext/vorbis/vorbis.c: (plugin_init):
* ext/vorbis/vorbisdec.c: (vorbis_dec_chain):
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/audio.c: (plugin_init):
* gst-libs/gst/audio/multichannel.c:
(gst_audio_check_channel_positions),
(gst_audio_get_channel_positions),
(gst_audio_set_channel_positions),
(gst_audio_set_structure_channel_positions_list),
(add_list_to_struct), (gst_audio_set_caps_channel_positions_list),
(gst_audio_fixate_channel_positions):
* gst-libs/gst/audio/multichannel.h:
* gst-libs/gst/audio/testchannels.c: (main):
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_getcaps),
(gst_audio_convert_parse_caps), (gst_audio_convert_link),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
* gst/audioconvert/plugin.c: (plugin_init):
Surround sound support.
2004-11-25 20:36:29 +00:00
|
|
|
const GValue *pos_val;
|
2004-03-21 02:54:37 +00:00
|
|
|
GstAudioConvert *this =
|
|
|
|
GST_AUDIO_CONVERT (gst_object_get_parent (GST_OBJECT (pad)));
|
2005-03-31 09:43:49 +00:00
|
|
|
//GstPad *otherpad = (pad == this->sink ? this->src : this->sink);
|
2004-05-26 14:47:23 +00:00
|
|
|
GstAudioConvertCaps try, ac_caps =
|
2004-03-21 02:54:37 +00:00
|
|
|
(pad == this->sink ? this->srccaps : this->sinkcaps);
|
2004-05-26 14:47:23 +00:00
|
|
|
GstCaps *copy = gst_caps_copy (caps);
|
2004-03-21 02:54:37 +00:00
|
|
|
|
2005-03-31 09:43:49 +00:00
|
|
|
//if (!GST_PAD_IS_NEGOTIATING (otherpad)) {
|
|
|
|
try.channels = 2;
|
|
|
|
try.width = 16;
|
|
|
|
try.depth = 16;
|
|
|
|
try.endianness = G_BYTE_ORDER;
|
|
|
|
/*
|
|
|
|
} else {
|
|
|
|
try.channels = ac_caps.channels;
|
|
|
|
try.width = ac_caps.is_int ? ac_caps.width : 16;
|
|
|
|
try.depth = ac_caps.is_int ? ac_caps.depth : 16;
|
|
|
|
try.endianness = ac_caps.is_int ? ac_caps.endianness : G_BYTE_ORDER;
|
|
|
|
}
|
|
|
|
*/
|
2004-03-21 02:54:37 +00:00
|
|
|
|
Surround sound support.
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_channels), (gst_a52dec_push),
(gst_a52dec_reneg), (gst_a52dec_loop), (plugin_init):
* ext/alsa/gstalsa.c: (gst_alsa_get_caps):
* ext/alsa/gstalsaplugin.c: (plugin_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_channels),
(gst_dtsdec_renegotiate), (gst_dtsdec_loop), (plugin_init):
* ext/faad/gstfaad.c: (gst_faad_init), (gst_faad_chanpos_from_gst),
(gst_faad_chanpos_to_gst), (gst_faad_sinkconnect),
(gst_faad_srcgetcaps), (gst_faad_srcconnect), (gst_faad_chain),
(gst_faad_change_state), (plugin_init):
* ext/faad/gstfaad.h:
* ext/vorbis/vorbis.c: (plugin_init):
* ext/vorbis/vorbisdec.c: (vorbis_dec_chain):
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/audio.c: (plugin_init):
* gst-libs/gst/audio/multichannel.c:
(gst_audio_check_channel_positions),
(gst_audio_get_channel_positions),
(gst_audio_set_channel_positions),
(gst_audio_set_structure_channel_positions_list),
(add_list_to_struct), (gst_audio_set_caps_channel_positions_list),
(gst_audio_fixate_channel_positions):
* gst-libs/gst/audio/multichannel.h:
* gst-libs/gst/audio/testchannels.c: (main):
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_getcaps),
(gst_audio_convert_parse_caps), (gst_audio_convert_link),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
* gst/audioconvert/plugin.c: (plugin_init):
Surround sound support.
2004-11-25 20:36:29 +00:00
|
|
|
if (_fixate_caps_to_int (©, "channels", try.channels)) {
|
2005-01-07 18:17:52 +00:00
|
|
|
int n, c;
|
Surround sound support.
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_channels), (gst_a52dec_push),
(gst_a52dec_reneg), (gst_a52dec_loop), (plugin_init):
* ext/alsa/gstalsa.c: (gst_alsa_get_caps):
* ext/alsa/gstalsaplugin.c: (plugin_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_channels),
(gst_dtsdec_renegotiate), (gst_dtsdec_loop), (plugin_init):
* ext/faad/gstfaad.c: (gst_faad_init), (gst_faad_chanpos_from_gst),
(gst_faad_chanpos_to_gst), (gst_faad_sinkconnect),
(gst_faad_srcgetcaps), (gst_faad_srcconnect), (gst_faad_chain),
(gst_faad_change_state), (plugin_init):
* ext/faad/gstfaad.h:
* ext/vorbis/vorbis.c: (plugin_init):
* ext/vorbis/vorbisdec.c: (vorbis_dec_chain):
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/audio.c: (plugin_init):
* gst-libs/gst/audio/multichannel.c:
(gst_audio_check_channel_positions),
(gst_audio_get_channel_positions),
(gst_audio_set_channel_positions),
(gst_audio_set_structure_channel_positions_list),
(add_list_to_struct), (gst_audio_set_caps_channel_positions_list),
(gst_audio_fixate_channel_positions):
* gst-libs/gst/audio/multichannel.h:
* gst-libs/gst/audio/testchannels.c: (main):
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_getcaps),
(gst_audio_convert_parse_caps), (gst_audio_convert_link),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
* gst/audioconvert/plugin.c: (plugin_init):
Surround sound support.
2004-11-25 20:36:29 +00:00
|
|
|
|
2005-01-07 18:17:52 +00:00
|
|
|
gst_structure_get_int (gst_caps_get_structure (copy, 0), "channels", &c);
|
|
|
|
if (c > 2) {
|
Surround sound support.
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_channels), (gst_a52dec_push),
(gst_a52dec_reneg), (gst_a52dec_loop), (plugin_init):
* ext/alsa/gstalsa.c: (gst_alsa_get_caps):
* ext/alsa/gstalsaplugin.c: (plugin_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_channels),
(gst_dtsdec_renegotiate), (gst_dtsdec_loop), (plugin_init):
* ext/faad/gstfaad.c: (gst_faad_init), (gst_faad_chanpos_from_gst),
(gst_faad_chanpos_to_gst), (gst_faad_sinkconnect),
(gst_faad_srcgetcaps), (gst_faad_srcconnect), (gst_faad_chain),
(gst_faad_change_state), (plugin_init):
* ext/faad/gstfaad.h:
* ext/vorbis/vorbis.c: (plugin_init):
* ext/vorbis/vorbisdec.c: (vorbis_dec_chain):
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/audio.c: (plugin_init):
* gst-libs/gst/audio/multichannel.c:
(gst_audio_check_channel_positions),
(gst_audio_get_channel_positions),
(gst_audio_set_channel_positions),
(gst_audio_set_structure_channel_positions_list),
(add_list_to_struct), (gst_audio_set_caps_channel_positions_list),
(gst_audio_fixate_channel_positions):
* gst-libs/gst/audio/multichannel.h:
* gst-libs/gst/audio/testchannels.c: (main):
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_getcaps),
(gst_audio_convert_parse_caps), (gst_audio_convert_link),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
* gst/audioconvert/plugin.c: (plugin_init):
Surround sound support.
2004-11-25 20:36:29 +00:00
|
|
|
/* make sure we have a channelpositions structure or array here */
|
|
|
|
GstStructure *str;
|
|
|
|
|
|
|
|
for (n = 0; n < gst_caps_get_size (copy); n++) {
|
|
|
|
str = gst_caps_get_structure (copy, n);
|
|
|
|
if (!gst_structure_get_value (str, "channel-positions")) {
|
|
|
|
/* first try otherpad's positions, else anything */
|
2005-01-07 18:17:52 +00:00
|
|
|
if (ac_caps.pos != NULL && c == ac_caps.channels) {
|
Surround sound support.
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_channels), (gst_a52dec_push),
(gst_a52dec_reneg), (gst_a52dec_loop), (plugin_init):
* ext/alsa/gstalsa.c: (gst_alsa_get_caps):
* ext/alsa/gstalsaplugin.c: (plugin_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_channels),
(gst_dtsdec_renegotiate), (gst_dtsdec_loop), (plugin_init):
* ext/faad/gstfaad.c: (gst_faad_init), (gst_faad_chanpos_from_gst),
(gst_faad_chanpos_to_gst), (gst_faad_sinkconnect),
(gst_faad_srcgetcaps), (gst_faad_srcconnect), (gst_faad_chain),
(gst_faad_change_state), (plugin_init):
* ext/faad/gstfaad.h:
* ext/vorbis/vorbis.c: (plugin_init):
* ext/vorbis/vorbisdec.c: (vorbis_dec_chain):
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/audio.c: (plugin_init):
* gst-libs/gst/audio/multichannel.c:
(gst_audio_check_channel_positions),
(gst_audio_get_channel_positions),
(gst_audio_set_channel_positions),
(gst_audio_set_structure_channel_positions_list),
(add_list_to_struct), (gst_audio_set_caps_channel_positions_list),
(gst_audio_fixate_channel_positions):
* gst-libs/gst/audio/multichannel.h:
* gst-libs/gst/audio/testchannels.c: (main):
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_getcaps),
(gst_audio_convert_parse_caps), (gst_audio_convert_link),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
* gst/audioconvert/plugin.c: (plugin_init):
Surround sound support.
2004-11-25 20:36:29 +00:00
|
|
|
gst_audio_set_channel_positions (str, ac_caps.pos);
|
|
|
|
} else {
|
|
|
|
gst_audio_set_structure_channel_positions_list (str,
|
|
|
|
supported_positions, GST_AUDIO_CHANNEL_POSITION_NUM);
|
|
|
|
/* FIXME: fixate (else we'll be less fixed than we used to) */
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
/* make sure we don't */
|
|
|
|
for (n = 0; n < gst_caps_get_size (copy); n++) {
|
|
|
|
gst_structure_remove_field (gst_caps_get_structure (copy, n),
|
|
|
|
"channel-positions");
|
|
|
|
}
|
|
|
|
}
|
2004-03-21 02:54:37 +00:00
|
|
|
return copy;
|
Surround sound support.
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_channels), (gst_a52dec_push),
(gst_a52dec_reneg), (gst_a52dec_loop), (plugin_init):
* ext/alsa/gstalsa.c: (gst_alsa_get_caps):
* ext/alsa/gstalsaplugin.c: (plugin_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_channels),
(gst_dtsdec_renegotiate), (gst_dtsdec_loop), (plugin_init):
* ext/faad/gstfaad.c: (gst_faad_init), (gst_faad_chanpos_from_gst),
(gst_faad_chanpos_to_gst), (gst_faad_sinkconnect),
(gst_faad_srcgetcaps), (gst_faad_srcconnect), (gst_faad_chain),
(gst_faad_change_state), (plugin_init):
* ext/faad/gstfaad.h:
* ext/vorbis/vorbis.c: (plugin_init):
* ext/vorbis/vorbisdec.c: (vorbis_dec_chain):
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/audio.c: (plugin_init):
* gst-libs/gst/audio/multichannel.c:
(gst_audio_check_channel_positions),
(gst_audio_get_channel_positions),
(gst_audio_set_channel_positions),
(gst_audio_set_structure_channel_positions_list),
(add_list_to_struct), (gst_audio_set_caps_channel_positions_list),
(gst_audio_fixate_channel_positions):
* gst-libs/gst/audio/multichannel.h:
* gst-libs/gst/audio/testchannels.c: (main):
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_getcaps),
(gst_audio_convert_parse_caps), (gst_audio_convert_link),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
* gst/audioconvert/plugin.c: (plugin_init):
Surround sound support.
2004-11-25 20:36:29 +00:00
|
|
|
}
|
2004-05-26 14:47:23 +00:00
|
|
|
if (_fixate_caps_to_int (©, "width", try.width))
|
2004-03-21 02:54:37 +00:00
|
|
|
return copy;
|
2004-11-27 20:22:42 +00:00
|
|
|
if (gst_structure_get_name (gst_caps_get_structure (copy, 0))[12] == 'i') {
|
|
|
|
if (_fixate_caps_to_int (©, "depth", try.depth))
|
|
|
|
return copy;
|
|
|
|
}
|
2004-05-26 14:47:23 +00:00
|
|
|
if (_fixate_caps_to_int (©, "endianness", try.endianness))
|
2004-05-25 20:14:10 +00:00
|
|
|
return copy;
|
Surround sound support.
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_channels), (gst_a52dec_push),
(gst_a52dec_reneg), (gst_a52dec_loop), (plugin_init):
* ext/alsa/gstalsa.c: (gst_alsa_get_caps):
* ext/alsa/gstalsaplugin.c: (plugin_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_channels),
(gst_dtsdec_renegotiate), (gst_dtsdec_loop), (plugin_init):
* ext/faad/gstfaad.c: (gst_faad_init), (gst_faad_chanpos_from_gst),
(gst_faad_chanpos_to_gst), (gst_faad_sinkconnect),
(gst_faad_srcgetcaps), (gst_faad_srcconnect), (gst_faad_chain),
(gst_faad_change_state), (plugin_init):
* ext/faad/gstfaad.h:
* ext/vorbis/vorbis.c: (plugin_init):
* ext/vorbis/vorbisdec.c: (vorbis_dec_chain):
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/audio.c: (plugin_init):
* gst-libs/gst/audio/multichannel.c:
(gst_audio_check_channel_positions),
(gst_audio_get_channel_positions),
(gst_audio_set_channel_positions),
(gst_audio_set_structure_channel_positions_list),
(add_list_to_struct), (gst_audio_set_caps_channel_positions_list),
(gst_audio_fixate_channel_positions):
* gst-libs/gst/audio/multichannel.h:
* gst-libs/gst/audio/testchannels.c: (main):
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_getcaps),
(gst_audio_convert_parse_caps), (gst_audio_convert_link),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
* gst/audioconvert/plugin.c: (plugin_init):
Surround sound support.
2004-11-25 20:36:29 +00:00
|
|
|
if ((pos_val = gst_structure_get_value (gst_caps_get_structure (copy, 0),
|
|
|
|
"channel-positions")) != NULL) {
|
|
|
|
GstAudioChannelPosition *pos;
|
|
|
|
const GValue *pos_val_entry;
|
|
|
|
gint i;
|
|
|
|
|
|
|
|
for (i = 0; i < gst_value_list_get_size (pos_val); i++) {
|
|
|
|
pos_val_entry = gst_value_list_get_value (pos_val, i);
|
|
|
|
if (G_VALUE_TYPE (pos_val_entry) == GST_TYPE_LIST) {
|
|
|
|
/* unfixed */
|
|
|
|
pos =
|
|
|
|
gst_audio_fixate_channel_positions (gst_caps_get_structure (copy,
|
|
|
|
0));
|
|
|
|
if (pos) {
|
|
|
|
gst_audio_set_channel_positions (gst_caps_get_structure (copy, 0),
|
|
|
|
pos);
|
|
|
|
g_free (pos);
|
|
|
|
return copy;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2004-03-21 02:54:37 +00:00
|
|
|
|
2005-03-31 09:43:49 +00:00
|
|
|
gst_caps_unref (copy);
|
2004-03-21 02:54:37 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2003-04-14 01:20:30 +00:00
|
|
|
static GstElementStateReturn
|
2004-03-14 22:34:34 +00:00
|
|
|
gst_audio_convert_change_state (GstElement * element)
|
2003-04-14 01:20:30 +00:00
|
|
|
{
|
Leak fixes in oggdemux.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_internal_chain),
(gst_ogg_demux_submit_buffer), (gst_ogg_demux_get_data),
(gst_ogg_demux_chain_unlocked):
* gst/audioconvert/gstaudioconvert.c: (gst_audio_convert_chain),
(gst_audio_convert_caps_remove_format_info),
(gst_audio_convert_getcaps), (gst_audio_convert_setcaps),
(gst_audio_convert_fixate), (gst_audio_convert_change_state):
* gst/ffmpegcolorspace/gstffmpegcolorspace.c:
(gst_ffmpegcsp_getcaps), (gst_ffmpegcsp_configure_context),
(gst_ffmpegcsp_setcaps), (gst_ffmpegcsp_init),
(gst_ffmpegcsp_bufferalloc), (gst_ffmpegcsp_chain),
(gst_ffmpegcsp_change_state), (gst_ffmpegcsp_set_property),
(gst_ffmpegcsp_get_property):
* sys/xvimage/xvimagesink.c: (gst_xvimage_buffer_destroy),
(gst_xvimage_buffer_finalize), (gst_xvimage_buffer_free),
(gst_xvimage_buffer_class_init), (gst_xvimage_buffer_get_type),
(gst_xvimagesink_check_xshm_calls), (gst_xvimagesink_xvimage_new),
(gst_xvimagesink_xvimage_put), (gst_xvimagesink_imagepool_clear),
(gst_xvimagesink_setcaps), (gst_xvimagesink_change_state),
(gst_xvimagesink_show_frame), (gst_xvimagesink_buffer_free),
(gst_xvimagesink_buffer_alloc), (gst_xvimagesink_set_xwindow_id):
Leak fixes in oggdemux.
Some cleanups in audioconvert.
Make passthrough work along with buffer_alloc etc.
Make buffer_alloc and buffer recycling actually work in
xvimagesink.
2005-05-17 17:41:32 +00:00
|
|
|
GstElementStateReturn ret;
|
2003-04-14 01:20:30 +00:00
|
|
|
GstAudioConvert *this = GST_AUDIO_CONVERT (element);
|
Leak fixes in oggdemux.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_internal_chain),
(gst_ogg_demux_submit_buffer), (gst_ogg_demux_get_data),
(gst_ogg_demux_chain_unlocked):
* gst/audioconvert/gstaudioconvert.c: (gst_audio_convert_chain),
(gst_audio_convert_caps_remove_format_info),
(gst_audio_convert_getcaps), (gst_audio_convert_setcaps),
(gst_audio_convert_fixate), (gst_audio_convert_change_state):
* gst/ffmpegcolorspace/gstffmpegcolorspace.c:
(gst_ffmpegcsp_getcaps), (gst_ffmpegcsp_configure_context),
(gst_ffmpegcsp_setcaps), (gst_ffmpegcsp_init),
(gst_ffmpegcsp_bufferalloc), (gst_ffmpegcsp_chain),
(gst_ffmpegcsp_change_state), (gst_ffmpegcsp_set_property),
(gst_ffmpegcsp_get_property):
* sys/xvimage/xvimagesink.c: (gst_xvimage_buffer_destroy),
(gst_xvimage_buffer_finalize), (gst_xvimage_buffer_free),
(gst_xvimage_buffer_class_init), (gst_xvimage_buffer_get_type),
(gst_xvimagesink_check_xshm_calls), (gst_xvimagesink_xvimage_new),
(gst_xvimagesink_xvimage_put), (gst_xvimagesink_imagepool_clear),
(gst_xvimagesink_setcaps), (gst_xvimagesink_change_state),
(gst_xvimagesink_show_frame), (gst_xvimagesink_buffer_free),
(gst_xvimagesink_buffer_alloc), (gst_xvimagesink_set_xwindow_id):
Leak fixes in oggdemux.
Some cleanups in audioconvert.
Make passthrough work along with buffer_alloc etc.
Make buffer_alloc and buffer recycling actually work in
xvimagesink.
2005-05-17 17:41:32 +00:00
|
|
|
gint transition;
|
2003-04-14 01:20:30 +00:00
|
|
|
|
Leak fixes in oggdemux.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_internal_chain),
(gst_ogg_demux_submit_buffer), (gst_ogg_demux_get_data),
(gst_ogg_demux_chain_unlocked):
* gst/audioconvert/gstaudioconvert.c: (gst_audio_convert_chain),
(gst_audio_convert_caps_remove_format_info),
(gst_audio_convert_getcaps), (gst_audio_convert_setcaps),
(gst_audio_convert_fixate), (gst_audio_convert_change_state):
* gst/ffmpegcolorspace/gstffmpegcolorspace.c:
(gst_ffmpegcsp_getcaps), (gst_ffmpegcsp_configure_context),
(gst_ffmpegcsp_setcaps), (gst_ffmpegcsp_init),
(gst_ffmpegcsp_bufferalloc), (gst_ffmpegcsp_chain),
(gst_ffmpegcsp_change_state), (gst_ffmpegcsp_set_property),
(gst_ffmpegcsp_get_property):
* sys/xvimage/xvimagesink.c: (gst_xvimage_buffer_destroy),
(gst_xvimage_buffer_finalize), (gst_xvimage_buffer_free),
(gst_xvimage_buffer_class_init), (gst_xvimage_buffer_get_type),
(gst_xvimagesink_check_xshm_calls), (gst_xvimagesink_xvimage_new),
(gst_xvimagesink_xvimage_put), (gst_xvimagesink_imagepool_clear),
(gst_xvimagesink_setcaps), (gst_xvimagesink_change_state),
(gst_xvimagesink_show_frame), (gst_xvimagesink_buffer_free),
(gst_xvimagesink_buffer_alloc), (gst_xvimagesink_set_xwindow_id):
Leak fixes in oggdemux.
Some cleanups in audioconvert.
Make passthrough work along with buffer_alloc etc.
Make buffer_alloc and buffer recycling actually work in
xvimagesink.
2005-05-17 17:41:32 +00:00
|
|
|
transition = GST_STATE_TRANSITION (element);
|
|
|
|
|
|
|
|
switch (transition) {
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = parent_class->change_state (element);
|
|
|
|
|
|
|
|
switch (transition) {
|
2003-04-14 01:20:30 +00:00
|
|
|
case GST_STATE_PAUSED_TO_READY:
|
2003-07-19 22:58:41 +00:00
|
|
|
this->convert_internal = NULL;
|
gst/audioconvert/: Implement a channel mixer.
Original commit message from CVS:
* gst/audioconvert/Makefile.am:
* gst/audioconvert/gstaudioconvert.c: (gst_audio_convert_init),
(gst_audio_convert_link), (gst_audio_convert_change_state),
(gst_audio_convert_channels):
* gst/audioconvert/gstchannelmix.c:
(gst_audio_convert_unset_matrix),
(gst_audio_convert_fill_identical),
(gst_audio_convert_fill_compatible),
(gst_audio_convert_detect_pos), (gst_audio_convert_fill_one_other),
(gst_audio_convert_fill_others),
(gst_audio_convert_fill_normalize),
(gst_audio_convert_fill_matrix), (gst_audio_convert_setup_matrix),
(gst_audio_convert_passthrough), (gst_audio_convert_mix):
* gst/audioconvert/gstchannelmix.h:
Implement a channel mixer.
2004-11-28 16:09:13 +00:00
|
|
|
gst_audio_convert_unset_matrix (this);
|
Leak fixes in oggdemux.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_internal_chain),
(gst_ogg_demux_submit_buffer), (gst_ogg_demux_get_data),
(gst_ogg_demux_chain_unlocked):
* gst/audioconvert/gstaudioconvert.c: (gst_audio_convert_chain),
(gst_audio_convert_caps_remove_format_info),
(gst_audio_convert_getcaps), (gst_audio_convert_setcaps),
(gst_audio_convert_fixate), (gst_audio_convert_change_state):
* gst/ffmpegcolorspace/gstffmpegcolorspace.c:
(gst_ffmpegcsp_getcaps), (gst_ffmpegcsp_configure_context),
(gst_ffmpegcsp_setcaps), (gst_ffmpegcsp_init),
(gst_ffmpegcsp_bufferalloc), (gst_ffmpegcsp_chain),
(gst_ffmpegcsp_change_state), (gst_ffmpegcsp_set_property),
(gst_ffmpegcsp_get_property):
* sys/xvimage/xvimagesink.c: (gst_xvimage_buffer_destroy),
(gst_xvimage_buffer_finalize), (gst_xvimage_buffer_free),
(gst_xvimage_buffer_class_init), (gst_xvimage_buffer_get_type),
(gst_xvimagesink_check_xshm_calls), (gst_xvimagesink_xvimage_new),
(gst_xvimagesink_xvimage_put), (gst_xvimagesink_imagepool_clear),
(gst_xvimagesink_setcaps), (gst_xvimagesink_change_state),
(gst_xvimagesink_show_frame), (gst_xvimagesink_buffer_free),
(gst_xvimagesink_buffer_alloc), (gst_xvimagesink_set_xwindow_id):
Leak fixes in oggdemux.
Some cleanups in audioconvert.
Make passthrough work along with buffer_alloc etc.
Make buffer_alloc and buffer recycling actually work in
xvimagesink.
2005-05-17 17:41:32 +00:00
|
|
|
gst_caps_replace (&GST_RPAD_CAPS (this->sink), NULL);
|
|
|
|
gst_caps_replace (&GST_RPAD_CAPS (this->src), NULL);
|
2003-04-14 01:20:30 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
Leak fixes in oggdemux.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_internal_chain),
(gst_ogg_demux_submit_buffer), (gst_ogg_demux_get_data),
(gst_ogg_demux_chain_unlocked):
* gst/audioconvert/gstaudioconvert.c: (gst_audio_convert_chain),
(gst_audio_convert_caps_remove_format_info),
(gst_audio_convert_getcaps), (gst_audio_convert_setcaps),
(gst_audio_convert_fixate), (gst_audio_convert_change_state):
* gst/ffmpegcolorspace/gstffmpegcolorspace.c:
(gst_ffmpegcsp_getcaps), (gst_ffmpegcsp_configure_context),
(gst_ffmpegcsp_setcaps), (gst_ffmpegcsp_init),
(gst_ffmpegcsp_bufferalloc), (gst_ffmpegcsp_chain),
(gst_ffmpegcsp_change_state), (gst_ffmpegcsp_set_property),
(gst_ffmpegcsp_get_property):
* sys/xvimage/xvimagesink.c: (gst_xvimage_buffer_destroy),
(gst_xvimage_buffer_finalize), (gst_xvimage_buffer_free),
(gst_xvimage_buffer_class_init), (gst_xvimage_buffer_get_type),
(gst_xvimagesink_check_xshm_calls), (gst_xvimagesink_xvimage_new),
(gst_xvimagesink_xvimage_put), (gst_xvimagesink_imagepool_clear),
(gst_xvimagesink_setcaps), (gst_xvimagesink_change_state),
(gst_xvimagesink_show_frame), (gst_xvimagesink_buffer_free),
(gst_xvimagesink_buffer_alloc), (gst_xvimagesink_set_xwindow_id):
Leak fixes in oggdemux.
Some cleanups in audioconvert.
Make passthrough work along with buffer_alloc etc.
Make buffer_alloc and buffer recycling actually work in
xvimagesink.
2005-05-17 17:41:32 +00:00
|
|
|
return ret;
|
2003-04-14 01:20:30 +00:00
|
|
|
}
|
|
|
|
|
2003-07-19 22:58:41 +00:00
|
|
|
/* return a writable buffer of size which ideally is the same as before
|
2003-04-14 01:20:30 +00:00
|
|
|
- You must unref the new buffer
|
|
|
|
- The size of the old buffer is undefined after this operation */
|
2004-03-14 22:34:34 +00:00
|
|
|
static GstBuffer *
|
|
|
|
gst_audio_convert_get_buffer (GstBuffer * buf, guint size)
|
2003-04-14 01:20:30 +00:00
|
|
|
{
|
|
|
|
GstBuffer *ret;
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2004-07-09 10:56:51 +00:00
|
|
|
g_assert (GST_IS_BUFFER (buf));
|
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
GST_LOG
|
Port from GstData to GstMiniObject.
Original commit message from CVS:
Port from GstData to GstMiniObject.
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_dispose):
* ext/ogg/gstoggmux.c: (gst_ogg_mux_buffer_from_page),
(gst_ogg_mux_queue_pads), (gst_ogg_mux_set_header_on_caps),
(gst_ogg_mux_collected):
* ext/ogg/gstogmparse.c: (gst_ogm_parse_chain):
* ext/theora/theoradec.c: (theora_handle_comment_packet),
(theora_handle_data_packet):
* ext/theora/theoraenc.c: (theora_buffer_from_packet),
(theora_set_header_on_caps), (theora_enc_chain):
* ext/vorbis/vorbisdec.c: (vorbis_dec_sink_event),
(vorbis_handle_comment_packet):
* ext/vorbis/vorbisenc.c: (gst_vorbisenc_set_header_on_caps):
* ext/vorbis/vorbisparse.c: (vorbis_parse_set_header_on_caps):
* gst-libs/gst/audio/gstaudiofilter.c: (gst_audiofilter_chain):
* gst-libs/gst/tag/gstvorbistag.c: (gst_vorbis_tag_chain):
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_get_buffer):
* gst/playback/gstdecodebin.c: (gst_decode_bin_class_init):
* gst/playback/gstplaybasebin.c: (check_queue), (probe_triggered),
(mute_stream), (silence_stream):
* gst/playback/gstplaybin.c: (gst_play_bin_class_init):
* gst/volume/gstvolume.c: (volume_transform):
* sys/ximage/ximagesink.c: (gst_ximage_buffer_finalize),
(gst_ximage_buffer_init), (gst_ximage_buffer_class_init),
(gst_ximage_buffer_get_type), (gst_ximagesink_check_xshm_calls),
(gst_ximagesink_ximage_new), (gst_ximagesink_ximage_destroy),
(gst_ximagesink_ximage_put), (gst_ximagesink_imagepool_clear),
(gst_ximagesink_show_frame), (gst_ximagesink_buffer_free),
(gst_ximagesink_buffer_alloc):
* sys/ximage/ximagesink.h:
2005-05-16 15:35:52 +00:00
|
|
|
("new buffer of size %u requested. Current is: data: %p - size: %u",
|
|
|
|
size, buf->data, buf->size);
|
|
|
|
if (buf->size >= size && gst_buffer_is_writable (buf)) {
|
2003-04-14 01:20:30 +00:00
|
|
|
gst_buffer_ref (buf);
|
|
|
|
buf->size = size;
|
2004-03-14 22:34:34 +00:00
|
|
|
GST_LOG
|
Port from GstData to GstMiniObject.
Original commit message from CVS:
Port from GstData to GstMiniObject.
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_dispose):
* ext/ogg/gstoggmux.c: (gst_ogg_mux_buffer_from_page),
(gst_ogg_mux_queue_pads), (gst_ogg_mux_set_header_on_caps),
(gst_ogg_mux_collected):
* ext/ogg/gstogmparse.c: (gst_ogm_parse_chain):
* ext/theora/theoradec.c: (theora_handle_comment_packet),
(theora_handle_data_packet):
* ext/theora/theoraenc.c: (theora_buffer_from_packet),
(theora_set_header_on_caps), (theora_enc_chain):
* ext/vorbis/vorbisdec.c: (vorbis_dec_sink_event),
(vorbis_handle_comment_packet):
* ext/vorbis/vorbisenc.c: (gst_vorbisenc_set_header_on_caps):
* ext/vorbis/vorbisparse.c: (vorbis_parse_set_header_on_caps):
* gst-libs/gst/audio/gstaudiofilter.c: (gst_audiofilter_chain):
* gst-libs/gst/tag/gstvorbistag.c: (gst_vorbis_tag_chain):
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_get_buffer):
* gst/playback/gstdecodebin.c: (gst_decode_bin_class_init):
* gst/playback/gstplaybasebin.c: (check_queue), (probe_triggered),
(mute_stream), (silence_stream):
* gst/playback/gstplaybin.c: (gst_play_bin_class_init):
* gst/volume/gstvolume.c: (volume_transform):
* sys/ximage/ximagesink.c: (gst_ximage_buffer_finalize),
(gst_ximage_buffer_init), (gst_ximage_buffer_class_init),
(gst_ximage_buffer_get_type), (gst_ximagesink_check_xshm_calls),
(gst_ximagesink_ximage_new), (gst_ximagesink_ximage_destroy),
(gst_ximagesink_ximage_put), (gst_ximagesink_imagepool_clear),
(gst_ximagesink_show_frame), (gst_ximagesink_buffer_free),
(gst_ximagesink_buffer_alloc):
* sys/ximage/ximagesink.h:
2005-05-16 15:35:52 +00:00
|
|
|
("returning same buffer with adjusted values. data: %p - size: %u",
|
|
|
|
buf->data, buf->size);
|
2003-04-14 01:20:30 +00:00
|
|
|
return buf;
|
|
|
|
} else {
|
2004-02-20 14:17:57 +00:00
|
|
|
ret = gst_buffer_new_and_alloc (size);
|
|
|
|
g_assert (ret);
|
2005-03-31 09:43:49 +00:00
|
|
|
//gst_buffer_stamp (ret, buf);
|
Port from GstData to GstMiniObject.
Original commit message from CVS:
Port from GstData to GstMiniObject.
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_dispose):
* ext/ogg/gstoggmux.c: (gst_ogg_mux_buffer_from_page),
(gst_ogg_mux_queue_pads), (gst_ogg_mux_set_header_on_caps),
(gst_ogg_mux_collected):
* ext/ogg/gstogmparse.c: (gst_ogm_parse_chain):
* ext/theora/theoradec.c: (theora_handle_comment_packet),
(theora_handle_data_packet):
* ext/theora/theoraenc.c: (theora_buffer_from_packet),
(theora_set_header_on_caps), (theora_enc_chain):
* ext/vorbis/vorbisdec.c: (vorbis_dec_sink_event),
(vorbis_handle_comment_packet):
* ext/vorbis/vorbisenc.c: (gst_vorbisenc_set_header_on_caps):
* ext/vorbis/vorbisparse.c: (vorbis_parse_set_header_on_caps):
* gst-libs/gst/audio/gstaudiofilter.c: (gst_audiofilter_chain):
* gst-libs/gst/tag/gstvorbistag.c: (gst_vorbis_tag_chain):
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_get_buffer):
* gst/playback/gstdecodebin.c: (gst_decode_bin_class_init):
* gst/playback/gstplaybasebin.c: (check_queue), (probe_triggered),
(mute_stream), (silence_stream):
* gst/playback/gstplaybin.c: (gst_play_bin_class_init):
* gst/volume/gstvolume.c: (volume_transform):
* sys/ximage/ximagesink.c: (gst_ximage_buffer_finalize),
(gst_ximage_buffer_init), (gst_ximage_buffer_class_init),
(gst_ximage_buffer_get_type), (gst_ximagesink_check_xshm_calls),
(gst_ximagesink_ximage_new), (gst_ximagesink_ximage_destroy),
(gst_ximagesink_ximage_put), (gst_ximagesink_imagepool_clear),
(gst_ximagesink_show_frame), (gst_ximagesink_buffer_free),
(gst_ximagesink_buffer_alloc):
* sys/ximage/ximagesink.h:
2005-05-16 15:35:52 +00:00
|
|
|
GST_LOG ("returning new buffer. data: %p - size: %u", ret->data, ret->size);
|
2003-04-14 01:20:30 +00:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
}
|
2003-07-19 22:58:41 +00:00
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
static inline guint8
|
|
|
|
GUINT8_IDENTITY (guint8 x)
|
|
|
|
{
|
|
|
|
return x;
|
|
|
|
}
|
|
|
|
static inline guint8
|
|
|
|
GINT8_IDENTITY (gint8 x)
|
|
|
|
{
|
|
|
|
return x;
|
|
|
|
}
|
2003-07-19 22:58:41 +00:00
|
|
|
|
2004-03-05 21:05:26 +00:00
|
|
|
#define CONVERT_TO(to, from, type, sign, endianness, LE_FUNC, BE_FUNC) \
|
|
|
|
G_STMT_START{ \
|
|
|
|
type value; \
|
|
|
|
memcpy (&value, from, sizeof (type)); \
|
|
|
|
from -= sizeof (type); \
|
|
|
|
value = (endianness == G_LITTLE_ENDIAN) ? LE_FUNC (value) : BE_FUNC (value); \
|
|
|
|
if (sign) { \
|
|
|
|
to = value; \
|
|
|
|
} else { \
|
|
|
|
to = (gint64) value - (1 << (sizeof (type) * 8 - 1)); \
|
|
|
|
} \
|
2003-04-14 01:20:30 +00:00
|
|
|
}G_STMT_END;
|
2003-07-19 22:58:41 +00:00
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
static GstBuffer *
|
|
|
|
gst_audio_convert_buffer_to_default_format (GstAudioConvert * this,
|
|
|
|
GstBuffer * buf)
|
2003-04-14 01:20:30 +00:00
|
|
|
{
|
|
|
|
GstBuffer *ret;
|
|
|
|
gint i, count;
|
2003-04-15 03:19:08 +00:00
|
|
|
gint64 cur = 0;
|
2003-04-14 01:20:30 +00:00
|
|
|
gint32 write;
|
2003-04-15 19:10:14 +00:00
|
|
|
gint32 *dest;
|
|
|
|
guint8 *src;
|
2003-04-14 01:20:30 +00:00
|
|
|
|
2004-02-20 14:17:57 +00:00
|
|
|
if (this->sinkcaps.is_int) {
|
|
|
|
if (this->sinkcaps.width == 32 && this->sinkcaps.depth == 32 &&
|
2004-03-15 19:32:28 +00:00
|
|
|
this->sinkcaps.endianness == G_BYTE_ORDER
|
|
|
|
&& this->sinkcaps.sign == TRUE)
|
2004-02-20 14:17:57 +00:00
|
|
|
return buf;
|
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
ret =
|
2004-03-15 19:32:28 +00:00
|
|
|
gst_audio_convert_get_buffer (buf,
|
|
|
|
buf->size * 32 / this->sinkcaps.width);
|
2005-03-31 09:43:49 +00:00
|
|
|
gst_buffer_set_caps (ret, GST_RPAD_CAPS (this->src));
|
2004-02-20 14:17:57 +00:00
|
|
|
|
|
|
|
count = ret->size / 4;
|
|
|
|
src = buf->data + (count - 1) * (this->sinkcaps.width / 8);
|
|
|
|
dest = (gint32 *) ret->data;
|
|
|
|
for (i = count - 1; i >= 0; i--) {
|
|
|
|
switch (this->sinkcaps.width) {
|
2004-03-15 19:32:28 +00:00
|
|
|
case 8:
|
|
|
|
if (this->sinkcaps.sign) {
|
|
|
|
CONVERT_TO (cur, src, gint8, this->sinkcaps.sign,
|
|
|
|
this->sinkcaps.endianness, GINT8_IDENTITY, GINT8_IDENTITY);
|
|
|
|
} else {
|
|
|
|
CONVERT_TO (cur, src, guint8, this->sinkcaps.sign,
|
|
|
|
this->sinkcaps.endianness, GUINT8_IDENTITY, GUINT8_IDENTITY);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 16:
|
|
|
|
if (this->sinkcaps.sign) {
|
|
|
|
CONVERT_TO (cur, src, gint16, this->sinkcaps.sign,
|
|
|
|
this->sinkcaps.endianness, GINT16_FROM_LE, GINT16_FROM_BE);
|
|
|
|
} else {
|
|
|
|
CONVERT_TO (cur, src, guint16, this->sinkcaps.sign,
|
|
|
|
this->sinkcaps.endianness, GUINT16_FROM_LE, GUINT16_FROM_BE);
|
|
|
|
}
|
|
|
|
break;
|
configure.ac: Add dvdlpcmdec
Original commit message from CVS:
* configure.ac:
Add dvdlpcmdec
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_reset),
(free_all_buffers), (gst_mpeg2dec_alloc_buffer):
Don't push buffers if the src pad isn't negotiated yet.
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_buffer_to_default_format),
(gst_audio_convert_buffer_from_default_format):
Add support for 24-bit width.
* gst/dvdlpcmdec/.cvsignore:
* gst/dvdlpcmdec/Makefile.am:
* gst/dvdlpcmdec/gstdvdlpcmdec.c: (gst_dvdlpcmdec_get_type),
(gst_dvdlpcmdec_base_init), (gst_dvdlpcmdec_class_init),
(gst_dvdlpcm_reset), (gst_dvdlpcmdec_init), (gst_dvdlpcmdec_link),
(gst_dvdlpcmdec_chain), (gst_dvdlpcmdec_change_state),
(plugin_init):
* gst/dvdlpcmdec/gstdvdlpcmdec.h:
New decoder for rearranging DVD LPCM into our audio/x-raw-int
format. Needs support for the channels maps if someone can find
a DVD LPCM track with > 2 channels.
* gst/mpegstream/gstdvddemux.c: (gst_dvd_demux_handle_dvd_event),
(gst_dvd_demux_send_discont), (gst_dvd_demux_handle_discont),
(gst_dvd_demux_get_audio_stream), (gst_dvd_demux_process_private):
* gst/mpegstream/gstdvddemux.h:
* gst/mpegstream/gstmpegdemux.c: (gst_mpeg_demux_send_discont),
(gst_mpeg_demux_new_output_pad), (gst_mpeg_demux_init_stream),
(gst_mpeg_demux_send_subbuffer), (gst_mpeg_demux_handle_src_query):
* gst/mpegstream/gstmpegdemux.h:
* gst/mpegstream/gstmpegparse.c: (gst_mpeg_parse_reset),
(gst_mpeg_parse_parse_packhead), (gst_mpeg_parse_loop),
(gst_mpeg_parse_get_rate), (gst_mpeg_parse_convert_src),
(gst_mpeg_parse_handle_src_query),
(gst_mpeg_parse_handle_src_event):
Use audio/x-dvd-lpcm for LPCM output.
Add DTS output.
2005-02-08 11:08:15 +00:00
|
|
|
case 24:
|
|
|
|
{
|
|
|
|
/* Read 24-bits LE/BE into signed 64 host-endian */
|
|
|
|
if (this->sinkcaps.endianness == G_LITTLE_ENDIAN) {
|
|
|
|
cur = src[0] | (src[1] << 8) | (src[2] << 16);
|
|
|
|
} else {
|
|
|
|
cur = src[2] | (src[1] << 8) | (src[0] << 16);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Sign extend */
|
|
|
|
if ((this->sinkcaps.sign)
|
|
|
|
&& (cur & (1 << (this->sinkcaps.depth - 1))))
|
|
|
|
cur |= ((gint64) (-1)) ^ ((1 << this->sinkcaps.depth) - 1);
|
|
|
|
|
|
|
|
src -= 3;
|
|
|
|
}
|
|
|
|
break;
|
2004-03-15 19:32:28 +00:00
|
|
|
case 32:
|
|
|
|
if (this->sinkcaps.sign) {
|
|
|
|
CONVERT_TO (cur, src, gint32, this->sinkcaps.sign,
|
|
|
|
this->sinkcaps.endianness, GINT32_FROM_LE, GINT32_FROM_BE);
|
|
|
|
} else {
|
|
|
|
CONVERT_TO (cur, src, guint32, this->sinkcaps.sign,
|
|
|
|
this->sinkcaps.endianness, GUINT32_FROM_LE, GUINT32_FROM_BE);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
g_assert_not_reached ();
|
2004-02-20 14:17:57 +00:00
|
|
|
}
|
|
|
|
cur = cur * ((gint64) 1 << (32 - this->sinkcaps.depth));
|
2004-03-14 22:34:34 +00:00
|
|
|
cur = CLAMP (cur, -((gint64) 1 << 32), (gint64) 0x7FFFFFFF);
|
2004-02-20 14:17:57 +00:00
|
|
|
write = cur;
|
|
|
|
memcpy (&dest[i], &write, 4);
|
2003-07-19 22:58:41 +00:00
|
|
|
}
|
2004-02-20 14:17:57 +00:00
|
|
|
} else {
|
|
|
|
/* float2int */
|
|
|
|
gfloat *in;
|
|
|
|
gint32 *out;
|
2004-10-29 12:48:45 +00:00
|
|
|
float temp;
|
2004-02-20 14:17:57 +00:00
|
|
|
|
|
|
|
/* should just give the same buffer, unless it's not writable -- float is
|
|
|
|
* already 32 bits */
|
|
|
|
ret = gst_audio_convert_get_buffer (buf, buf->size);
|
2005-03-31 09:43:49 +00:00
|
|
|
gst_buffer_set_caps (ret, GST_RPAD_CAPS (this->src));
|
2004-02-20 14:17:57 +00:00
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
in = (gfloat *) GST_BUFFER_DATA (buf);
|
|
|
|
out = (gint32 *) GST_BUFFER_DATA (ret);
|
|
|
|
for (i = buf->size / sizeof (float); i > 0; i--) {
|
2004-10-29 12:48:45 +00:00
|
|
|
temp = *in * 2147483647.0f + .5;
|
|
|
|
*out = (gint32) CLAMP ((gint64) temp, -2147483648ll, 2147483647ll);
|
2004-03-04 23:30:29 +00:00
|
|
|
out++;
|
|
|
|
in++;
|
|
|
|
}
|
2003-04-14 01:20:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
gst_buffer_unref (buf);
|
|
|
|
return ret;
|
|
|
|
}
|
2003-07-19 22:58:41 +00:00
|
|
|
|
configure.ac: Add dvdlpcmdec
Original commit message from CVS:
* configure.ac:
Add dvdlpcmdec
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_reset),
(free_all_buffers), (gst_mpeg2dec_alloc_buffer):
Don't push buffers if the src pad isn't negotiated yet.
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_buffer_to_default_format),
(gst_audio_convert_buffer_from_default_format):
Add support for 24-bit width.
* gst/dvdlpcmdec/.cvsignore:
* gst/dvdlpcmdec/Makefile.am:
* gst/dvdlpcmdec/gstdvdlpcmdec.c: (gst_dvdlpcmdec_get_type),
(gst_dvdlpcmdec_base_init), (gst_dvdlpcmdec_class_init),
(gst_dvdlpcm_reset), (gst_dvdlpcmdec_init), (gst_dvdlpcmdec_link),
(gst_dvdlpcmdec_chain), (gst_dvdlpcmdec_change_state),
(plugin_init):
* gst/dvdlpcmdec/gstdvdlpcmdec.h:
New decoder for rearranging DVD LPCM into our audio/x-raw-int
format. Needs support for the channels maps if someone can find
a DVD LPCM track with > 2 channels.
* gst/mpegstream/gstdvddemux.c: (gst_dvd_demux_handle_dvd_event),
(gst_dvd_demux_send_discont), (gst_dvd_demux_handle_discont),
(gst_dvd_demux_get_audio_stream), (gst_dvd_demux_process_private):
* gst/mpegstream/gstdvddemux.h:
* gst/mpegstream/gstmpegdemux.c: (gst_mpeg_demux_send_discont),
(gst_mpeg_demux_new_output_pad), (gst_mpeg_demux_init_stream),
(gst_mpeg_demux_send_subbuffer), (gst_mpeg_demux_handle_src_query):
* gst/mpegstream/gstmpegdemux.h:
* gst/mpegstream/gstmpegparse.c: (gst_mpeg_parse_reset),
(gst_mpeg_parse_parse_packhead), (gst_mpeg_parse_loop),
(gst_mpeg_parse_get_rate), (gst_mpeg_parse_convert_src),
(gst_mpeg_parse_handle_src_query),
(gst_mpeg_parse_handle_src_event):
Use audio/x-dvd-lpcm for LPCM output.
Add DTS output.
2005-02-08 11:08:15 +00:00
|
|
|
#define POPULATE(out, format, be_func, le_func) G_STMT_START{ \
|
2004-01-26 03:54:21 +00:00
|
|
|
format val; \
|
configure.ac: Add dvdlpcmdec
Original commit message from CVS:
* configure.ac:
Add dvdlpcmdec
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_reset),
(free_all_buffers), (gst_mpeg2dec_alloc_buffer):
Don't push buffers if the src pad isn't negotiated yet.
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_buffer_to_default_format),
(gst_audio_convert_buffer_from_default_format):
Add support for 24-bit width.
* gst/dvdlpcmdec/.cvsignore:
* gst/dvdlpcmdec/Makefile.am:
* gst/dvdlpcmdec/gstdvdlpcmdec.c: (gst_dvdlpcmdec_get_type),
(gst_dvdlpcmdec_base_init), (gst_dvdlpcmdec_class_init),
(gst_dvdlpcm_reset), (gst_dvdlpcmdec_init), (gst_dvdlpcmdec_link),
(gst_dvdlpcmdec_chain), (gst_dvdlpcmdec_change_state),
(plugin_init):
* gst/dvdlpcmdec/gstdvdlpcmdec.h:
New decoder for rearranging DVD LPCM into our audio/x-raw-int
format. Needs support for the channels maps if someone can find
a DVD LPCM track with > 2 channels.
* gst/mpegstream/gstdvddemux.c: (gst_dvd_demux_handle_dvd_event),
(gst_dvd_demux_send_discont), (gst_dvd_demux_handle_discont),
(gst_dvd_demux_get_audio_stream), (gst_dvd_demux_process_private):
* gst/mpegstream/gstdvddemux.h:
* gst/mpegstream/gstmpegdemux.c: (gst_mpeg_demux_send_discont),
(gst_mpeg_demux_new_output_pad), (gst_mpeg_demux_init_stream),
(gst_mpeg_demux_send_subbuffer), (gst_mpeg_demux_handle_src_query):
* gst/mpegstream/gstmpegdemux.h:
* gst/mpegstream/gstmpegparse.c: (gst_mpeg_parse_reset),
(gst_mpeg_parse_parse_packhead), (gst_mpeg_parse_loop),
(gst_mpeg_parse_get_rate), (gst_mpeg_parse_convert_src),
(gst_mpeg_parse_handle_src_query),
(gst_mpeg_parse_handle_src_event):
Use audio/x-dvd-lpcm for LPCM output.
Add DTS output.
2005-02-08 11:08:15 +00:00
|
|
|
format* p = (format *) out; \
|
2004-01-26 03:54:21 +00:00
|
|
|
int_value >>= (32 - this->srccaps.depth); \
|
2004-03-05 21:05:26 +00:00
|
|
|
if (this->srccaps.sign) { \
|
|
|
|
val = (format) int_value; \
|
|
|
|
} else { \
|
|
|
|
val = (format) int_value + (1 << (this->srccaps.depth - 1)); \
|
|
|
|
} \
|
2004-01-26 03:54:21 +00:00
|
|
|
switch (this->srccaps.endianness) { \
|
2003-07-19 22:58:41 +00:00
|
|
|
case G_LITTLE_ENDIAN: \
|
|
|
|
val = le_func (val); \
|
|
|
|
break; \
|
|
|
|
case G_BIG_ENDIAN: \
|
|
|
|
val = be_func (val); \
|
|
|
|
break; \
|
|
|
|
default: \
|
|
|
|
g_assert_not_reached (); \
|
|
|
|
}; \
|
|
|
|
*p = val; \
|
|
|
|
p ++; \
|
configure.ac: Add dvdlpcmdec
Original commit message from CVS:
* configure.ac:
Add dvdlpcmdec
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_reset),
(free_all_buffers), (gst_mpeg2dec_alloc_buffer):
Don't push buffers if the src pad isn't negotiated yet.
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_buffer_to_default_format),
(gst_audio_convert_buffer_from_default_format):
Add support for 24-bit width.
* gst/dvdlpcmdec/.cvsignore:
* gst/dvdlpcmdec/Makefile.am:
* gst/dvdlpcmdec/gstdvdlpcmdec.c: (gst_dvdlpcmdec_get_type),
(gst_dvdlpcmdec_base_init), (gst_dvdlpcmdec_class_init),
(gst_dvdlpcm_reset), (gst_dvdlpcmdec_init), (gst_dvdlpcmdec_link),
(gst_dvdlpcmdec_chain), (gst_dvdlpcmdec_change_state),
(plugin_init):
* gst/dvdlpcmdec/gstdvdlpcmdec.h:
New decoder for rearranging DVD LPCM into our audio/x-raw-int
format. Needs support for the channels maps if someone can find
a DVD LPCM track with > 2 channels.
* gst/mpegstream/gstdvddemux.c: (gst_dvd_demux_handle_dvd_event),
(gst_dvd_demux_send_discont), (gst_dvd_demux_handle_discont),
(gst_dvd_demux_get_audio_stream), (gst_dvd_demux_process_private):
* gst/mpegstream/gstdvddemux.h:
* gst/mpegstream/gstmpegdemux.c: (gst_mpeg_demux_send_discont),
(gst_mpeg_demux_new_output_pad), (gst_mpeg_demux_init_stream),
(gst_mpeg_demux_send_subbuffer), (gst_mpeg_demux_handle_src_query):
* gst/mpegstream/gstmpegdemux.h:
* gst/mpegstream/gstmpegparse.c: (gst_mpeg_parse_reset),
(gst_mpeg_parse_parse_packhead), (gst_mpeg_parse_loop),
(gst_mpeg_parse_get_rate), (gst_mpeg_parse_convert_src),
(gst_mpeg_parse_handle_src_query),
(gst_mpeg_parse_handle_src_event):
Use audio/x-dvd-lpcm for LPCM output.
Add DTS output.
2005-02-08 11:08:15 +00:00
|
|
|
out = (guint8 *) p; \
|
2003-04-14 01:20:30 +00:00
|
|
|
}G_STMT_END
|
2003-07-19 22:58:41 +00:00
|
|
|
|
2003-04-14 01:20:30 +00:00
|
|
|
static GstBuffer *
|
2004-03-14 22:34:34 +00:00
|
|
|
gst_audio_convert_buffer_from_default_format (GstAudioConvert * this,
|
|
|
|
GstBuffer * buf)
|
2003-04-14 01:20:30 +00:00
|
|
|
{
|
|
|
|
GstBuffer *ret;
|
|
|
|
guint count, i;
|
|
|
|
gint32 *src;
|
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
if (this->srccaps.is_int && this->srccaps.width == 32
|
|
|
|
&& this->srccaps.depth == 32 && this->srccaps.endianness == G_BYTE_ORDER
|
|
|
|
&& this->srccaps.sign == TRUE)
|
2003-04-14 01:20:30 +00:00
|
|
|
return buf;
|
2003-07-19 22:58:41 +00:00
|
|
|
|
2004-03-06 13:26:12 +00:00
|
|
|
if (this->srccaps.is_int) {
|
|
|
|
guint8 *dest;
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2004-03-15 19:32:28 +00:00
|
|
|
count = buf->size / 4; /* size is undefined after gst_audio_convert_get_buffer! */
|
2004-03-14 22:34:34 +00:00
|
|
|
ret =
|
2004-03-15 19:32:28 +00:00
|
|
|
gst_audio_convert_get_buffer (buf,
|
|
|
|
buf->size * this->srccaps.width / 32);
|
2005-03-31 09:43:49 +00:00
|
|
|
gst_buffer_set_caps (ret, GST_RPAD_CAPS (this->src));
|
2003-07-19 22:58:41 +00:00
|
|
|
|
2004-03-06 13:26:12 +00:00
|
|
|
dest = ret->data;
|
|
|
|
src = (gint32 *) buf->data;
|
2003-07-19 22:58:41 +00:00
|
|
|
|
2004-03-06 13:26:12 +00:00
|
|
|
for (i = 0; i < count; i++) {
|
|
|
|
gint32 int_value = *src;
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2004-03-06 13:26:12 +00:00
|
|
|
src++;
|
|
|
|
switch (this->srccaps.width) {
|
2004-03-15 19:32:28 +00:00
|
|
|
case 8:
|
|
|
|
if (this->srccaps.sign) {
|
configure.ac: Add dvdlpcmdec
Original commit message from CVS:
* configure.ac:
Add dvdlpcmdec
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_reset),
(free_all_buffers), (gst_mpeg2dec_alloc_buffer):
Don't push buffers if the src pad isn't negotiated yet.
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_buffer_to_default_format),
(gst_audio_convert_buffer_from_default_format):
Add support for 24-bit width.
* gst/dvdlpcmdec/.cvsignore:
* gst/dvdlpcmdec/Makefile.am:
* gst/dvdlpcmdec/gstdvdlpcmdec.c: (gst_dvdlpcmdec_get_type),
(gst_dvdlpcmdec_base_init), (gst_dvdlpcmdec_class_init),
(gst_dvdlpcm_reset), (gst_dvdlpcmdec_init), (gst_dvdlpcmdec_link),
(gst_dvdlpcmdec_chain), (gst_dvdlpcmdec_change_state),
(plugin_init):
* gst/dvdlpcmdec/gstdvdlpcmdec.h:
New decoder for rearranging DVD LPCM into our audio/x-raw-int
format. Needs support for the channels maps if someone can find
a DVD LPCM track with > 2 channels.
* gst/mpegstream/gstdvddemux.c: (gst_dvd_demux_handle_dvd_event),
(gst_dvd_demux_send_discont), (gst_dvd_demux_handle_discont),
(gst_dvd_demux_get_audio_stream), (gst_dvd_demux_process_private):
* gst/mpegstream/gstdvddemux.h:
* gst/mpegstream/gstmpegdemux.c: (gst_mpeg_demux_send_discont),
(gst_mpeg_demux_new_output_pad), (gst_mpeg_demux_init_stream),
(gst_mpeg_demux_send_subbuffer), (gst_mpeg_demux_handle_src_query):
* gst/mpegstream/gstmpegdemux.h:
* gst/mpegstream/gstmpegparse.c: (gst_mpeg_parse_reset),
(gst_mpeg_parse_parse_packhead), (gst_mpeg_parse_loop),
(gst_mpeg_parse_get_rate), (gst_mpeg_parse_convert_src),
(gst_mpeg_parse_handle_src_query),
(gst_mpeg_parse_handle_src_event):
Use audio/x-dvd-lpcm for LPCM output.
Add DTS output.
2005-02-08 11:08:15 +00:00
|
|
|
POPULATE (dest, gint8, GINT8_IDENTITY, GINT8_IDENTITY);
|
2004-03-15 19:32:28 +00:00
|
|
|
} else {
|
configure.ac: Add dvdlpcmdec
Original commit message from CVS:
* configure.ac:
Add dvdlpcmdec
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_reset),
(free_all_buffers), (gst_mpeg2dec_alloc_buffer):
Don't push buffers if the src pad isn't negotiated yet.
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_buffer_to_default_format),
(gst_audio_convert_buffer_from_default_format):
Add support for 24-bit width.
* gst/dvdlpcmdec/.cvsignore:
* gst/dvdlpcmdec/Makefile.am:
* gst/dvdlpcmdec/gstdvdlpcmdec.c: (gst_dvdlpcmdec_get_type),
(gst_dvdlpcmdec_base_init), (gst_dvdlpcmdec_class_init),
(gst_dvdlpcm_reset), (gst_dvdlpcmdec_init), (gst_dvdlpcmdec_link),
(gst_dvdlpcmdec_chain), (gst_dvdlpcmdec_change_state),
(plugin_init):
* gst/dvdlpcmdec/gstdvdlpcmdec.h:
New decoder for rearranging DVD LPCM into our audio/x-raw-int
format. Needs support for the channels maps if someone can find
a DVD LPCM track with > 2 channels.
* gst/mpegstream/gstdvddemux.c: (gst_dvd_demux_handle_dvd_event),
(gst_dvd_demux_send_discont), (gst_dvd_demux_handle_discont),
(gst_dvd_demux_get_audio_stream), (gst_dvd_demux_process_private):
* gst/mpegstream/gstdvddemux.h:
* gst/mpegstream/gstmpegdemux.c: (gst_mpeg_demux_send_discont),
(gst_mpeg_demux_new_output_pad), (gst_mpeg_demux_init_stream),
(gst_mpeg_demux_send_subbuffer), (gst_mpeg_demux_handle_src_query):
* gst/mpegstream/gstmpegdemux.h:
* gst/mpegstream/gstmpegparse.c: (gst_mpeg_parse_reset),
(gst_mpeg_parse_parse_packhead), (gst_mpeg_parse_loop),
(gst_mpeg_parse_get_rate), (gst_mpeg_parse_convert_src),
(gst_mpeg_parse_handle_src_query),
(gst_mpeg_parse_handle_src_event):
Use audio/x-dvd-lpcm for LPCM output.
Add DTS output.
2005-02-08 11:08:15 +00:00
|
|
|
POPULATE (dest, guint8, GUINT8_IDENTITY, GUINT8_IDENTITY);
|
2004-03-15 19:32:28 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 16:
|
|
|
|
if (this->srccaps.sign) {
|
configure.ac: Add dvdlpcmdec
Original commit message from CVS:
* configure.ac:
Add dvdlpcmdec
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_reset),
(free_all_buffers), (gst_mpeg2dec_alloc_buffer):
Don't push buffers if the src pad isn't negotiated yet.
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_buffer_to_default_format),
(gst_audio_convert_buffer_from_default_format):
Add support for 24-bit width.
* gst/dvdlpcmdec/.cvsignore:
* gst/dvdlpcmdec/Makefile.am:
* gst/dvdlpcmdec/gstdvdlpcmdec.c: (gst_dvdlpcmdec_get_type),
(gst_dvdlpcmdec_base_init), (gst_dvdlpcmdec_class_init),
(gst_dvdlpcm_reset), (gst_dvdlpcmdec_init), (gst_dvdlpcmdec_link),
(gst_dvdlpcmdec_chain), (gst_dvdlpcmdec_change_state),
(plugin_init):
* gst/dvdlpcmdec/gstdvdlpcmdec.h:
New decoder for rearranging DVD LPCM into our audio/x-raw-int
format. Needs support for the channels maps if someone can find
a DVD LPCM track with > 2 channels.
* gst/mpegstream/gstdvddemux.c: (gst_dvd_demux_handle_dvd_event),
(gst_dvd_demux_send_discont), (gst_dvd_demux_handle_discont),
(gst_dvd_demux_get_audio_stream), (gst_dvd_demux_process_private):
* gst/mpegstream/gstdvddemux.h:
* gst/mpegstream/gstmpegdemux.c: (gst_mpeg_demux_send_discont),
(gst_mpeg_demux_new_output_pad), (gst_mpeg_demux_init_stream),
(gst_mpeg_demux_send_subbuffer), (gst_mpeg_demux_handle_src_query):
* gst/mpegstream/gstmpegdemux.h:
* gst/mpegstream/gstmpegparse.c: (gst_mpeg_parse_reset),
(gst_mpeg_parse_parse_packhead), (gst_mpeg_parse_loop),
(gst_mpeg_parse_get_rate), (gst_mpeg_parse_convert_src),
(gst_mpeg_parse_handle_src_query),
(gst_mpeg_parse_handle_src_event):
Use audio/x-dvd-lpcm for LPCM output.
Add DTS output.
2005-02-08 11:08:15 +00:00
|
|
|
POPULATE (dest, gint16, GINT16_TO_BE, GINT16_TO_LE);
|
|
|
|
} else {
|
|
|
|
POPULATE (dest, guint16, GUINT16_TO_BE, GUINT16_TO_LE);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 24:
|
|
|
|
{
|
|
|
|
guint8 tmp[4];
|
|
|
|
guint8 *tmpp = tmp;
|
|
|
|
|
|
|
|
/* Write out big endian array */
|
|
|
|
if (this->srccaps.sign) {
|
|
|
|
POPULATE (tmpp, gint32, GINT32_TO_BE, GINT32_TO_BE);
|
2004-03-15 19:32:28 +00:00
|
|
|
} else {
|
configure.ac: Add dvdlpcmdec
Original commit message from CVS:
* configure.ac:
Add dvdlpcmdec
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_reset),
(free_all_buffers), (gst_mpeg2dec_alloc_buffer):
Don't push buffers if the src pad isn't negotiated yet.
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_buffer_to_default_format),
(gst_audio_convert_buffer_from_default_format):
Add support for 24-bit width.
* gst/dvdlpcmdec/.cvsignore:
* gst/dvdlpcmdec/Makefile.am:
* gst/dvdlpcmdec/gstdvdlpcmdec.c: (gst_dvdlpcmdec_get_type),
(gst_dvdlpcmdec_base_init), (gst_dvdlpcmdec_class_init),
(gst_dvdlpcm_reset), (gst_dvdlpcmdec_init), (gst_dvdlpcmdec_link),
(gst_dvdlpcmdec_chain), (gst_dvdlpcmdec_change_state),
(plugin_init):
* gst/dvdlpcmdec/gstdvdlpcmdec.h:
New decoder for rearranging DVD LPCM into our audio/x-raw-int
format. Needs support for the channels maps if someone can find
a DVD LPCM track with > 2 channels.
* gst/mpegstream/gstdvddemux.c: (gst_dvd_demux_handle_dvd_event),
(gst_dvd_demux_send_discont), (gst_dvd_demux_handle_discont),
(gst_dvd_demux_get_audio_stream), (gst_dvd_demux_process_private):
* gst/mpegstream/gstdvddemux.h:
* gst/mpegstream/gstmpegdemux.c: (gst_mpeg_demux_send_discont),
(gst_mpeg_demux_new_output_pad), (gst_mpeg_demux_init_stream),
(gst_mpeg_demux_send_subbuffer), (gst_mpeg_demux_handle_src_query):
* gst/mpegstream/gstmpegdemux.h:
* gst/mpegstream/gstmpegparse.c: (gst_mpeg_parse_reset),
(gst_mpeg_parse_parse_packhead), (gst_mpeg_parse_loop),
(gst_mpeg_parse_get_rate), (gst_mpeg_parse_convert_src),
(gst_mpeg_parse_handle_src_query),
(gst_mpeg_parse_handle_src_event):
Use audio/x-dvd-lpcm for LPCM output.
Add DTS output.
2005-02-08 11:08:15 +00:00
|
|
|
POPULATE (tmpp, guint32, GUINT32_TO_BE, GUINT32_TO_BE);
|
2004-03-15 19:32:28 +00:00
|
|
|
}
|
configure.ac: Add dvdlpcmdec
Original commit message from CVS:
* configure.ac:
Add dvdlpcmdec
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_reset),
(free_all_buffers), (gst_mpeg2dec_alloc_buffer):
Don't push buffers if the src pad isn't negotiated yet.
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_buffer_to_default_format),
(gst_audio_convert_buffer_from_default_format):
Add support for 24-bit width.
* gst/dvdlpcmdec/.cvsignore:
* gst/dvdlpcmdec/Makefile.am:
* gst/dvdlpcmdec/gstdvdlpcmdec.c: (gst_dvdlpcmdec_get_type),
(gst_dvdlpcmdec_base_init), (gst_dvdlpcmdec_class_init),
(gst_dvdlpcm_reset), (gst_dvdlpcmdec_init), (gst_dvdlpcmdec_link),
(gst_dvdlpcmdec_chain), (gst_dvdlpcmdec_change_state),
(plugin_init):
* gst/dvdlpcmdec/gstdvdlpcmdec.h:
New decoder for rearranging DVD LPCM into our audio/x-raw-int
format. Needs support for the channels maps if someone can find
a DVD LPCM track with > 2 channels.
* gst/mpegstream/gstdvddemux.c: (gst_dvd_demux_handle_dvd_event),
(gst_dvd_demux_send_discont), (gst_dvd_demux_handle_discont),
(gst_dvd_demux_get_audio_stream), (gst_dvd_demux_process_private):
* gst/mpegstream/gstdvddemux.h:
* gst/mpegstream/gstmpegdemux.c: (gst_mpeg_demux_send_discont),
(gst_mpeg_demux_new_output_pad), (gst_mpeg_demux_init_stream),
(gst_mpeg_demux_send_subbuffer), (gst_mpeg_demux_handle_src_query):
* gst/mpegstream/gstmpegdemux.h:
* gst/mpegstream/gstmpegparse.c: (gst_mpeg_parse_reset),
(gst_mpeg_parse_parse_packhead), (gst_mpeg_parse_loop),
(gst_mpeg_parse_get_rate), (gst_mpeg_parse_convert_src),
(gst_mpeg_parse_handle_src_query),
(gst_mpeg_parse_handle_src_event):
Use audio/x-dvd-lpcm for LPCM output.
Add DTS output.
2005-02-08 11:08:15 +00:00
|
|
|
|
|
|
|
if (this->srccaps.endianness == G_LITTLE_ENDIAN) {
|
|
|
|
dest[2] = tmp[1];
|
|
|
|
dest[1] = tmp[2];
|
|
|
|
dest[0] = tmp[3];
|
|
|
|
} else {
|
|
|
|
memcpy (dest, tmp + 1, 3);
|
|
|
|
}
|
|
|
|
dest += 3;
|
|
|
|
}
|
2004-03-15 19:32:28 +00:00
|
|
|
break;
|
|
|
|
case 32:
|
|
|
|
if (this->srccaps.sign) {
|
configure.ac: Add dvdlpcmdec
Original commit message from CVS:
* configure.ac:
Add dvdlpcmdec
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_reset),
(free_all_buffers), (gst_mpeg2dec_alloc_buffer):
Don't push buffers if the src pad isn't negotiated yet.
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_buffer_to_default_format),
(gst_audio_convert_buffer_from_default_format):
Add support for 24-bit width.
* gst/dvdlpcmdec/.cvsignore:
* gst/dvdlpcmdec/Makefile.am:
* gst/dvdlpcmdec/gstdvdlpcmdec.c: (gst_dvdlpcmdec_get_type),
(gst_dvdlpcmdec_base_init), (gst_dvdlpcmdec_class_init),
(gst_dvdlpcm_reset), (gst_dvdlpcmdec_init), (gst_dvdlpcmdec_link),
(gst_dvdlpcmdec_chain), (gst_dvdlpcmdec_change_state),
(plugin_init):
* gst/dvdlpcmdec/gstdvdlpcmdec.h:
New decoder for rearranging DVD LPCM into our audio/x-raw-int
format. Needs support for the channels maps if someone can find
a DVD LPCM track with > 2 channels.
* gst/mpegstream/gstdvddemux.c: (gst_dvd_demux_handle_dvd_event),
(gst_dvd_demux_send_discont), (gst_dvd_demux_handle_discont),
(gst_dvd_demux_get_audio_stream), (gst_dvd_demux_process_private):
* gst/mpegstream/gstdvddemux.h:
* gst/mpegstream/gstmpegdemux.c: (gst_mpeg_demux_send_discont),
(gst_mpeg_demux_new_output_pad), (gst_mpeg_demux_init_stream),
(gst_mpeg_demux_send_subbuffer), (gst_mpeg_demux_handle_src_query):
* gst/mpegstream/gstmpegdemux.h:
* gst/mpegstream/gstmpegparse.c: (gst_mpeg_parse_reset),
(gst_mpeg_parse_parse_packhead), (gst_mpeg_parse_loop),
(gst_mpeg_parse_get_rate), (gst_mpeg_parse_convert_src),
(gst_mpeg_parse_handle_src_query),
(gst_mpeg_parse_handle_src_event):
Use audio/x-dvd-lpcm for LPCM output.
Add DTS output.
2005-02-08 11:08:15 +00:00
|
|
|
POPULATE (dest, gint32, GINT32_TO_BE, GINT32_TO_LE);
|
2004-03-15 19:32:28 +00:00
|
|
|
} else {
|
configure.ac: Add dvdlpcmdec
Original commit message from CVS:
* configure.ac:
Add dvdlpcmdec
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_reset),
(free_all_buffers), (gst_mpeg2dec_alloc_buffer):
Don't push buffers if the src pad isn't negotiated yet.
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_buffer_to_default_format),
(gst_audio_convert_buffer_from_default_format):
Add support for 24-bit width.
* gst/dvdlpcmdec/.cvsignore:
* gst/dvdlpcmdec/Makefile.am:
* gst/dvdlpcmdec/gstdvdlpcmdec.c: (gst_dvdlpcmdec_get_type),
(gst_dvdlpcmdec_base_init), (gst_dvdlpcmdec_class_init),
(gst_dvdlpcm_reset), (gst_dvdlpcmdec_init), (gst_dvdlpcmdec_link),
(gst_dvdlpcmdec_chain), (gst_dvdlpcmdec_change_state),
(plugin_init):
* gst/dvdlpcmdec/gstdvdlpcmdec.h:
New decoder for rearranging DVD LPCM into our audio/x-raw-int
format. Needs support for the channels maps if someone can find
a DVD LPCM track with > 2 channels.
* gst/mpegstream/gstdvddemux.c: (gst_dvd_demux_handle_dvd_event),
(gst_dvd_demux_send_discont), (gst_dvd_demux_handle_discont),
(gst_dvd_demux_get_audio_stream), (gst_dvd_demux_process_private):
* gst/mpegstream/gstdvddemux.h:
* gst/mpegstream/gstmpegdemux.c: (gst_mpeg_demux_send_discont),
(gst_mpeg_demux_new_output_pad), (gst_mpeg_demux_init_stream),
(gst_mpeg_demux_send_subbuffer), (gst_mpeg_demux_handle_src_query):
* gst/mpegstream/gstmpegdemux.h:
* gst/mpegstream/gstmpegparse.c: (gst_mpeg_parse_reset),
(gst_mpeg_parse_parse_packhead), (gst_mpeg_parse_loop),
(gst_mpeg_parse_get_rate), (gst_mpeg_parse_convert_src),
(gst_mpeg_parse_handle_src_query),
(gst_mpeg_parse_handle_src_event):
Use audio/x-dvd-lpcm for LPCM output.
Add DTS output.
2005-02-08 11:08:15 +00:00
|
|
|
POPULATE (dest, guint32, GUINT32_TO_BE, GUINT32_TO_LE);
|
2004-03-15 19:32:28 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
g_assert_not_reached ();
|
2004-03-06 13:26:12 +00:00
|
|
|
}
|
2003-07-19 22:58:41 +00:00
|
|
|
}
|
2004-03-06 13:26:12 +00:00
|
|
|
} else {
|
|
|
|
gfloat *dest;
|
|
|
|
|
|
|
|
/* 1 / (2^31-1) * i */
|
2004-03-14 22:34:34 +00:00
|
|
|
#define INT2FLOAT(i) (4.6566128752457969e-10 * ((gfloat)i))
|
2004-03-15 19:32:28 +00:00
|
|
|
count = buf->size / 4; /* size is undefined after gst_audio_convert_get_buffer! */
|
2004-03-14 22:34:34 +00:00
|
|
|
ret =
|
2004-03-15 19:32:28 +00:00
|
|
|
gst_audio_convert_get_buffer (buf,
|
|
|
|
buf->size * this->srccaps.width / 32);
|
2005-03-31 09:43:49 +00:00
|
|
|
gst_buffer_set_caps (ret, GST_RPAD_CAPS (this->src));
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2004-03-06 13:26:12 +00:00
|
|
|
dest = (gfloat *) ret->data;
|
|
|
|
src = (gint32 *) buf->data;
|
|
|
|
for (i = 0; i < count; i++) {
|
2004-03-14 22:34:34 +00:00
|
|
|
*dest = (4.6566128752457969e-10 * ((gfloat) * src));
|
2004-03-06 13:26:12 +00:00
|
|
|
dest++;
|
|
|
|
src++;
|
2003-04-14 01:20:30 +00:00
|
|
|
}
|
|
|
|
}
|
2003-07-19 22:58:41 +00:00
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
gst_buffer_unref (buf);
|
2003-04-14 01:20:30 +00:00
|
|
|
return ret;
|
|
|
|
}
|
2003-07-19 22:58:41 +00:00
|
|
|
|
2003-04-14 01:20:30 +00:00
|
|
|
static GstBuffer *
|
2004-03-14 22:34:34 +00:00
|
|
|
gst_audio_convert_channels (GstAudioConvert * this, GstBuffer * buf)
|
2003-04-14 01:20:30 +00:00
|
|
|
{
|
|
|
|
GstBuffer *ret;
|
gst/audioconvert/: Implement a channel mixer.
Original commit message from CVS:
* gst/audioconvert/Makefile.am:
* gst/audioconvert/gstaudioconvert.c: (gst_audio_convert_init),
(gst_audio_convert_link), (gst_audio_convert_change_state),
(gst_audio_convert_channels):
* gst/audioconvert/gstchannelmix.c:
(gst_audio_convert_unset_matrix),
(gst_audio_convert_fill_identical),
(gst_audio_convert_fill_compatible),
(gst_audio_convert_detect_pos), (gst_audio_convert_fill_one_other),
(gst_audio_convert_fill_others),
(gst_audio_convert_fill_normalize),
(gst_audio_convert_fill_matrix), (gst_audio_convert_setup_matrix),
(gst_audio_convert_passthrough), (gst_audio_convert_mix):
* gst/audioconvert/gstchannelmix.h:
Implement a channel mixer.
2004-11-28 16:09:13 +00:00
|
|
|
gint count;
|
Surround sound support.
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_channels), (gst_a52dec_push),
(gst_a52dec_reneg), (gst_a52dec_loop), (plugin_init):
* ext/alsa/gstalsa.c: (gst_alsa_get_caps):
* ext/alsa/gstalsaplugin.c: (plugin_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_channels),
(gst_dtsdec_renegotiate), (gst_dtsdec_loop), (plugin_init):
* ext/faad/gstfaad.c: (gst_faad_init), (gst_faad_chanpos_from_gst),
(gst_faad_chanpos_to_gst), (gst_faad_sinkconnect),
(gst_faad_srcgetcaps), (gst_faad_srcconnect), (gst_faad_chain),
(gst_faad_change_state), (plugin_init):
* ext/faad/gstfaad.h:
* ext/vorbis/vorbis.c: (plugin_init):
* ext/vorbis/vorbisdec.c: (vorbis_dec_chain):
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/audio.c: (plugin_init):
* gst-libs/gst/audio/multichannel.c:
(gst_audio_check_channel_positions),
(gst_audio_get_channel_positions),
(gst_audio_set_channel_positions),
(gst_audio_set_structure_channel_positions_list),
(add_list_to_struct), (gst_audio_set_caps_channel_positions_list),
(gst_audio_fixate_channel_positions):
* gst-libs/gst/audio/multichannel.h:
* gst-libs/gst/audio/testchannels.c: (main):
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_getcaps),
(gst_audio_convert_parse_caps), (gst_audio_convert_link),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
* gst/audioconvert/plugin.c: (plugin_init):
Surround sound support.
2004-11-25 20:36:29 +00:00
|
|
|
|
2005-02-13 17:39:22 +00:00
|
|
|
g_assert (this->matrix != NULL);
|
2005-03-31 09:43:49 +00:00
|
|
|
|
gst/audioconvert/: Implement a channel mixer.
Original commit message from CVS:
* gst/audioconvert/Makefile.am:
* gst/audioconvert/gstaudioconvert.c: (gst_audio_convert_init),
(gst_audio_convert_link), (gst_audio_convert_change_state),
(gst_audio_convert_channels):
* gst/audioconvert/gstchannelmix.c:
(gst_audio_convert_unset_matrix),
(gst_audio_convert_fill_identical),
(gst_audio_convert_fill_compatible),
(gst_audio_convert_detect_pos), (gst_audio_convert_fill_one_other),
(gst_audio_convert_fill_others),
(gst_audio_convert_fill_normalize),
(gst_audio_convert_fill_matrix), (gst_audio_convert_setup_matrix),
(gst_audio_convert_passthrough), (gst_audio_convert_mix):
* gst/audioconvert/gstchannelmix.h:
Implement a channel mixer.
2004-11-28 16:09:13 +00:00
|
|
|
/* check for passthrough */
|
|
|
|
if (gst_audio_convert_passthrough (this))
|
|
|
|
return buf;
|
2003-04-14 01:20:30 +00:00
|
|
|
|
gst/audioconvert/: Implement a channel mixer.
Original commit message from CVS:
* gst/audioconvert/Makefile.am:
* gst/audioconvert/gstaudioconvert.c: (gst_audio_convert_init),
(gst_audio_convert_link), (gst_audio_convert_change_state),
(gst_audio_convert_channels):
* gst/audioconvert/gstchannelmix.c:
(gst_audio_convert_unset_matrix),
(gst_audio_convert_fill_identical),
(gst_audio_convert_fill_compatible),
(gst_audio_convert_detect_pos), (gst_audio_convert_fill_one_other),
(gst_audio_convert_fill_others),
(gst_audio_convert_fill_normalize),
(gst_audio_convert_fill_matrix), (gst_audio_convert_setup_matrix),
(gst_audio_convert_passthrough), (gst_audio_convert_mix):
* gst/audioconvert/gstchannelmix.h:
Implement a channel mixer.
2004-11-28 16:09:13 +00:00
|
|
|
/* convert */
|
|
|
|
count = GST_BUFFER_SIZE (buf) / 4 / this->sinkcaps.channels;
|
|
|
|
ret = gst_audio_convert_get_buffer (buf, count * 4 * this->srccaps.channels);
|
2005-03-31 09:43:49 +00:00
|
|
|
gst_buffer_set_caps (ret, GST_RPAD_CAPS (this->src));
|
gst/audioconvert/: Implement a channel mixer.
Original commit message from CVS:
* gst/audioconvert/Makefile.am:
* gst/audioconvert/gstaudioconvert.c: (gst_audio_convert_init),
(gst_audio_convert_link), (gst_audio_convert_change_state),
(gst_audio_convert_channels):
* gst/audioconvert/gstchannelmix.c:
(gst_audio_convert_unset_matrix),
(gst_audio_convert_fill_identical),
(gst_audio_convert_fill_compatible),
(gst_audio_convert_detect_pos), (gst_audio_convert_fill_one_other),
(gst_audio_convert_fill_others),
(gst_audio_convert_fill_normalize),
(gst_audio_convert_fill_matrix), (gst_audio_convert_setup_matrix),
(gst_audio_convert_passthrough), (gst_audio_convert_mix):
* gst/audioconvert/gstchannelmix.h:
Implement a channel mixer.
2004-11-28 16:09:13 +00:00
|
|
|
gst_audio_convert_mix (this, (gint32 *) GST_BUFFER_DATA (buf),
|
|
|
|
(gint32 *) GST_BUFFER_DATA (ret), count);
|
2004-03-14 22:34:34 +00:00
|
|
|
gst_buffer_unref (buf);
|
gst/audioconvert/: Implement a channel mixer.
Original commit message from CVS:
* gst/audioconvert/Makefile.am:
* gst/audioconvert/gstaudioconvert.c: (gst_audio_convert_init),
(gst_audio_convert_link), (gst_audio_convert_change_state),
(gst_audio_convert_channels):
* gst/audioconvert/gstchannelmix.c:
(gst_audio_convert_unset_matrix),
(gst_audio_convert_fill_identical),
(gst_audio_convert_fill_compatible),
(gst_audio_convert_detect_pos), (gst_audio_convert_fill_one_other),
(gst_audio_convert_fill_others),
(gst_audio_convert_fill_normalize),
(gst_audio_convert_fill_matrix), (gst_audio_convert_setup_matrix),
(gst_audio_convert_passthrough), (gst_audio_convert_mix):
* gst/audioconvert/gstchannelmix.h:
Implement a channel mixer.
2004-11-28 16:09:13 +00:00
|
|
|
|
2003-04-14 01:20:30 +00:00
|
|
|
return ret;
|
|
|
|
}
|