From 7ccfa2dac77e36fb5b1bd240d29a677bdf240a54 Mon Sep 17 00:00:00 2001 From: David Schleef Date: Fri, 2 Jan 2004 07:09:22 +0000 Subject: [PATCH] Convert elements to use gst_pad_use_explicit_caps() where appropriate. Original commit message from CVS: Convert elements to use gst_pad_use_explicit_caps() where appropriate. --- ChangeLog | 52 +++++++++++++++++++++++++++++++++++++++++ ext/ogg/gstoggdemux.c | 9 +++++-- ext/vorbis/vorbisfile.c | 8 ++----- 3 files changed, 61 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 156f7af8a1..fa195725e2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,55 @@ +2004-01-01 David Schleef + + Convert elements to use gst_pad_use_explicit_caps() where + appropriate: + * ext/a52dec/gsta52dec.c: (gst_a52dec_init), (gst_a52dec_reneg): + * ext/audiofile/gstafparse.c: (gst_afparse_init), + (gst_afparse_open_file): + * ext/audiofile/gstafsrc.c: (gst_afsrc_init), + (gst_afsrc_open_file): + * ext/esd/esdmon.c: (gst_esdmon_init), (gst_esdmon_get): + * ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_init), + (gst_ffmpegdec_chain): + * ext/ffmpeg/gstffmpegdemux.c: (gst_ffmpegdemux_loop): + * ext/flac/gstflacdec.c: (gst_flacdec_init), (gst_flacdec_write): + * ext/gdk_pixbuf/gstgdkpixbuf.c: (gst_gdk_pixbuf_init), + (gst_gdk_pixbuf_chain): + * ext/jpeg/gstjpegdec.c: (gst_jpegdec_init), (gst_jpegdec_link), + (gst_jpegdec_chain): + * ext/mad/gstmad.c: (gst_mad_init), (gst_mad_chain): + * ext/mikmod/gstmikmod.c: (gst_mikmod_init), + (gst_mikmod_negotiate): + * ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_init), + (gst_mpeg2dec_negotiate_format): + * ext/mpeg2enc/gstmpeg2enc.cc: + * ext/ogg/gstoggdemux.c: (gst_ogg_pad_push): + * ext/speex/gstspeexdec.c: (gst_speexdec_init), + (gst_speexdec_sinkconnect): + * ext/swfdec/gstswfdec.c: (gst_swfdec_loop), (gst_swfdec_init): + * ext/vorbis/vorbisfile.c: (gst_vorbisfile_init), + (gst_vorbisfile_new_link): + * gst/ac3parse/gstac3parse.c: (gst_ac3parse_init), + (gst_ac3parse_chain): + * gst/asfdemux/gstasfdemux.c: (gst_asf_demux_add_audio_stream), + (gst_asf_demux_setup_pad): + * gst/auparse/gstauparse.c: (gst_auparse_init), + (gst_auparse_chain): + * gst/id3/gstid3types.c: (gst_id3types_loop): + * gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream): + * gst/mpeg1videoparse/gstmp1videoparse.c: (gst_mp1videoparse_init), + (mp1videoparse_parse_seq): + * gst/mpegaudioparse/gstmpegaudioparse.c: (gst_mp3parse_init), + (bpf_from_header): + * gst/mpegstream/gstmpegdemux.c: (gst_mpeg_demux_parse_syshead), + (gst_mpeg_demux_parse_pes), (gst_mpeg_demux_lpcm_set_caps): + * gst/mpegstream/gstmpegparse.c: (gst_mpeg_parse_init), + (gst_mpeg_parse_send_data): + * gst/qtdemux/qtdemux.c: (gst_qtdemux_loop_header), + (gst_qtdemux_add_stream): + * gst/realmedia/rmdemux.c: (gst_rmdemux_add_stream): + * gst/wavparse/gstwavparse.c: (gst_wavparse_init), + (gst_wavparse_parse_fmt): + 2004-01-01 Ronald Bultje * configure.ac: diff --git a/ext/ogg/gstoggdemux.c b/ext/ogg/gstoggdemux.c index df6eea45e5..34e40cf65b 100644 --- a/ext/ogg/gstoggdemux.c +++ b/ext/ogg/gstoggdemux.c @@ -437,6 +437,11 @@ gst_ogg_pad_push (GstOggDemux *ogg, GstOggPad *pad) GstCaps *caps = gst_ogg_type_find (&packet); gchar *name = g_strdup_printf ("serial %d", pad->serial); + if (caps == NULL) { + gst_element_error (GST_ELEMENT (ogg), + "couldn't determine stream type from media"); + return; + } pad->pad = gst_pad_new_from_template ( gst_static_pad_template_get (&ogg_demux_src_template_factory), name); @@ -445,8 +450,8 @@ gst_ogg_pad_push (GstOggDemux *ogg, GstOggPad *pad) gst_pad_set_event_mask_function (pad->pad, GST_DEBUG_FUNCPTR (gst_ogg_demux_get_event_masks)); gst_pad_set_query_function (pad->pad, GST_DEBUG_FUNCPTR (gst_ogg_demux_src_query)); gst_pad_set_query_type_function (pad->pad, GST_DEBUG_FUNCPTR (gst_ogg_demux_get_query_types)); - if (caps) - g_assert (gst_pad_try_set_caps (pad->pad, caps) >= GST_PAD_LINK_OK); + gst_pad_use_explicit_caps (pad->pad); + gst_pad_set_explicit_caps (pad->pad, caps); gst_pad_set_active (pad->pad, TRUE); gst_element_add_pad (GST_ELEMENT (ogg), pad->pad); } diff --git a/ext/vorbis/vorbisfile.c b/ext/vorbis/vorbisfile.c index f43c8c71ba..d1a21708d9 100644 --- a/ext/vorbis/vorbisfile.c +++ b/ext/vorbis/vorbisfile.c @@ -270,6 +270,7 @@ gst_vorbisfile_init (VorbisFile * vorbisfile) gst_vorbisfile_get_event_masks); gst_pad_set_event_function (vorbisfile->srcpad, gst_vorbisfile_src_event); gst_pad_set_convert_function (vorbisfile->srcpad, gst_vorbisfile_src_convert); + gst_pad_use_explicit_caps (vorbisfile->srcpad); vorbisfile->total_bytes = 0; vorbisfile->offset = 0; @@ -525,12 +526,7 @@ gst_vorbisfile_new_link (VorbisFile *vorbisfile, gint link) "channels", G_TYPE_INT, vi->channels, NULL); - if (gst_pad_try_set_caps (vorbisfile->srcpad, caps) <= 0) { - res = FALSE; - } - gst_caps_free (caps); - - return res; + return gst_pad_set_explicit_caps (vorbisfile->srcpad, caps); } static void