ext/alsa/gstalsasink.c: Chain up to the parent finalize method.
authorJan Schmidt <thaytan@mad.scientist.com>
Wed, 15 Mar 2006 17:59:05 +0000 (17:59 +0000)
committerJan Schmidt <thaytan@mad.scientist.com>
Wed, 15 Mar 2006 17:59:05 +0000 (17:59 +0000)
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.

ChangeLog
ext/alsa/gstalsasink.c
gst-libs/gst/riff/riff-media.c
gst/playback/gststreamselector.c
gst/tcp/gstmultifdsink.c

index b662b01..215d5c3 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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>
 
        Patch by: Tommi Myöhänen  <ext-tommi dot myohanen at nokia dot com>
index 051444b..1113b34 100644 (file)
@@ -115,6 +115,12 @@ static GstStaticPadTemplate alsasink_sink_factory =
     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 " }, "
+        "signed = (boolean) { TRUE, FALSE }, "
         "width = (int) 16, "
         "depth = (int) 16, "
         "rate = (int) [ 1, MAX ], " "channels = (int) [ 1, 8 ]; "
@@ -166,6 +172,8 @@ gst_alsasink_finalise (GObject * object)
 
   g_free (sink->device);
   g_mutex_free (sink->alsa_lock);
+
+  G_OBJECT_CLASS (parent_class)->finalize (object);
 }
 
 static void
index d786d8d..f9bf20c 100644 (file)
@@ -535,6 +535,13 @@ gst_riff_create_video_caps (guint32 codec_fcc,
         *codec_name = g_strdup ("Flash Video 1");
       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:
       GST_WARNING ("Unknown video fourcc %" GST_FOURCC_FORMAT,
           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 ('C', 'Y', 'U', 'V'),
     GST_MAKE_FOURCC ('F', 'L', 'V', '1'),
+    GST_MAKE_FOURCC ('V', 'M', 'n', 'c'),
     /* FILL ME */
     0
   };
index d483713..05a96c2 100644 (file)
@@ -68,6 +68,8 @@ static void gst_stream_selector_set_property (GObject * object, guint prop_id,
     const GValue * value, GParamSpec * pspec);
 static void gst_stream_selector_get_property (GObject * object, guint prop_id,
     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;
 
@@ -284,6 +286,35 @@ gst_stream_selector_getcaps (GstPad * pad)
   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 *
 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_pad_set_internal_link_function (sinkpad,
       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);
 
   return sinkpad;
index 23a2b76..809b9ca 100644 (file)
@@ -1074,10 +1074,14 @@ gst_multi_fd_sink_handle_client_write (GstMultiFdSink * sink,
         GST_WARNING_OBJECT (sink, "pad has no peer");
         return FALSE;
       }
-
-      caps = gst_pad_get_negotiated_caps (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 */
       res = gst_multi_fd_sink_client_queue_caps (sink, client, caps);