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:
Benjamin Otte 2004-08-03 14:28:12 +00:00
parent 07ea0aef1c
commit fac2d57868
16 changed files with 134 additions and 45 deletions

View file

@ -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> 2004-08-04 Jan Schmidt <thaytan@mad.scientist.com>
* sys/ximage/ximagesink.c: * sys/ximage/ximagesink.c:

View file

@ -183,8 +183,9 @@ ui_control_create (GstElement * element, GtkWidget * control, _filter_ui_t * ui)
/* create the dparam object */ /* create the dparam object */
dparam = gst_dpsmooth_new (G_PARAM_SPEC_VALUE_TYPE (specs[i])); dparam = gst_dpsmooth_new (G_PARAM_SPEC_VALUE_TYPE (specs[i]));
g_object_set (G_OBJECT (dparam), "update_period", 2000000LL, NULL); g_object_set (G_OBJECT (dparam), "update_period", 2000000LL, NULL);
g_assert (gst_dpman_attach_dparam (dpman, if (!gst_dpman_attach_dparam (dpman,
(gchar *) g_param_spec_get_name (specs[i]), dparam)); (gchar *) g_param_spec_get_name (specs[i]), dparam))
g_assert_not_reached ();
gst_dpman_set_mode (dpman, "asynchronous"); gst_dpman_set_mode (dpman, "asynchronous");
g_signal_connect (widget, "value-changed", g_signal_connect (widget, "value-changed",
G_CALLBACK (cb_dynparm_value_changed), dparam); G_CALLBACK (cb_dynparm_value_changed), dparam);

View file

@ -34,7 +34,8 @@ print_tag (const GstTagList * list, const gchar * tag, gpointer unused)
gchar *str; gchar *str;
if (gst_tag_get_type (tag) == G_TYPE_STRING) { 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 { } else {
str = str =
g_strdup_value_contents (gst_tag_list_get_value_index (list, tag, i)); g_strdup_value_contents (gst_tag_list_get_value_index (list, tag, i));

View file

@ -515,8 +515,9 @@ gst_alsa_request_new_pad (GstElement * element, GstPadTemplate * templ,
GstAlsa *this; GstAlsa *this;
gint track = 0; 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); g_return_val_if_fail (!GST_FLAG_IS_SET (element, GST_ALSA_RUNNING), NULL);
this = GST_ALSA (element);
if (name) { if (name) {
/* locate the track number in the requested pad name. */ /* locate the track number in the requested pad name. */

View file

@ -491,21 +491,24 @@ gst_oggvorbisenc_get_tag_value (const GstTagList * list, const gchar * tag,
|| (strcmp (tag, GST_TAG_ALBUM_VOLUME_COUNT) == 0)) { || (strcmp (tag, GST_TAG_ALBUM_VOLUME_COUNT) == 0)) {
guint track_no; 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); vorbisvalue = g_strdup_printf ("%u", track_no);
} else if (strcmp (tag, GST_TAG_DATE) == 0) { } else if (strcmp (tag, GST_TAG_DATE) == 0) {
/* FIXME: how are dates represented in vorbis files? */ /* FIXME: how are dates represented in vorbis files? */
GDate *date; GDate *date;
guint u; 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); date = g_date_new_julian (u);
vorbisvalue = vorbisvalue =
g_strdup_printf ("%04d-%02d-%02d", (gint) g_date_get_year (date), g_strdup_printf ("%04d-%02d-%02d", (gint) g_date_get_year (date),
(gint) g_date_get_month (date), (gint) g_date_get_day (date)); (gint) g_date_get_month (date), (gint) g_date_get_day (date));
g_date_free (date); g_date_free (date);
} else if (gst_tag_get_type (tag) == G_TYPE_STRING) { } 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; return vorbisvalue;

View file

@ -497,21 +497,24 @@ gst_vorbisenc_get_tag_value (const GstTagList * list, const gchar * tag,
|| (strcmp (tag, GST_TAG_ALBUM_VOLUME_COUNT) == 0)) { || (strcmp (tag, GST_TAG_ALBUM_VOLUME_COUNT) == 0)) {
guint track_no; 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); vorbisvalue = g_strdup_printf ("%u", track_no);
} else if (strcmp (tag, GST_TAG_DATE) == 0) { } else if (strcmp (tag, GST_TAG_DATE) == 0) {
/* FIXME: how are dates represented in vorbis files? */ /* FIXME: how are dates represented in vorbis files? */
GDate *date; GDate *date;
guint u; 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); date = g_date_new_julian (u);
vorbisvalue = vorbisvalue =
g_strdup_printf ("%04d-%02d-%02d", (gint) g_date_get_year (date), g_strdup_printf ("%04d-%02d-%02d", (gint) g_date_get_year (date),
(gint) g_date_get_month (date), (gint) g_date_get_day (date)); (gint) g_date_get_month (date), (gint) g_date_get_day (date));
g_date_free (date); g_date_free (date);
} else if (gst_tag_get_type (tag) == G_TYPE_STRING) { } 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; return vorbisvalue;

