From: <tp...@fr...> - 2005-10-21 17:01:17
|
CVS Root: /cvs/gstreamer Module: gst-plugins-good Changes by: tpm Date: Fri Oct 21 2005 10:01:10 PDT Log message: * ext/speex/gstspeexenc.c: (gst_speexenc_get_query_types), (gst_speexenc_src_query): Add position and duration query, fix query type function. * gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream), (gst_matroska_demux_video_caps), (gst_matroska_demux_audio_caps): Let's not set non-fixed caps on source pads. Modified files: . : ChangeLog ext/speex : gstspeexenc.c gst/matroska : matroska-demux.c Links: http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-good/ChangeLog.diff?r1=1.1910&r2=1.1911 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-good/ext/speex/gstspeexenc.c.diff?r1=1.33&r2=1.34 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-good/gst/matroska/matroska-demux.c.diff?r1=1.51&r2=1.52 ====Begin Diffs==== Index: ChangeLog =================================================================== RCS file: /cvs/gstreamer/gst-plugins-good/ChangeLog,v retrieving revision 1.1910 retrieving revision 1.1911 diff -u -d -r1.1910 -r1.1911 --- ChangeLog 21 Oct 2005 16:15:57 -0000 1.1910 +++ ChangeLog 21 Oct 2005 17:00:57 -0000 1.1911 @@ -1,3 +1,13 @@ +2005-10-21 Tim-Philipp Müller <tim at centricular dot net> + + * ext/speex/gstspeexenc.c: (gst_speexenc_get_query_types), + (gst_speexenc_src_query): + Add position and duration query, fix query type function. + + * gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream), + (gst_matroska_demux_video_caps), (gst_matroska_demux_audio_caps): + Let's not set non-fixed caps on source pads. 2005-10-21 Wim Taymans <wi...@fl...> * ext/dv/gstdvdemux.c: (gst_dvdemux_demux_frame): Index: gstspeexenc.c RCS file: /cvs/gstreamer/gst-plugins-good/ext/speex/gstspeexenc.c,v retrieving revision 1.33 retrieving revision 1.34 diff -u -d -r1.33 -r1.34 --- gstspeexenc.c 13 Oct 2005 18:59:35 -0000 1.33 +++ gstspeexenc.c 21 Oct 2005 17:00:57 -0000 1.34 @@ -368,6 +368,8 @@ { static const GstQueryType gst_speexenc_src_query_types[] = { GST_QUERY_POSITION, + GST_QUERY_DURATION, + GST_QUERY_CONVERT, 0 }; @@ -379,48 +381,50 @@ gboolean res = TRUE; GstSpeexEnc *speexenc; + GstPad *peerpad; - speexenc = GST_SPEEXENC (GST_PAD_PARENT (pad)); + speexenc = GST_SPEEXENC (gst_pad_get_parent (pad)); + peerpad = gst_pad_get_peer (GST_PAD (speexenc->sinkpad)); switch (GST_QUERY_TYPE (query)) { case GST_QUERY_POSITION: { -#if 0 - switch (*format) { - case GST_FORMAT_BYTES: - case GST_FORMAT_TIME: - { - gint64 peer_value; - const GstFormat *peer_formats; + GstFormat fmt, req_fmt; + gint64 pos, val; - res = FALSE; + gst_query_parse_position (query, &req_fmt, NULL); + if ((res = gst_pad_query_position (peerpad, &req_fmt, &val))) { + gst_query_set_position (query, req_fmt, val); + break; + } - peer_formats = gst_pad_get_formats (GST_PAD_PEER (speexenc->sinkpad)); + fmt = GST_FORMAT_TIME; + if (!(res = gst_pad_query_position (peerpad, &fmt, &pos))) - while (peer_formats && *peer_formats && !res) { + if ((res = gst_pad_query_convert (peerpad, fmt, pos, &req_fmt, &val))) - GstFormat peer_format = *peer_formats; + break; + } + case GST_QUERY_DURATION: + { + gint64 dur, val; - /* do the probe */ - if (gst_pad_query (GST_PAD_PEER (speexenc->sinkpad), - GST_QUERY_TOTAL, &peer_format, &peer_value)) { - GstFormat conv_format; + gst_query_parse_duration (query, &req_fmt, NULL); + if ((res = gst_pad_query_duration (peerpad, &req_fmt, &val))) { + gst_query_set_duration (query, req_fmt, val); - /* convert to TIME */ - conv_format = GST_FORMAT_TIME; - res = gst_pad_convert (speexenc->sinkpad, - peer_format, peer_value, &conv_format, value); - /* and to final format */ - res &= gst_pad_convert (pad, - GST_FORMAT_TIME, *value, format, value); - } - peer_formats++; - } - break; - } + if (!(res = gst_pad_query_duration (peerpad, &fmt, &dur))) + if ((res = gst_pad_query_convert (peerpad, fmt, dur, &req_fmt, &val))) { } -#endif - res = FALSE; break; } case GST_QUERY_CONVERT: @@ -441,6 +445,8 @@ } error: + gst_object_unref (peerpad); + gst_object_unref (speexenc); return res; } Index: matroska-demux.c RCS file: /cvs/gstreamer/gst-plugins-good/gst/matroska/matroska-demux.c,v retrieving revision 1.51 retrieving revision 1.52 diff -u -d -r1.51 -r1.52 --- matroska-demux.c 20 Oct 2005 19:14:27 -0000 1.51 +++ matroska-demux.c 21 Oct 2005 17:00:58 -0000 1.52 @@ -265,28 +265,6 @@ return -1; -static GstCaps * -gst_matroska_demux_getcaps (GstPad * pad) -{ - GstMatroskaDemux *demux; - GstCaps *caps = NULL; - guint i; - - demux = GST_MATROSKA_DEMUX (gst_pad_get_parent (pad)); - for (i = 0; caps == NULL && i < demux->num_streams; ++i) { - if (demux->src[i]->pad == pad) - caps = gst_caps_copy (demux->src[i]->caps); - } - gst_object_unref (demux); - g_return_val_if_fail (caps != NULL, NULL); - return caps; -} static gboolean gst_matroska_demux_add_stream (GstMatroskaDemux * demux) @@ -922,16 +900,13 @@ if (caps) { GST_LOG ("Adding pad '%s' with caps %" GST_PTR_FORMAT, padname, caps); if (gst_caps_is_fixed (caps)) { - GST_LOG ("fixed caps"); gst_pad_use_fixed_caps (context->pad); gst_pad_set_caps (context->pad, context->caps); + gst_pad_set_active (context->pad, TRUE); + gst_element_add_pad (GST_ELEMENT (demux), context->pad); } else { - GST_LOG ("non-fixed caps"); - gst_pad_set_getcaps_function (context->pad, - GST_DEBUG_FUNCPTR (gst_matroska_demux_getcaps)); + g_warning ("FIXME: non-fixed caps: %s", gst_caps_to_string (caps)); - gst_pad_set_active (context->pad, TRUE); - gst_element_add_pad (GST_ELEMENT (demux), context->pad); } else { /* FIXME: are we leaking the pad here? can this even happen? */ GST_LOG ("Not adding pad '%s' with empty caps", padname); @@ -2967,12 +2942,17 @@ *codec_name = g_strdup ("MPEG-4 simple profile"); } else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_VIDEO_MPEG4_ASP) || !strcmp (codec_id, GST_MATROSKA_CODEC_ID_VIDEO_MPEG4_AP)) { +#if 0 caps = gst_caps_new_full (gst_structure_new ("video/x-divx", "divxversion", G_TYPE_INT, 5, NULL), gst_structure_new ("video/x-xvid", NULL), gst_structure_new ("video/mpeg", "mpegversion", G_TYPE_INT, 4, "systemstream", G_TYPE_BOOLEAN, FALSE, NULL), NULL); +#endif + caps = gst_caps_new_simple ("video/mpeg", + "mpegversion", G_TYPE_INT, 4, + "systemstream", G_TYPE_BOOLEAN, FALSE, NULL); if (codec_name) { if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_VIDEO_MPEG4_ASP)) *codec_name = g_strdup ("MPEG-4 advanced simple profile"); @@ -2980,10 +2960,14 @@ *codec_name = g_strdup ("MPEG-4 advanced profile"); } else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_VIDEO_MSMPEG4V3)) { "divxversion", G_TYPE_INT, 3, NULL), gst_structure_new ("video/x-msmpeg", "msmpegversion", G_TYPE_INT, 43, NULL), NULL); + caps = gst_caps_new_simple ("video/x-msmpeg", + "msmpegversion", G_TYPE_INT, 43, NULL); if (codec_name) *codec_name = g_strdup ("Microsoft MPEG-4 v.3"); } else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_VIDEO_MPEG1) || @@ -3190,8 +3174,7 @@ audiocontext->bitdepth); } else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_AUDIO_PCM_FLOAT)) { caps = gst_caps_new_simple ("audio/x-raw-float", - "endianness", G_TYPE_INT, G_BYTE_ORDER, - "buffer-frames", GST_TYPE_INT_RANGE, 1, G_MAXINT, NULL); + "endianness", G_TYPE_INT, G_BYTE_ORDER, NULL); if (audiocontext != NULL) { gst_caps_set_simple (caps, "width", G_TYPE_INT, audiocontext->bitdepth, NULL); @@ -3286,6 +3269,7 @@ caps = gst_caps_new_simple ("audio/x-tta", + /* FIXME: we can't have non-fixed caps, what to do here? */ caps = gst_caps_from_string ("audio/x-tta, " "width = (int) { 8, 16, 24 }"); @@ -3297,6 +3281,7 @@ "width", G_TYPE_INT, audiocontext->bitdepth, "framed", G_TYPE_BOOLEAN, TRUE, NULL); caps = gst_caps_from_string ("audio/x-wavpack, " "width = (int) { 8, 16, 24 }, " "framed = (boolean) true"); @@ -3320,6 +3305,7 @@ "rate", G_TYPE_INT, audiocontext->samplerate, NULL); } } else { + /* FIXME: we can't have non-fixed caps, what to do here? */ gst_structure_set (structure, "channels", GST_TYPE_INT_RANGE, 1, 6, "rate", GST_TYPE_INT_RANGE, 4000, 96000, NULL); |