ext/alsa/gstalsasink.c: Chain up to the parent finalize method.

Original commit message from CVS:
* ext/alsa/gstalsasink.c: (gst_alsasink_finalise):
Chain up to the parent finalize method.
Add 32-bit sample size to the template caps.

* gst-libs/gst/riff/riff-media.c: (gst_riff_create_video_caps),
(gst_riff_create_video_template_caps):
Add the fourcc that the VMWare codec uses.

* gst/playback/gststreamselector.c:
(gst_stream_selector_set_property),
(gst_stream_selector_bufferalloc),
(gst_stream_selector_request_new_pad):
For the active pad, forward buffer-alloc requests, otherwise
return GST_FLOW_NOT_LINKED. This also prevents xvimagesink
having to memcpy every frame when used by playbin.

* gst/tcp/gstmultifdsink.c:
(gst_multi_fd_sink_handle_client_write):
Get negotiated caps from the sink pad, rather than the sink
pad's peer.
This commit is contained in:
Jan Schmidt 2006-03-15 17:59:05 +00:00
parent eaa55625ad
commit 28bf221806
5 changed files with 79 additions and 2 deletions

View file

@ -1,3 +1,26 @@
2006-03-15 Jan Schmidt <thaytan@mad.scientist.com>
* ext/alsa/gstalsasink.c: (gst_alsasink_finalise):
Chain up to the parent finalize method.
Add 32-bit sample size to the template caps.
* gst-libs/gst/riff/riff-media.c: (gst_riff_create_video_caps),
(gst_riff_create_video_template_caps):
Add the fourcc that the VMWare codec uses.
* gst/playback/gststreamselector.c:
(gst_stream_selector_set_property),
(gst_stream_selector_bufferalloc),
(gst_stream_selector_request_new_pad):
For the active pad, forward buffer-alloc requests, otherwise
return GST_FLOW_NOT_LINKED. This also prevents xvimagesink
having to memcpy every frame when used by playbin.
* gst/tcp/gstmultifdsink.c:
(gst_multi_fd_sink_handle_client_write):
Get negotiated caps from the sink pad, rather than the sink
pad's peer.
2006-03-15 Tim-Philipp Müller <tim at centricular dot net> 2006-03-15 Tim-Philipp Müller <tim at centricular dot net>
Patch by: Tommi Myöhänen <ext-tommi dot myohanen at nokia dot com> Patch by: Tommi Myöhänen <ext-tommi dot myohanen at nokia dot com>

View file

@ -113,6 +113,12 @@ static GstStaticPadTemplate alsasink_sink_factory =
GST_PAD_SINK, GST_PAD_SINK,
GST_PAD_ALWAYS, GST_PAD_ALWAYS,
GST_STATIC_CAPS ("audio/x-raw-int, " GST_STATIC_CAPS ("audio/x-raw-int, "
"endianness = (int) { " ALSA_SINK_FACTORY_ENDIANNESS " }, "
"signed = (boolean) { TRUE, FALSE }, "
"width = (int) 32, "
"depth = (int) 32, "
"rate = (int) [ 1, MAX ], " "channels = (int) [ 1, 8 ]; "
"audio/x-raw-int, "
"endianness = (int) { " ALSA_SINK_FACTORY_ENDIANNESS " }, " "endianness = (int) { " ALSA_SINK_FACTORY_ENDIANNESS " }, "
"signed = (boolean) { TRUE, FALSE }, " "signed = (boolean) { TRUE, FALSE }, "
"width = (int) 16, " "width = (int) 16, "
@ -166,6 +172,8 @@ gst_alsasink_finalise (GObject * object)
g_free (sink->device); g_free (sink->device);
g_mutex_free (sink->alsa_lock); g_mutex_free (sink->alsa_lock);
G_OBJECT_CLASS (parent_class)->finalize (object);
} }
static void static void

View file