View file

@ -15,7 +15,8 @@ print_tag (const GstTagList * list, const gchar * tag, gpointer unused)
gchar *str; gchar *str;
if (gst_tag_get_type (tag) == G_TYPE_STRING) { 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 { } else {
str = str =
g_strdup_value_contents (gst_tag_list_get_value_index (list, tag, i)); g_strdup_value_contents (gst_tag_list_get_value_index (list, tag, i));

View file

@ -96,7 +96,8 @@ main (int argc, char *argv[])
g_object_set (G_OBJECT (freq), "slope_time", 50000000LL, NULL); g_object_set (G_OBJECT (freq), "slope_time", 50000000LL, NULL);
dpman = gst_dpman_get_manager (sinesrc); 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"); gst_dpman_set_mode (dpman, "asynchronous");
spec = (GParamSpecDouble *) gst_dpman_get_param_spec (dpman, "freq"); 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); g_object_set (G_OBJECT (volume), "slope_time", 50000000LL, NULL);
dpman = gst_dpman_get_manager (volfilter); 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"); gst_dpman_set_mode (dpman, "asynchronous");
g_object_set (G_OBJECT (volfilter), "mute", FALSE, NULL); g_object_set (G_OBJECT (volfilter), "mute", FALSE, NULL);

View file

@ -445,7 +445,8 @@ gst_tag_to_vorbis_comments (const GstTagList * list, const gchar * tag)
GDate *date; GDate *date;
guint u; 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); date = g_date_new_julian (u);
/* vorbis suggests using ISO date formats */ /* vorbis suggests using ISO date formats */
result = result =
@ -456,21 +457,24 @@ gst_tag_to_vorbis_comments (const GstTagList * list, const gchar * tag)
} else { } else {
guint u; 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); result = g_strdup_printf ("%s=%u", vorbis_tag, u);
} }
break; break;
case G_TYPE_STRING:{ case G_TYPE_STRING:{
gchar *str; 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); result = g_strdup_printf ("%s=%s", vorbis_tag, str);
break; break;
} }
case G_TYPE_DOUBLE:{ case G_TYPE_DOUBLE:{
gdouble value; 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); result = g_strdup_printf ("%s=%f", vorbis_tag, value);
} }
default: default:

View file

