mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-25 01:30:38 +00:00
ext/speex/gstspeexenc.c: Add position and duration query, fix query type function.
Original commit message from CVS: * 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.
This commit is contained in:
parent
bee54790e7
commit
512eb8ab25
3 changed files with 67 additions and 65 deletions
10
ChangeLog
10
ChangeLog
|
@ -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 <wim@fluendo.com>
|
||||
|
||||
* ext/dv/gstdvdemux.c: (gst_dvdemux_demux_frame):
|
||||
|
|
|
@ -368,6 +368,8 @@ gst_speexenc_get_query_types (GstPad * pad)
|
|||
{
|
||||
static const GstQueryType gst_speexenc_src_query_types[] = {
|
||||
GST_QUERY_POSITION,
|
||||
GST_QUERY_DURATION,
|
||||
GST_QUERY_CONVERT,
|
||||
0
|
||||
};
|
||||
|
||||
|
@ -379,48 +381,50 @@ gst_speexenc_src_query (GstPad * pad, GstQuery * query)
|
|||
{
|
||||
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;
|
||||
|
||||
peer_formats = gst_pad_get_formats (GST_PAD_PEER (speexenc->sinkpad));
|
||||
|
||||
while (peer_formats && *peer_formats && !res) {
|
||||
|
||||
GstFormat peer_format = *peer_formats;
|
||||
|
||||
/* do the probe */
|
||||
if (gst_pad_query (GST_PAD_PEER (speexenc->sinkpad),
|
||||
GST_QUERY_TOTAL, &peer_format, &peer_value)) {
|
||||
GstFormat conv_format;
|
||||
|
||||
/* 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;
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
fmt = GST_FORMAT_TIME;
|
||||
if (!(res = gst_pad_query_position (peerpad, &fmt, &pos)))
|
||||
break;
|
||||
|
||||
if ((res = gst_pad_query_convert (peerpad, fmt, pos, &req_fmt, &val)))
|
||||
gst_query_set_position (query, req_fmt, val);
|
||||
|
||||
break;
|
||||
}
|
||||
case GST_QUERY_DURATION:
|
||||
{
|
||||
GstFormat fmt, req_fmt;
|
||||
gint64 dur, val;
|
||||
|
||||
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);
|
||||
break;
|
||||
}
|
||||
|
||||
fmt = GST_FORMAT_TIME;
|
||||
if (!(res = gst_pad_query_duration (peerpad, &fmt, &dur)))
|
||||
break;
|
||||
|
||||
if ((res = gst_pad_query_convert (peerpad, fmt, dur, &req_fmt, &val))) {
|
||||
gst_query_set_duration (query, req_fmt, val);
|
||||
}
|
||||
#endif
|
||||
res = FALSE;
|
||||
break;
|
||||
}
|
||||
case GST_QUERY_CONVERT:
|
||||
|
@ -441,6 +445,8 @@ gst_speexenc_src_query (GstPad * pad, GstQuery * query)
|
|||
}
|
||||
|
||||
error:
|
||||
gst_object_unref (peerpad);
|
||||
gst_object_unref (speexenc);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
|
@ -265,28 +265,6 @@ gst_matroska_demux_stream_from_num (GstMatroskaDemux * demux, guint track_num)
|
|||
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 @@ gst_matroska_demux_add_stream (GstMatroskaDemux * demux)
|
|||
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 @@ gst_matroska_demux_video_caps (GstMatroskaTrackVideoContext *
|
|||
*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 @@ gst_matroska_demux_video_caps (GstMatroskaTrackVideoContext *
|
|||
*codec_name = g_strdup ("MPEG-4 advanced profile");
|
||||
}
|
||||
} else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_VIDEO_MSMPEG4V3)) {
|
||||
#if 0
|
||||
caps = gst_caps_new_full (gst_structure_new ("video/x-divx",
|
||||
"divxversion", G_TYPE_INT, 3, NULL),
|
||||
gst_structure_new ("video/x-msmpeg",
|
||||
"msmpegversion", G_TYPE_INT, 43, NULL), NULL);
|
||||
#endif
|
||||
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 @@ gst_matroska_demux_audio_caps (GstMatroskaTrackAudioContext *
|
|||
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 @@ gst_matroska_demux_audio_caps (GstMatroskaTrackAudioContext *
|
|||
caps = gst_caps_new_simple ("audio/x-tta",
|
||||
"width", G_TYPE_INT, audiocontext->bitdepth, NULL);
|
||||
} else {
|
||||
/* 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 @@ gst_matroska_demux_audio_caps (GstMatroskaTrackAudioContext *
|
|||
"width", G_TYPE_INT, audiocontext->bitdepth,
|
||||
"framed", G_TYPE_BOOLEAN, TRUE, NULL);
|
||||
} else {
|
||||
/* FIXME: we can't have non-fixed caps, what to do here? */
|
||||
caps = gst_caps_from_string ("audio/x-wavpack, "
|
||||
"width = (int) { 8, 16, 24 }, " "framed = (boolean) true");
|
||||
}
|
||||
|
@ -3320,6 +3305,7 @@ gst_matroska_demux_audio_caps (GstMatroskaTrackAudioContext *
|
|||
"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);
|
||||
|
|
Loading…
Reference in a new issue