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
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>
|
2004-01-14 Benjamin Otte <in7y118@public.uni-hamburg.de>
|
||||||
|
|
||||||
* ext/flac/gstflacdec.c: (gst_flacdec_update_metadata):
|
* ext/flac/gstflacdec.c: (gst_flacdec_update_metadata):
|
||||||
|
@ -109,15 +109,13 @@ gst_alsa_clock_new (gchar *name, GstAlsaClockGetTimeFunc get_time, GstAlsa *owne
|
|||||||
void
|
void
|
||||||
gst_alsa_clock_start (GstAlsaClock *clock)
|
gst_alsa_clock_start (GstAlsaClock *clock)
|
||||||
{
|
{
|
||||||
GTimeVal timeval;
|
|
||||||
g_get_current_time (&timeval);
|
|
||||||
|
|
||||||
g_assert (!GST_CLOCK_TIME_IS_VALID (clock->start_time));
|
g_assert (!GST_CLOCK_TIME_IS_VALID (clock->start_time));
|
||||||
|
|
||||||
if (clock->owner->format) {
|
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 {
|
} else {
|
||||||
clock->start_time = GST_TIMEVAL_TO_TIME (timeval) + clock->adjust;
|
clock->start_time = gst_clock_get_event_time (GST_CLOCK (clock));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void
|
void
|
||||||
@ -128,7 +126,7 @@ gst_alsa_clock_stop (GstAlsaClock *clock)
|
|||||||
|
|
||||||
g_assert (GST_CLOCK_TIME_IS_VALID (clock->start_time));
|
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;
|
clock->start_time = GST_CLOCK_TIME_NONE;
|
||||||
}
|
}
|
||||||
static GstClockTime
|
static GstClockTime
|
||||||
|
@ -214,8 +214,7 @@ gst_alsa_sink_check_event (GstAlsaSink *sink, gint pad_nr)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (gst_event_discont_get_value (event, GST_FORMAT_TIME, &value)) {
|
if (gst_event_discont_get_value (event, GST_FORMAT_TIME, &value)) {
|
||||||
if (!gst_clock_handle_discont (GST_ELEMENT (this)->clock, value))
|
gst_element_set_time (GST_ELEMENT (this), value);
|
||||||
GST_WARNING_OBJECT (this, "clock couldn't handle discontinuity");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gst_event_discont_get_value (event, GST_FORMAT_DEFAULT, &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
|
void
|
||||||
gst_audio_clock_set_active (GstAudioClock *aclock, gboolean active)
|
gst_audio_clock_set_active (GstAudioClock *aclock, gboolean active)
|
||||||
{
|
{
|
||||||
GTimeVal timeval;
|
|
||||||
GstClockTime time;
|
GstClockTime time;
|
||||||
GstClockTime audiotime;
|
GstClock *clock;
|
||||||
|
|
||||||
g_get_current_time (&timeval);
|
g_return_if_fail (GST_IS_AUDIO_CLOCK (aclock));
|
||||||
time = GST_TIMEVAL_TO_TIME (timeval);
|
clock = GST_CLOCK (aclock);
|
||||||
audiotime = aclock->func ((GstClock*)aclock, aclock->user_data);
|
|
||||||
|
time = gst_clock_get_event_time (clock);
|
||||||
|
|
||||||
if (active) {
|
if (active) {
|
||||||
aclock->adjust = time - audiotime;
|
aclock->adjust = time - aclock->func (clock, aclock->user_data);
|
||||||
}
|
} else {
|
||||||
else {
|
GTimeVal timeval;
|
||||||
aclock->adjust = audiotime - time;
|
g_get_current_time (&timeval);
|
||||||
|
|
||||||
|
aclock->adjust = GST_TIMEVAL_TO_TIME (timeval) - time;
|
||||||
}
|
}
|
||||||
|
|
||||||
aclock->active = active;
|
aclock->active = active;
|
||||||
@ -129,20 +131,12 @@ gst_audio_clock_get_internal_time (GstClock *clock)
|
|||||||
GstAudioClock *aclock = GST_AUDIO_CLOCK (clock);
|
GstAudioClock *aclock = GST_AUDIO_CLOCK (clock);
|
||||||
|
|
||||||
if (aclock->active) {
|
if (aclock->active) {
|
||||||
GstClockTime audiotime;
|
return aclock->func (clock, aclock->user_data) + aclock->adjust;
|
||||||
|
} else {
|
||||||
audiotime = aclock->func (clock, aclock->user_data) + aclock->adjust;
|
|
||||||
|
|
||||||
return audiotime;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
GstClockTime time;
|
|
||||||
GTimeVal timeval;
|
GTimeVal timeval;
|
||||||
|
|
||||||
g_get_current_time (&timeval);
|
g_get_current_time (&timeval);
|
||||||
time = GST_TIMEVAL_TO_TIME (timeval);
|
return GST_TIMEVAL_TO_TIME (timeval);
|
||||||
|
|
||||||
return time;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -263,12 +263,8 @@ gst_tcpsink_chain (GstPad *pad, GstData *_data)
|
|||||||
|
|
||||||
tcpsink = GST_TCPSINK (GST_OBJECT_PARENT (pad));
|
tcpsink = GST_TCPSINK (GST_OBJECT_PARENT (pad));
|
||||||
|
|
||||||
if (tcpsink->clock) {
|
if (tcpsink->clock && GST_BUFFER_TIMESTAMP_IS_VALID (buf)) {
|
||||||
GstClockID id = gst_clock_new_single_shot_id (tcpsink->clock, GST_BUFFER_TIMESTAMP (buf));
|
gst_element_wait (GST_ELEMENT (tcpsink), 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 (write (tcpsink->sock, GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf)) <= 0)
|
if (write (tcpsink->sock, GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf)) <= 0)
|
||||||
|
@ -397,7 +397,6 @@ gst_videotestsrc_get (GstPad * pad)
|
|||||||
GstVideotestsrc *videotestsrc;
|
GstVideotestsrc *videotestsrc;
|
||||||
gulong newsize;
|
gulong newsize;
|
||||||
GstBuffer *buf;
|
GstBuffer *buf;
|
||||||
GstClockTimeDiff jitter = 0;
|
|
||||||
|
|
||||||
GST_DEBUG ("gst_videotestsrc_get");
|
GST_DEBUG ("gst_videotestsrc_get");
|
||||||
|
|
||||||
@ -425,21 +424,14 @@ gst_videotestsrc_get (GstPad * pad)
|
|||||||
videotestsrc->width, videotestsrc->height);
|
videotestsrc->width, videotestsrc->height);
|
||||||
|
|
||||||
if (videotestsrc->sync){
|
if (videotestsrc->sync){
|
||||||
do {
|
GST_BUFFER_TIMESTAMP (buf) = videotestsrc->timestamp_offset +
|
||||||
GstClockID id;
|
(videotestsrc->n_frames * GST_SECOND)/(double)videotestsrc->rate;
|
||||||
|
videotestsrc->n_frames++;
|
||||||
|
|
||||||
GST_BUFFER_TIMESTAMP (buf) = videotestsrc->timestamp_offset +
|
/* FIXME this is not correct if we do QoS */
|
||||||
(videotestsrc->n_frames * GST_SECOND)/(double)videotestsrc->rate;
|
if (videotestsrc->clock) {
|
||||||
videotestsrc->n_frames++;
|
gst_element_wait (GST_ELEMENT (videotestsrc), GST_BUFFER_TIMESTAMP (buf));
|
||||||
|
}
|
||||||
/* 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);
|
|
||||||
}else{
|
}else{
|
||||||
GST_BUFFER_TIMESTAMP (buf) = videotestsrc->timestamp_offset +
|
GST_BUFFER_TIMESTAMP (buf) = videotestsrc->timestamp_offset +
|
||||||
(videotestsrc->n_frames * GST_SECOND)/(double)videotestsrc->rate;
|
(videotestsrc->n_frames * GST_SECOND)/(double)videotestsrc->rate;
|
||||||
|
@ -243,7 +243,6 @@ gst_v4lmjpegsink_chain (GstPad *pad,
|
|||||||
{
|
{
|
||||||
GstBuffer *buf = GST_BUFFER (_data);
|
GstBuffer *buf = GST_BUFFER (_data);
|
||||||
GstV4lMjpegSink *v4lmjpegsink;
|
GstV4lMjpegSink *v4lmjpegsink;
|
||||||
GstClockTimeDiff jitter;
|
|
||||||
gint num;
|
gint num;
|
||||||
|
|
||||||
g_return_if_fail (pad != NULL);
|
g_return_if_fail (pad != NULL);
|
||||||
@ -253,18 +252,9 @@ gst_v4lmjpegsink_chain (GstPad *pad,
|
|||||||
v4lmjpegsink = GST_V4LMJPEGSINK (gst_pad_get_parent (pad));
|
v4lmjpegsink = GST_V4LMJPEGSINK (gst_pad_get_parent (pad));
|
||||||
|
|
||||||
if (v4lmjpegsink->clock) {
|
if (v4lmjpegsink->clock) {
|
||||||
GstClockID id;
|
|
||||||
|
|
||||||
GST_DEBUG ("videosink: clock wait: %" G_GUINT64_FORMAT, GST_BUFFER_TIMESTAMP(buf));
|
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)); */
|
gst_element_wait (GST_ELEMENT(v4lmjpegsink), 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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
@ -730,11 +730,7 @@ gst_ximagesink_chain (GstPad *pad, GstData *data)
|
|||||||
GST_DEBUG ("videosink: clock wait: %" G_GUINT64_FORMAT, ximagesink->time);
|
GST_DEBUG ("videosink: clock wait: %" G_GUINT64_FORMAT, ximagesink->time);
|
||||||
|
|
||||||
if (GST_VIDEOSINK_CLOCK (ximagesink)) {
|
if (GST_VIDEOSINK_CLOCK (ximagesink)) {
|
||||||
GstClockID id;
|
gst_element_wait (GST_ELEMENT (ximagesink), ximagesink->time);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If this buffer has been allocated using our buffer management we simply
|
/* 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);
|
GST_DEBUG ("videosink: clock wait: %" G_GUINT64_FORMAT, xvimagesink->time);
|
||||||
|
|
||||||
if (GST_VIDEOSINK_CLOCK (xvimagesink)) {
|
if (GST_VIDEOSINK_CLOCK (xvimagesink)) {
|
||||||
GstClockID id;
|
gst_element_wait (GST_ELEMENT (xvimagesink), xvimagesink->time);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If this buffer has been allocated using our buffer management we simply
|
/* If this buffer has been allocated using our buffer management we simply
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
testprogs = formats state
|
testprogs = formats state
|
||||||
|
|
||||||
TESTS =
|
TESTS = $(testprogs)
|
||||||
|
|
||||||
check_PROGRAMS = $(testprogs)
|
check_PROGRAMS = $(testprogs)
|
||||||
|
|
||||||
|
@ -24,25 +24,24 @@
|
|||||||
|
|
||||||
#define SAMPLES_PER_WAVE 200
|
#define SAMPLES_PER_WAVE 200
|
||||||
|
|
||||||
GST_PAD_TEMPLATE_FACTORY (sinesrc_src_factory,
|
static GstStaticPadTemplate sinesrc_src_factory =
|
||||||
|
GST_STATIC_PAD_TEMPLATE (
|
||||||
"src",
|
"src",
|
||||||
GST_PAD_SRC,
|
GST_PAD_SRC,
|
||||||
GST_PAD_ALWAYS,
|
GST_PAD_ALWAYS,
|
||||||
GST_CAPS_NEW (
|
GST_STATIC_CAPS (
|
||||||
"sinesrc_int_src",
|
"audio/x-raw-int, "
|
||||||
"audio/raw",
|
"endianness = (int) { LITTLE_ENDIAN, BIG_ENDIAN }, "
|
||||||
"law", GST_PROPS_INT (0),
|
"signed = (boolean) { FALSE, TRUE }, "
|
||||||
"endianness", GST_PROPS_LIST (GST_PROPS_INT (G_LITTLE_ENDIAN), GST_PROPS_INT (G_BIG_ENDIAN)),
|
"width = (int) [8, 32], "
|
||||||
"signed", GST_PROPS_LIST (GST_PROPS_BOOLEAN (FALSE), GST_PROPS_BOOLEAN (TRUE)),
|
"depth = (int) [8, 32], "
|
||||||
"width", GST_PROPS_INT_RANGE (8, 32),
|
"rate = (int) [8000, 192000], "
|
||||||
"depth", GST_PROPS_INT_RANGE (8, 32),
|
"channels = (int) [1, 16];"
|
||||||
"rate", GST_PROPS_INT_RANGE (8000, 192000),
|
"audio/x-raw-float, "
|
||||||
"channels", GST_PROPS_INT_RANGE (1, 16)
|
"endianness = (int) BYTE_ORDER, "
|
||||||
),
|
"width = (int) {32, 64}, "
|
||||||
GST_CAPS_NEW (
|
"rate = (int) [8000, 192000], "
|
||||||
"sinesrc_float_src",
|
"channels = (int) [1, 16]"
|
||||||
"audio/raw",
|
|
||||||
"channels", GST_PROPS_INT_RANGE (1, 16)
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -86,7 +85,7 @@ static void
|
|||||||
sinesrc_init (SineSrc *src)
|
sinesrc_init (SineSrc *src)
|
||||||
{
|
{
|
||||||
src->src = gst_pad_new_from_template (
|
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_element_add_pad (GST_ELEMENT(src), src->src);
|
||||||
gst_pad_set_get_function (src->src, sinesrc_get);
|
gst_pad_set_get_function (src->src, sinesrc_get);
|
||||||
|
|
||||||
@ -115,36 +114,30 @@ sinesrc_force_caps (SineSrc *src) {
|
|||||||
|
|
||||||
switch (src->type) {
|
switch (src->type) {
|
||||||
case SINE_SRC_INT:
|
case SINE_SRC_INT:
|
||||||
caps = GST_CAPS_NEW (
|
caps = gst_caps_new_simple ("audio/x-raw-int",
|
||||||
"sinesrc_src_caps",
|
"signed", G_TYPE_BOOLEAN, src->sign,
|
||||||
"audio/raw",
|
"depth", G_TYPE_INT, src->depth,
|
||||||
"law", GST_PROPS_INT (0),
|
NULL);
|
||||||
"signed", GST_PROPS_BOOLEAN (src->sign),
|
|
||||||
"depth", GST_PROPS_INT (src->depth)
|
|
||||||
);
|
|
||||||
if (src->width > 8)
|
if (src->width > 8)
|
||||||
gst_props_add_entry (gst_caps_get_props (caps),
|
gst_caps_set_simple (caps,
|
||||||
gst_props_entry_new ("endianness",
|
"endianness", G_TYPE_INT, src->endianness,
|
||||||
GST_PROPS_INT (src->endianness)));
|
NULL);
|
||||||
break;
|
break;
|
||||||
case SINE_SRC_FLOAT:
|
case SINE_SRC_FLOAT:
|
||||||
g_assert (src->width == 32 || src->width == 64);
|
g_assert (src->width == 32 || src->width == 64);
|
||||||
caps = GST_CAPS_NEW (
|
caps = gst_caps_new_simple ("audio/x-raw-float",
|
||||||
"sinesrc_src_caps",
|
"endianness", G_TYPE_INT, src->endianness,
|
||||||
"audio/raw",
|
NULL);
|
||||||
"endianness", GST_PROPS_INT(src->endianness)
|
|
||||||
);
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
caps = NULL;
|
caps = NULL;
|
||||||
g_assert_not_reached();
|
g_assert_not_reached();
|
||||||
}
|
}
|
||||||
gst_props_add_entry (gst_caps_get_props (caps),
|
gst_caps_set_simple (caps,
|
||||||
gst_props_entry_new ("width", GST_PROPS_INT (src->width)));
|
"width", G_TYPE_INT, src->width,
|
||||||
gst_props_add_entry (gst_caps_get_props (caps),
|
"rate", G_TYPE_INT, src->rate,
|
||||||
gst_props_entry_new ("rate", GST_PROPS_INT (src->rate)));
|
"channels", G_TYPE_INT, src->channels,
|
||||||
gst_props_add_entry (gst_caps_get_props (caps),
|
NULL);
|
||||||
gst_props_entry_new ("channels", GST_PROPS_INT (src->channels)));
|
|
||||||
|
|
||||||
g_assert (gst_pad_try_set_caps (src->src, caps) == GST_PAD_LINK_OK);
|
g_assert (gst_pad_try_set_caps (src->src, caps) == GST_PAD_LINK_OK);
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
testprogs = formats state
|
testprogs = formats state
|
||||||
|
|
||||||
TESTS =
|
TESTS = $(testprogs)
|
||||||
|
|
||||||
check_PROGRAMS = $(testprogs)
|
check_PROGRAMS = $(testprogs)
|
||||||
|
|
||||||
|
@ -24,25 +24,24 @@
|
|||||||
|
|
||||||
#define SAMPLES_PER_WAVE 200
|
#define SAMPLES_PER_WAVE 200
|
||||||
|
|
||||||
GST_PAD_TEMPLATE_FACTORY (sinesrc_src_factory,
|
static GstStaticPadTemplate sinesrc_src_factory =
|
||||||
|
GST_STATIC_PAD_TEMPLATE (
|
||||||
"src",
|
"src",
|
||||||
GST_PAD_SRC,
|
GST_PAD_SRC,
|
||||||
GST_PAD_ALWAYS,
|
GST_PAD_ALWAYS,
|
||||||
GST_CAPS_NEW (
|
GST_STATIC_CAPS (
|
||||||
"sinesrc_int_src",
|
"audio/x-raw-int, "
|
||||||
"audio/raw",
|
"endianness = (int) { LITTLE_ENDIAN, BIG_ENDIAN }, "
|
||||||
"law", GST_PROPS_INT (0),
|
"signed = (boolean) { FALSE, TRUE }, "
|
||||||
"endianness", GST_PROPS_LIST (GST_PROPS_INT (G_LITTLE_ENDIAN), GST_PROPS_INT (G_BIG_ENDIAN)),
|
"width = (int) [8, 32], "
|
||||||
"signed", GST_PROPS_LIST (GST_PROPS_BOOLEAN (FALSE), GST_PROPS_BOOLEAN (TRUE)),
|
"depth = (int) [8, 32], "
|
||||||
"width", GST_PROPS_INT_RANGE (8, 32),
|
"rate = (int) [8000, 192000], "
|
||||||
"depth", GST_PROPS_INT_RANGE (8, 32),
|
"channels = (int) [1, 16];"
|
||||||
"rate", GST_PROPS_INT_RANGE (8000, 192000),
|
"audio/x-raw-float, "
|
||||||
"channels", GST_PROPS_INT_RANGE (1, 16)
|
"endianness = (int) BYTE_ORDER, "
|
||||||
),
|
"width = (int) {32, 64}, "
|
||||||
GST_CAPS_NEW (
|
"rate = (int) [8000, 192000], "
|
||||||
"sinesrc_float_src",
|
"channels = (int) [1, 16]"
|
||||||
"audio/raw",
|
|
||||||
"channels", GST_PROPS_INT_RANGE (1, 16)
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -86,7 +85,7 @@ static void
|
|||||||
sinesrc_init (SineSrc *src)
|
sinesrc_init (SineSrc *src)
|
||||||
{
|
{
|
||||||
src->src = gst_pad_new_from_template (
|
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_element_add_pad (GST_ELEMENT(src), src->src);
|
||||||
gst_pad_set_get_function (src->src, sinesrc_get);
|
gst_pad_set_get_function (src->src, sinesrc_get);
|
||||||
|
|
||||||
@ -115,36 +114,30 @@ sinesrc_force_caps (SineSrc *src) {
|
|||||||
|
|
||||||
switch (src->type) {
|
switch (src->type) {
|
||||||
case SINE_SRC_INT:
|
case SINE_SRC_INT:
|
||||||
caps = GST_CAPS_NEW (
|
caps = gst_caps_new_simple ("audio/x-raw-int",
|
||||||
"sinesrc_src_caps",
|
"signed", G_TYPE_BOOLEAN, src->sign,
|
||||||
"audio/raw",
|
"depth", G_TYPE_INT, src->depth,
|
||||||
"law", GST_PROPS_INT (0),
|
NULL);
|
||||||
"signed", GST_PROPS_BOOLEAN (src->sign),
|
|
||||||
"depth", GST_PROPS_INT (src->depth)
|
|
||||||
);
|
|
||||||
if (src->width > 8)
|
if (src->width > 8)
|
||||||
gst_props_add_entry (gst_caps_get_props (caps),
|
gst_caps_set_simple (caps,
|
||||||
gst_props_entry_new ("endianness",
|
"endianness", G_TYPE_INT, src->endianness,
|
||||||
GST_PROPS_INT (src->endianness)));
|
NULL);
|
||||||
break;
|
break;
|
||||||
case SINE_SRC_FLOAT:
|
case SINE_SRC_FLOAT:
|
||||||
g_assert (src->width == 32 || src->width == 64);
|
g_assert (src->width == 32 || src->width == 64);
|
||||||
caps = GST_CAPS_NEW (
|
caps = gst_caps_new_simple ("audio/x-raw-float",
|
||||||
"sinesrc_src_caps",
|
"endianness", G_TYPE_INT, src->endianness,
|
||||||
"audio/raw",
|
NULL);
|
||||||
"endianness", GST_PROPS_INT(src->endianness)
|
|
||||||
);
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
caps = NULL;
|
caps = NULL;
|
||||||
g_assert_not_reached();
|
g_assert_not_reached();
|
||||||
}
|
}
|
||||||
gst_props_add_entry (gst_caps_get_props (caps),
|
gst_caps_set_simple (caps,
|
||||||
gst_props_entry_new ("width", GST_PROPS_INT (src->width)));
|
"width", G_TYPE_INT, src->width,
|
||||||
gst_props_add_entry (gst_caps_get_props (caps),
|
"rate", G_TYPE_INT, src->rate,
|
||||||
gst_props_entry_new ("rate", GST_PROPS_INT (src->rate)));
|
"channels", G_TYPE_INT, src->channels,
|
||||||
gst_props_add_entry (gst_caps_get_props (caps),
|
NULL);
|
||||||
gst_props_entry_new ("channels", GST_PROPS_INT (src->channels)));
|
|
||||||
|
|
||||||
g_assert (gst_pad_try_set_caps (src->src, caps) == GST_PAD_LINK_OK);
|
g_assert (gst_pad_try_set_caps (src->src, caps) == GST_PAD_LINK_OK);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user