@ -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 * 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; && 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 GST_LOG
("mp3typefind: samplerate = %u - bitrate = %u - layer = %u - version = %u" ("mp3typefind: samplerate = %u - bitrate = %u - layer = %u - version = %u"
" - channels = %u", samplerate, bitrate, layer, version, channels); " - 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 * if no more data is available, we will return a probability of
* (found_headers/TRY_HEADERS) * (MAXIMUM * (TRY_SYNC - bytes_skipped) * (found_headers/TRY_HEADERS) * (MAXIMUM * (TRY_SYNC - bytes_skipped)
* / TRY_SYNC) * / 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_TRY_SYNC (GST_TYPE_FIND_MAXIMUM * 100) /* 10kB */
#define GST_MP3_TYPEFIND_SYNC_SIZE 2048 #define GST_MP3_TYPEFIND_SYNC_SIZE (2048)
static void static void
mp3_type_find (GstTypeFind * tf, gpointer unused) 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, if (!(length = mp3_type_frame_length_from_header (head, &layer,
&channels, &bitrate, &samplerate))) { &channels, &bitrate, &samplerate))) {
GST_LOG ("%d. header at offset %" G_GUINT64_FORMAT 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; break;
} }
if ((prev_layer && prev_layer != layer) || if ((prev_layer && prev_layer != layer) ||
@ -375,18 +404,26 @@ mp3_type_find (GstTypeFind * tf, gpointer unused)
prev_samplerate = samplerate; prev_samplerate = samplerate;
} else { } else {
found++; found++;
GST_LOG ("found %d. header at offset %" G_GUINT64_FORMAT " (0x%X)",
found, offset, (guint) offset);
} }
offset += length; offset += length;
} }
g_assert (found <= GST_MP3_TYPEFIND_TRY_HEADERS); 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 */ /* we can make a valid guess */
guint probability = found * GST_TYPE_FIND_MAXIMUM * guint probability = found * GST_TYPE_FIND_MAXIMUM *
(GST_MP3_TYPEFIND_TRY_SYNC - skipped) / (GST_MP3_TYPEFIND_TRY_SYNC - skipped) /
GST_MP3_TYPEFIND_TRY_HEADERS / GST_MP3_TYPEFIND_TRY_SYNC; GST_MP3_TYPEFIND_TRY_HEADERS / GST_MP3_TYPEFIND_TRY_SYNC;
if (probability < GST_TYPE_FIND_MINIMUM) if (probability < GST_TYPE_FIND_MINIMUM)
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 */ /* make sure we're not id3 tagged */
head_data = gst_type_find_peek (tf, -128, 3); head_data = gst_type_find_peek (tf, -128, 3);
if (!head_data) { if (!head_data) {
@ -793,9 +830,9 @@ ape_type_find (GstTypeFind * tf, gpointer unused)
/*** audio/x-m4a *********************************************/ /*** 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 static void
m4a_type_find (GstTypeFind * tf, gpointer unused) m4a_type_find (GstTypeFind * tf, gpointer unused)
{ {
@ -1307,6 +1344,7 @@ plugin_init (GstPlugin * plugin)
static gchar *zip_exts[] = { "zip", NULL }; static gchar *zip_exts[] = { "zip", NULL };
static gchar *compress_exts[] = { "Z", NULL }; static gchar *compress_exts[] = { "Z", NULL };
static gchar *m4a_exts[] = { "m4a", NULL }; static gchar *m4a_exts[] = { "m4a", NULL };
static gchar *aac_exts[] = { "aac", NULL };
GST_DEBUG_CATEGORY_INIT (type_find_debug, "typefindfunctions", GST_DEBUG_CATEGORY_INIT (type_find_debug, "typefindfunctions",
GST_DEBUG_FG_GREEN | GST_DEBUG_BG_RED, "generic type find functions"); 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, TYPE_FIND_REGISTER (plugin, "audio/x-speex", GST_RANK_PRIMARY,
speex_type_find, NULL, SPEEX_CAPS, NULL); speex_type_find, NULL, SPEEX_CAPS, NULL);
TYPE_FIND_REGISTER (plugin, "audio/x-m4a", GST_RANK_PRIMARY, m4a_type_find, 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", TYPE_FIND_REGISTER_START_WITH (plugin, "application/x-executable",
GST_RANK_MARGINAL, NULL, "\177ELF", 4, GST_TYPE_FIND_MAXIMUM); 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; return TRUE;
} }

View file

@ -183,8 +183,9 @@ ui_control_create (GstElement * element, GtkWidget * control, _filter_ui_t * ui)
/* create the dparam object */ /* create the dparam object */
dparam = gst_dpsmooth_new (G_PARAM_SPEC_VALUE_TYPE (specs[i])); dparam = gst_dpsmooth_new (G_PARAM_SPEC_VALUE_TYPE (specs[i]));
g_object_set (G_OBJECT (dparam), "update_period", 2000000LL, NULL); g_object_set (G_OBJECT (dparam), "update_period", 2000000LL, NULL);
g_assert (gst_dpman_attach_dparam (dpman, if (!gst_dpman_attach_dparam (dpman,
(gchar *) g_param_spec_get_name (specs[i]), dparam)); (gchar *) g_param_spec_get_name (specs[i]), dparam))
g_assert_not_reached ();
gst_dpman_set_mode (dpman, "asynchronous"); gst_dpman_set_mode (dpman, "asynchronous");
g_signal_connect (widget, "value-changed", g_signal_connect (widget, "value-changed",
G_CALLBACK (cb_dynparm_value_changed), dparam); G_CALLBACK (cb_dynparm_value_changed), dparam);

View file

@ -34,7 +34,8 @@ print_tag (const GstTagList * list, const gchar * tag, gpointer unused)
gchar *str; gchar *str;
if (gst_tag_get_type (tag) == G_TYPE_STRING) { 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 { } else {
str = str =
g_strdup_value_contents (gst_tag_list_get_value_index (list, tag, i)); g_strdup_value_contents (gst_tag_list_get_value_index (list, tag, i));

View file

@ -139,10 +139,11 @@ create_pipeline (void)
sinesrc->width = 16; sinesrc->width = 16;
if (temp == 0) { if (temp == 0) {
g_assert ((law = gst_element_factory_make ("mulawenc", "mulaw"))); law = gst_element_factory_make ("mulawenc", "mulaw");
} else { } 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_element_unlink (src, alsasink);
gst_bin_add (GST_BIN (pipeline), law); gst_bin_add (GST_BIN (pipeline), law);
gst_element_link_many (src, law, alsasink, NULL); gst_element_link_many (src, law, alsasink, NULL);

View file

@ -134,7 +134,8 @@ sinesrc_force_caps (SineSrc * src)
"rate", G_TYPE_INT, src->rate, "rate", G_TYPE_INT, src->rate,
"channels", G_TYPE_INT, src->channels, NULL); "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 /* always return 1 wave
@ -187,10 +188,11 @@ sinesrc_get (GstPad * pad)
if (src->pre_get_func) if (src->pre_get_func)
src->pre_get_func (src); src->pre_get_func (src);
g_assert ((buf = buf = gst_buffer_new_and_alloc ((src->width / 8) * src->channels *
gst_buffer_new_and_alloc ((src->width / 8) * src->channels * SAMPLES_PER_WAVE);
SAMPLES_PER_WAVE))); g_assert (buf);
g_assert ((data = GST_BUFFER_DATA (buf))); data = GST_BUFFER_DATA (buf);
g_assert (data);
for (i = 0; i < SAMPLES_PER_WAVE; i++) { for (i = 0; i < SAMPLES_PER_WAVE; i++) {
value = sin (i * 2 * M_PI / SAMPLES_PER_WAVE); value = sin (i * 2 * M_PI / SAMPLES_PER_WAVE);

View file

@ -139,10 +139,11 @@ create_pipeline (void)
sinesrc->width = 16; sinesrc->width = 16;
if (temp == 0) { if (temp == 0) {
g_assert ((law = gst_element_factory_make ("mulawenc", "mulaw"))); law = gst_element_factory_make ("mulawenc", "mulaw");
} else { } 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_element_unlink (src, alsasink);
gst_bin_add (GST_BIN (pipeline), law); gst_bin_add (GST_BIN (pipeline), law);
gst_element_link_many (src, law, alsasink, NULL); gst_element_link_many (src, law, alsasink, NULL);

View file

@ -134,7 +134,8 @@ sinesrc_force_caps (SineSrc * src)
"rate", G_TYPE_INT, src->rate, "rate", G_TYPE_INT, src->rate,
"channels", G_TYPE_INT, src->channels, NULL); "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 /* always return 1 wave
@ -187,10 +188,11 @@ sinesrc_get (GstPad * pad)
if (src->pre_get_func) if (src->pre_get_func)
src->pre_get_func (src); src->pre_get_func (src);
g_assert ((buf = buf = gst_buffer_new_and_alloc ((src->width / 8) * src->channels *
gst_buffer_new_and_alloc ((src->width / 8) * src->channels * SAMPLES_PER_WAVE);
SAMPLES_PER_WAVE))); g_assert (buf);
g_assert ((data = GST_BUFFER_DATA (buf))); data = GST_BUFFER_DATA (buf);
g_assert (data);
for (i = 0; i < SAMPLES_PER_WAVE; i++) { for (i = 0; i < SAMPLES_PER_WAVE; i++) {
value = sin (i * 2 * M_PI / SAMPLES_PER_WAVE); value = sin (i * 2 * M_PI / SAMPLES_PER_WAVE);