mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-04 05:22:30 +00:00
use element time.
Original commit message from CVS: 2004-01-14 Benjamin Otte <in7y118@public.uni-hamburg.de> * ext/aalib/gstaasink.c: (gst_aasink_chain): * ext/alsa/gstalsasink.c: (gst_alsa_sink_check_event): * ext/esd/esdsink.c: (gst_esdsink_chain): * ext/libcaca/gstcacasink.c: (gst_cacasink_chain): * ext/mas/massink.c: (gst_massink_chain): * ext/sdl/sdlvideosink.c: (gst_sdlvideosink_chain): * gst/matroska/matroska-demux.c: (gst_matroska_demux_parse_index), (gst_matroska_demux_parse_metadata): * gst/mpegstream/gstmpegparse.c: (gst_mpeg_parse_loop), (gst_mpeg_parse_release_locks): * gst/tcp/gsttcpsink.c: (gst_tcpsink_chain): * gst/udp/gstudpsink.c: (gst_udpsink_chain): * gst/videotestsrc/gstvideotestsrc.c: (gst_videotestsrc_get): * sys/oss/gstosssink.c: (gst_osssink_init), (gst_osssink_chain), (gst_osssink_change_state): * sys/v4l/gstv4lmjpegsink.c: (gst_v4lmjpegsink_chain): * sys/ximage/ximagesink.c: (gst_ximagesink_chain): * sys/xvideo/xvideosink.c: (gst_xvideosink_chain), (gst_xvideosink_release_locks): * sys/xvimage/xvimagesink.c: (gst_xvimagesink_chain): use element time. * ext/alsa/gstalsaclock.c: (gst_alsa_clock_start), (gst_alsa_clock_stop): * gst-libs/gst/audio/audioclock.c: (gst_audio_clock_set_active), (gst_audio_clock_get_internal_time): simplify for use with new clocking code. * testsuite/alsa/Makefile.am: * testsuite/alsa/sinesrc.c: (sinesrc_init), (sinesrc_force_caps): fix testsuite for new caps system
This commit is contained in:
parent
a4b77770a9
commit
3a64b7c99f
13 changed files with 127 additions and 148 deletions
32
ChangeLog
32
ChangeLog
|
@ -1,3 +1,35 @@
|
|||
2004-01-14 Benjamin Otte <in7y118@public.uni-hamburg.de>
|
||||
|
||||
* ext/aalib/gstaasink.c: (gst_aasink_chain):
|
||||
* ext/alsa/gstalsasink.c: (gst_alsa_sink_check_event):
|
||||
* ext/esd/esdsink.c: (gst_esdsink_chain):
|
||||
* ext/libcaca/gstcacasink.c: (gst_cacasink_chain):
|
||||
* ext/mas/massink.c: (gst_massink_chain):
|
||||
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_chain):
|
||||
* gst/matroska/matroska-demux.c: (gst_matroska_demux_parse_index),
|
||||
(gst_matroska_demux_parse_metadata):
|
||||
* gst/mpegstream/gstmpegparse.c: (gst_mpeg_parse_loop),
|
||||
(gst_mpeg_parse_release_locks):
|
||||
* gst/tcp/gsttcpsink.c: (gst_tcpsink_chain):
|
||||
* gst/udp/gstudpsink.c: (gst_udpsink_chain):
|
||||
* gst/videotestsrc/gstvideotestsrc.c: (gst_videotestsrc_get):
|
||||
* sys/oss/gstosssink.c: (gst_osssink_init), (gst_osssink_chain),
|
||||
(gst_osssink_change_state):
|
||||
* sys/v4l/gstv4lmjpegsink.c: (gst_v4lmjpegsink_chain):
|
||||
* sys/ximage/ximagesink.c: (gst_ximagesink_chain):
|
||||
* sys/xvideo/xvideosink.c: (gst_xvideosink_chain),
|
||||
(gst_xvideosink_release_locks):
|
||||
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_chain):
|
||||
use element time.
|
||||
* ext/alsa/gstalsaclock.c: (gst_alsa_clock_start),
|
||||
(gst_alsa_clock_stop):
|
||||
* gst-libs/gst/audio/audioclock.c: (gst_audio_clock_set_active),
|
||||
(gst_audio_clock_get_internal_time):
|
||||
simplify for use with new clocking code.
|
||||
* testsuite/alsa/Makefile.am:
|
||||
* testsuite/alsa/sinesrc.c: (sinesrc_init), (sinesrc_force_caps):
|
||||
fix testsuite for new caps system
|
||||
|
||||
2004-01-14 Benjamin Otte <in7y118@public.uni-hamburg.de>
|
||||
|
||||
* ext/flac/gstflacdec.c: (gst_flacdec_update_metadata):
|
||||
|
|
|
@ -109,15 +109,13 @@ gst_alsa_clock_new (gchar *name, GstAlsaClockGetTimeFunc get_time, GstAlsa *owne
|
|||
void
|
||||
gst_alsa_clock_start (GstAlsaClock *clock)
|
||||
{
|
||||
GTimeVal timeval;
|
||||
g_get_current_time (&timeval);
|
||||
|
||||
g_assert (!GST_CLOCK_TIME_IS_VALID (clock->start_time));
|
||||
|
||||
if (clock->owner->format) {
|
||||
clock->start_time = GST_TIMEVAL_TO_TIME (timeval) + clock->adjust - clock->get_time (clock->owner);
|
||||
clock->start_time = gst_clock_get_event_time (GST_CLOCK (clock))
|
||||
- clock->get_time (clock->owner);
|
||||
} else {
|
||||
clock->start_time = GST_TIMEVAL_TO_TIME (timeval) + clock->adjust;
|
||||
clock->start_time = gst_clock_get_event_time (GST_CLOCK (clock));
|
||||
}
|
||||
}
|
||||
void
|
||||
|
@ -128,7 +126,7 @@ gst_alsa_clock_stop (GstAlsaClock *clock)
|
|||
|
||||
g_assert (GST_CLOCK_TIME_IS_VALID (clock->start_time));
|
||||
|
||||
clock->adjust += GST_TIMEVAL_TO_TIME (timeval) - clock->start_time - clock->get_time (clock->owner);
|
||||
clock->adjust += GST_TIMEVAL_TO_TIME (timeval) - gst_clock_get_event_time (GST_CLOCK (clock));
|
||||
clock->start_time = GST_CLOCK_TIME_NONE;
|
||||
}
|
||||
static GstClockTime
|
||||
|
|
|
@ -214,8 +214,7 @@ gst_alsa_sink_check_event (GstAlsaSink *sink, gint pad_nr)
|
|||
break;
|
||||
}
|
||||
if (gst_event_discont_get_value (event, GST_FORMAT_TIME, &value)) {
|
||||
if (!gst_clock_handle_discont (GST_ELEMENT (this)->clock, value))
|
||||
GST_WARNING_OBJECT (this, "clock couldn't handle discontinuity");
|
||||
gst_element_set_time (GST_ELEMENT (this), value);
|
||||
}
|
||||
|
||||
if (gst_event_discont_get_value (event, GST_FORMAT_DEFAULT, &value)) {
|
||||
|
|
|
@ -105,19 +105,21 @@ gst_audio_clock_new (gchar *name, GstAudioClockGetTimeFunc func, gpointer user_d
|
|||
void
|
||||
gst_audio_clock_set_active (GstAudioClock *aclock, gboolean active)
|
||||
{
|
||||
GTimeVal timeval;
|
||||
GstClockTime time;
|
||||
GstClockTime audiotime;
|
||||
GstClock *clock;
|
||||
|
||||
g_get_current_time (&timeval);
|
||||
time = GST_TIMEVAL_TO_TIME (timeval);
|
||||
audiotime = aclock->func ((GstClock*)aclock, aclock->user_data);
|
||||
g_return_if_fail (GST_IS_AUDIO_CLOCK (aclock));
|
||||
clock = GST_CLOCK (aclock);
|
||||
|
||||
time = gst_clock_get_event_time (clock);
|
||||
|
||||
if (active) {
|
||||
aclock->adjust = time - audiotime;
|
||||
}
|
||||
else {
|
||||
aclock->adjust = audiotime - time;
|
||||
aclock->adjust = time - aclock->func (clock, aclock->user_data);
|
||||
} else {
|
||||
GTimeVal timeval;
|
||||
g_get_current_time (&timeval);
|
||||
|
||||
aclock->adjust = GST_TIMEVAL_TO_TIME (timeval) - time;
|
||||
}
|
||||
|
||||
aclock->active = active;
|
||||
|
@ -129,20 +131,12 @@ gst_audio_clock_get_internal_time (GstClock *clock)
|
|||
GstAudioClock *aclock = GST_AUDIO_CLOCK (clock);
|
||||
|
||||
if (aclock->active) {
|
||||
GstClockTime audiotime;
|
||||
|
||||
audiotime = aclock->func (clock, aclock->user_data) + aclock->adjust;
|
||||
|
||||
return audiotime;
|
||||
}
|
||||
else {
|
||||
GstClockTime time;
|
||||
return aclock->func (clock, aclock->user_data) + aclock->adjust;
|
||||
} else {
|
||||
GTimeVal timeval;
|
||||
|
||||
g_get_current_time (&timeval);
|
||||
time = GST_TIMEVAL_TO_TIME (timeval);
|
||||
|
||||
return time;
|
||||
return GST_TIMEVAL_TO_TIME (timeval);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -263,12 +263,8 @@ gst_tcpsink_chain (GstPad *pad, GstData *_data)
|
|||
|
||||
tcpsink = GST_TCPSINK (GST_OBJECT_PARENT (pad));
|
||||
|
||||
if (tcpsink->clock) {
|
||||
GstClockID id = gst_clock_new_single_shot_id (tcpsink->clock, GST_BUFFER_TIMESTAMP (buf));
|
||||
|
||||
GST_DEBUG ("tcpsink: clock wait: %" G_GUINT64_FORMAT "\n", GST_BUFFER_TIMESTAMP (buf));
|
||||
gst_element_clock_wait (GST_ELEMENT (tcpsink), id, NULL);
|
||||
gst_clock_id_free (id);
|
||||
if (tcpsink->clock && GST_BUFFER_TIMESTAMP_IS_VALID (buf)) {
|
||||
gst_element_wait (GST_ELEMENT (tcpsink), GST_BUFFER_TIMESTAMP (buf));
|
||||
}
|
||||
|
||||
if (write (tcpsink->sock, GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf)) <= 0)
|
||||
|
|
|
@ -397,7 +397,6 @@ gst_videotestsrc_get (GstPad * pad)
|
|||
GstVideotestsrc *videotestsrc;
|
||||
gulong newsize;
|
||||
GstBuffer *buf;
|
||||
GstClockTimeDiff jitter = 0;
|
||||
|
||||
GST_DEBUG ("gst_videotestsrc_get");
|
||||
|
||||
|
@ -425,21 +424,14 @@ gst_videotestsrc_get (GstPad * pad)
|
|||
videotestsrc->width, videotestsrc->height);
|
||||
|
||||
if (videotestsrc->sync){
|
||||
do {
|
||||
GstClockID id;
|
||||
GST_BUFFER_TIMESTAMP (buf) = videotestsrc->timestamp_offset +
|
||||
(videotestsrc->n_frames * GST_SECOND)/(double)videotestsrc->rate;
|
||||
videotestsrc->n_frames++;
|
||||
|
||||
GST_BUFFER_TIMESTAMP (buf) = videotestsrc->timestamp_offset +
|
||||
(videotestsrc->n_frames * GST_SECOND)/(double)videotestsrc->rate;
|
||||
videotestsrc->n_frames++;
|
||||
|
||||
/* FIXME this is not correct if we do QoS */
|
||||
if (videotestsrc->clock) {
|
||||
id = gst_clock_new_single_shot_id (videotestsrc->clock,
|
||||
GST_BUFFER_TIMESTAMP (buf));
|
||||
gst_element_clock_wait (GST_ELEMENT (videotestsrc), id, &jitter);
|
||||
gst_clock_id_free (id);
|
||||
}
|
||||
} while (jitter > 100 * GST_MSECOND);
|
||||
/* FIXME this is not correct if we do QoS */
|
||||
if (videotestsrc->clock) {
|
||||
gst_element_wait (GST_ELEMENT (videotestsrc), GST_BUFFER_TIMESTAMP (buf));
|
||||
}
|
||||
}else{
|
||||
GST_BUFFER_TIMESTAMP (buf) = videotestsrc->timestamp_offset +
|
||||
(videotestsrc->n_frames * GST_SECOND)/(double)videotestsrc->rate;
|
||||
|
|
|
@ -243,7 +243,6 @@ gst_v4lmjpegsink_chain (GstPad *pad,
|
|||
{
|
||||
GstBuffer *buf = GST_BUFFER (_data);
|
||||
GstV4lMjpegSink *v4lmjpegsink;
|
||||
GstClockTimeDiff jitter;
|
||||
gint num;
|
||||
|
||||
g_return_if_fail (pad != NULL);
|
||||
|
@ -253,18 +252,9 @@ gst_v4lmjpegsink_chain (GstPad *pad,
|
|||
v4lmjpegsink = GST_V4LMJPEGSINK (gst_pad_get_parent (pad));
|
||||
|
||||
if (v4lmjpegsink->clock) {
|
||||
GstClockID id;
|
||||
|
||||
GST_DEBUG ("videosink: clock wait: %" G_GUINT64_FORMAT, GST_BUFFER_TIMESTAMP(buf));
|
||||
|
||||
jitter = 0; /* FIXME: jitter = gst_clock_current_diff(v4lmjpegsink->clock, GST_BUFFER_TIMESTAMP (buf)); */
|
||||
|
||||
if (jitter > 500000 || jitter < -500000)
|
||||
GST_DEBUG ("jitter: %" G_GINT64_FORMAT, jitter);
|
||||
|
||||
id = gst_clock_new_single_shot_id (v4lmjpegsink->clock, GST_BUFFER_TIMESTAMP(buf));
|
||||
gst_element_clock_wait(GST_ELEMENT(v4lmjpegsink), id, NULL);
|
||||
gst_clock_id_free (id);
|
||||
gst_element_wait (GST_ELEMENT(v4lmjpegsink), GST_BUFFER_TIMESTAMP(buf));
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
|
|
@ -730,11 +730,7 @@ gst_ximagesink_chain (GstPad *pad, GstData *data)
|
|||
GST_DEBUG ("videosink: clock wait: %" G_GUINT64_FORMAT, ximagesink->time);
|
||||
|
||||
if (GST_VIDEOSINK_CLOCK (ximagesink)) {
|
||||
GstClockID id;
|
||||
id = gst_clock_new_single_shot_id (GST_VIDEOSINK_CLOCK (ximagesink),
|
||||
ximagesink->time);
|
||||
gst_element_clock_wait (GST_ELEMENT (ximagesink), id, NULL);
|
||||
gst_clock_id_free (id);
|
||||
gst_element_wait (GST_ELEMENT (ximagesink), ximagesink->time);
|
||||
}
|
||||
|
||||
/* If this buffer has been allocated using our buffer management we simply
|
||||
|
|
|
@ -936,11 +936,7 @@ gst_xvimagesink_chain (GstPad *pad, GstData *data)
|
|||
GST_DEBUG ("videosink: clock wait: %" G_GUINT64_FORMAT, xvimagesink->time);
|
||||
|
||||
if (GST_VIDEOSINK_CLOCK (xvimagesink)) {
|
||||
GstClockID id;
|
||||
id = gst_clock_new_single_shot_id (GST_VIDEOSINK_CLOCK (xvimagesink),
|
||||
xvimagesink->time);
|
||||
gst_element_clock_wait (GST_ELEMENT (xvimagesink), id, NULL);
|
||||
gst_clock_id_free (id);
|
||||
gst_element_wait (GST_ELEMENT (xvimagesink), xvimagesink->time);
|
||||
}
|
||||
|
||||
/* If this buffer has been allocated using our buffer management we simply
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
testprogs = formats state
|
||||
|
||||
TESTS =
|
||||
TESTS = $(testprogs)
|
||||
|
||||
check_PROGRAMS = $(testprogs)
|
||||
|
||||
|
|
|
@ -24,25 +24,24 @@
|
|||
|
||||
#define SAMPLES_PER_WAVE 200
|
||||
|
||||
GST_PAD_TEMPLATE_FACTORY (sinesrc_src_factory,
|
||||
static GstStaticPadTemplate sinesrc_src_factory =
|
||||
GST_STATIC_PAD_TEMPLATE (
|
||||
"src",
|
||||
GST_PAD_SRC,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_CAPS_NEW (
|
||||
"sinesrc_int_src",
|
||||
"audio/raw",
|
||||
"law", GST_PROPS_INT (0),
|
||||
"endianness", GST_PROPS_LIST (GST_PROPS_INT (G_LITTLE_ENDIAN), GST_PROPS_INT (G_BIG_ENDIAN)),
|
||||
"signed", GST_PROPS_LIST (GST_PROPS_BOOLEAN (FALSE), GST_PROPS_BOOLEAN (TRUE)),
|
||||
"width", GST_PROPS_INT_RANGE (8, 32),
|
||||
"depth", GST_PROPS_INT_RANGE (8, 32),
|
||||
"rate", GST_PROPS_INT_RANGE (8000, 192000),
|
||||
"channels", GST_PROPS_INT_RANGE (1, 16)
|
||||
),
|
||||
GST_CAPS_NEW (
|
||||
"sinesrc_float_src",
|
||||
"audio/raw",
|
||||
"channels", GST_PROPS_INT_RANGE (1, 16)
|
||||
GST_STATIC_CAPS (
|
||||
"audio/x-raw-int, "
|
||||
"endianness = (int) { LITTLE_ENDIAN, BIG_ENDIAN }, "
|
||||
"signed = (boolean) { FALSE, TRUE }, "
|
||||
"width = (int) [8, 32], "
|
||||
"depth = (int) [8, 32], "
|
||||
"rate = (int) [8000, 192000], "
|
||||
"channels = (int) [1, 16];"
|
||||
"audio/x-raw-float, "
|
||||
"endianness = (int) BYTE_ORDER, "
|
||||
"width = (int) {32, 64}, "
|
||||
"rate = (int) [8000, 192000], "
|
||||
"channels = (int) [1, 16]"
|
||||
)
|
||||
);
|
||||
|
||||
|
@ -86,7 +85,7 @@ static void
|
|||
sinesrc_init (SineSrc *src)
|
||||
{
|
||||
src->src = gst_pad_new_from_template (
|
||||
GST_PAD_TEMPLATE_GET (sinesrc_src_factory), "src");
|
||||
gst_static_pad_template_get (&sinesrc_src_factory), "src");
|
||||
gst_element_add_pad (GST_ELEMENT(src), src->src);
|
||||
gst_pad_set_get_function (src->src, sinesrc_get);
|
||||
|
||||
|
@ -115,36 +114,30 @@ sinesrc_force_caps (SineSrc *src) {
|
|||
|
||||
switch (src->type) {
|
||||
case SINE_SRC_INT:
|
||||
caps = GST_CAPS_NEW (
|
||||
"sinesrc_src_caps",
|
||||
"audio/raw",
|
||||
"law", GST_PROPS_INT (0),
|
||||
"signed", GST_PROPS_BOOLEAN (src->sign),
|
||||
"depth", GST_PROPS_INT (src->depth)
|
||||
);
|
||||
caps = gst_caps_new_simple ("audio/x-raw-int",
|
||||
"signed", G_TYPE_BOOLEAN, src->sign,
|
||||
"depth", G_TYPE_INT, src->depth,
|
||||
NULL);
|
||||
if (src->width > 8)
|
||||
gst_props_add_entry (gst_caps_get_props (caps),
|
||||
gst_props_entry_new ("endianness",
|
||||
GST_PROPS_INT (src->endianness)));
|
||||
gst_caps_set_simple (caps,
|
||||
"endianness", G_TYPE_INT, src->endianness,
|
||||
NULL);
|
||||
break;
|
||||
case SINE_SRC_FLOAT:
|
||||
g_assert (src->width == 32 || src->width == 64);
|
||||
caps = GST_CAPS_NEW (
|
||||
"sinesrc_src_caps",
|
||||
"audio/raw",
|
||||
"endianness", GST_PROPS_INT(src->endianness)
|
||||
);
|
||||
caps = gst_caps_new_simple ("audio/x-raw-float",
|
||||
"endianness", G_TYPE_INT, src->endianness,
|
||||
NULL);
|
||||
break;
|
||||
default:
|
||||
caps = NULL;
|
||||
g_assert_not_reached();
|
||||
}
|
||||
gst_props_add_entry (gst_caps_get_props (caps),
|
||||
gst_props_entry_new ("width", GST_PROPS_INT (src->width)));
|
||||
gst_props_add_entry (gst_caps_get_props (caps),
|
||||
gst_props_entry_new ("rate", GST_PROPS_INT (src->rate)));
|
||||
gst_props_add_entry (gst_caps_get_props (caps),
|
||||
gst_props_entry_new ("channels", GST_PROPS_INT (src->channels)));
|
||||
gst_caps_set_simple (caps,
|
||||
"width", G_TYPE_INT, src->width,
|
||||
"rate", G_TYPE_INT, src->rate,
|
||||
"channels", G_TYPE_INT, src->channels,
|
||||
NULL);
|
||||
|
||||
g_assert (gst_pad_try_set_caps (src->src, caps) == GST_PAD_LINK_OK);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
testprogs = formats state
|
||||
|
||||
TESTS =
|
||||
TESTS = $(testprogs)
|
||||
|
||||
check_PROGRAMS = $(testprogs)
|
||||
|
||||
|
|
|
@ -24,25 +24,24 @@
|
|||
|
||||
#define SAMPLES_PER_WAVE 200
|
||||
|
||||
GST_PAD_TEMPLATE_FACTORY (sinesrc_src_factory,
|
||||
static GstStaticPadTemplate sinesrc_src_factory =
|
||||
GST_STATIC_PAD_TEMPLATE (
|
||||
"src",
|
||||
GST_PAD_SRC,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_CAPS_NEW (
|
||||
"sinesrc_int_src",
|
||||
"audio/raw",
|
||||
"law", GST_PROPS_INT (0),
|
||||
"endianness", GST_PROPS_LIST (GST_PROPS_INT (G_LITTLE_ENDIAN), GST_PROPS_INT (G_BIG_ENDIAN)),
|
||||
"signed", GST_PROPS_LIST (GST_PROPS_BOOLEAN (FALSE), GST_PROPS_BOOLEAN (TRUE)),
|
||||
"width", GST_PROPS_INT_RANGE (8, 32),
|
||||
"depth", GST_PROPS_INT_RANGE (8, 32),
|
||||
"rate", GST_PROPS_INT_RANGE (8000, 192000),
|
||||
"channels", GST_PROPS_INT_RANGE (1, 16)
|
||||
),
|
||||
GST_CAPS_NEW (
|
||||
"sinesrc_float_src",
|
||||
"audio/raw",
|
||||
"channels", GST_PROPS_INT_RANGE (1, 16)
|
||||
GST_STATIC_CAPS (
|
||||
"audio/x-raw-int, "
|
||||
"endianness = (int) { LITTLE_ENDIAN, BIG_ENDIAN }, "
|
||||
"signed = (boolean) { FALSE, TRUE }, "
|
||||
"width = (int) [8, 32], "
|
||||
"depth = (int) [8, 32], "
|
||||
"rate = (int) [8000, 192000], "
|
||||
"channels = (int) [1, 16];"
|
||||
"audio/x-raw-float, "
|
||||
"endianness = (int) BYTE_ORDER, "
|
||||
"width = (int) {32, 64}, "
|
||||
"rate = (int) [8000, 192000], "
|
||||
"channels = (int) [1, 16]"
|
||||
)
|
||||
);
|
||||
|
||||
|
@ -86,7 +85,7 @@ static void
|
|||
sinesrc_init (SineSrc *src)
|
||||
{
|
||||
src->src = gst_pad_new_from_template (
|
||||
GST_PAD_TEMPLATE_GET (sinesrc_src_factory), "src");
|
||||
gst_static_pad_template_get (&sinesrc_src_factory), "src");
|
||||
gst_element_add_pad (GST_ELEMENT(src), src->src);
|
||||
gst_pad_set_get_function (src->src, sinesrc_get);
|
||||
|
||||
|
@ -115,36 +114,30 @@ sinesrc_force_caps (SineSrc *src) {
|
|||
|
||||
switch (src->type) {
|
||||
case SINE_SRC_INT:
|
||||
caps = GST_CAPS_NEW (
|
||||
"sinesrc_src_caps",
|
||||
"audio/raw",
|
||||
"law", GST_PROPS_INT (0),
|
||||
"signed", GST_PROPS_BOOLEAN (src->sign),
|
||||
"depth", GST_PROPS_INT (src->depth)
|
||||
);
|
||||
caps = gst_caps_new_simple ("audio/x-raw-int",
|
||||
"signed", G_TYPE_BOOLEAN, src->sign,
|
||||
"depth", G_TYPE_INT, src->depth,
|
||||
NULL);
|
||||
if (src->width > 8)
|
||||
gst_props_add_entry (gst_caps_get_props (caps),
|
||||
gst_props_entry_new ("endianness",
|
||||
GST_PROPS_INT (src->endianness)));
|
||||
gst_caps_set_simple (caps,
|
||||
"endianness", G_TYPE_INT, src->endianness,
|
||||
NULL);
|
||||
break;
|
||||
case SINE_SRC_FLOAT:
|
||||
g_assert (src->width == 32 || src->width == 64);
|
||||
caps = GST_CAPS_NEW (
|
||||
"sinesrc_src_caps",
|
||||
"audio/raw",
|
||||
"endianness", GST_PROPS_INT(src->endianness)
|
||||
);
|
||||
caps = gst_caps_new_simple ("audio/x-raw-float",
|
||||
"endianness", G_TYPE_INT, src->endianness,
|
||||
NULL);
|
||||
break;
|
||||
default:
|
||||
caps = NULL;
|
||||
g_assert_not_reached();
|
||||
}
|
||||
gst_props_add_entry (gst_caps_get_props (caps),
|
||||
gst_props_entry_new ("width", GST_PROPS_INT (src->width)));
|
||||
gst_props_add_entry (gst_caps_get_props (caps),
|
||||
gst_props_entry_new ("rate", GST_PROPS_INT (src->rate)));
|
||||
gst_props_add_entry (gst_caps_get_props (caps),
|
||||
gst_props_entry_new ("channels", GST_PROPS_INT (src->channels)));
|
||||
gst_caps_set_simple (caps,
|
||||
"width", G_TYPE_INT, src->width,
|
||||
"rate", G_TYPE_INT, src->rate,
|
||||
"channels", G_TYPE_INT, src->channels,
|
||||
NULL);
|
||||
|
||||
g_assert (gst_pad_try_set_caps (src->src, caps) == GST_PAD_LINK_OK);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue