2003-05-29 14:35:24 +00:00
|
|
|
/* GStreamer
|
|
|
|
* Copyright (C) 2003 Martin Soto <martinsoto@users.sourceforge.net>
|
|
|
|
*
|
|
|
|
* dxr3audiosink.c: Audio sink for em8300 based DVD cards.
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
2003-06-29 19:46:13 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
2003-05-29 14:35:24 +00:00
|
|
|
#include <errno.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <fcntl.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <sys/ioctl.h>
|
|
|
|
|
|
|
|
#include <linux/soundcard.h>
|
|
|
|
#include <linux/em8300.h>
|
|
|
|
|
2004-01-20 13:34:41 +00:00
|
|
|
#include <gst/gst-i18n-plugin.h>
|
2003-05-29 14:35:24 +00:00
|
|
|
#include <gst/gst.h>
|
|
|
|
|
|
|
|
#include "dxr3audiosink.h"
|
|
|
|
#include "dxr3marshal.h"
|
|
|
|
#include "dxr3common.h"
|
|
|
|
|
|
|
|
/* Our only supported AC3 byte rate. */
|
|
|
|
#define AC3_BYTE_RATE 48000
|
|
|
|
|
|
|
|
/* Determines the amount of time to play the given number of bytes of
|
|
|
|
the original AC3 stream. The result is expressed as MPEG2. */
|
|
|
|
#define TIME_FOR_BYTES(bytes) (((bytes) * 90) / 48)
|
|
|
|
|
|
|
|
|
|
|
|
/* ElementFactory information. */
|
|
|
|
static GstElementDetails dxr3audiosink_details = {
|
|
|
|
"dxr3/Hollywood+ mpeg decoder board audio plugin",
|
2003-11-02 17:13:40 +00:00
|
|
|
"Audio/Sink",
|
2003-05-29 14:35:24 +00:00
|
|
|
"Feeds audio to Sigma Designs em8300 based boards",
|
2003-11-02 17:13:40 +00:00
|
|
|
"Martin Soto <martinsoto@users.sourceforge.net>"
|
2003-05-29 14:35:24 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/* Dxr3AudioSink signals and args */
|
2004-03-14 22:34:33 +00:00
|
|
|
enum
|
|
|
|
{
|
2003-05-29 14:35:24 +00:00
|
|
|
SIGNAL_FLUSHED,
|
|
|
|
LAST_SIGNAL
|
|
|
|
};
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
enum
|
|
|
|
{
|
2003-05-29 14:35:24 +00:00
|
|
|
ARG_0,
|
|
|
|
ARG_DIGITAL_PCM
|
|
|
|
};
|
|
|
|
|
Fix caps breakage after Dave's caps branch merge.
Original commit message from CVS:
2003-12-23 Ronald Bultje <rbultje@ronald.bitfreak.net>
* ext/divx/gstdivxdec.c: (gst_divxdec_base_init),
(gst_divxdec_init), (gst_divxdec_negotiate):
* ext/divx/gstdivxdec.h:
* ext/divx/gstdivxenc.c: (gst_divxenc_base_init),
(gst_divxenc_init):
* ext/faac/gstfaac.c: (gst_faac_base_init), (gst_faac_init),
(gst_faac_sinkconnect), (gst_faac_srcconnect):
* ext/mpeg2enc/gstmpeg2enc.cc:
* ext/mpeg2enc/gstmpeg2encoder.cc:
* ext/mpeg2enc/gstmpeg2encpicturereader.cc:
* sys/dxr3/dxr3audiosink.c: (dxr3audiosink_base_init),
(dxr3audiosink_init), (dxr3audiosink_pcm_sinklink):
* sys/dxr3/dxr3spusink.c: (dxr3spusink_base_init),
(dxr3spusink_init):
* sys/dxr3/dxr3videosink.c: (dxr3videosink_base_init),
(dxr3videosink_init):
Fix caps breakage after Dave's caps branch merge.
2003-12-23 22:50:06 +00:00
|
|
|
static GstStaticPadTemplate dxr3audiosink_pcm_sink_factory =
|
2004-03-14 22:34:33 +00:00
|
|
|
GST_STATIC_PAD_TEMPLATE ("pcm_sink",
|
|
|
|
GST_PAD_SINK,
|
|
|
|
GST_PAD_ALWAYS,
|
|
|
|
GST_STATIC_CAPS ("audio/x-raw-int, "
|
2004-03-15 19:32:27 +00:00
|
|
|
"endianness = (int) BYTE_ORDER, "
|
|
|
|
"signed = (boolean) TRUE, "
|
|
|
|
"width = (int) 16, "
|
|
|
|
"depth = (int) 16, "
|
|
|
|
"rate = (int) { 32000, 44100, 48000, 66000 }, " "channels = (int) 2")
|
2004-03-14 22:34:33 +00:00
|
|
|
);
|
2003-05-29 14:35:24 +00:00
|
|
|
|
Fix caps breakage after Dave's caps branch merge.
Original commit message from CVS:
2003-12-23 Ronald Bultje <rbultje@ronald.bitfreak.net>
* ext/divx/gstdivxdec.c: (gst_divxdec_base_init),
(gst_divxdec_init), (gst_divxdec_negotiate):
* ext/divx/gstdivxdec.h:
* ext/divx/gstdivxenc.c: (gst_divxenc_base_init),
(gst_divxenc_init):
* ext/faac/gstfaac.c: (gst_faac_base_init), (gst_faac_init),
(gst_faac_sinkconnect), (gst_faac_srcconnect):
* ext/mpeg2enc/gstmpeg2enc.cc:
* ext/mpeg2enc/gstmpeg2encoder.cc:
* ext/mpeg2enc/gstmpeg2encpicturereader.cc:
* sys/dxr3/dxr3audiosink.c: (dxr3audiosink_base_init),
(dxr3audiosink_init), (dxr3audiosink_pcm_sinklink):
* sys/dxr3/dxr3spusink.c: (dxr3spusink_base_init),
(dxr3spusink_init):
* sys/dxr3/dxr3videosink.c: (dxr3videosink_base_init),
(dxr3videosink_init):
Fix caps breakage after Dave's caps branch merge.
2003-12-23 22:50:06 +00:00
|
|
|
static GstStaticPadTemplate dxr3audiosink_ac3_sink_factory =
|
2004-03-14 22:34:33 +00:00
|
|
|
GST_STATIC_PAD_TEMPLATE ("ac3_sink",
|
|
|
|
GST_PAD_SINK,
|
|
|
|
GST_PAD_ALWAYS,
|
|
|
|
GST_STATIC_CAPS ("audio/x-ac3"
|
2004-03-15 19:32:27 +00:00
|
|
|
/* no parameters needed, we don't need a parsed stream */
|
2004-03-14 22:34:33 +00:00
|
|
|
)
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
static void dxr3audiosink_class_init (Dxr3AudioSinkClass * klass);
|
|
|
|
static void dxr3audiosink_base_init (Dxr3AudioSinkClass * klass);
|
|
|
|
static void dxr3audiosink_init (Dxr3AudioSink * sink);
|
|
|
|
|
|
|
|
static void dxr3audiosink_set_property (GObject * object,
|
|
|
|
guint prop_id, const GValue * value, GParamSpec * pspec);
|
|
|
|
static void dxr3audiosink_get_property (GObject * object,
|
|
|
|
guint prop_id, GValue * value, GParamSpec * pspec);
|
|
|
|
|
|
|
|
static gboolean dxr3audiosink_open (Dxr3AudioSink * sink);
|
|
|
|
static gboolean dxr3audiosink_set_mode_pcm (Dxr3AudioSink * sink);
|
|
|
|
static gboolean dxr3audiosink_set_mode_ac3 (Dxr3AudioSink * sink);
|
|
|
|
static void dxr3audiosink_close (Dxr3AudioSink * sink);
|
|
|
|
static void dxr3audiosink_set_clock (GstElement * element, GstClock * clock);
|
|
|
|
|
|
|
|
static GstPadLinkReturn dxr3audiosink_pcm_sinklink (GstPad * pad,
|
|
|
|
const GstCaps * caps);
|
|
|
|
static void dxr3audiosink_set_scr (Dxr3AudioSink * sink, guint32 scr);
|
|
|
|
|
|
|
|
static gboolean dxr3audiosink_handle_event (GstPad * pad, GstEvent * event);
|
|
|
|
static void dxr3audiosink_chain_pcm (GstPad * pad, GstData * buf);
|
|
|
|
static void dxr3audiosink_chain_ac3 (GstPad * pad, GstData * buf);
|
2003-05-29 14:35:24 +00:00
|
|
|
|
2005-12-06 19:55:58 +00:00
|
|
|
/* static void dxr3audiosink_wait (Dxr3AudioSink *sink, */
|
2003-05-29 14:35:24 +00:00
|
|
|
/* GstClockTime time); */
|
2005-12-06 19:55:58 +00:00
|
|
|
/* static int dxr3audiosink_mvcommand (Dxr3AudioSink *sink, */
|
2003-05-29 14:35:24 +00:00
|
|
|
/* int command); */
|
|
|
|
|
2005-09-05 17:20:29 +00:00
|
|
|
static GstStateChangeReturn dxr3audiosink_change_state (GstElement * element,
|
|
|
|
GstStateChange transition);
|
2003-05-29 14:35:24 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
static void dxr3audiosink_flushed (Dxr3AudioSink * sink);
|
2003-05-29 14:35:24 +00:00
|
|
|
|
|
|
|
static GstElementClass *parent_class = NULL;
|
|
|
|
static guint dxr3audiosink_signals[LAST_SIGNAL] = { 0 };
|
|
|
|
|
|
|
|
|
|
|
|
extern GType
|
2004-03-14 22:34:33 +00:00
|
|
|
dxr3audiosink_get_type (void)
|
2003-05-29 14:35:24 +00:00
|
|
|
{
|
|
|
|
static GType dxr3audiosink_type = 0;
|
|
|
|
|
|
|
|
if (!dxr3audiosink_type) {
|
|
|
|
static const GTypeInfo dxr3audiosink_info = {
|
2004-03-14 22:34:33 +00:00
|
|
|
sizeof (Dxr3AudioSinkClass),
|
2003-11-02 17:13:40 +00:00
|
|
|
(GBaseInitFunc) dxr3audiosink_base_init,
|
2003-05-29 14:35:24 +00:00
|
|
|
NULL,
|
|
|
|
(GClassInitFunc) dxr3audiosink_class_init,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
sizeof (Dxr3AudioSink),
|
|
|
|
0,
|
|
|
|
(GInstanceInitFunc) dxr3audiosink_init,
|
|
|
|
};
|
2004-03-15 19:32:27 +00:00
|
|
|
|
2003-05-29 14:35:24 +00:00
|
|
|
dxr3audiosink_type = g_type_register_static (GST_TYPE_ELEMENT,
|
2004-03-15 19:32:27 +00:00
|
|
|
"Dxr3AudioSink", &dxr3audiosink_info, 0);
|
2003-05-29 14:35:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return dxr3audiosink_type;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-11-02 17:13:40 +00:00
|
|
|
static void
|
2004-03-14 22:34:33 +00:00
|
|
|
dxr3audiosink_base_init (Dxr3AudioSinkClass * klass)
|
2003-11-02 17:13:40 +00:00
|
|
|
{
|
|
|
|
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
|
|
|
|
|
|
|
|
gst_element_class_add_pad_template (element_class,
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_static_pad_template_get (&dxr3audiosink_pcm_sink_factory));
|
2003-11-02 17:13:40 +00:00
|
|
|
gst_element_class_add_pad_template (element_class,
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_static_pad_template_get (&dxr3audiosink_ac3_sink_factory));
|
|
|
|
gst_element_class_set_details (element_class, &dxr3audiosink_details);
|
2003-11-02 17:13:40 +00:00
|
|
|
}
|
|
|
|
|
2003-05-29 14:35:24 +00:00
|
|
|
static void
|
2004-03-14 22:34:33 +00:00
|
|
|
dxr3audiosink_class_init (Dxr3AudioSinkClass * klass)
|
2003-05-29 14:35:24 +00:00
|
|
|
{
|
|
|
|
GObjectClass *gobject_class;
|
|
|
|
GstElementClass *gstelement_class;
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
gobject_class = (GObjectClass *) klass;
|
|
|
|
gstelement_class = (GstElementClass *) klass;
|
2003-05-29 14:35:24 +00:00
|
|
|
|
|
|
|
parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
|
|
|
|
|
|
|
|
dxr3audiosink_signals[SIGNAL_FLUSHED] =
|
2004-03-14 22:34:33 +00:00
|
|
|
g_signal_new ("flushed", G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_LAST,
|
|
|
|
G_STRUCT_OFFSET (Dxr3AudioSinkClass, flushed),
|
|
|
|
NULL, NULL, dxr3_marshal_VOID__VOID, G_TYPE_NONE, 0);
|
2003-05-29 14:35:24 +00:00
|
|
|
|
|
|
|
klass->flushed = dxr3audiosink_flushed;
|
|
|
|
|
|
|
|
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DIGITAL_PCM,
|
2004-03-14 22:34:33 +00:00
|
|
|
g_param_spec_boolean ("digital-pcm", "Digital PCM",
|
2004-03-15 19:32:27 +00:00
|
|
|
"Use the digital output for PCM sound", FALSE, G_PARAM_READWRITE));
|
2003-05-29 14:35:24 +00:00
|
|
|
|
|
|
|
gobject_class->set_property = dxr3audiosink_set_property;
|
|
|
|
gobject_class->get_property = dxr3audiosink_get_property;
|
|
|
|
|
|
|
|
gstelement_class->change_state = dxr3audiosink_change_state;
|
|
|
|
gstelement_class->set_clock = dxr3audiosink_set_clock;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
static void
|
|
|
|
dxr3audiosink_init (Dxr3AudioSink * sink)
|
2003-05-29 14:35:24 +00:00
|
|
|
{
|
|
|
|
GstPadTemplate *temp;
|
|
|
|
|
|
|
|
/* Create the PCM pad. */
|
Fix caps breakage after Dave's caps branch merge.
Original commit message from CVS:
2003-12-23 Ronald Bultje <rbultje@ronald.bitfreak.net>
* ext/divx/gstdivxdec.c: (gst_divxdec_base_init),
(gst_divxdec_init), (gst_divxdec_negotiate):
* ext/divx/gstdivxdec.h:
* ext/divx/gstdivxenc.c: (gst_divxenc_base_init),
(gst_divxenc_init):
* ext/faac/gstfaac.c: (gst_faac_base_init), (gst_faac_init),
(gst_faac_sinkconnect), (gst_faac_srcconnect):
* ext/mpeg2enc/gstmpeg2enc.cc:
* ext/mpeg2enc/gstmpeg2encoder.cc:
* ext/mpeg2enc/gstmpeg2encpicturereader.cc:
* sys/dxr3/dxr3audiosink.c: (dxr3audiosink_base_init),
(dxr3audiosink_init), (dxr3audiosink_pcm_sinklink):
* sys/dxr3/dxr3spusink.c: (dxr3spusink_base_init),
(dxr3spusink_init):
* sys/dxr3/dxr3videosink.c: (dxr3videosink_base_init),
(dxr3videosink_init):
Fix caps breakage after Dave's caps branch merge.
2003-12-23 22:50:06 +00:00
|
|
|
temp = gst_static_pad_template_get (&dxr3audiosink_pcm_sink_factory);
|
2003-05-29 14:35:24 +00:00
|
|
|
sink->pcm_sinkpad = gst_pad_new_from_template (temp, "pcm_sink");
|
|
|
|
gst_pad_set_chain_function (sink->pcm_sinkpad, dxr3audiosink_chain_pcm);
|
|
|
|
gst_pad_set_link_function (sink->pcm_sinkpad, dxr3audiosink_pcm_sinklink);
|
|
|
|
gst_element_add_pad (GST_ELEMENT (sink), sink->pcm_sinkpad);
|
|
|
|
|
|
|
|
/* Create the AC3 pad. */
|
Fix caps breakage after Dave's caps branch merge.
Original commit message from CVS:
2003-12-23 Ronald Bultje <rbultje@ronald.bitfreak.net>
* ext/divx/gstdivxdec.c: (gst_divxdec_base_init),
(gst_divxdec_init), (gst_divxdec_negotiate):
* ext/divx/gstdivxdec.h:
* ext/divx/gstdivxenc.c: (gst_divxenc_base_init),
(gst_divxenc_init):
* ext/faac/gstfaac.c: (gst_faac_base_init), (gst_faac_init),
(gst_faac_sinkconnect), (gst_faac_srcconnect):
* ext/mpeg2enc/gstmpeg2enc.cc:
* ext/mpeg2enc/gstmpeg2encoder.cc:
* ext/mpeg2enc/gstmpeg2encpicturereader.cc:
* sys/dxr3/dxr3audiosink.c: (dxr3audiosink_base_init),
(dxr3audiosink_init), (dxr3audiosink_pcm_sinklink):
* sys/dxr3/dxr3spusink.c: (dxr3spusink_base_init),
(dxr3spusink_init):
* sys/dxr3/dxr3videosink.c: (dxr3videosink_base_init),
(dxr3videosink_init):
Fix caps breakage after Dave's caps branch merge.
2003-12-23 22:50:06 +00:00
|
|
|
temp = gst_static_pad_template_get (&dxr3audiosink_ac3_sink_factory);
|
2003-05-29 14:35:24 +00:00
|
|
|
sink->ac3_sinkpad = gst_pad_new_from_template (temp, "ac3_sink");
|
|
|
|
gst_pad_set_chain_function (sink->ac3_sinkpad, dxr3audiosink_chain_ac3);
|
|
|
|
gst_element_add_pad (GST_ELEMENT (sink), sink->ac3_sinkpad);
|
|
|
|
|
renamed GST_FLAGS macros to GST_OBJECT_FLAGS moved bitshift from macro to enum definition
Original commit message from CVS:
* examples/indexing/indexmpeg.c: (main):
* ext/artsd/gstartsdsink.c: (gst_artsdsink_open_audio),
(gst_artsdsink_close_audio), (gst_artsdsink_change_state):
* ext/artsd/gstartsdsink.h:
* ext/audiofile/gstafparse.c: (gst_afparse_open_file),
(gst_afparse_close_file):
* ext/audiofile/gstafparse.h:
* ext/audiofile/gstafsink.c: (gst_afsink_open_file),
(gst_afsink_close_file), (gst_afsink_chain),
(gst_afsink_change_state):
* ext/audiofile/gstafsink.h:
* ext/audiofile/gstafsrc.c: (gst_afsrc_open_file),
(gst_afsrc_close_file), (gst_afsrc_change_state):
* ext/audiofile/gstafsrc.h:
* ext/cdaudio/gstcdaudio.c: (gst_cdaudio_init):
* ext/directfb/directfbvideosink.c: (gst_directfbvideosink_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_init):
* ext/jack/gstjack.h:
* ext/jack/gstjackbin.c: (gst_jack_bin_init),
(gst_jack_bin_change_state):
* ext/musepack/gstmusepackdec.c: (gst_musepackdec_init):
* ext/musicbrainz/gsttrm.c: (gst_musicbrainz_init):
* ext/nas/nassink.c: (gst_nassink_open_audio),
(gst_nassink_close_audio), (gst_nassink_change_state):
* ext/nas/nassink.h:
* ext/polyp/polypsink.c: (gst_polypsink_init):
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_change_state):
* ext/sdl/sdlvideosink.h:
* ext/smoothwave/gstsmoothwave.c: (gst_smoothwave_init):
* ext/sndfile/gstsf.c: (gst_sf_set_property),
(gst_sf_change_state), (gst_sf_release_request_pad),
(gst_sf_open_file), (gst_sf_close_file), (gst_sf_loop):
* ext/sndfile/gstsf.h:
* ext/swfdec/gstswfdec.c: (gst_swfdec_init):
* ext/tarkin/gsttarkindec.c: (gst_tarkindec_init):
* gst/apetag/apedemux.c: (gst_ape_demux_init):
* gst/cdxaparse/gstcdxaparse.c: (gst_cdxaparse_init):
* gst/cdxaparse/gstcdxastrip.c: (gst_cdxastrip_init):
* gst/festival/gstfestival.c: (gst_festival_change_state):
* gst/festival/gstfestival.h:
* gst/mpeg2sub/gstmpeg2subt.c: (gst_mpeg2subt_init):
* gst/multifilesink/gstmultifilesink.c: (gst_multifilesink_init),
(gst_multifilesink_set_location), (gst_multifilesink_open_file),
(gst_multifilesink_close_file), (gst_multifilesink_next_file),
(gst_multifilesink_pad_query), (gst_multifilesink_handle_event),
(gst_multifilesink_chain), (gst_multifilesink_change_state):
* gst/multifilesink/gstmultifilesink.h:
* gst/videodrop/gstvideodrop.c: (gst_videodrop_init):
* sys/cdrom/gstcdplayer.c: (cdplayer_init):
* sys/dxr3/dxr3audiosink.c: (dxr3audiosink_init),
(dxr3audiosink_open), (dxr3audiosink_close),
(dxr3audiosink_chain_pcm), (dxr3audiosink_chain_ac3),
(dxr3audiosink_change_state):
* sys/dxr3/dxr3audiosink.h:
* sys/dxr3/dxr3spusink.c: (dxr3spusink_init), (dxr3spusink_open),
(dxr3spusink_close), (dxr3spusink_chain),
(dxr3spusink_change_state):
* sys/dxr3/dxr3spusink.h:
* sys/dxr3/dxr3videosink.c: (dxr3videosink_init),
(dxr3videosink_open), (dxr3videosink_close),
(dxr3videosink_write_data), (dxr3videosink_change_state):
* sys/dxr3/dxr3videosink.h:
* sys/glsink/glimagesink.c: (gst_glimagesink_init):
* sys/qcam/gstqcamsrc.c: (gst_qcamsrc_change_state),
(gst_qcamsrc_open), (gst_qcamsrc_close):
* sys/qcam/gstqcamsrc.h:
* sys/v4l2/gstv4l2src.c: (gst_v4l2src_init):
* sys/vcd/vcdsrc.c: (gst_vcdsrc_set_property), (gst_vcdsrc_get),
(gst_vcdsrc_open_file), (gst_vcdsrc_close_file),
(gst_vcdsrc_change_state), (gst_vcdsrc_recalculate):
* sys/vcd/vcdsrc.h:
renamed GST_FLAGS macros to GST_OBJECT_FLAGS
moved bitshift from macro to enum definition
2005-10-12 14:29:55 +00:00
|
|
|
GST_OBJECT_FLAG_SET (GST_ELEMENT (sink), GST_ELEMENT_EVENT_AWARE);
|
2003-05-29 14:35:24 +00:00
|
|
|
|
|
|
|
sink->card_number = 0;
|
|
|
|
|
|
|
|
sink->audio_filename = NULL;
|
|
|
|
sink->audio_fd = -1;
|
|
|
|
|
|
|
|
sink->control_filename = NULL;
|
|
|
|
sink->control_fd = -1;
|
|
|
|
|
|
|
|
/* Since we don't know any better, we set the initial scr to 0. */
|
|
|
|
sink->scr = 0;
|
|
|
|
|
|
|
|
/* Initially don't use digital output. */
|
|
|
|
sink->digital_pcm = FALSE;
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
/* Initially there's no padder. */
|
2003-05-29 14:35:24 +00:00
|
|
|
sink->padder = NULL;
|
|
|
|
|
|
|
|
sink->mode = DXR3AUDIOSINK_MODE_NONE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
2004-03-14 22:34:33 +00:00
|
|
|
dxr3audiosink_set_property (GObject * object, guint prop_id,
|
|
|
|
const GValue * value, GParamSpec * pspec)
|
2003-05-29 14:35:24 +00:00
|
|
|
{
|
|
|
|
Dxr3AudioSink *sink;
|
|
|
|
|
|
|
|
sink = DXR3AUDIOSINK (object);
|
|
|
|
|
|
|
|
switch (prop_id) {
|
2004-03-14 22:34:33 +00:00
|
|
|
case ARG_DIGITAL_PCM:
|
|
|
|
sink->digital_pcm = g_value_get_boolean (value);
|
|
|
|
/* Refresh the setup of the device. */
|
|
|
|
if (sink->mode == DXR3AUDIOSINK_MODE_PCM) {
|
2004-03-15 19:32:27 +00:00
|
|
|
dxr3audiosink_set_mode_pcm (sink);
|
2004-03-14 22:34:33 +00:00
|
|
|
}
|
|
|
|
g_object_notify (G_OBJECT (sink), "digital-pcm");
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
2003-05-29 14:35:24 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
static void
|
|
|
|
dxr3audiosink_get_property (GObject * object, guint prop_id,
|
|
|
|
GValue * value, GParamSpec * pspec)
|
2003-05-29 14:35:24 +00:00
|
|
|
{
|
|
|
|
Dxr3AudioSink *sink;
|
2004-03-14 22:34:33 +00:00
|
|
|
|
2003-05-29 14:35:24 +00:00
|
|
|
g_return_if_fail (GST_IS_DXR3AUDIOSINK (object));
|
2004-03-14 22:34:33 +00:00
|
|
|
|
2003-05-29 14:35:24 +00:00
|
|
|
sink = DXR3AUDIOSINK (object);
|
2004-03-14 22:34:33 +00:00
|
|
|
|
2003-05-29 14:35:24 +00:00
|
|
|
switch (prop_id) {
|
2004-03-14 22:34:33 +00:00
|
|
|
case ARG_DIGITAL_PCM:
|
|
|
|
g_value_set_boolean (value, sink->digital_pcm);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
2003-05-29 14:35:24 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static gboolean
|
2004-03-14 22:34:33 +00:00
|
|
|
dxr3audiosink_open (Dxr3AudioSink * sink)
|
2003-05-29 14:35:24 +00:00
|
|
|
{
|
renamed GST_FLAGS macros to GST_OBJECT_FLAGS moved bitshift from macro to enum definition
Original commit message from CVS:
* examples/indexing/indexmpeg.c: (main):
* ext/artsd/gstartsdsink.c: (gst_artsdsink_open_audio),
(gst_artsdsink_close_audio), (gst_artsdsink_change_state):
* ext/artsd/gstartsdsink.h:
* ext/audiofile/gstafparse.c: (gst_afparse_open_file),
(gst_afparse_close_file):
* ext/audiofile/gstafparse.h:
* ext/audiofile/gstafsink.c: (gst_afsink_open_file),
(gst_afsink_close_file), (gst_afsink_chain),
(gst_afsink_change_state):
* ext/audiofile/gstafsink.h:
* ext/audiofile/gstafsrc.c: (gst_afsrc_open_file),
(gst_afsrc_close_file), (gst_afsrc_change_state):
* ext/audiofile/gstafsrc.h:
* ext/cdaudio/gstcdaudio.c: (gst_cdaudio_init):
* ext/directfb/directfbvideosink.c: (gst_directfbvideosink_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_init):
* ext/jack/gstjack.h:
* ext/jack/gstjackbin.c: (gst_jack_bin_init),
(gst_jack_bin_change_state):
* ext/musepack/gstmusepackdec.c: (gst_musepackdec_init):
* ext/musicbrainz/gsttrm.c: (gst_musicbrainz_init):
* ext/nas/nassink.c: (gst_nassink_open_audio),
(gst_nassink_close_audio), (gst_nassink_change_state):
* ext/nas/nassink.h:
* ext/polyp/polypsink.c: (gst_polypsink_init):
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_change_state):
* ext/sdl/sdlvideosink.h:
* ext/smoothwave/gstsmoothwave.c: (gst_smoothwave_init):
* ext/sndfile/gstsf.c: (gst_sf_set_property),
(gst_sf_change_state), (gst_sf_release_request_pad),
(gst_sf_open_file), (gst_sf_close_file), (gst_sf_loop):
* ext/sndfile/gstsf.h:
* ext/swfdec/gstswfdec.c: (gst_swfdec_init):
* ext/tarkin/gsttarkindec.c: (gst_tarkindec_init):
* gst/apetag/apedemux.c: (gst_ape_demux_init):
* gst/cdxaparse/gstcdxaparse.c: (gst_cdxaparse_init):
* gst/cdxaparse/gstcdxastrip.c: (gst_cdxastrip_init):
* gst/festival/gstfestival.c: (gst_festival_change_state):
* gst/festival/gstfestival.h:
* gst/mpeg2sub/gstmpeg2subt.c: (gst_mpeg2subt_init):
* gst/multifilesink/gstmultifilesink.c: (gst_multifilesink_init),
(gst_multifilesink_set_location), (gst_multifilesink_open_file),
(gst_multifilesink_close_file), (gst_multifilesink_next_file),
(gst_multifilesink_pad_query), (gst_multifilesink_handle_event),
(gst_multifilesink_chain), (gst_multifilesink_change_state):
* gst/multifilesink/gstmultifilesink.h:
* gst/videodrop/gstvideodrop.c: (gst_videodrop_init):
* sys/cdrom/gstcdplayer.c: (cdplayer_init):
* sys/dxr3/dxr3audiosink.c: (dxr3audiosink_init),
(dxr3audiosink_open), (dxr3audiosink_close),
(dxr3audiosink_chain_pcm), (dxr3audiosink_chain_ac3),
(dxr3audiosink_change_state):
* sys/dxr3/dxr3audiosink.h:
* sys/dxr3/dxr3spusink.c: (dxr3spusink_init), (dxr3spusink_open),
(dxr3spusink_close), (dxr3spusink_chain),
(dxr3spusink_change_state):
* sys/dxr3/dxr3spusink.h:
* sys/dxr3/dxr3videosink.c: (dxr3videosink_init),
(dxr3videosink_open), (dxr3videosink_close),
(dxr3videosink_write_data), (dxr3videosink_change_state):
* sys/dxr3/dxr3videosink.h:
* sys/glsink/glimagesink.c: (gst_glimagesink_init):
* sys/qcam/gstqcamsrc.c: (gst_qcamsrc_change_state),
(gst_qcamsrc_open), (gst_qcamsrc_close):
* sys/qcam/gstqcamsrc.h:
* sys/v4l2/gstv4l2src.c: (gst_v4l2src_init):
* sys/vcd/vcdsrc.c: (gst_vcdsrc_set_property), (gst_vcdsrc_get),
(gst_vcdsrc_open_file), (gst_vcdsrc_close_file),
(gst_vcdsrc_change_state), (gst_vcdsrc_recalculate):
* sys/vcd/vcdsrc.h:
renamed GST_FLAGS macros to GST_OBJECT_FLAGS
moved bitshift from macro to enum definition
2005-10-12 14:29:55 +00:00
|
|
|
g_return_val_if_fail (!GST_OBJECT_FLAG_IS_SET (sink, DXR3AUDIOSINK_OPEN),
|
|
|
|
FALSE);
|
2003-05-29 14:35:24 +00:00
|
|
|
|
|
|
|
/* Compute the name of the audio device file. */
|
|
|
|
sink->audio_filename = g_strdup_printf ("/dev/em8300_ma-%d",
|
2004-03-14 22:34:33 +00:00
|
|
|
sink->card_number);
|
2003-05-29 14:35:24 +00:00
|
|
|
|
|
|
|
sink->audio_fd = open (sink->audio_filename, O_WRONLY);
|
|
|
|
if (sink->audio_fd < 0) {
|
2004-01-29 23:20:45 +00:00
|
|
|
GST_ELEMENT_ERROR (sink, RESOURCE, OPEN_WRITE,
|
2004-03-15 19:32:27 +00:00
|
|
|
(_("Could not open audio device \"%s\" for writing."),
|
|
|
|
sink->audio_filename), GST_ERROR_SYSTEM);
|
2003-05-29 14:35:24 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Open the control device. */
|
|
|
|
sink->control_filename = g_strdup_printf ("/dev/em8300-%d",
|
2004-03-14 22:34:33 +00:00
|
|
|
sink->card_number);
|
2003-05-29 14:35:24 +00:00
|
|
|
|
|
|
|
sink->control_fd = open (sink->control_filename, O_WRONLY);
|
|
|
|
if (sink->control_fd < 0) {
|
2004-01-29 23:20:45 +00:00
|
|
|
GST_ELEMENT_ERROR (sink, RESOURCE, OPEN_WRITE,
|
2004-03-15 19:32:27 +00:00
|
|
|
(_("Could not open control device \"%s\" for writing."),
|
|
|
|
sink->control_filename), GST_ERROR_SYSTEM);
|
2003-05-29 14:35:24 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
renamed GST_FLAGS macros to GST_OBJECT_FLAGS moved bitshift from macro to enum definition
Original commit message from CVS:
* examples/indexing/indexmpeg.c: (main):
* ext/artsd/gstartsdsink.c: (gst_artsdsink_open_audio),
(gst_artsdsink_close_audio), (gst_artsdsink_change_state):
* ext/artsd/gstartsdsink.h:
* ext/audiofile/gstafparse.c: (gst_afparse_open_file),
(gst_afparse_close_file):
* ext/audiofile/gstafparse.h:
* ext/audiofile/gstafsink.c: (gst_afsink_open_file),
(gst_afsink_close_file), (gst_afsink_chain),
(gst_afsink_change_state):
* ext/audiofile/gstafsink.h:
* ext/audiofile/gstafsrc.c: (gst_afsrc_open_file),
(gst_afsrc_close_file), (gst_afsrc_change_state):
* ext/audiofile/gstafsrc.h:
* ext/cdaudio/gstcdaudio.c: (gst_cdaudio_init):
* ext/directfb/directfbvideosink.c: (gst_directfbvideosink_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_init):
* ext/jack/gstjack.h:
* ext/jack/gstjackbin.c: (gst_jack_bin_init),
(gst_jack_bin_change_state):
* ext/musepack/gstmusepackdec.c: (gst_musepackdec_init):
* ext/musicbrainz/gsttrm.c: (gst_musicbrainz_init):
* ext/nas/nassink.c: (gst_nassink_open_audio),
(gst_nassink_close_audio), (gst_nassink_change_state):
* ext/nas/nassink.h:
* ext/polyp/polypsink.c: (gst_polypsink_init):
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_change_state):
* ext/sdl/sdlvideosink.h:
* ext/smoothwave/gstsmoothwave.c: (gst_smoothwave_init):
* ext/sndfile/gstsf.c: (gst_sf_set_property),
(gst_sf_change_state), (gst_sf_release_request_pad),
(gst_sf_open_file), (gst_sf_close_file), (gst_sf_loop):
* ext/sndfile/gstsf.h:
* ext/swfdec/gstswfdec.c: (gst_swfdec_init):
* ext/tarkin/gsttarkindec.c: (gst_tarkindec_init):
* gst/apetag/apedemux.c: (gst_ape_demux_init):
* gst/cdxaparse/gstcdxaparse.c: (gst_cdxaparse_init):
* gst/cdxaparse/gstcdxastrip.c: (gst_cdxastrip_init):
* gst/festival/gstfestival.c: (gst_festival_change_state):
* gst/festival/gstfestival.h:
* gst/mpeg2sub/gstmpeg2subt.c: (gst_mpeg2subt_init):
* gst/multifilesink/gstmultifilesink.c: (gst_multifilesink_init),
(gst_multifilesink_set_location), (gst_multifilesink_open_file),
(gst_multifilesink_close_file), (gst_multifilesink_next_file),
(gst_multifilesink_pad_query), (gst_multifilesink_handle_event),
(gst_multifilesink_chain), (gst_multifilesink_change_state):
* gst/multifilesink/gstmultifilesink.h:
* gst/videodrop/gstvideodrop.c: (gst_videodrop_init):
* sys/cdrom/gstcdplayer.c: (cdplayer_init):
* sys/dxr3/dxr3audiosink.c: (dxr3audiosink_init),
(dxr3audiosink_open), (dxr3audiosink_close),
(dxr3audiosink_chain_pcm), (dxr3audiosink_chain_ac3),
(dxr3audiosink_change_state):
* sys/dxr3/dxr3audiosink.h:
* sys/dxr3/dxr3spusink.c: (dxr3spusink_init), (dxr3spusink_open),
(dxr3spusink_close), (dxr3spusink_chain),
(dxr3spusink_change_state):
* sys/dxr3/dxr3spusink.h:
* sys/dxr3/dxr3videosink.c: (dxr3videosink_init),
(dxr3videosink_open), (dxr3videosink_close),
(dxr3videosink_write_data), (dxr3videosink_change_state):
* sys/dxr3/dxr3videosink.h:
* sys/glsink/glimagesink.c: (gst_glimagesink_init):
* sys/qcam/gstqcamsrc.c: (gst_qcamsrc_change_state),
(gst_qcamsrc_open), (gst_qcamsrc_close):
* sys/qcam/gstqcamsrc.h:
* sys/v4l2/gstv4l2src.c: (gst_v4l2src_init):
* sys/vcd/vcdsrc.c: (gst_vcdsrc_set_property), (gst_vcdsrc_get),
(gst_vcdsrc_open_file), (gst_vcdsrc_close_file),
(gst_vcdsrc_change_state), (gst_vcdsrc_recalculate):
* sys/vcd/vcdsrc.h:
renamed GST_FLAGS macros to GST_OBJECT_FLAGS
moved bitshift from macro to enum definition
2005-10-12 14:29:55 +00:00
|
|
|
GST_OBJECT_FLAG_SET (sink, DXR3AUDIOSINK_OPEN);
|
2003-05-29 14:35:24 +00:00
|
|
|
|
|
|
|
dxr3audiosink_set_mode_pcm (sink);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* dxr3audiosink_set_mode:
|
|
|
|
* @sink: The sink element to operate on.
|
|
|
|
*
|
|
|
|
* Set the operation mode of the element to PCM.
|
|
|
|
*/
|
|
|
|
static gboolean
|
2004-03-14 22:34:33 +00:00
|
|
|
dxr3audiosink_set_mode_pcm (Dxr3AudioSink * sink)
|
2003-05-29 14:35:24 +00:00
|
|
|
{
|
|
|
|
int tmp, oss_mode, audiomode;
|
|
|
|
|
|
|
|
if (sink->audio_fd == -1 || sink->control_fd == -1) {
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Set the audio device mode. */
|
|
|
|
oss_mode = (G_BYTE_ORDER == G_BIG_ENDIAN ? AFMT_S16_BE : AFMT_S16_LE);
|
|
|
|
tmp = oss_mode;
|
2004-03-14 22:34:33 +00:00
|
|
|
if (ioctl (sink->audio_fd, SNDCTL_DSP_SETFMT, &tmp) < 0 || tmp != oss_mode) {
|
2004-01-29 23:20:45 +00:00
|
|
|
GST_ELEMENT_ERROR (sink, RESOURCE, SETTINGS,
|
2004-03-15 19:32:27 +00:00
|
|
|
(_("Could not configure audio device \"%s\"."), sink->audio_filename),
|
|
|
|
GST_ERROR_SYSTEM);
|
2003-05-29 14:35:24 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Set the card's general audio output mode. */
|
|
|
|
audiomode = sink->digital_pcm ?
|
2004-03-14 22:34:33 +00:00
|
|
|
EM8300_AUDIOMODE_DIGITALPCM : EM8300_AUDIOMODE_ANALOG;
|
2003-05-29 14:35:24 +00:00
|
|
|
ioctl (sink->control_fd, EM8300_IOCTL_SET_AUDIOMODE, &audiomode);
|
|
|
|
|
|
|
|
/* Set the sampling rate. */
|
|
|
|
tmp = sink->rate;
|
|
|
|
if (ioctl (sink->audio_fd, SNDCTL_DSP_SPEED, &tmp) < 0) {
|
2004-01-29 23:20:45 +00:00
|
|
|
GST_ELEMENT_ERROR (sink, RESOURCE, SETTINGS,
|
2004-03-15 19:32:27 +00:00
|
|
|
(_("Could not set audio device \"%s\" to %d Hz."), sink->audio_filename,
|
|
|
|
sink->rate), GST_ERROR_SYSTEM);
|
2003-05-29 14:35:24 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Get rid of the padder, if any. */
|
|
|
|
if (sink->padder != NULL) {
|
2004-03-14 22:34:33 +00:00
|
|
|
g_free (sink->padder);
|
2003-05-29 14:35:24 +00:00
|
|
|
sink->padder = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
sink->mode = DXR3AUDIOSINK_MODE_PCM;
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* dxr3audiosink_set_mode:
|
|
|
|
* @sink: The sink element to operate on
|
|
|
|
*
|
|
|
|
* Set the operation mode of the element to AC3.
|
|
|
|
*/
|
|
|
|
static gboolean
|
2004-03-14 22:34:33 +00:00
|
|
|
dxr3audiosink_set_mode_ac3 (Dxr3AudioSink * sink)
|
2003-05-29 14:35:24 +00:00
|
|
|
{
|
2004-03-14 22:34:33 +00:00
|
|
|
int tmp, audiomode;
|
2003-05-29 14:35:24 +00:00
|
|
|
|
|
|
|
if (sink->audio_fd == -1 || sink->control_fd == -1) {
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Set the sampling rate. */
|
|
|
|
tmp = AC3_BYTE_RATE;
|
|
|
|
if (ioctl (sink->audio_fd, SNDCTL_DSP_SPEED, &tmp) < 0 ||
|
|
|
|
tmp != AC3_BYTE_RATE) {
|
2004-01-29 23:20:45 +00:00
|
|
|
GST_ELEMENT_ERROR (sink, RESOURCE, SETTINGS,
|
2004-03-15 19:32:27 +00:00
|
|
|
(_("Could not set audio device \"%s\" to %d Hz."), sink->audio_filename,
|
|
|
|
AC3_BYTE_RATE), GST_ERROR_SYSTEM);
|
2003-05-29 14:35:24 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Set the card's general audio output mode to AC3. */
|
|
|
|
audiomode = EM8300_AUDIOMODE_DIGITALAC3;
|
|
|
|
ioctl (sink->control_fd, EM8300_IOCTL_SET_AUDIOMODE, &audiomode);
|
|
|
|
|
|
|
|
/* Create a padder if necessary, */
|
|
|
|
if (sink->padder == NULL) {
|
2004-03-14 22:34:33 +00:00
|
|
|
sink->padder = g_malloc (sizeof (ac3_padder));
|
|
|
|
ac3p_init (sink->padder);
|
2003-05-29 14:35:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
sink->mode = DXR3AUDIOSINK_MODE_AC3;
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
2004-03-14 22:34:33 +00:00
|
|
|
dxr3audiosink_close (Dxr3AudioSink * sink)
|
2003-05-29 14:35:24 +00:00
|
|
|
{
|
renamed GST_FLAGS macros to GST_OBJECT_FLAGS moved bitshift from macro to enum definition
Original commit message from CVS:
* examples/indexing/indexmpeg.c: (main):
* ext/artsd/gstartsdsink.c: (gst_artsdsink_open_audio),
(gst_artsdsink_close_audio), (gst_artsdsink_change_state):
* ext/artsd/gstartsdsink.h:
* ext/audiofile/gstafparse.c: (gst_afparse_open_file),
(gst_afparse_close_file):
* ext/audiofile/gstafparse.h:
* ext/audiofile/gstafsink.c: (gst_afsink_open_file),
(gst_afsink_close_file), (gst_afsink_chain),
(gst_afsink_change_state):
* ext/audiofile/gstafsink.h:
* ext/audiofile/gstafsrc.c: (gst_afsrc_open_file),
(gst_afsrc_close_file), (gst_afsrc_change_state):
* ext/audiofile/gstafsrc.h:
* ext/cdaudio/gstcdaudio.c: (gst_cdaudio_init):
* ext/directfb/directfbvideosink.c: (gst_directfbvideosink_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_init):
* ext/jack/gstjack.h:
* ext/jack/gstjackbin.c: (gst_jack_bin_init),
(gst_jack_bin_change_state):
* ext/musepack/gstmusepackdec.c: (gst_musepackdec_init):
* ext/musicbrainz/gsttrm.c: (gst_musicbrainz_init):
* ext/nas/nassink.c: (gst_nassink_open_audio),
(gst_nassink_close_audio), (gst_nassink_change_state):
* ext/nas/nassink.h:
* ext/polyp/polypsink.c: (gst_polypsink_init):
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_change_state):
* ext/sdl/sdlvideosink.h:
* ext/smoothwave/gstsmoothwave.c: (gst_smoothwave_init):
* ext/sndfile/gstsf.c: (gst_sf_set_property),
(gst_sf_change_state), (gst_sf_release_request_pad),
(gst_sf_open_file), (gst_sf_close_file), (gst_sf_loop):
* ext/sndfile/gstsf.h:
* ext/swfdec/gstswfdec.c: (gst_swfdec_init):
* ext/tarkin/gsttarkindec.c: (gst_tarkindec_init):
* gst/apetag/apedemux.c: (gst_ape_demux_init):
* gst/cdxaparse/gstcdxaparse.c: (gst_cdxaparse_init):
* gst/cdxaparse/gstcdxastrip.c: (gst_cdxastrip_init):
* gst/festival/gstfestival.c: (gst_festival_change_state):
* gst/festival/gstfestival.h:
* gst/mpeg2sub/gstmpeg2subt.c: (gst_mpeg2subt_init):
* gst/multifilesink/gstmultifilesink.c: (gst_multifilesink_init),
(gst_multifilesink_set_location), (gst_multifilesink_open_file),
(gst_multifilesink_close_file), (gst_multifilesink_next_file),
(gst_multifilesink_pad_query), (gst_multifilesink_handle_event),
(gst_multifilesink_chain), (gst_multifilesink_change_state):
* gst/multifilesink/gstmultifilesink.h:
* gst/videodrop/gstvideodrop.c: (gst_videodrop_init):
* sys/cdrom/gstcdplayer.c: (cdplayer_init):
* sys/dxr3/dxr3audiosink.c: (dxr3audiosink_init),
(dxr3audiosink_open), (dxr3audiosink_close),
(dxr3audiosink_chain_pcm), (dxr3audiosink_chain_ac3),
(dxr3audiosink_change_state):
* sys/dxr3/dxr3audiosink.h:
* sys/dxr3/dxr3spusink.c: (dxr3spusink_init), (dxr3spusink_open),
(dxr3spusink_close), (dxr3spusink_chain),
(dxr3spusink_change_state):
* sys/dxr3/dxr3spusink.h:
* sys/dxr3/dxr3videosink.c: (dxr3videosink_init),
(dxr3videosink_open), (dxr3videosink_close),
(dxr3videosink_write_data), (dxr3videosink_change_state):
* sys/dxr3/dxr3videosink.h:
* sys/glsink/glimagesink.c: (gst_glimagesink_init):
* sys/qcam/gstqcamsrc.c: (gst_qcamsrc_change_state),
(gst_qcamsrc_open), (gst_qcamsrc_close):
* sys/qcam/gstqcamsrc.h:
* sys/v4l2/gstv4l2src.c: (gst_v4l2src_init):
* sys/vcd/vcdsrc.c: (gst_vcdsrc_set_property), (gst_vcdsrc_get),
(gst_vcdsrc_open_file), (gst_vcdsrc_close_file),
(gst_vcdsrc_change_state), (gst_vcdsrc_recalculate):
* sys/vcd/vcdsrc.h:
renamed GST_FLAGS macros to GST_OBJECT_FLAGS
moved bitshift from macro to enum definition
2005-10-12 14:29:55 +00:00
|
|
|
g_return_if_fail (GST_OBJECT_FLAG_IS_SET (sink, DXR3AUDIOSINK_OPEN));
|
2003-05-29 14:35:24 +00:00
|
|
|
|
|
|
|
if (close (sink->audio_fd) != 0) {
|
2004-01-29 23:20:45 +00:00
|
|
|
GST_ELEMENT_ERROR (sink, RESOURCE, CLOSE,
|
2004-03-15 19:32:27 +00:00
|
|
|
(_("Could not close audio device \"%s\"."), sink->audio_filename),
|
|
|
|
GST_ERROR_SYSTEM);
|
2003-05-29 14:35:24 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (close (sink->control_fd) != 0) {
|
2004-01-29 23:20:45 +00:00
|
|
|
GST_ELEMENT_ERROR (sink, RESOURCE, CLOSE,
|
2004-03-15 19:32:27 +00:00
|
|
|
(_("Could not close control device \"%s\"."), sink->audio_filename),
|
|
|
|
GST_ERROR_SYSTEM);
|
2003-05-29 14:35:24 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
renamed GST_FLAGS macros to GST_OBJECT_FLAGS moved bitshift from macro to enum definition
Original commit message from CVS:
* examples/indexing/indexmpeg.c: (main):
* ext/artsd/gstartsdsink.c: (gst_artsdsink_open_audio),
(gst_artsdsink_close_audio), (gst_artsdsink_change_state):
* ext/artsd/gstartsdsink.h:
* ext/audiofile/gstafparse.c: (gst_afparse_open_file),
(gst_afparse_close_file):
* ext/audiofile/gstafparse.h:
* ext/audiofile/gstafsink.c: (gst_afsink_open_file),
(gst_afsink_close_file), (gst_afsink_chain),
(gst_afsink_change_state):
* ext/audiofile/gstafsink.h:
* ext/audiofile/gstafsrc.c: (gst_afsrc_open_file),
(gst_afsrc_close_file), (gst_afsrc_change_state):
* ext/audiofile/gstafsrc.h:
* ext/cdaudio/gstcdaudio.c: (gst_cdaudio_init):
* ext/directfb/directfbvideosink.c: (gst_directfbvideosink_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_init):
* ext/jack/gstjack.h:
* ext/jack/gstjackbin.c: (gst_jack_bin_init),
(gst_jack_bin_change_state):
* ext/musepack/gstmusepackdec.c: (gst_musepackdec_init):
* ext/musicbrainz/gsttrm.c: (gst_musicbrainz_init):
* ext/nas/nassink.c: (gst_nassink_open_audio),
(gst_nassink_close_audio), (gst_nassink_change_state):
* ext/nas/nassink.h:
* ext/polyp/polypsink.c: (gst_polypsink_init):
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_change_state):
* ext/sdl/sdlvideosink.h:
* ext/smoothwave/gstsmoothwave.c: (gst_smoothwave_init):
* ext/sndfile/gstsf.c: (gst_sf_set_property),
(gst_sf_change_state), (gst_sf_release_request_pad),
(gst_sf_open_file), (gst_sf_close_file), (gst_sf_loop):
* ext/sndfile/gstsf.h:
* ext/swfdec/gstswfdec.c: (gst_swfdec_init):
* ext/tarkin/gsttarkindec.c: (gst_tarkindec_init):
* gst/apetag/apedemux.c: (gst_ape_demux_init):
* gst/cdxaparse/gstcdxaparse.c: (gst_cdxaparse_init):
* gst/cdxaparse/gstcdxastrip.c: (gst_cdxastrip_init):
* gst/festival/gstfestival.c: (gst_festival_change_state):
* gst/festival/gstfestival.h:
* gst/mpeg2sub/gstmpeg2subt.c: (gst_mpeg2subt_init):
* gst/multifilesink/gstmultifilesink.c: (gst_multifilesink_init),
(gst_multifilesink_set_location), (gst_multifilesink_open_file),
(gst_multifilesink_close_file), (gst_multifilesink_next_file),
(gst_multifilesink_pad_query), (gst_multifilesink_handle_event),
(gst_multifilesink_chain), (gst_multifilesink_change_state):
* gst/multifilesink/gstmultifilesink.h:
* gst/videodrop/gstvideodrop.c: (gst_videodrop_init):
* sys/cdrom/gstcdplayer.c: (cdplayer_init):
* sys/dxr3/dxr3audiosink.c: (dxr3audiosink_init),
(dxr3audiosink_open), (dxr3audiosink_close),
(dxr3audiosink_chain_pcm), (dxr3audiosink_chain_ac3),
(dxr3audiosink_change_state):
* sys/dxr3/dxr3audiosink.h:
* sys/dxr3/dxr3spusink.c: (dxr3spusink_init), (dxr3spusink_open),
(dxr3spusink_close), (dxr3spusink_chain),
(dxr3spusink_change_state):
* sys/dxr3/dxr3spusink.h:
* sys/dxr3/dxr3videosink.c: (dxr3videosink_init),
(dxr3videosink_open), (dxr3videosink_close),
(dxr3videosink_write_data), (dxr3videosink_change_state):
* sys/dxr3/dxr3videosink.h:
* sys/glsink/glimagesink.c: (gst_glimagesink_init):
* sys/qcam/gstqcamsrc.c: (gst_qcamsrc_change_state),
(gst_qcamsrc_open), (gst_qcamsrc_close):
* sys/qcam/gstqcamsrc.h:
* sys/v4l2/gstv4l2src.c: (gst_v4l2src_init):
* sys/vcd/vcdsrc.c: (gst_vcdsrc_set_property), (gst_vcdsrc_get),
(gst_vcdsrc_open_file), (gst_vcdsrc_close_file),
(gst_vcdsrc_change_state), (gst_vcdsrc_recalculate):
* sys/vcd/vcdsrc.h:
renamed GST_FLAGS macros to GST_OBJECT_FLAGS
moved bitshift from macro to enum definition
2005-10-12 14:29:55 +00:00
|
|
|
GST_OBJECT_FLAG_UNSET (sink, DXR3AUDIOSINK_OPEN);
|
2003-05-29 14:35:24 +00:00
|
|
|
|
|
|
|
g_free (sink->audio_filename);
|
|
|
|
sink->audio_filename = NULL;
|
|
|
|
|
|
|
|
g_free (sink->control_filename);
|
|
|
|
sink->control_filename = NULL;
|
|
|
|
|
|
|
|
/* Get rid of the padder, if any. */
|
|
|
|
if (sink->padder != NULL) {
|
2004-03-14 22:34:33 +00:00
|
|
|
g_free (sink->padder);
|
2003-05-29 14:35:24 +00:00
|
|
|
sink->padder = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
2004-03-14 22:34:33 +00:00
|
|
|
dxr3audiosink_set_clock (GstElement * element, GstClock * clock)
|
2003-05-29 14:35:24 +00:00
|
|
|
{
|
|
|
|
Dxr3AudioSink *src = DXR3AUDIOSINK (element);
|
|
|
|
|
|
|
|
src->clock = clock;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static GstPadLinkReturn
|
2004-03-14 22:34:33 +00:00
|
|
|
dxr3audiosink_pcm_sinklink (GstPad * pad, const GstCaps * caps)
|
2003-05-29 14:35:24 +00:00
|
|
|
{
|
|
|
|
Dxr3AudioSink *sink = DXR3AUDIOSINK (gst_pad_get_parent (pad));
|
Fix caps breakage after Dave's caps branch merge.
Original commit message from CVS:
2003-12-23 Ronald Bultje <rbultje@ronald.bitfreak.net>
* ext/divx/gstdivxdec.c: (gst_divxdec_base_init),
(gst_divxdec_init), (gst_divxdec_negotiate):
* ext/divx/gstdivxdec.h:
* ext/divx/gstdivxenc.c: (gst_divxenc_base_init),
(gst_divxenc_init):
* ext/faac/gstfaac.c: (gst_faac_base_init), (gst_faac_init),
(gst_faac_sinkconnect), (gst_faac_srcconnect):
* ext/mpeg2enc/gstmpeg2enc.cc:
* ext/mpeg2enc/gstmpeg2encoder.cc:
* ext/mpeg2enc/gstmpeg2encpicturereader.cc:
* sys/dxr3/dxr3audiosink.c: (dxr3audiosink_base_init),
(dxr3audiosink_init), (dxr3audiosink_pcm_sinklink):
* sys/dxr3/dxr3spusink.c: (dxr3spusink_base_init),
(dxr3spusink_init):
* sys/dxr3/dxr3videosink.c: (dxr3videosink_base_init),
(dxr3videosink_init):
Fix caps breakage after Dave's caps branch merge.
2003-12-23 22:50:06 +00:00
|
|
|
GstStructure *structure = gst_caps_get_structure (caps, 0);
|
2003-05-29 14:35:24 +00:00
|
|
|
gint rate;
|
|
|
|
|
Fix caps breakage after Dave's caps branch merge.
Original commit message from CVS:
2003-12-23 Ronald Bultje <rbultje@ronald.bitfreak.net>
* ext/divx/gstdivxdec.c: (gst_divxdec_base_init),
(gst_divxdec_init), (gst_divxdec_negotiate):
* ext/divx/gstdivxdec.h:
* ext/divx/gstdivxenc.c: (gst_divxenc_base_init),
(gst_divxenc_init):
* ext/faac/gstfaac.c: (gst_faac_base_init), (gst_faac_init),
(gst_faac_sinkconnect), (gst_faac_srcconnect):
* ext/mpeg2enc/gstmpeg2enc.cc:
* ext/mpeg2enc/gstmpeg2encoder.cc:
* ext/mpeg2enc/gstmpeg2encpicturereader.cc:
* sys/dxr3/dxr3audiosink.c: (dxr3audiosink_base_init),
(dxr3audiosink_init), (dxr3audiosink_pcm_sinklink):
* sys/dxr3/dxr3spusink.c: (dxr3spusink_base_init),
(dxr3spusink_init):
* sys/dxr3/dxr3videosink.c: (dxr3videosink_base_init),
(dxr3videosink_init):
Fix caps breakage after Dave's caps branch merge.
2003-12-23 22:50:06 +00:00
|
|
|
if (!gst_caps_is_fixed (caps)) {
|
2003-05-29 14:35:24 +00:00
|
|
|
return GST_PAD_LINK_DELAYED;
|
|
|
|
}
|
|
|
|
|
Fix caps breakage after Dave's caps branch merge.
Original commit message from CVS:
2003-12-23 Ronald Bultje <rbultje@ronald.bitfreak.net>
* ext/divx/gstdivxdec.c: (gst_divxdec_base_init),
(gst_divxdec_init), (gst_divxdec_negotiate):
* ext/divx/gstdivxdec.h:
* ext/divx/gstdivxenc.c: (gst_divxenc_base_init),
(gst_divxenc_init):
* ext/faac/gstfaac.c: (gst_faac_base_init), (gst_faac_init),
(gst_faac_sinkconnect), (gst_faac_srcconnect):
* ext/mpeg2enc/gstmpeg2enc.cc:
* ext/mpeg2enc/gstmpeg2encoder.cc:
* ext/mpeg2enc/gstmpeg2encpicturereader.cc:
* sys/dxr3/dxr3audiosink.c: (dxr3audiosink_base_init),
(dxr3audiosink_init), (dxr3audiosink_pcm_sinklink):
* sys/dxr3/dxr3spusink.c: (dxr3spusink_base_init),
(dxr3spusink_init):
* sys/dxr3/dxr3videosink.c: (dxr3videosink_base_init),
(dxr3videosink_init):
Fix caps breakage after Dave's caps branch merge.
2003-12-23 22:50:06 +00:00
|
|
|
gst_structure_get_int (structure, "rate", &rate);
|
2003-05-29 14:35:24 +00:00
|
|
|
sink->rate = rate;
|
|
|
|
|
|
|
|
return GST_PAD_LINK_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
2004-03-14 22:34:33 +00:00
|
|
|
dxr3audiosink_set_scr (Dxr3AudioSink * sink, guint32 scr)
|
2003-05-29 14:35:24 +00:00
|
|
|
{
|
|
|
|
guint32 zero = 0;
|
|
|
|
|
|
|
|
/* fprintf (stderr, "====== Adjusting SCR\n"); */
|
|
|
|
ioctl (sink->control_fd, EM8300_IOCTL_SCR_SET, &zero);
|
|
|
|
ioctl (sink->control_fd, EM8300_IOCTL_SCR_SET, &scr);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static gboolean
|
2004-03-14 22:34:33 +00:00
|
|
|
dxr3audiosink_handle_event (GstPad * pad, GstEvent * event)
|
2003-05-29 14:35:24 +00:00
|
|
|
{
|
|
|
|
GstEventType type;
|
|
|
|
Dxr3AudioSink *sink = DXR3AUDIOSINK (gst_pad_get_parent (pad));
|
|
|
|
|
|
|
|
type = event ? GST_EVENT_TYPE (event) : GST_EVENT_UNKNOWN;
|
|
|
|
|
|
|
|
switch (type) {
|
2004-03-14 22:34:33 +00:00
|
|
|
case GST_EVENT_FLUSH:
|
|
|
|
if (sink->control_fd >= 0) {
|
2004-03-15 19:32:27 +00:00
|
|
|
unsigned audiomode;
|
|
|
|
|
|
|
|
if (sink->mode == DXR3AUDIOSINK_MODE_AC3) {
|
|
|
|
audiomode = EM8300_AUDIOMODE_DIGITALPCM;
|
|
|
|
ioctl (sink->control_fd, EM8300_IOCTL_SET_AUDIOMODE, &audiomode);
|
|
|
|
audiomode = EM8300_AUDIOMODE_DIGITALAC3;
|
|
|
|
ioctl (sink->control_fd, EM8300_IOCTL_SET_AUDIOMODE, &audiomode);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Report the flush operation. */
|
|
|
|
g_signal_emit (G_OBJECT (sink),
|
|
|
|
dxr3audiosink_signals[SIGNAL_FLUSHED], 0);
|
2003-05-29 14:35:24 +00:00
|
|
|
}
|
2004-03-14 22:34:33 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
gst_pad_event_default (pad, event);
|
|
|
|
break;
|
2003-05-29 14:35:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
static void
|
|
|
|
dxr3audiosink_chain_pcm (GstPad * pad, GstData * _data)
|
2003-05-29 14:35:24 +00:00
|
|
|
{
|
|
|
|
Dxr3AudioSink *sink;
|
|
|
|
gint bytes_written = 0;
|
2003-10-14 10:09:11 +00:00
|
|
|
GstBuffer *buf;
|
2003-05-29 14:35:24 +00:00
|
|
|
|
|
|
|
g_return_if_fail (pad != NULL);
|
|
|
|
g_return_if_fail (GST_IS_PAD (pad));
|
2003-10-14 10:09:11 +00:00
|
|
|
g_return_if_fail (_data != NULL);
|
2003-05-29 14:35:24 +00:00
|
|
|
|
|
|
|
sink = DXR3AUDIOSINK (gst_pad_get_parent (pad));
|
|
|
|
|
2003-10-14 10:09:11 +00:00
|
|
|
if (GST_IS_EVENT (_data)) {
|
|
|
|
dxr3audiosink_handle_event (pad, GST_EVENT (_data));
|
2003-05-29 14:35:24 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2003-10-14 10:09:11 +00:00
|
|
|
buf = GST_BUFFER (_data);
|
|
|
|
|
2003-05-29 14:35:24 +00:00
|
|
|
if (sink->mode != DXR3AUDIOSINK_MODE_PCM) {
|
|
|
|
/* Switch to PCM mode. */
|
|
|
|
dxr3audiosink_set_mode_pcm (sink);
|
|
|
|
}
|
|
|
|
|
renamed GST_FLAGS macros to GST_OBJECT_FLAGS moved bitshift from macro to enum definition
Original commit message from CVS:
* examples/indexing/indexmpeg.c: (main):
* ext/artsd/gstartsdsink.c: (gst_artsdsink_open_audio),
(gst_artsdsink_close_audio), (gst_artsdsink_change_state):
* ext/artsd/gstartsdsink.h:
* ext/audiofile/gstafparse.c: (gst_afparse_open_file),
(gst_afparse_close_file):
* ext/audiofile/gstafparse.h:
* ext/audiofile/gstafsink.c: (gst_afsink_open_file),
(gst_afsink_close_file), (gst_afsink_chain),
(gst_afsink_change_state):
* ext/audiofile/gstafsink.h:
* ext/audiofile/gstafsrc.c: (gst_afsrc_open_file),
(gst_afsrc_close_file), (gst_afsrc_change_state):
* ext/audiofile/gstafsrc.h:
* ext/cdaudio/gstcdaudio.c: (gst_cdaudio_init):
* ext/directfb/directfbvideosink.c: (gst_directfbvideosink_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_init):
* ext/jack/gstjack.h:
* ext/jack/gstjackbin.c: (gst_jack_bin_init),
(gst_jack_bin_change_state):
* ext/musepack/gstmusepackdec.c: (gst_musepackdec_init):
* ext/musicbrainz/gsttrm.c: (gst_musicbrainz_init):
* ext/nas/nassink.c: (gst_nassink_open_audio),
(gst_nassink_close_audio), (gst_nassink_change_state):
* ext/nas/nassink.h:
* ext/polyp/polypsink.c: (gst_polypsink_init):
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_change_state):
* ext/sdl/sdlvideosink.h:
* ext/smoothwave/gstsmoothwave.c: (gst_smoothwave_init):
* ext/sndfile/gstsf.c: (gst_sf_set_property),
(gst_sf_change_state), (gst_sf_release_request_pad),
(gst_sf_open_file), (gst_sf_close_file), (gst_sf_loop):
* ext/sndfile/gstsf.h:
* ext/swfdec/gstswfdec.c: (gst_swfdec_init):
* ext/tarkin/gsttarkindec.c: (gst_tarkindec_init):
* gst/apetag/apedemux.c: (gst_ape_demux_init):
* gst/cdxaparse/gstcdxaparse.c: (gst_cdxaparse_init):
* gst/cdxaparse/gstcdxastrip.c: (gst_cdxastrip_init):
* gst/festival/gstfestival.c: (gst_festival_change_state):
* gst/festival/gstfestival.h:
* gst/mpeg2sub/gstmpeg2subt.c: (gst_mpeg2subt_init):
* gst/multifilesink/gstmultifilesink.c: (gst_multifilesink_init),
(gst_multifilesink_set_location), (gst_multifilesink_open_file),
(gst_multifilesink_close_file), (gst_multifilesink_next_file),
(gst_multifilesink_pad_query), (gst_multifilesink_handle_event),
(gst_multifilesink_chain), (gst_multifilesink_change_state):
* gst/multifilesink/gstmultifilesink.h:
* gst/videodrop/gstvideodrop.c: (gst_videodrop_init):
* sys/cdrom/gstcdplayer.c: (cdplayer_init):
* sys/dxr3/dxr3audiosink.c: (dxr3audiosink_init),
(dxr3audiosink_open), (dxr3audiosink_close),
(dxr3audiosink_chain_pcm), (dxr3audiosink_chain_ac3),
(dxr3audiosink_change_state):
* sys/dxr3/dxr3audiosink.h:
* sys/dxr3/dxr3spusink.c: (dxr3spusink_init), (dxr3spusink_open),
(dxr3spusink_close), (dxr3spusink_chain),
(dxr3spusink_change_state):
* sys/dxr3/dxr3spusink.h:
* sys/dxr3/dxr3videosink.c: (dxr3videosink_init),
(dxr3videosink_open), (dxr3videosink_close),
(dxr3videosink_write_data), (dxr3videosink_change_state):
* sys/dxr3/dxr3videosink.h:
* sys/glsink/glimagesink.c: (gst_glimagesink_init):
* sys/qcam/gstqcamsrc.c: (gst_qcamsrc_change_state),
(gst_qcamsrc_open), (gst_qcamsrc_close):
* sys/qcam/gstqcamsrc.h:
* sys/v4l2/gstv4l2src.c: (gst_v4l2src_init):
* sys/vcd/vcdsrc.c: (gst_vcdsrc_set_property), (gst_vcdsrc_get),
(gst_vcdsrc_open_file), (gst_vcdsrc_close_file),
(gst_vcdsrc_change_state), (gst_vcdsrc_recalculate):
* sys/vcd/vcdsrc.h:
renamed GST_FLAGS macros to GST_OBJECT_FLAGS
moved bitshift from macro to enum definition
2005-10-12 14:29:55 +00:00
|
|
|
if (GST_OBJECT_FLAG_IS_SET (sink, DXR3AUDIOSINK_OPEN)) {
|
2003-05-29 14:35:24 +00:00
|
|
|
if (GST_BUFFER_TIMESTAMP (buf) != GST_CLOCK_TIME_NONE) {
|
|
|
|
/* We have a new scr value. */
|
|
|
|
sink->scr = GSTTIME_TO_MPEGTIME (GST_BUFFER_TIMESTAMP (buf));
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Update the system reference clock (SCR) in the card. */
|
|
|
|
{
|
|
|
|
unsigned in, out, odelay;
|
|
|
|
unsigned diff;
|
|
|
|
|
|
|
|
ioctl (sink->control_fd, EM8300_IOCTL_SCR_GET, &out);
|
|
|
|
|
|
|
|
ioctl (sink->audio_fd, SNDCTL_DSP_GETODELAY, &odelay);
|
|
|
|
|
|
|
|
in = MPEGTIME_TO_DXRTIME (sink->scr - (odelay * 90) / 192);
|
|
|
|
diff = in > out ? in - out : out - in;
|
|
|
|
if (diff > 1800) {
|
2004-03-15 19:32:27 +00:00
|
|
|
dxr3audiosink_set_scr (sink, in);
|
2003-05-29 14:35:24 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Update our SCR value. */
|
|
|
|
sink->scr += (unsigned) (GST_BUFFER_SIZE (buf) *
|
2004-03-15 19:32:27 +00:00
|
|
|
(90000.0 / ((float) sink->rate * 4)));
|
2003-05-29 14:35:24 +00:00
|
|
|
|
|
|
|
/* Write the buffer to the sound device. */
|
|
|
|
bytes_written = write (sink->audio_fd, GST_BUFFER_DATA (buf),
|
2004-03-15 19:32:27 +00:00
|
|
|
GST_BUFFER_SIZE (buf));
|
2003-05-29 14:35:24 +00:00
|
|
|
if (bytes_written < GST_BUFFER_SIZE (buf)) {
|
|
|
|
fprintf (stderr, "dxr3audiosink: Warning: %d bytes should be "
|
2004-03-15 19:32:27 +00:00
|
|
|
"written, only %d bytes written\n",
|
|
|
|
GST_BUFFER_SIZE (buf), bytes_written);
|
2003-05-29 14:35:24 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
gst_buffer_unref (buf);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
static void
|
|
|
|
dxr3audiosink_chain_ac3 (GstPad * pad, GstData * _data)
|
2003-05-29 14:35:24 +00:00
|
|
|
{
|
|
|
|
Dxr3AudioSink *sink;
|
|
|
|
gint bytes_written = 0;
|
2003-10-14 10:09:11 +00:00
|
|
|
GstBuffer *buf;
|
2003-05-29 14:35:24 +00:00
|
|
|
|
|
|
|
g_return_if_fail (pad != NULL);
|
|
|
|
g_return_if_fail (GST_IS_PAD (pad));
|
2003-10-14 10:09:11 +00:00
|
|
|
g_return_if_fail (_data != NULL);
|
2003-05-29 14:35:24 +00:00
|
|
|
|
|
|
|
sink = DXR3AUDIOSINK (gst_pad_get_parent (pad));
|
|
|
|
|
2003-10-14 10:09:11 +00:00
|
|
|
if (GST_IS_EVENT (_data)) {
|
|
|
|
dxr3audiosink_handle_event (pad, GST_EVENT (_data));
|
2003-05-29 14:35:24 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2003-10-14 10:09:11 +00:00
|
|
|
buf = GST_BUFFER (_data);
|
|
|
|
|
2003-05-29 14:35:24 +00:00
|
|
|
if (sink->mode != DXR3AUDIOSINK_MODE_AC3) {
|
|
|
|
/* Switch to AC3 mode. */
|
|
|
|
dxr3audiosink_set_mode_ac3 (sink);
|
|
|
|
}
|
|
|
|
|
renamed GST_FLAGS macros to GST_OBJECT_FLAGS moved bitshift from macro to enum definition
Original commit message from CVS:
* examples/indexing/indexmpeg.c: (main):
* ext/artsd/gstartsdsink.c: (gst_artsdsink_open_audio),
(gst_artsdsink_close_audio), (gst_artsdsink_change_state):
* ext/artsd/gstartsdsink.h:
* ext/audiofile/gstafparse.c: (gst_afparse_open_file),
(gst_afparse_close_file):
* ext/audiofile/gstafparse.h:
* ext/audiofile/gstafsink.c: (gst_afsink_open_file),
(gst_afsink_close_file), (gst_afsink_chain),
(gst_afsink_change_state):
* ext/audiofile/gstafsink.h:
* ext/audiofile/gstafsrc.c: (gst_afsrc_open_file),
(gst_afsrc_close_file), (gst_afsrc_change_state):
* ext/audiofile/gstafsrc.h:
* ext/cdaudio/gstcdaudio.c: (gst_cdaudio_init):
* ext/directfb/directfbvideosink.c: (gst_directfbvideosink_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_init):
* ext/jack/gstjack.h:
* ext/jack/gstjackbin.c: (gst_jack_bin_init),
(gst_jack_bin_change_state):
* ext/musepack/gstmusepackdec.c: (gst_musepackdec_init):
* ext/musicbrainz/gsttrm.c: (gst_musicbrainz_init):
* ext/nas/nassink.c: (gst_nassink_open_audio),
(gst_nassink_close_audio), (gst_nassink_change_state):
* ext/nas/nassink.h:
* ext/polyp/polypsink.c: (gst_polypsink_init):
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_change_state):
* ext/sdl/sdlvideosink.h:
* ext/smoothwave/gstsmoothwave.c: (gst_smoothwave_init):
* ext/sndfile/gstsf.c: (gst_sf_set_property),
(gst_sf_change_state), (gst_sf_release_request_pad),
(gst_sf_open_file), (gst_sf_close_file), (gst_sf_loop):
* ext/sndfile/gstsf.h:
* ext/swfdec/gstswfdec.c: (gst_swfdec_init):
* ext/tarkin/gsttarkindec.c: (gst_tarkindec_init):
* gst/apetag/apedemux.c: (gst_ape_demux_init):
* gst/cdxaparse/gstcdxaparse.c: (gst_cdxaparse_init):
* gst/cdxaparse/gstcdxastrip.c: (gst_cdxastrip_init):
* gst/festival/gstfestival.c: (gst_festival_change_state):
* gst/festival/gstfestival.h:
* gst/mpeg2sub/gstmpeg2subt.c: (gst_mpeg2subt_init):
* gst/multifilesink/gstmultifilesink.c: (gst_multifilesink_init),
(gst_multifilesink_set_location), (gst_multifilesink_open_file),
(gst_multifilesink_close_file), (gst_multifilesink_next_file),
(gst_multifilesink_pad_query), (gst_multifilesink_handle_event),
(gst_multifilesink_chain), (gst_multifilesink_change_state):
* gst/multifilesink/gstmultifilesink.h:
* gst/videodrop/gstvideodrop.c: (gst_videodrop_init):
* sys/cdrom/gstcdplayer.c: (cdplayer_init):
* sys/dxr3/dxr3audiosink.c: (dxr3audiosink_init),
(dxr3audiosink_open), (dxr3audiosink_close),
(dxr3audiosink_chain_pcm), (dxr3audiosink_chain_ac3),
(dxr3audiosink_change_state):
* sys/dxr3/dxr3audiosink.h:
* sys/dxr3/dxr3spusink.c: (dxr3spusink_init), (dxr3spusink_open),
(dxr3spusink_close), (dxr3spusink_chain),
(dxr3spusink_change_state):
* sys/dxr3/dxr3spusink.h:
* sys/dxr3/dxr3videosink.c: (dxr3videosink_init),
(dxr3videosink_open), (dxr3videosink_close),
(dxr3videosink_write_data), (dxr3videosink_change_state):
* sys/dxr3/dxr3videosink.h:
* sys/glsink/glimagesink.c: (gst_glimagesink_init):
* sys/qcam/gstqcamsrc.c: (gst_qcamsrc_change_state),
(gst_qcamsrc_open), (gst_qcamsrc_close):
* sys/qcam/gstqcamsrc.h:
* sys/v4l2/gstv4l2src.c: (gst_v4l2src_init):
* sys/vcd/vcdsrc.c: (gst_vcdsrc_set_property), (gst_vcdsrc_get),
(gst_vcdsrc_open_file), (gst_vcdsrc_close_file),
(gst_vcdsrc_change_state), (gst_vcdsrc_recalculate):
* sys/vcd/vcdsrc.h:
renamed GST_FLAGS macros to GST_OBJECT_FLAGS
moved bitshift from macro to enum definition
2005-10-12 14:29:55 +00:00
|
|
|
if (GST_OBJECT_FLAG_IS_SET (sink, DXR3AUDIOSINK_OPEN)) {
|
2003-05-29 14:35:24 +00:00
|
|
|
int event;
|
|
|
|
|
|
|
|
if (GST_BUFFER_TIMESTAMP (buf) != GST_CLOCK_TIME_NONE) {
|
|
|
|
/* We have a new scr value. */
|
|
|
|
|
|
|
|
/* fprintf (stderr, "------ Audio Time %.04f\n", */
|
|
|
|
/* (double) GST_BUFFER_TIMESTAMP (buf) / GST_SECOND); */
|
|
|
|
|
|
|
|
sink->scr = GSTTIME_TO_MPEGTIME (GST_BUFFER_TIMESTAMP (buf));
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Push the new data into the padder. */
|
2004-03-14 22:34:33 +00:00
|
|
|
ac3p_push_data (sink->padder, GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf));
|
2003-05-29 14:35:24 +00:00
|
|
|
|
|
|
|
/* Parse the data. */
|
|
|
|
event = ac3p_parse (sink->padder);
|
|
|
|
while (event != AC3P_EVENT_PUSH) {
|
|
|
|
switch (event) {
|
2004-03-15 19:32:27 +00:00
|
|
|
case AC3P_EVENT_FRAME:
|
|
|
|
/* We have a new frame: */
|
2003-05-29 14:35:24 +00:00
|
|
|
|
2004-03-15 19:32:27 +00:00
|
|
|
/* Update the system reference clock (SCR) in the card. */
|
|
|
|
{
|
|
|
|
unsigned in, out, odelay;
|
|
|
|
unsigned diff;
|
2003-05-29 14:35:24 +00:00
|
|
|
|
2004-03-15 19:32:27 +00:00
|
|
|
ioctl (sink->control_fd, EM8300_IOCTL_SCR_GET, &out);
|
2003-05-29 14:35:24 +00:00
|
|
|
|
2004-03-15 19:32:27 +00:00
|
|
|
ioctl (sink->audio_fd, SNDCTL_DSP_GETODELAY, &odelay);
|
|
|
|
/* 192000 bytes/sec */
|
2003-05-29 14:35:24 +00:00
|
|
|
|
2004-03-15 19:32:27 +00:00
|
|
|
in = MPEGTIME_TO_DXRTIME (sink->scr - (odelay * 90) / 192);
|
|
|
|
diff = in > out ? in - out : out - in;
|
|
|
|
if (diff > 1800) {
|
|
|
|
dxr3audiosink_set_scr (sink, in);
|
|
|
|
}
|
|
|
|
}
|
2003-05-29 14:35:24 +00:00
|
|
|
|
2004-03-15 19:32:27 +00:00
|
|
|
/* Update our SCR value. */
|
|
|
|
sink->scr += TIME_FOR_BYTES (ac3p_frame_size (sink->padder));
|
2003-05-29 14:35:24 +00:00
|
|
|
|
2004-03-15 19:32:27 +00:00
|
|
|
/* Write the frame to the sound device. */
|
|
|
|
bytes_written = write (sink->audio_fd, ac3p_frame (sink->padder),
|
|
|
|
AC3P_IEC_FRAME_SIZE);
|
2003-05-29 14:35:24 +00:00
|
|
|
|
2004-03-15 19:32:27 +00:00
|
|
|
if (bytes_written < AC3P_IEC_FRAME_SIZE) {
|
|
|
|
fprintf (stderr, "dxr3audiosink: Warning: %d bytes should be "
|
|
|
|
"written, only %d bytes written\n",
|
|
|
|
AC3P_IEC_FRAME_SIZE, bytes_written);
|
|
|
|
}
|
2003-05-29 14:35:24 +00:00
|
|
|
|
2004-03-15 19:32:27 +00:00
|
|
|
break;
|
2003-05-29 14:35:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
event = ac3p_parse (sink->padder);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_buffer_unref (buf);
|
2003-05-29 14:35:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
/**
|
|
|
|
* dxr3audiosink_wait:
|
2005-11-09 01:04:05 +00:00
|
|
|
*
|
2003-05-29 14:35:24 +00:00
|
|
|
* Make the sink wait the specified amount of time.
|
|
|
|
*/
|
|
|
|
static void
|
2004-03-14 22:34:33 +00:00
|
|
|
dxr3audiosink_wait (Dxr3AudioSink * sink, GstClockTime time)
|
2003-05-29 14:35:24 +00:00
|
|
|
{
|
|
|
|
GstClockID id;
|
|
|
|
GstClockTimeDiff jitter;
|
|
|
|
GstClockReturn ret;
|
|
|
|
GstClockTime current_time = gst_clock_get_time (sink->clock);
|
|
|
|
|
|
|
|
id = gst_clock_new_single_shot_id (sink->clock, current_time + time);
|
|
|
|
ret = gst_clock_id_wait (id, &jitter);
|
|
|
|
gst_clock_id_free (id);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static int
|
2004-03-14 22:34:33 +00:00
|
|
|
dxr3audiosink_mvcommand (Dxr3AudioSink * sink, int command)
|
2003-05-29 14:35:24 +00:00
|
|
|
{
|
|
|
|
em8300_register_t regs;
|
2004-03-14 22:34:33 +00:00
|
|
|
|
2003-05-29 14:35:24 +00:00
|
|
|
regs.microcode_register = 1;
|
|
|
|
regs.reg = 0;
|
|
|
|
regs.val = command;
|
2004-03-14 22:34:33 +00:00
|
|
|
|
2003-05-29 14:35:24 +00:00
|
|
|
return ioctl (sink->control_fd, EM8300_IOCTL_WRITEREG, ®s);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2005-09-05 17:20:29 +00:00
|
|
|
static GstStateChangeReturn
|
|
|
|
dxr3audiosink_change_state (GstElement * element, GstStateChange transition)
|
2003-05-29 14:35:24 +00:00
|
|
|
{
|
2005-09-05 17:20:29 +00:00
|
|
|
g_return_val_if_fail (GST_IS_DXR3AUDIOSINK (element),
|
|
|
|
GST_STATE_CHANGE_FAILURE);
|
2003-05-29 14:35:24 +00:00
|
|
|
|
|
|
|
if (GST_STATE_PENDING (element) == GST_STATE_NULL) {
|
renamed GST_FLAGS macros to GST_OBJECT_FLAGS moved bitshift from macro to enum definition
Original commit message from CVS:
* examples/indexing/indexmpeg.c: (main):
* ext/artsd/gstartsdsink.c: (gst_artsdsink_open_audio),
(gst_artsdsink_close_audio), (gst_artsdsink_change_state):
* ext/artsd/gstartsdsink.h:
* ext/audiofile/gstafparse.c: (gst_afparse_open_file),
(gst_afparse_close_file):
* ext/audiofile/gstafparse.h:
* ext/audiofile/gstafsink.c: (gst_afsink_open_file),
(gst_afsink_close_file), (gst_afsink_chain),
(gst_afsink_change_state):
* ext/audiofile/gstafsink.h:
* ext/audiofile/gstafsrc.c: (gst_afsrc_open_file),
(gst_afsrc_close_file), (gst_afsrc_change_state):
* ext/audiofile/gstafsrc.h:
* ext/cdaudio/gstcdaudio.c: (gst_cdaudio_init):
* ext/directfb/directfbvideosink.c: (gst_directfbvideosink_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_init):
* ext/jack/gstjack.h:
* ext/jack/gstjackbin.c: (gst_jack_bin_init),
(gst_jack_bin_change_state):
* ext/musepack/gstmusepackdec.c: (gst_musepackdec_init):
* ext/musicbrainz/gsttrm.c: (gst_musicbrainz_init):
* ext/nas/nassink.c: (gst_nassink_open_audio),
(gst_nassink_close_audio), (gst_nassink_change_state):
* ext/nas/nassink.h:
* ext/polyp/polypsink.c: (gst_polypsink_init):
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_change_state):
* ext/sdl/sdlvideosink.h:
* ext/smoothwave/gstsmoothwave.c: (gst_smoothwave_init):
* ext/sndfile/gstsf.c: (gst_sf_set_property),
(gst_sf_change_state), (gst_sf_release_request_pad),
(gst_sf_open_file), (gst_sf_close_file), (gst_sf_loop):
* ext/sndfile/gstsf.h:
* ext/swfdec/gstswfdec.c: (gst_swfdec_init):
* ext/tarkin/gsttarkindec.c: (gst_tarkindec_init):
* gst/apetag/apedemux.c: (gst_ape_demux_init):
* gst/cdxaparse/gstcdxaparse.c: (gst_cdxaparse_init):
* gst/cdxaparse/gstcdxastrip.c: (gst_cdxastrip_init):
* gst/festival/gstfestival.c: (gst_festival_change_state):
* gst/festival/gstfestival.h:
* gst/mpeg2sub/gstmpeg2subt.c: (gst_mpeg2subt_init):
* gst/multifilesink/gstmultifilesink.c: (gst_multifilesink_init),
(gst_multifilesink_set_location), (gst_multifilesink_open_file),
(gst_multifilesink_close_file), (gst_multifilesink_next_file),
(gst_multifilesink_pad_query), (gst_multifilesink_handle_event),
(gst_multifilesink_chain), (gst_multifilesink_change_state):
* gst/multifilesink/gstmultifilesink.h:
* gst/videodrop/gstvideodrop.c: (gst_videodrop_init):
* sys/cdrom/gstcdplayer.c: (cdplayer_init):
* sys/dxr3/dxr3audiosink.c: (dxr3audiosink_init),
(dxr3audiosink_open), (dxr3audiosink_close),
(dxr3audiosink_chain_pcm), (dxr3audiosink_chain_ac3),
(dxr3audiosink_change_state):
* sys/dxr3/dxr3audiosink.h:
* sys/dxr3/dxr3spusink.c: (dxr3spusink_init), (dxr3spusink_open),
(dxr3spusink_close), (dxr3spusink_chain),
(dxr3spusink_change_state):
* sys/dxr3/dxr3spusink.h:
* sys/dxr3/dxr3videosink.c: (dxr3videosink_init),
(dxr3videosink_open), (dxr3videosink_close),
(dxr3videosink_write_data), (dxr3videosink_change_state):
* sys/dxr3/dxr3videosink.h:
* sys/glsink/glimagesink.c: (gst_glimagesink_init):
* sys/qcam/gstqcamsrc.c: (gst_qcamsrc_change_state),
(gst_qcamsrc_open), (gst_qcamsrc_close):
* sys/qcam/gstqcamsrc.h:
* sys/v4l2/gstv4l2src.c: (gst_v4l2src_init):
* sys/vcd/vcdsrc.c: (gst_vcdsrc_set_property), (gst_vcdsrc_get),
(gst_vcdsrc_open_file), (gst_vcdsrc_close_file),
(gst_vcdsrc_change_state), (gst_vcdsrc_recalculate):
* sys/vcd/vcdsrc.h:
renamed GST_FLAGS macros to GST_OBJECT_FLAGS
moved bitshift from macro to enum definition
2005-10-12 14:29:55 +00:00
|
|
|
if (GST_OBJECT_FLAG_IS_SET (element, DXR3AUDIOSINK_OPEN)) {
|
2003-05-29 14:35:24 +00:00
|
|
|
dxr3audiosink_close (DXR3AUDIOSINK (element));
|
|
|
|
}
|
2004-03-14 22:34:33 +00:00
|
|
|
} else {
|
renamed GST_FLAGS macros to GST_OBJECT_FLAGS moved bitshift from macro to enum definition
Original commit message from CVS:
* examples/indexing/indexmpeg.c: (main):
* ext/artsd/gstartsdsink.c: (gst_artsdsink_open_audio),
(gst_artsdsink_close_audio), (gst_artsdsink_change_state):
* ext/artsd/gstartsdsink.h:
* ext/audiofile/gstafparse.c: (gst_afparse_open_file),
(gst_afparse_close_file):
* ext/audiofile/gstafparse.h:
* ext/audiofile/gstafsink.c: (gst_afsink_open_file),
(gst_afsink_close_file), (gst_afsink_chain),
(gst_afsink_change_state):
* ext/audiofile/gstafsink.h:
* ext/audiofile/gstafsrc.c: (gst_afsrc_open_file),
(gst_afsrc_close_file), (gst_afsrc_change_state):
* ext/audiofile/gstafsrc.h:
* ext/cdaudio/gstcdaudio.c: (gst_cdaudio_init):
* ext/directfb/directfbvideosink.c: (gst_directfbvideosink_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_init):
* ext/jack/gstjack.h:
* ext/jack/gstjackbin.c: (gst_jack_bin_init),
(gst_jack_bin_change_state):
* ext/musepack/gstmusepackdec.c: (gst_musepackdec_init):
* ext/musicbrainz/gsttrm.c: (gst_musicbrainz_init):
* ext/nas/nassink.c: (gst_nassink_open_audio),
(gst_nassink_close_audio), (gst_nassink_change_state):
* ext/nas/nassink.h:
* ext/polyp/polypsink.c: (gst_polypsink_init):
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_change_state):
* ext/sdl/sdlvideosink.h:
* ext/smoothwave/gstsmoothwave.c: (gst_smoothwave_init):
* ext/sndfile/gstsf.c: (gst_sf_set_property),
(gst_sf_change_state), (gst_sf_release_request_pad),
(gst_sf_open_file), (gst_sf_close_file), (gst_sf_loop):
* ext/sndfile/gstsf.h:
* ext/swfdec/gstswfdec.c: (gst_swfdec_init):
* ext/tarkin/gsttarkindec.c: (gst_tarkindec_init):
* gst/apetag/apedemux.c: (gst_ape_demux_init):
* gst/cdxaparse/gstcdxaparse.c: (gst_cdxaparse_init):
* gst/cdxaparse/gstcdxastrip.c: (gst_cdxastrip_init):
* gst/festival/gstfestival.c: (gst_festival_change_state):
* gst/festival/gstfestival.h:
* gst/mpeg2sub/gstmpeg2subt.c: (gst_mpeg2subt_init):
* gst/multifilesink/gstmultifilesink.c: (gst_multifilesink_init),
(gst_multifilesink_set_location), (gst_multifilesink_open_file),
(gst_multifilesink_close_file), (gst_multifilesink_next_file),
(gst_multifilesink_pad_query), (gst_multifilesink_handle_event),
(gst_multifilesink_chain), (gst_multifilesink_change_state):
* gst/multifilesink/gstmultifilesink.h:
* gst/videodrop/gstvideodrop.c: (gst_videodrop_init):
* sys/cdrom/gstcdplayer.c: (cdplayer_init):
* sys/dxr3/dxr3audiosink.c: (dxr3audiosink_init),
(dxr3audiosink_open), (dxr3audiosink_close),
(dxr3audiosink_chain_pcm), (dxr3audiosink_chain_ac3),
(dxr3audiosink_change_state):
* sys/dxr3/dxr3audiosink.h:
* sys/dxr3/dxr3spusink.c: (dxr3spusink_init), (dxr3spusink_open),
(dxr3spusink_close), (dxr3spusink_chain),
(dxr3spusink_change_state):
* sys/dxr3/dxr3spusink.h:
* sys/dxr3/dxr3videosink.c: (dxr3videosink_init),
(dxr3videosink_open), (dxr3videosink_close),
(dxr3videosink_write_data), (dxr3videosink_change_state):
* sys/dxr3/dxr3videosink.h:
* sys/glsink/glimagesink.c: (gst_glimagesink_init):
* sys/qcam/gstqcamsrc.c: (gst_qcamsrc_change_state),
(gst_qcamsrc_open), (gst_qcamsrc_close):
* sys/qcam/gstqcamsrc.h:
* sys/v4l2/gstv4l2src.c: (gst_v4l2src_init):
* sys/vcd/vcdsrc.c: (gst_vcdsrc_set_property), (gst_vcdsrc_get),
(gst_vcdsrc_open_file), (gst_vcdsrc_close_file),
(gst_vcdsrc_change_state), (gst_vcdsrc_recalculate):
* sys/vcd/vcdsrc.h:
renamed GST_FLAGS macros to GST_OBJECT_FLAGS
moved bitshift from macro to enum definition
2005-10-12 14:29:55 +00:00
|
|
|
if (!GST_OBJECT_FLAG_IS_SET (element, DXR3AUDIOSINK_OPEN)) {
|
2003-05-29 14:35:24 +00:00
|
|
|
if (!dxr3audiosink_open (DXR3AUDIOSINK (element))) {
|
2005-09-05 17:20:29 +00:00
|
|
|
return GST_STATE_CHANGE_FAILURE;
|
2003-05-29 14:35:24 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (GST_ELEMENT_CLASS (parent_class)->change_state) {
|
2005-09-05 17:20:29 +00:00
|
|
|
return GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
|
2003-05-29 14:35:24 +00:00
|
|
|
}
|
|
|
|
|
2005-09-05 17:20:29 +00:00
|
|
|
return GST_STATE_CHANGE_SUCCESS;
|
2003-05-29 14:35:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* dxr3audiosink_flushed:
|
|
|
|
*
|
|
|
|
* Default do nothing implementation for the "flushed" signal. The
|
|
|
|
* "flushed" signal will be fired right after flushing the hardware
|
|
|
|
* queues due to a received flush event
|
|
|
|
*/
|
|
|
|
static void
|
2004-03-14 22:34:33 +00:00
|
|
|
dxr3audiosink_flushed (Dxr3AudioSink * sink)
|
2003-05-29 14:35:24 +00:00
|
|
|
{
|
|
|
|
/* Do nothing. */
|
|
|
|
}
|