mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 20:21:24 +00:00
fixes for G_DISABLE_ASSERT and friends
Original commit message from CVS: * examples/dynparams/filter.c: (ui_control_create): * examples/gstplay/player.c: (print_tag): * ext/alsa/gstalsa.c: (gst_alsa_request_new_pad): * ext/gdk_pixbuf/gstgdkanimation.c: (gst_gdk_animation_iter_may_advance): * ext/jack/gstjack.c: (gst_jack_request_new_pad): * ext/mad/gstid3tag.c: (gst_mad_id3_to_tag_list), (tag_list_to_id3_tag_foreach), (gst_id3_tag_handle_event): * ext/vorbis/oggvorbisenc.c: (gst_oggvorbisenc_get_tag_value): * ext/vorbis/vorbisenc.c: (gst_vorbisenc_get_tag_value): * ext/xine/xineaudiodec.c: (gst_xine_audio_dec_chain): * gst-libs/gst/media-info/media-info-test.c: (print_tag): * gst/sine/demo-dparams.c: (main): * gst/tags/gstvorbistag.c: (gst_tag_to_vorbis_comments): * testsuite/alsa/formats.c: (create_pipeline): * testsuite/alsa/sinesrc.c: (sinesrc_force_caps), (sinesrc_get): fixes for G_DISABLE_ASSERT and friends * gst/typefind/gsttypefindfunctions.c: (aac_type_find), (mp3_type_frame_length_from_header), (mp3_type_find), (plugin_init): require mp3 typefinding to have at least MIN_HEADERS valid headers add typefinding for AAC adts files
This commit is contained in:
parent
07ea0aef1c
commit
fac2d57868
16 changed files with 134 additions and 45 deletions
25
ChangeLog
25
ChangeLog
|
@ -1,3 +1,28 @@
|
|||
2004-08-03 Benjamin Otte <otte@gnome.org>
|
||||
|
||||
* examples/dynparams/filter.c: (ui_control_create):
|
||||
* examples/gstplay/player.c: (print_tag):
|
||||
* ext/alsa/gstalsa.c: (gst_alsa_request_new_pad):
|
||||
* ext/gdk_pixbuf/gstgdkanimation.c:
|
||||
(gst_gdk_animation_iter_may_advance):
|
||||
* ext/jack/gstjack.c: (gst_jack_request_new_pad):
|
||||
* ext/mad/gstid3tag.c: (gst_mad_id3_to_tag_list),
|
||||
(tag_list_to_id3_tag_foreach), (gst_id3_tag_handle_event):
|
||||
* ext/vorbis/oggvorbisenc.c: (gst_oggvorbisenc_get_tag_value):
|
||||
* ext/vorbis/vorbisenc.c: (gst_vorbisenc_get_tag_value):
|
||||
* ext/xine/xineaudiodec.c: (gst_xine_audio_dec_chain):
|
||||
* gst-libs/gst/media-info/media-info-test.c: (print_tag):
|
||||
* gst/sine/demo-dparams.c: (main):
|
||||
* gst/tags/gstvorbistag.c: (gst_tag_to_vorbis_comments):
|
||||
* testsuite/alsa/formats.c: (create_pipeline):
|
||||
* testsuite/alsa/sinesrc.c: (sinesrc_force_caps), (sinesrc_get):
|
||||
fixes for G_DISABLE_ASSERT and friends
|
||||
* gst/typefind/gsttypefindfunctions.c: (aac_type_find),
|
||||
(mp3_type_frame_length_from_header), (mp3_type_find),
|
||||
(plugin_init):
|
||||
require mp3 typefinding to have at least MIN_HEADERS valid headers
|
||||
add typefinding for AAC adts files
|
||||
|
||||
2004-08-04 Jan Schmidt <thaytan@mad.scientist.com>
|
||||
|
||||
* sys/ximage/ximagesink.c:
|
||||
|
|
|
@ -183,8 +183,9 @@ ui_control_create (GstElement * element, GtkWidget * control, _filter_ui_t * ui)
|
|||
/* create the dparam object */
|
||||
dparam = gst_dpsmooth_new (G_PARAM_SPEC_VALUE_TYPE (specs[i]));
|
||||
g_object_set (G_OBJECT (dparam), "update_period", 2000000LL, NULL);
|
||||
g_assert (gst_dpman_attach_dparam (dpman,
|
||||
(gchar *) g_param_spec_get_name (specs[i]), dparam));
|
||||
if (!gst_dpman_attach_dparam (dpman,
|
||||
(gchar *) g_param_spec_get_name (specs[i]), dparam))
|
||||
g_assert_not_reached ();
|
||||
gst_dpman_set_mode (dpman, "asynchronous");
|
||||
g_signal_connect (widget, "value-changed",
|
||||
G_CALLBACK (cb_dynparm_value_changed), dparam);
|
||||
|
|
|
@ -34,7 +34,8 @@ print_tag (const GstTagList * list, const gchar * tag, gpointer unused)
|
|||
gchar *str;
|
||||
|
||||
if (gst_tag_get_type (tag) == G_TYPE_STRING) {
|
||||
g_assert (gst_tag_list_get_string_index (list, tag, i, &str));
|
||||
if (!gst_tag_list_get_string_index (list, tag, i, &str))
|
||||
g_assert_not_reached ();
|
||||
} else {
|
||||
str =
|
||||
g_strdup_value_contents (gst_tag_list_get_value_index (list, tag, i));
|
||||
|
|
|
@ -515,8 +515,9 @@ gst_alsa_request_new_pad (GstElement * element, GstPadTemplate * templ,
|
|||
GstAlsa *this;
|
||||
gint track = 0;
|
||||
|
||||
g_return_val_if_fail ((this = GST_ALSA (element)), NULL);
|
||||
g_return_val_if_fail (GST_IS_ALSA (element), NULL);
|
||||
g_return_val_if_fail (!GST_FLAG_IS_SET (element, GST_ALSA_RUNNING), NULL);
|
||||
this = GST_ALSA (element);
|
||||
|
||||
if (name) {
|
||||
/* locate the track number in the requested pad name. */
|
||||
|
|
|
@ -491,21 +491,24 @@ gst_oggvorbisenc_get_tag_value (const GstTagList * list, const gchar * tag,
|
|||
|| (strcmp (tag, GST_TAG_ALBUM_VOLUME_COUNT) == 0)) {
|
||||
guint track_no;
|
||||
|
||||
g_assert (gst_tag_list_get_uint_index (list, tag, index, &track_no));
|
||||
if (!gst_tag_list_get_uint_index (list, tag, index, &track_no))
|
||||
g_assert_not_reached ();
|
||||
vorbisvalue = g_strdup_printf ("%u", track_no);
|
||||
} else if (strcmp (tag, GST_TAG_DATE) == 0) {
|
||||
/* FIXME: how are dates represented in vorbis files? */
|
||||
GDate *date;
|
||||
guint u;
|
||||
|
||||
g_assert (gst_tag_list_get_uint_index (list, tag, index, &u));
|
||||
if (!gst_tag_list_get_uint_index (list, tag, index, &u))
|
||||
g_assert_not_reached ();
|
||||
date = g_date_new_julian (u);
|
||||
vorbisvalue =
|
||||
g_strdup_printf ("%04d-%02d-%02d", (gint) g_date_get_year (date),
|
||||
(gint) g_date_get_month (date), (gint) g_date_get_day (date));
|
||||
g_date_free (date);
|
||||
} else if (gst_tag_get_type (tag) == G_TYPE_STRING) {
|
||||
g_assert (gst_tag_list_get_string_index (list, tag, index, &vorbisvalue));
|
||||
if (!gst_tag_list_get_string_index (list, tag, index, &vorbisvalue))
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
|
||||
return vorbisvalue;
|
||||
|
|
|
@ -497,21 +497,24 @@ gst_vorbisenc_get_tag_value (const GstTagList * list, const gchar * tag,
|
|||
|| (strcmp (tag, GST_TAG_ALBUM_VOLUME_COUNT) == 0)) {
|
||||
guint track_no;
|
||||
|
||||
g_assert (gst_tag_list_get_uint_index (list, tag, index, &track_no));
|
||||
if (!gst_tag_list_get_uint_index (list, tag, index, &track_no))
|
||||
g_assert_not_reached ();
|
||||
vorbisvalue = g_strdup_printf ("%u", track_no);
|
||||
} else if (strcmp (tag, GST_TAG_DATE) == 0) {
|
||||
/* FIXME: how are dates represented in vorbis files? */
|
||||
GDate *date;
|
||||
guint u;
|
||||
|
||||
g_assert (gst_tag_list_get_uint_index (list, tag, index, &u));
|
||||
if (!gst_tag_list_get_uint_index (list, tag, index, &u))
|
||||
g_assert_not_reached ();
|
||||
date = g_date_new_julian (u);
|
||||
vorbisvalue =
|
||||
g_strdup_printf ("%04d-%02d-%02d", (gint) g_date_get_year (date),
|
||||
(gint) g_date_get_month (date), (gint) g_date_get_day (date));
|
||||
g_date_free (date);
|
||||
} else if (gst_tag_get_type (tag) == G_TYPE_STRING) {
|
||||
g_assert (gst_tag_list_get_string_index (list, tag, index, &vorbisvalue));
|
||||
if (!gst_tag_list_get_string_index (list, tag, index, &vorbisvalue))
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
|
||||
return vorbisvalue;
|
||||
|
|
|
@ -15,7 +15,8 @@ print_tag (const GstTagList * list, const gchar * tag, gpointer unused)
|
|||
gchar *str;
|
||||
|
||||
if (gst_tag_get_type (tag) == G_TYPE_STRING) {
|
||||
g_assert (gst_tag_list_get_string_index (list, tag, i, &str));
|
||||
if (!gst_tag_list_get_string_index (list, tag, i, &str))
|
||||
g_assert_not_reached ();
|
||||
} else {
|
||||
str =
|
||||
g_strdup_value_contents (gst_tag_list_get_value_index (list, tag, i));
|
||||
|
|
|
@ -96,7 +96,8 @@ main (int argc, char *argv[])
|
|||
g_object_set (G_OBJECT (freq), "slope_time", 50000000LL, NULL);
|
||||
|
||||
dpman = gst_dpman_get_manager (sinesrc);
|
||||
g_assert (gst_dpman_attach_dparam (dpman, "freq", freq));
|
||||
if (!gst_dpman_attach_dparam (dpman, "freq", freq))
|
||||
g_assert_not_reached ();
|
||||
gst_dpman_set_mode (dpman, "asynchronous");
|
||||
|
||||
spec = (GParamSpecDouble *) gst_dpman_get_param_spec (dpman, "freq");
|
||||
|
@ -119,7 +120,8 @@ main (int argc, char *argv[])
|
|||
g_object_set (G_OBJECT (volume), "slope_time", 50000000LL, NULL);
|
||||
|
||||
dpman = gst_dpman_get_manager (volfilter);
|
||||
g_assert (gst_dpman_attach_dparam (dpman, "volume", volume));
|
||||
if (!gst_dpman_attach_dparam (dpman, "volume", volume))
|
||||
g_assert_not_reached ();
|
||||
gst_dpman_set_mode (dpman, "asynchronous");
|
||||
|
||||
g_object_set (G_OBJECT (volfilter), "mute", FALSE, NULL);
|
||||
|
|
|
@ -445,7 +445,8 @@ gst_tag_to_vorbis_comments (const GstTagList * list, const gchar * tag)
|
|||
GDate *date;
|
||||
guint u;
|
||||
|
||||
g_assert (gst_tag_list_get_uint_index (list, tag, i, &u));
|
||||
if (!gst_tag_list_get_uint_index (list, tag, i, &u))
|
||||
g_assert_not_reached ();
|
||||
date = g_date_new_julian (u);
|
||||
/* vorbis suggests using ISO date formats */
|
||||
result =
|
||||
|
@ -456,21 +457,24 @@ gst_tag_to_vorbis_comments (const GstTagList * list, const gchar * tag)
|
|||
} else {
|
||||
guint u;
|
||||
|
||||
g_assert (gst_tag_list_get_uint_index (list, tag, i, &u));
|
||||
if (!gst_tag_list_get_uint_index (list, tag, i, &u))
|
||||
g_assert_not_reached ();
|
||||
result = g_strdup_printf ("%s=%u", vorbis_tag, u);
|
||||
}
|
||||
break;
|
||||
case G_TYPE_STRING:{
|
||||
gchar *str;
|
||||
|
||||
g_assert (gst_tag_list_get_string_index (list, tag, i, &str));
|
||||
if (!gst_tag_list_get_string_index (list, tag, i, &str))
|
||||
g_assert_not_reached ();
|
||||
result = g_strdup_printf ("%s=%s", vorbis_tag, str);
|
||||
break;
|
||||
}
|
||||
case G_TYPE_DOUBLE:{
|
||||
gdouble value;
|
||||
|
||||
g_assert (gst_tag_list_get_double_index (list, tag, i, &value));
|
||||
if (!gst_tag_list_get_double_index (list, tag, i, &value))
|
||||
g_assert_not_reached ();
|
||||
result = g_strdup_printf ("%s=%f", vorbis_tag, value);
|
||||
}
|
||||
default:
|
||||
|
|
|
@ -190,7 +190,33 @@ id3_type_find (GstTypeFind * tf, gpointer unused)
|
|||
}
|
||||
}
|
||||
|
||||
/*** audio/mpeg **************************************************************/
|
||||
/*** audio/mpeg version 2, 4 *************************************************/
|
||||
|
||||
static GstStaticCaps aac_caps = GST_STATIC_CAPS ("audio/mpeg, "
|
||||
"mpegversion = (int) { 2, 4 }, framed = (bool) false");
|
||||
#define AAC_CAPS (gst_static_caps_get(&aac_caps))
|
||||
static void
|
||||
aac_type_find (GstTypeFind * tf, gpointer unused)
|
||||
{
|
||||
guint8 *data = gst_type_find_peek (tf, 0, 2);
|
||||
|
||||
/* detect adts header
|
||||
* note that this is a pretty lame typefind method (14 bits, 0.006%), so
|
||||
* we'll only use LIKELY
|
||||
*/
|
||||
if (data[0] == 0xFF && (data[1] & 0xF6) == 0xF0) {
|
||||
gboolean mpegversion = (data[1] & 0x08) ? 2 : 4;
|
||||
GstCaps *caps = gst_caps_new_simple ("audio/mpeg",
|
||||
"framed", G_TYPE_BOOLEAN, FALSE,
|
||||
"mpegversion", G_TYPE_INT, mpegversion,
|
||||
NULL);
|
||||
|
||||
gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, caps);
|
||||
gst_caps_free (caps);
|
||||
}
|
||||
}
|
||||
|
||||
/*** audio/mpeg version 1 ****************************************************/
|
||||
|
||||
/**
|
||||
* The chance that random data is identified as a valid mp3 header is 63 / 2^18
|
||||
|
@ -287,7 +313,7 @@ mp3_type_frame_length_from_header (guint32 header, guint * put_layer,
|
|||
&& version != 3) ? 72000 : 144000) * bitrate / samplerate;
|
||||
}
|
||||
|
||||
GST_LOG ("mp3typefind: alculated mp3 frame length of %u bytes", length);
|
||||
GST_LOG ("mp3typefind: calculated mp3 frame length of %u bytes", length);
|
||||
GST_LOG
|
||||
("mp3typefind: samplerate = %u - bitrate = %u - layer = %u - version = %u"
|
||||
" - channels = %u", samplerate, bitrate, layer, version, channels);
|
||||
|
@ -313,10 +339,12 @@ static GstStaticCaps mp3_caps = GST_STATIC_CAPS ("audio/mpeg, "
|
|||
* if no more data is available, we will return a probability of
|
||||
* (found_headers/TRY_HEADERS) * (MAXIMUM * (TRY_SYNC - bytes_skipped)
|
||||
* / TRY_SYNC)
|
||||
* if found_headers >= MIN_HEADERS
|
||||
*/
|
||||
#define GST_MP3_TYPEFIND_TRY_HEADERS 5
|
||||
#define GST_MP3_TYPEFIND_MIN_HEADERS (2)
|
||||
#define GST_MP3_TYPEFIND_TRY_HEADERS (5)
|
||||
#define GST_MP3_TYPEFIND_TRY_SYNC (GST_TYPE_FIND_MAXIMUM * 100) /* 10kB */
|
||||
#define GST_MP3_TYPEFIND_SYNC_SIZE 2048
|
||||
#define GST_MP3_TYPEFIND_SYNC_SIZE (2048)
|
||||
|
||||
static void
|
||||
mp3_type_find (GstTypeFind * tf, gpointer unused)
|
||||
|
@ -358,7 +386,8 @@ mp3_type_find (GstTypeFind * tf, gpointer unused)
|
|||
if (!(length = mp3_type_frame_length_from_header (head, &layer,
|
||||
&channels, &bitrate, &samplerate))) {
|
||||
GST_LOG ("%d. header at offset %" G_GUINT64_FORMAT
|
||||
" was not an mp3 header", found + 1, offset);
|
||||
" (0x%X) was not an mp3 header", found + 1, offset,
|
||||
(guint) offset);
|
||||
break;
|
||||
}
|
||||
if ((prev_layer && prev_layer != layer) ||
|
||||
|
@ -375,18 +404,26 @@ mp3_type_find (GstTypeFind * tf, gpointer unused)
|
|||
prev_samplerate = samplerate;
|
||||
} else {
|
||||
found++;
|
||||
GST_LOG ("found %d. header at offset %" G_GUINT64_FORMAT " (0x%X)",
|
||||
found, offset, (guint) offset);
|
||||
}
|
||||
offset += length;
|
||||
}
|
||||
g_assert (found <= GST_MP3_TYPEFIND_TRY_HEADERS);
|
||||
if (found == GST_MP3_TYPEFIND_TRY_HEADERS || head_data == NULL) {
|
||||
if (found == GST_MP3_TYPEFIND_TRY_HEADERS ||
|
||||
(found >= GST_MP3_TYPEFIND_MIN_HEADERS && head_data == NULL)) {
|
||||
/* we can make a valid guess */
|
||||
guint probability = found * GST_TYPE_FIND_MAXIMUM *
|
||||
(GST_MP3_TYPEFIND_TRY_SYNC - skipped) /
|
||||
GST_MP3_TYPEFIND_TRY_HEADERS / GST_MP3_TYPEFIND_TRY_SYNC;
|
||||
|
||||
if (probability < GST_TYPE_FIND_MINIMUM)
|
||||
probability = GST_TYPE_FIND_MINIMUM;
|
||||
|
||||
GST_INFO
|
||||
("audio/mpeg calculated %u = %u * %u / %u * (%u - %u) / %u",
|
||||
probability, GST_TYPE_FIND_MAXIMUM, found,
|
||||
GST_MP3_TYPEFIND_TRY_HEADERS, GST_MP3_TYPEFIND_TRY_SYNC, skipped,
|
||||
GST_MP3_TYPEFIND_TRY_SYNC);
|
||||
/* make sure we're not id3 tagged */
|
||||
head_data = gst_type_find_peek (tf, -128, 3);
|
||||
if (!head_data) {
|
||||
|
@ -793,9 +830,9 @@ ape_type_find (GstTypeFind * tf, gpointer unused)
|
|||
|
||||
/*** audio/x-m4a *********************************************/
|
||||
|
||||
static GstStaticCaps aac_caps = GST_STATIC_CAPS ("audio/x-m4a");
|
||||
static GstStaticCaps m4a_caps = GST_STATIC_CAPS ("audio/x-m4a");
|
||||
|
||||
#define AAC_CAPS (gst_static_caps_get(&aac_caps))
|
||||
#define M4A_CAPS (gst_static_caps_get(&m4a_caps))
|
||||
static void
|
||||
m4a_type_find (GstTypeFind * tf, gpointer unused)
|
||||
{
|
||||
|
@ -1307,6 +1344,7 @@ plugin_init (GstPlugin * plugin)
|
|||
static gchar *zip_exts[] = { "zip", NULL };
|
||||
static gchar *compress_exts[] = { "Z", NULL };
|
||||
static gchar *m4a_exts[] = { "m4a", NULL };
|
||||
static gchar *aac_exts[] = { "aac", NULL };
|
||||
|
||||
GST_DEBUG_CATEGORY_INIT (type_find_debug, "typefindfunctions",
|
||||
GST_DEBUG_FG_GREEN | GST_DEBUG_BG_RED, "generic type find functions");
|
||||
|
@ -1402,9 +1440,11 @@ plugin_init (GstPlugin * plugin)
|
|||
TYPE_FIND_REGISTER (plugin, "audio/x-speex", GST_RANK_PRIMARY,
|
||||
speex_type_find, NULL, SPEEX_CAPS, NULL);
|
||||
TYPE_FIND_REGISTER (plugin, "audio/x-m4a", GST_RANK_PRIMARY, m4a_type_find,
|
||||
m4a_exts, AAC_CAPS, NULL);
|
||||
m4a_exts, M4A_CAPS, NULL);
|
||||
TYPE_FIND_REGISTER_START_WITH (plugin, "application/x-executable",
|
||||
GST_RANK_MARGINAL, NULL, "\177ELF", 4, GST_TYPE_FIND_MAXIMUM);
|
||||
TYPE_FIND_REGISTER (plugin, "adts_mpeg_stream", GST_RANK_SECONDARY,
|
||||
aac_type_find, aac_exts, AAC_CAPS, NULL);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -183,8 +183,9 @@ ui_control_create (GstElement * element, GtkWidget * control, _filter_ui_t * ui)
|
|||
/* create the dparam object */
|
||||
dparam = gst_dpsmooth_new (G_PARAM_SPEC_VALUE_TYPE (specs[i]));
|
||||
g_object_set (G_OBJECT (dparam), "update_period", 2000000LL, NULL);
|
||||
g_assert (gst_dpman_attach_dparam (dpman,
|
||||
(gchar *) g_param_spec_get_name (specs[i]), dparam));
|
||||
if (!gst_dpman_attach_dparam (dpman,
|
||||
(gchar *) g_param_spec_get_name (specs[i]), dparam))
|
||||
g_assert_not_reached ();
|
||||
gst_dpman_set_mode (dpman, "asynchronous");
|
||||
g_signal_connect (widget, "value-changed",
|
||||
G_CALLBACK (cb_dynparm_value_changed), dparam);
|
||||
|
|
|
@ -34,7 +34,8 @@ print_tag (const GstTagList * list, const gchar * tag, gpointer unused)
|
|||
gchar *str;
|
||||
|
||||
if (gst_tag_get_type (tag) == G_TYPE_STRING) {
|
||||
g_assert (gst_tag_list_get_string_index (list, tag, i, &str));
|
||||
if (!gst_tag_list_get_string_index (list, tag, i, &str))
|
||||
g_assert_not_reached ();
|
||||
} else {
|
||||
str =
|
||||
g_strdup_value_contents (gst_tag_list_get_value_index (list, tag, i));
|
||||
|
|
|
@ -139,10 +139,11 @@ create_pipeline (void)
|
|||
sinesrc->width = 16;
|
||||
|
||||
if (temp == 0) {
|
||||
g_assert ((law = gst_element_factory_make ("mulawenc", "mulaw")));
|
||||
law = gst_element_factory_make ("mulawenc", "mulaw");
|
||||
} else {
|
||||
g_assert ((law = gst_element_factory_make ("alawenc", "alaw")));
|
||||
law = gst_element_factory_make ("alawenc", "alaw");
|
||||
}
|
||||
g_assert (law);
|
||||
gst_element_unlink (src, alsasink);
|
||||
gst_bin_add (GST_BIN (pipeline), law);
|
||||
gst_element_link_many (src, law, alsasink, NULL);
|
||||
|
|
|
@ -134,7 +134,8 @@ sinesrc_force_caps (SineSrc * src)
|
|||
"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);
|
||||
if (gst_pad_try_set_caps (src->src, caps) != GST_PAD_LINK_OK)
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
|
||||
/* always return 1 wave
|
||||
|
@ -187,10 +188,11 @@ sinesrc_get (GstPad * pad)
|
|||
if (src->pre_get_func)
|
||||
src->pre_get_func (src);
|
||||
|
||||
g_assert ((buf =
|
||||
gst_buffer_new_and_alloc ((src->width / 8) * src->channels *
|
||||
SAMPLES_PER_WAVE)));
|
||||
g_assert ((data = GST_BUFFER_DATA (buf)));
|
||||
buf = gst_buffer_new_and_alloc ((src->width / 8) * src->channels *
|
||||
SAMPLES_PER_WAVE);
|
||||
g_assert (buf);
|
||||
data = GST_BUFFER_DATA (buf);
|
||||
g_assert (data);
|
||||
|
||||
for (i = 0; i < SAMPLES_PER_WAVE; i++) {
|
||||
value = sin (i * 2 * M_PI / SAMPLES_PER_WAVE);
|
||||
|
|
|
@ -139,10 +139,11 @@ create_pipeline (void)
|
|||
sinesrc->width = 16;
|
||||
|
||||
if (temp == 0) {
|
||||
g_assert ((law = gst_element_factory_make ("mulawenc", "mulaw")));
|
||||
law = gst_element_factory_make ("mulawenc", "mulaw");
|
||||
} else {
|
||||
g_assert ((law = gst_element_factory_make ("alawenc", "alaw")));
|
||||
law = gst_element_factory_make ("alawenc", "alaw");
|
||||
}
|
||||
g_assert (law);
|
||||
gst_element_unlink (src, alsasink);
|
||||
gst_bin_add (GST_BIN (pipeline), law);
|
||||
gst_element_link_many (src, law, alsasink, NULL);
|
||||
|
|
|
@ -134,7 +134,8 @@ sinesrc_force_caps (SineSrc * src)
|
|||
"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);
|
||||
if (gst_pad_try_set_caps (src->src, caps) != GST_PAD_LINK_OK)
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
|
||||
/* always return 1 wave
|
||||
|
@ -187,10 +188,11 @@ sinesrc_get (GstPad * pad)
|
|||
if (src->pre_get_func)
|
||||
src->pre_get_func (src);
|
||||
|
||||
g_assert ((buf =
|
||||
gst_buffer_new_and_alloc ((src->width / 8) * src->channels *
|
||||
SAMPLES_PER_WAVE)));
|
||||
g_assert ((data = GST_BUFFER_DATA (buf)));
|
||||
buf = gst_buffer_new_and_alloc ((src->width / 8) * src->channels *
|
||||
SAMPLES_PER_WAVE);
|
||||
g_assert (buf);
|
||||
data = GST_BUFFER_DATA (buf);
|
||||
g_assert (data);
|
||||
|
||||
for (i = 0; i < SAMPLES_PER_WAVE; i++) {
|
||||
value = sin (i * 2 * M_PI / SAMPLES_PER_WAVE);
|
||||
|
|
Loading…
Reference in a new issue