2001-12-21 11:46:15 +00:00
|
|
|
/* GStreamer
|
|
|
|
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
|
|
|
|
* 2000 Wim Taymans <wtay@chello.be>
|
|
|
|
*
|
|
|
|
* gstafsink.c:
|
|
|
|
*
|
|
|
|
* 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
|
2004-01-18 21:46:58 +00:00
|
|
|
|
2004-01-19 13:50:39 +00:00
|
|
|
#include "gst/gst-i18n-plugin.h"
|
2004-01-18 21:46:58 +00:00
|
|
|
|
2001-12-21 11:46:15 +00:00
|
|
|
#include <gst/gst.h>
|
2004-01-18 21:46:58 +00:00
|
|
|
#include <string.h>
|
|
|
|
#include <errno.h>
|
|
|
|
|
2001-12-21 11:46:15 +00:00
|
|
|
#include "gstafsink.h"
|
|
|
|
|
|
|
|
/* AFSink signals and args */
|
2004-03-14 22:34:33 +00:00
|
|
|
enum
|
|
|
|
{
|
2001-12-21 11:46:15 +00:00
|
|
|
/* FILL ME */
|
|
|
|
SIGNAL_HANDOFF,
|
|
|
|
LAST_SIGNAL
|
|
|
|
};
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
enum
|
|
|
|
{
|
2001-12-21 11:46:15 +00:00
|
|
|
ARG_0,
|
|
|
|
ARG_TYPE,
|
|
|
|
ARG_OUTPUT_ENDIANNESS,
|
|
|
|
ARG_LOCATION
|
|
|
|
};
|
|
|
|
|
|
|
|
/* added a sink factory function to force audio/raw MIME type */
|
|
|
|
/* I think the caps can be broader, we need to change that somehow */
|
2003-12-22 01:47:09 +00:00
|
|
|
static GstStaticPadTemplate afsink_sink_factory =
|
2004-03-14 22:34:33 +00:00
|
|
|
GST_STATIC_PAD_TEMPLATE ("sink",
|
|
|
|
GST_PAD_SINK,
|
|
|
|
GST_PAD_ALWAYS,
|
|
|
|
GST_STATIC_CAPS ("audio/x-raw-int, "
|
2004-03-15 19:32:27 +00:00
|
|
|
"rate = (int) [ 1, MAX ], "
|
|
|
|
"channels = (int) [ 1, 2 ], "
|
|
|
|
"endianness = (int) BYTE_ORDER, "
|
|
|
|
"width = (int) { 8, 16 }, "
|
2004-11-09 06:08:22 +00:00
|
|
|
"depth = (int) { 8, 16 }, " "signed = (boolean) { true, false }")
|
2004-03-14 22:34:33 +00:00
|
|
|
);
|
2001-12-21 11:46:15 +00:00
|
|
|
|
|
|
|
/* we use an enum for the output type arg */
|
|
|
|
|
|
|
|
#define GST_TYPE_AFSINK_TYPES (gst_afsink_types_get_type())
|
|
|
|
/* FIXME: fix the string ints to be string-converted from the audiofile.h types */
|
|
|
|
static GType
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_afsink_types_get_type (void)
|
2001-12-21 11:46:15 +00:00
|
|
|
{
|
|
|
|
static GType afsink_types_type = 0;
|
|
|
|
static GEnumValue afsink_types[] = {
|
|
|
|
{AF_FILE_RAWDATA, "0", "raw PCM"},
|
2004-03-14 22:34:33 +00:00
|
|
|
{AF_FILE_AIFFC, "1", "AIFFC"},
|
|
|
|
{AF_FILE_AIFF, "2", "AIFF"},
|
2001-12-21 11:46:15 +00:00
|
|
|
{AF_FILE_NEXTSND, "3", "Next/SND"},
|
2004-03-14 22:34:33 +00:00
|
|
|
{AF_FILE_WAVE, "4", "Wave"},
|
2001-12-21 11:46:15 +00:00
|
|
|
{0, NULL, NULL},
|
|
|
|
};
|
2004-03-14 22:34:33 +00:00
|
|
|
|
|
|
|
if (!afsink_types_type) {
|
|
|
|
afsink_types_type =
|
2004-03-15 19:32:27 +00:00
|
|
|
g_enum_register_static ("GstAudiosinkTypes", afsink_types);
|
2001-12-21 11:46:15 +00:00
|
|
|
}
|
|
|
|
return afsink_types_type;
|
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
static void gst_afsink_base_init (gpointer g_class);
|
|
|
|
static void gst_afsink_class_init (GstAFSinkClass * klass);
|
|
|
|
static void gst_afsink_init (GstAFSink * afsink);
|
2001-12-21 11:46:15 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
static gboolean gst_afsink_open_file (GstAFSink * sink);
|
|
|
|
static void gst_afsink_close_file (GstAFSink * sink);
|
2001-12-21 11:46:15 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
static void gst_afsink_chain (GstPad * pad, GstData * _data);
|
2001-12-21 11:46:15 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
static void gst_afsink_set_property (GObject * object, guint prop_id,
|
|
|
|
const GValue * value, GParamSpec * pspec);
|
|
|
|
static void gst_afsink_get_property (GObject * object, guint prop_id,
|
|
|
|
GValue * value, GParamSpec * pspec);
|
2001-12-21 11:46:15 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
static gboolean gst_afsink_handle_event (GstPad * pad, GstEvent * event);
|
2001-12-21 11:46:15 +00:00
|
|
|
|
2005-09-05 17:20:29 +00:00
|
|
|
static GstStateChangeReturn gst_afsink_change_state (GstElement * element,
|
|
|
|
GstStateChange transition);
|
2001-12-21 11:46:15 +00:00
|
|
|
|
|
|
|
static GstElementClass *parent_class = NULL;
|
|
|
|
static guint gst_afsink_signals[LAST_SIGNAL] = { 0 };
|
|
|
|
|
|
|
|
GType
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_afsink_get_type (void)
|
2001-12-21 11:46:15 +00:00
|
|
|
{
|
|
|
|
static GType afsink_type = 0;
|
|
|
|
|
|
|
|
if (!afsink_type) {
|
|
|
|
static const GTypeInfo afsink_info = {
|
2003-11-01 14:04:20 +00:00
|
|
|
sizeof (GstAFSinkClass),
|
|
|
|
gst_afsink_base_init,
|
2001-12-21 11:46:15 +00:00
|
|
|
NULL,
|
|
|
|
(GClassInitFunc) gst_afsink_class_init,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
sizeof (GstAFSink),
|
|
|
|
0,
|
|
|
|
(GInstanceInitFunc) gst_afsink_init,
|
|
|
|
};
|
2004-03-15 19:32:27 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
afsink_type =
|
2004-03-15 19:32:27 +00:00
|
|
|
g_type_register_static (GST_TYPE_ELEMENT, "GstAFSink", &afsink_info, 0);
|
2001-12-21 11:46:15 +00:00
|
|
|
}
|
|
|
|
return afsink_type;
|
|
|
|
}
|
|
|
|
|
2003-11-01 14:04:20 +00:00
|
|
|
static void
|
|
|
|
gst_afsink_base_init (gpointer g_class)
|
|
|
|
{
|
|
|
|
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
|
|
|
|
|
2003-12-22 01:47:09 +00:00
|
|
|
gst_element_class_add_pad_template (element_class,
|
|
|
|
gst_static_pad_template_get (&afsink_sink_factory));
|
2010-03-18 16:30:26 +00:00
|
|
|
gst_element_class_set_details_simple (element_class, "Audiofile sink",
|
|
|
|
"Sink/Audio",
|
|
|
|
"Write audio streams to disk using libaudiofile",
|
|
|
|
"Thomas Vander Stichele <thomas@apestaart.org>");
|
2003-11-01 14:04:20 +00:00
|
|
|
}
|
|
|
|
|
2001-12-21 11:46:15 +00:00
|
|
|
static void
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_afsink_class_init (GstAFSinkClass * klass)
|
2001-12-21 11:46:15 +00:00
|
|
|
{
|
|
|
|
GObjectClass *gobject_class;
|
|
|
|
GstElementClass *gstelement_class;
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
gobject_class = (GObjectClass *) klass;
|
|
|
|
gstelement_class = (GstElementClass *) klass;
|
2001-12-21 11:46:15 +00:00
|
|
|
|
2006-04-08 21:48:01 +00:00
|
|
|
parent_class = g_type_class_peek_parent (klass);
|
2001-12-21 11:46:15 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_element_class_install_std_props (GST_ELEMENT_CLASS (klass),
|
|
|
|
"location", ARG_LOCATION, G_PARAM_READWRITE, NULL);
|
|
|
|
|
2010-10-19 12:30:02 +00:00
|
|
|
/* FIXME: add long property descriptions */
|
|
|
|
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_TYPE,
|
|
|
|
g_param_spec_enum ("type", "type", "type", GST_TYPE_AFSINK_TYPES, 0,
|
2010-10-19 13:23:23 +00:00
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2010-10-19 12:30:02 +00:00
|
|
|
g_object_class_install_property (G_OBJECT_CLASS (klass),
|
|
|
|
ARG_OUTPUT_ENDIANNESS, g_param_spec_int ("endianness", "endianness",
|
2010-10-19 13:23:23 +00:00
|
|
|
"endianness", G_MININT, G_MAXINT, 0,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2004-03-14 22:34:33 +00:00
|
|
|
|
2001-12-21 11:46:15 +00:00
|
|
|
gst_afsink_signals[SIGNAL_HANDOFF] =
|
2004-03-14 22:34:33 +00:00
|
|
|
g_signal_new ("handoff", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
|
|
|
|
G_STRUCT_OFFSET (GstAFSinkClass, handoff), NULL, NULL,
|
|
|
|
g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
|
2001-12-21 11:46:15 +00:00
|
|
|
|
|
|
|
|
|
|
|
gobject_class->set_property = gst_afsink_set_property;
|
|
|
|
gobject_class->get_property = gst_afsink_get_property;
|
|
|
|
|
|
|
|
gstelement_class->change_state = gst_afsink_change_state;
|
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
static void
|
|
|
|
gst_afsink_init (GstAFSink * afsink)
|
2001-12-21 11:46:15 +00:00
|
|
|
{
|
2002-02-03 20:35:26 +00:00
|
|
|
/* GstPad *pad; this is now done in the struct */
|
2001-12-21 11:46:15 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
afsink->sinkpad =
|
|
|
|
gst_pad_new_from_template (gst_element_get_pad_template (GST_ELEMENT
|
2004-03-15 19:32:27 +00:00
|
|
|
(afsink), "sink"), "sink");
|
2001-12-21 11:46:15 +00:00
|
|
|
gst_element_add_pad (GST_ELEMENT (afsink), afsink->sinkpad);
|
|
|
|
|
|
|
|
gst_pad_set_chain_function (afsink->sinkpad, gst_afsink_chain);
|
|
|
|
|
|
|
|
afsink->filename = NULL;
|
|
|
|
afsink->file = NULL;
|
|
|
|
/* default values, should never be needed */
|
|
|
|
afsink->channels = 2;
|
|
|
|
afsink->width = 16;
|
|
|
|
afsink->rate = 44100;
|
|
|
|
afsink->type = AF_FILE_WAVE;
|
|
|
|
afsink->endianness_data = 1234;
|
|
|
|
afsink->endianness_wanted = 1234;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_afsink_set_property (GObject * object, guint prop_id, const GValue * value,
|
|
|
|
GParamSpec * pspec)
|
2001-12-21 11:46:15 +00:00
|
|
|
{
|
|
|
|
GstAFSink *sink;
|
|
|
|
|
|
|
|
sink = GST_AFSINK (object);
|
|
|
|
|
|
|
|
switch (prop_id) {
|
|
|
|
case ARG_LOCATION:
|
|
|
|
/* the element must be stopped or paused in order to do this */
|
|
|
|
g_return_if_fail ((GST_STATE (sink) < GST_STATE_PLAYING)
|
2004-03-15 19:32:27 +00:00
|
|
|
|| (GST_STATE (sink) == GST_STATE_PAUSED));
|
2001-12-21 11:46:15 +00:00
|
|
|
if (sink->filename)
|
2004-03-15 19:32:27 +00:00
|
|
|
g_free (sink->filename);
|
2001-12-21 11:46:15 +00:00
|
|
|
sink->filename = g_strdup (g_value_get_string (value));
|
2004-03-14 22:34:33 +00:00
|
|
|
if ((GST_STATE (sink) == GST_STATE_PAUSED)
|
2004-03-15 19:32:27 +00:00
|
|
|
&& (sink->filename != NULL)) {
|
|
|
|
gst_afsink_close_file (sink);
|
|
|
|
gst_afsink_open_file (sink);
|
2001-12-21 11:46:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
case ARG_TYPE:
|
|
|
|
sink->type = g_value_get_enum (value);
|
|
|
|
break;
|
|
|
|
case ARG_OUTPUT_ENDIANNESS:
|
2004-03-14 22:34:33 +00:00
|
|
|
{
|
|
|
|
int end = g_value_get_int (value);
|
|
|
|
|
|
|
|
if (end == 1234 || end == 4321)
|
2004-03-15 19:32:27 +00:00
|
|
|
sink->endianness_output = end;
|
2004-03-14 22:34:33 +00:00
|
|
|
}
|
2001-12-21 11:46:15 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
static void
|
|
|
|
gst_afsink_get_property (GObject * object, guint prop_id, GValue * value,
|
|
|
|
GParamSpec * pspec)
|
2001-12-21 11:46:15 +00:00
|
|
|
{
|
|
|
|
GstAFSink *sink;
|
2004-03-14 22:34:33 +00:00
|
|
|
|
2001-12-21 11:46:15 +00:00
|
|
|
g_return_if_fail (GST_IS_AFSINK (object));
|
2004-03-14 22:34:33 +00:00
|
|
|
|
2001-12-21 11:46:15 +00:00
|
|
|
sink = GST_AFSINK (object);
|
2004-03-14 22:34:33 +00:00
|
|
|
|
2001-12-21 11:46:15 +00:00
|
|
|
switch (prop_id) {
|
|
|
|
case ARG_LOCATION:
|
|
|
|
g_value_set_string (value, sink->filename);
|
|
|
|
break;
|
2002-04-14 10:19:08 +00:00
|
|
|
case ARG_TYPE:
|
|
|
|
g_value_set_enum (value, sink->type);
|
|
|
|
break;
|
|
|
|
case ARG_OUTPUT_ENDIANNESS:
|
|
|
|
g_value_set_int (value, sink->endianness_output);
|
|
|
|
break;
|
2001-12-21 11:46:15 +00:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-05-26 21:59:21 +00:00
|
|
|
gboolean
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_afsink_plugin_init (GstPlugin * plugin)
|
2001-12-21 11:46:15 +00:00
|
|
|
{
|
2003-11-01 14:04:20 +00:00
|
|
|
if (!gst_element_register (plugin, "afsink", GST_RANK_NONE, GST_TYPE_AFSINK))
|
|
|
|
return FALSE;
|
2004-01-19 15:45:55 +00:00
|
|
|
#ifdef ENABLE_NLS
|
|
|
|
setlocale (LC_ALL, "");
|
|
|
|
bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
|
|
|
|
#endif /* ENABLE_NLS */
|
|
|
|
|
2001-12-21 11:46:15 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* this is where we open the audiofile */
|
|
|
|
static gboolean
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_afsink_open_file (GstAFSink * sink)
|
2001-12-21 11:46:15 +00:00
|
|
|
{
|
|
|
|
AFfilesetup outfilesetup;
|
2003-12-22 01:47:09 +00:00
|
|
|
const GstCaps *caps;
|
|
|
|
GstStructure *structure;
|
2004-03-15 19:32:27 +00:00
|
|
|
int sample_format; /* audiofile's sample format, look in audiofile.h */
|
|
|
|
int byte_order = 0; /* audiofile's byte order defines */
|
2004-03-14 22:34:33 +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, GST_AFSINK_OPEN), FALSE);
|
2001-12-21 11:46:15 +00:00
|
|
|
|
|
|
|
/* get the audio parameters */
|
|
|
|
g_return_val_if_fail (GST_IS_PAD (sink->sinkpad), FALSE);
|
|
|
|
caps = GST_PAD_CAPS (sink->sinkpad);
|
2004-03-14 22:34:33 +00:00
|
|
|
|
2003-12-22 01:47:09 +00:00
|
|
|
if (caps == NULL) {
|
|
|
|
g_critical ("gstafsink chain : Could not get caps of pad !\n");
|
|
|
|
} else {
|
|
|
|
structure = gst_caps_get_structure (caps, 0);
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_structure_get_int (structure, "channels", &sink->channels);
|
|
|
|
gst_structure_get_int (structure, "width", &sink->width);
|
|
|
|
gst_structure_get_int (structure, "rate", &sink->rate);
|
2003-12-22 01:47:09 +00:00
|
|
|
gst_structure_get_boolean (structure, "signed", &sink->is_signed);
|
|
|
|
gst_structure_get_int (structure, "endianness", &sink->endianness_data);
|
2001-12-21 11:46:15 +00:00
|
|
|
}
|
2003-06-29 19:46:13 +00:00
|
|
|
GST_DEBUG ("channels %d, width %d, rate %d, signed %s",
|
2004-03-14 22:34:33 +00:00
|
|
|
sink->channels, sink->width, sink->rate, sink->is_signed ? "yes" : "no");
|
|
|
|
GST_DEBUG ("endianness: data %d, output %d",
|
|
|
|
sink->endianness_data, sink->endianness_output);
|
2001-12-21 11:46:15 +00:00
|
|
|
/* setup the output file */
|
|
|
|
if (sink->is_signed)
|
|
|
|
sample_format = AF_SAMPFMT_TWOSCOMP;
|
|
|
|
else
|
|
|
|
sample_format = AF_SAMPFMT_UNSIGNED;
|
2002-02-03 20:35:26 +00:00
|
|
|
/* FIXME : this check didn't seem to work, so let the output endianness be set */
|
2001-12-21 11:46:15 +00:00
|
|
|
/*
|
2004-03-14 22:34:33 +00:00
|
|
|
if (sink->endianness_data == sink->endianness_wanted)
|
|
|
|
byte_order = AF_BYTEORDER_LITTLEENDIAN;
|
|
|
|
else
|
|
|
|
byte_order = AF_BYTEORDER_BIGENDIAN;
|
|
|
|
*/
|
2001-12-21 11:46:15 +00:00
|
|
|
if (sink->endianness_output == 1234)
|
|
|
|
byte_order = AF_BYTEORDER_LITTLEENDIAN;
|
|
|
|
else
|
|
|
|
byte_order = AF_BYTEORDER_BIGENDIAN;
|
|
|
|
|
|
|
|
outfilesetup = afNewFileSetup ();
|
|
|
|
afInitFileFormat (outfilesetup, sink->type);
|
|
|
|
afInitChannels (outfilesetup, AF_DEFAULT_TRACK, sink->channels);
|
|
|
|
afInitRate (outfilesetup, AF_DEFAULT_TRACK, sink->rate);
|
2004-03-14 22:34:33 +00:00
|
|
|
afInitSampleFormat (outfilesetup, AF_DEFAULT_TRACK,
|
|
|
|
sample_format, sink->width);
|
2001-12-21 11:46:15 +00:00
|
|
|
|
|
|
|
/* open it */
|
|
|
|
sink->file = afOpenFile (sink->filename, "w", outfilesetup);
|
2004-03-14 22:34:33 +00:00
|
|
|
if (sink->file == AF_NULL_FILEHANDLE) {
|
|
|
|
GST_ELEMENT_ERROR (sink, RESOURCE, OPEN_WRITE,
|
2004-03-15 19:32:27 +00:00
|
|
|
(_("Could not open file \"%s\" for writing."), sink->filename),
|
|
|
|
("system error: %s", strerror (errno)));
|
2001-12-21 11:46:15 +00:00
|
|
|
return FALSE;
|
2004-03-14 22:34:33 +00:00
|
|
|
}
|
2001-12-21 11:46:15 +00:00
|
|
|
|
|
|
|
afFreeFileSetup (outfilesetup);
|
2002-02-03 20:35:26 +00:00
|
|
|
/* afSetVirtualByteOrder (sink->file, AF_DEFAULT_TRACK, byte_order); */
|
2004-03-14 22:34:33 +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
|
|
|
GST_OBJECT_FLAG_SET (sink, GST_AFSINK_OPEN);
|
2001-12-21 11:46:15 +00:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_afsink_close_file (GstAFSink * sink)
|
2001-12-21 11:46:15 +00:00
|
|
|
{
|
2002-02-03 20:35:26 +00:00
|
|
|
/* g_print ("DEBUG: closing sinkfile...\n"); */
|
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, GST_AFSINK_OPEN));
|
2002-02-03 20:35:26 +00:00
|
|
|
/* g_print ("DEBUG: past flag test\n"); */
|
|
|
|
/* if (fclose (sink->file) != 0) */
|
2004-03-14 22:34:33 +00:00
|
|
|
if (afCloseFile (sink->file) != 0) {
|
2004-01-29 23:20:45 +00:00
|
|
|
GST_ELEMENT_ERROR (sink, RESOURCE, CLOSE,
|
2004-03-15 19:32:27 +00:00
|
|
|
(_("Error closing file \"%s\"."), sink->filename), GST_ERROR_SYSTEM);
|
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
|
|
|
GST_OBJECT_FLAG_UNSET (sink, GST_AFSINK_OPEN);
|
2001-12-21 11:46:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_afsink_chain:
|
|
|
|
* @pad: the pad this afsink is connected to
|
|
|
|
* @buf: the buffer that has to be absorbed
|
|
|
|
*
|
|
|
|
* take the buffer from the pad and write to file if it's open
|
|
|
|
*/
|
2004-03-14 22:34:33 +00:00
|
|
|
static void
|
|
|
|
gst_afsink_chain (GstPad * pad, GstData * _data)
|
2001-12-21 11:46:15 +00:00
|
|
|
{
|
2004-01-07 13:18:08 +00:00
|
|
|
GstBuffer *buf;
|
2001-12-21 11:46:15 +00:00
|
|
|
GstAFSink *afsink;
|
|
|
|
int ret = 0;
|
|
|
|
|
|
|
|
g_return_if_fail (pad != NULL);
|
|
|
|
g_return_if_fail (GST_IS_PAD (pad));
|
|
|
|
|
2004-01-07 13:18:08 +00:00
|
|
|
if (GST_IS_EVENT (_data)) {
|
|
|
|
gst_afsink_handle_event (pad, GST_EVENT (_data));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
buf = GST_BUFFER (_data);
|
2001-12-21 11:46:15 +00:00
|
|
|
afsink = GST_AFSINK (gst_pad_get_parent (pad));
|
|
|
|
/* we use audiofile now
|
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 (afsink, GST_AFSINK_OPEN))
|
2001-12-21 11:46:15 +00:00
|
|
|
{
|
|
|
|
bytes_written = fwrite (GST_BUFFER_DATA (buf), 1, GST_BUFFER_SIZE (buf), afsink->file);
|
|
|
|
if (bytes_written < GST_BUFFER_SIZE (buf))
|
|
|
|
{
|
|
|
|
printf ("afsink : Warning : %d bytes should be written, only %d bytes written\n",
|
2005-12-06 19:55:58 +00:00
|
|
|
GST_BUFFER_SIZE (buf), bytes_written);
|
2001-12-21 11:46:15 +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
|
|
|
if (!GST_OBJECT_FLAG_IS_SET (afsink, GST_AFSINK_OPEN)) {
|
2001-12-21 11:46:15 +00:00
|
|
|
/* it's not open yet, open it */
|
|
|
|
if (!gst_afsink_open_file (afsink))
|
2004-03-14 22:34:33 +00:00
|
|
|
g_print ("WARNING: gstafsink: can't open file !\n");
|
2002-02-03 20:35:26 +00:00
|
|
|
/* return FALSE; Can't return value */
|
2001-12-21 11:46:15 +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
|
|
|
if (GST_OBJECT_FLAG_IS_SET (afsink, GST_AFSINK_OPEN)) {
|
2001-12-21 11:46:15 +00:00
|
|
|
int frameCount = 0;
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
frameCount =
|
2004-03-15 19:32:27 +00:00
|
|
|
GST_BUFFER_SIZE (buf) / ((afsink->width / 8) * afsink->channels);
|
2004-03-14 22:34:33 +00:00
|
|
|
/* g_print ("DEBUG: writing %d frames ", frameCount); */
|
|
|
|
ret = afWriteFrames (afsink->file, AF_DEFAULT_TRACK,
|
2004-03-15 19:32:27 +00:00
|
|
|
GST_BUFFER_DATA (buf), frameCount);
|
2004-03-14 22:34:33 +00:00
|
|
|
if (ret == AF_BAD_WRITE || ret == AF_BAD_LSEEK) {
|
2001-12-21 11:46:15 +00:00
|
|
|
printf ("afsink : Warning : afWriteFrames returned an error (%d)\n", ret);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
gst_buffer_unref (buf);
|
|
|
|
|
|
|
|
g_signal_emit (G_OBJECT (afsink), gst_afsink_signals[SIGNAL_HANDOFF], 0);
|
|
|
|
}
|
|
|
|
|
2005-09-05 17:20:29 +00:00
|
|
|
static GstStateChangeReturn
|
|
|
|
gst_afsink_change_state (GstElement * element, GstStateChange transition)
|
2001-12-21 11:46:15 +00:00
|
|
|
{
|
2005-09-05 17:20:29 +00:00
|
|
|
g_return_val_if_fail (GST_IS_AFSINK (element), GST_STATE_CHANGE_FAILURE);
|
2001-12-21 11:46:15 +00:00
|
|
|
|
|
|
|
/* if going to NULL? then close the file */
|
2004-03-14 22:34:33 +00:00
|
|
|
if (GST_STATE_PENDING (element) == GST_STATE_NULL) {
|
2002-02-03 20:35:26 +00:00
|
|
|
/* printf ("DEBUG: afsink state change: null pending\n"); */
|
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, GST_AFSINK_OPEN)) {
|
2002-02-03 20:35:26 +00:00
|
|
|
/* g_print ("DEBUG: trying to close the sink file\n"); */
|
2001-12-21 11:46:15 +00:00
|
|
|
gst_afsink_close_file (GST_AFSINK (element));
|
|
|
|
}
|
2004-03-14 22:34:33 +00:00
|
|
|
}
|
2001-12-21 11:46:15 +00:00
|
|
|
/*
|
|
|
|
|
|
|
|
else
|
2002-02-04 10:27:33 +00:00
|
|
|
this has been moved to the chain function, since it's only then that
|
|
|
|
the caps are set and can be known
|
2001-12-21 11:46:15 +00:00
|
|
|
{
|
2002-02-04 10:27:33 +00:00
|
|
|
g_print ("DEBUG: it's not going to null\n");
|
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, GST_AFSINK_OPEN))
|
2001-12-21 11:46:15 +00:00
|
|
|
{
|
2002-02-04 10:27:33 +00:00
|
|
|
g_print ("DEBUG: GST_AFSINK_OPEN not set\n");
|
2001-12-21 11:46:15 +00:00
|
|
|
if (!gst_afsink_open_file (GST_AFSINK (element)))
|
|
|
|
{
|
2002-02-04 10:27:33 +00:00
|
|
|
g_print ("DEBUG: element tries to open file\n");
|
2005-09-05 17:20:29 +00:00
|
|
|
return GST_STATE_CHANGE_FAILURE;
|
2001-12-21 11:46:15 +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);
|
2001-12-21 11:46:15 +00:00
|
|
|
|
2005-09-05 17:20:29 +00:00
|
|
|
return GST_STATE_CHANGE_SUCCESS;
|
2001-12-21 11:46:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* this function was copied from sinesrc */
|
|
|
|
|
|
|
|
static gboolean
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_afsink_handle_event (GstPad * pad, GstEvent * event)
|
2001-12-21 11:46:15 +00:00
|
|
|
{
|
|
|
|
GstAFSink *afsink;
|
|
|
|
|
|
|
|
afsink = GST_AFSINK (gst_pad_get_parent (pad));
|
2003-06-29 19:46:13 +00:00
|
|
|
GST_DEBUG ("DEBUG: afsink: got event");
|
2004-01-07 13:18:08 +00:00
|
|
|
|
|
|
|
switch (GST_EVENT_TYPE (event)) {
|
|
|
|
case GST_EVENT_EOS:
|
|
|
|
gst_afsink_close_file (afsink);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
gst_pad_event_default (pad, event);
|
2001-12-21 11:46:15 +00:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|