@ -535,6 +535,13 @@ gst_riff_create_video_caps (guint32 codec_fcc,
*codec_name = g_strdup ("Flash Video 1"); *codec_name = g_strdup ("Flash Video 1");
break; break;
case GST_MAKE_FOURCC ('V', 'M', 'n', 'c'):
caps = gst_caps_new_simple ("video/x-vmnc",
"version", G_TYPE_INT, 1, NULL);
if (codec_name)
*codec_name = g_strdup ("VMWare NC Video");
break;
default: default:
GST_WARNING ("Unknown video fourcc %" GST_FOURCC_FORMAT, GST_WARNING ("Unknown video fourcc %" GST_FOURCC_FORMAT,
GST_FOURCC_ARGS (codec_fcc)); GST_FOURCC_ARGS (codec_fcc));
@ -1042,6 +1049,7 @@ gst_riff_create_video_template_caps (void)
GST_MAKE_FOURCC ('P', 'N', 'G', ' '), GST_MAKE_FOURCC ('P', 'N', 'G', ' '),
GST_MAKE_FOURCC ('C', 'Y', 'U', 'V'), GST_MAKE_FOURCC ('C', 'Y', 'U', 'V'),
GST_MAKE_FOURCC ('F', 'L', 'V', '1'), GST_MAKE_FOURCC ('F', 'L', 'V', '1'),
GST_MAKE_FOURCC ('V', 'M', 'n', 'c'),
/* FILL ME */ /* FILL ME */
0 0
}; };

View file

@ -68,6 +68,8 @@ static void gst_stream_selector_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec); const GValue * value, GParamSpec * pspec);
static void gst_stream_selector_get_property (GObject * object, guint prop_id, static void gst_stream_selector_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec); GValue * value, GParamSpec * pspec);
static GstFlowReturn gst_stream_selector_bufferalloc (GstPad * pad,
guint64 offset, guint size, GstCaps * caps, GstBuffer ** buf);
static GstElementClass *parent_class = NULL; static GstElementClass *parent_class = NULL;
@ -284,6 +286,35 @@ gst_stream_selector_getcaps (GstPad * pad)
return gst_pad_peer_get_caps (otherpad); return gst_pad_peer_get_caps (otherpad);
} }
static GstFlowReturn
gst_stream_selector_bufferalloc (GstPad * pad, guint64 offset,
guint size, GstCaps * caps, GstBuffer ** buf)
{
GstStreamSelector *sel = GST_STREAM_SELECTOR (gst_pad_get_parent (pad));
GstFlowReturn result;
GstPad *active_sinkpad;
GST_OBJECT_LOCK (sel);
active_sinkpad = sel->active_sinkpad;
GST_OBJECT_UNLOCK (sel);
/* Ignore buffers from pads except the selected one */
if (pad != active_sinkpad) {
GST_DEBUG_OBJECT (sel,
"Returning not-linked for buffer alloc from pad %s:%s",
GST_DEBUG_PAD_NAME (pad));
result = GST_FLOW_NOT_LINKED;
} else {
result = gst_pad_alloc_buffer_and_set_caps (sel->srcpad, offset,
size, caps, buf);
}
gst_object_unref (sel);
return result;
}
static GList * static GList *
gst_stream_selector_get_linked_pads (GstPad * pad) gst_stream_selector_get_linked_pads (GstPad * pad)
{ {
@ -322,6 +353,9 @@ gst_stream_selector_request_new_pad (GstElement * element,
GST_DEBUG_FUNCPTR (gst_stream_selector_chain)); GST_DEBUG_FUNCPTR (gst_stream_selector_chain));
gst_pad_set_internal_link_function (sinkpad, gst_pad_set_internal_link_function (sinkpad,
GST_DEBUG_FUNCPTR (gst_stream_selector_get_linked_pads)); GST_DEBUG_FUNCPTR (gst_stream_selector_get_linked_pads));
gst_pad_set_bufferalloc_function (sinkpad,
GST_DEBUG_FUNCPTR (gst_stream_selector_bufferalloc));
gst_element_add_pad (GST_ELEMENT (sel), sinkpad); gst_element_add_pad (GST_ELEMENT (sel), sinkpad);
return sinkpad; return sinkpad;

View file

@ -1074,10 +1074,14 @@ gst_multi_fd_sink_handle_client_write (GstMultiFdSink * sink,
GST_WARNING_OBJECT (sink, "pad has no peer"); GST_WARNING_OBJECT (sink, "pad has no peer");
return FALSE; return FALSE;
} }
caps = gst_pad_get_negotiated_caps (peer);
gst_object_unref (peer); gst_object_unref (peer);
caps = gst_pad_get_negotiated_caps (GST_BASE_SINK_PAD (sink));
if (!caps) {
GST_WARNING_OBJECT (sink, "pad caps not yet negotiated");
return FALSE;
}
/* queue caps for sending */ /* queue caps for sending */
res = gst_multi_fd_sink_client_queue_caps (sink, client, caps); res = gst_multi_fd_sink_client_queue_caps (sink, client, caps);