Updated to release 13 from tizendev 58/23058/1
authorAndrey Shelest <a.shelest@samsung.com>
Mon, 16 Jun 2014 15:23:47 +0000 (18:23 +0300)
committerAndrey Shelest <a.shelest@samsung.com>
Mon, 16 Jun 2014 15:25:15 +0000 (18:25 +0300)
Change-Id: I99113a08ca7a25168881346a4284ef592c8ba6db

configure.ac
packaging/gst-rtsp-server-wfd.spec
src/Makefile.am
src/include/rtsp-client.h
src/rtsp-client.c
src/rtsp-funnel.c [changed mode: 0755->0644]
src/rtsp-media-factory-uri.c
src/rtsp-media.c
src/rtsp-session-pool.c

index 9062f40..1df13ce 100755 (executable)
@@ -2,12 +2,13 @@
 # Process this file with autoconf to produce a configure script.
 
 AC_PREREQ(2.61)
-AC_INIT([gst-rtsp-server-wfd],[0.0.1])
+AC_INIT([gst-rtsp-server-wfd],[0.2.0])
 AC_CONFIG_SRCDIR([src/rtsp-client.c])
 AC_CONFIG_HEADER([config.h])
-AM_INIT_AUTOMAKE([1.11 -Wall -Wno-extra-portability foreign])
+AM_INIT_AUTOMAKE([-Wall -Werror foreign])
 
 # Checks for programs.
+m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
 AC_PROG_CC
 AC_PROG_LIBTOOL
 
@@ -51,19 +52,15 @@ PKG_CHECK_MODULES(GLIB, glib-2.0)
 AC_SUBST(GLIB_CFLAGS)
 AC_SUBST(GLIB_LIBS)
 
-PKG_CHECK_MODULES(GST, gstreamer-0.10 >= 0.10)
+PKG_CHECK_MODULES(GST, gstreamer-1.0 >= 1.2.0)
 AC_SUBST(GST_CFLAGS)
 AC_SUBST(GST_LIBS)
 
-PKG_CHECK_MODULES(GST_PLUGIN_BASE, gstreamer-plugins-base-0.10 >= 0.10)
+PKG_CHECK_MODULES(GST_PLUGIN_BASE, gstreamer-plugins-base-1.0 >= 1.2.0)
 AC_SUBST(GST_PLUGIN_BASE_CFLAGS)
 AC_SUBST(GST_PLUGIN_BASE_LIBS)
 
-PKG_CHECK_MODULES(GST_INTERFACE, gstreamer-interfaces-0.10 >= 0.10)
-AC_SUBST(GST_INTERFACE_CFLAGS)
-AC_SUBST(GST_LIBS)
-
-PKG_CHECK_MODULES(GST_APP, gstreamer-app-0.10 >= 0.10)
+PKG_CHECK_MODULES(GST_APP, gstreamer-app-1.0 >= 1.2.0)
 AC_SUBST(GST_APP_CFLAGS)
 AC_SUBST(GST_APP_LIBS)
 
index 70da3ee..eb64c8b 100755 (executable)
@@ -2,7 +2,7 @@
 Name:       gst-rtsp-server-wfd
 Summary:    Multimedia Framework Wifi-Display Library
 Version:    0.1.0
-Release:    12
+Release:    13
 Group:      System/Libraries
 License:    LGPLv2+
 Source0:    %{name}-%{version}.tar.gz
@@ -10,9 +10,8 @@ Requires(post):  /sbin/ldconfig
 Requires(postun):  /sbin/ldconfig
 BuildRequires:  pkgconfig(mm-ta)
 BuildRequires:  pkgconfig(mm-common)
-BuildRequires:  pkgconfig(gstreamer-0.10)
-BuildRequires:  pkgconfig(gstreamer-plugins-base-0.10)
-BuildRequires:  pkgconfig(elementary)
+BuildRequires:  pkgconfig(gstreamer-1.0)
+BuildRequires:  pkgconfig(gstreamer-plugins-base-1.0)
 BuildRequires:  pkgconfig(mm-session)
 BuildRequires:  pkgconfig(iniparser)
 BuildRequires: pkgconfig(xau)
@@ -24,6 +23,7 @@ BuildRequires:        pkgconfig(libdrm)
 BuildRequires: pkgconfig(dri2proto)
 BuildRequires: pkgconfig(libdri2)
 BuildRequires: pkgconfig(utilX)
+BuildRequires:  pkgconfig(libdrm_exynos)
 
 BuildRoot:  %{_tmppath}/%{name}-%{version}-build
 
@@ -85,4 +85,5 @@ rm -rf %{buildroot}
 %defattr(-,root,root,-)
 %{_libdir}/*.so
 %{_includedir}/mmf/wfdconfigmessage.h
+%{_includedir}/mmf/rtsp-*.h
 %{_libdir}/pkgconfig/*
index 9f85c3e..34cdc8b 100755 (executable)
@@ -2,7 +2,16 @@ lib_LTLIBRARIES = libmmfwfdconfig.la
 
 includelibmmfwfdconfigdir = $(includedir)/mmf
 
-includelibmmfwfdconfig_HEADERS = include/wfdconfigmessage.h
+includelibmmfwfdconfig_HEADERS = include/wfdconfigmessage.h \
+                                 include/rtsp-auth.h \
+                                 include/rtsp-client.h \
+                                 include/rtsp-media.h \
+                                 include/rtsp-media-factory.h \
+                                 include/rtsp-media-factory-uri.h \
+                                 include/rtsp-media-mapping.h \
+                                 include/rtsp-server.h      \
+                                 include/rtsp-session.h \
+                                 include/rtsp-session-pool.h
 
 libmmfwfdconfig_la_SOURCES = wfdconfigmessage.c
 
@@ -20,7 +29,7 @@ libmmfwfdconfig_la_LIBADD = $(GLIB_LIBS) \
                                $(GST_LIBS) \
                                $(GST_PLUGINS_BASE_LIBS) \
                                $(GST_BASE_LIBS) \
-                               -lgstrtp-0.10 -lgstrtsp-0.10 -lgstsdp-0.10 -lgstapp-0.10 \
+                               -lgstrtp-1.0 -lgstrtsp-1.0 -lgstsdp-1.0 -lgstapp-1.0 \
                                $(GST_INTERFACE_LIBS) \
                                $(GST_APP_LIBS) \
                                $(MMCOMMON_LIBS)
@@ -56,23 +65,15 @@ libmmfwfd_rtsp_server_la_CFLAGS =  -I$(srcdir)/include \
                                $(UTILX_CFLAGS)
 
 noinst_HEADERS = include/rtsp-funnel.h \
-               include/rtsp-auth.h \
-               include/rtsp-params.h \
-               include/rtsp-sdp.h \
-               include/rtsp-media.h \
-               include/rtsp-media-factory.h \
-               include/rtsp-media-factory-uri.h \
-               include/rtsp-media-mapping.h \
-               include/rtsp-session.h \
-               include/rtsp-session-pool.h \
-               include/rtsp-client.h
+                include/rtsp-params.h \
+                include/rtsp-sdp.h
 
 #libmmfwfd_rtsp_server_la_DEPENDENCIES = $(top_builddir)/src/libmmfwfdconfig.la
 
 libmmfwfd_rtsp_server_la_LIBADD = $(GLIB_LIBS) \
                                $(GST_LIBS) \
                                $(GST_PLUGINS_BASE_LIBS) $(GST_BASE_LIBS) \
-                               -lgstrtp-0.10 -lgstrtsp-0.10 -lgstsdp-0.10 -lgstapp-0.10 -lmmfwfdconfig \
+                               -lgstrtp-1.0 -lgstrtsp-1.0 -lgstsdp-1.0 -lgstapp-1.0 -lmmfwfdconfig \
                                $(GST_INTERFACE_LIBS) \
                                $(GST_APP_LIBS) \
                                $(INIPARSER_LIBS)\
index 209637b..1e48e3c 100755 (executable)
@@ -229,7 +229,6 @@ struct _GstRTSPClient {
 #ifdef STANDBY_RESUME_CAPABILITY
   gboolean standby_resume_capability_support;
 #endif
-  guint cseq;
   gboolean keep_alive_flag;
   GMutex *keep_alive_lock;
 
index 65b66d8..f50f186 100755 (executable)
@@ -51,6 +51,7 @@
 #include <X11/Xmd.h>
 #include <dri2.h>
 #include <utilX.h>
+#include <xf86drm.h>
 
 #define DEFAULT_RTSP_TIMEOUT   60
 #define DRM_EXYNOS_VIDI_ON  1
@@ -107,7 +108,7 @@ set_edid_info(gchar *edid_info, gboolean plug);
 static gboolean
 gst_rtsp_client_parse_methods (GstRTSPClient * client, GstRTSPMessage * response);
 gboolean
-keep_alive_condition(gpointer *userdata);
+keep_alive_condition(gpointer userdata);
 gboolean
 gst_rtsp_client_sending_m16_message (GstRTSPClient * client);
 
@@ -190,7 +191,6 @@ gst_rtsp_client_init (GstRTSPClient * client)
   client->state_lock = g_mutex_new ();
   client->keep_alive_lock = g_mutex_new();
   client->keep_alive_flag = TRUE;
-  client->cseq = 0;
   client->state_wait = g_cond_new ();
   client->client_state = CLIENT_STATE_UNKNOWN;
   client->videosrc_type = WFD_INI_VSRC_XVIMAGESRC;
@@ -508,7 +508,7 @@ find_media (GstRTSPClient * client, GstRTSPClientState * state)
   GstRTSPAuth *auth;
 
   GST_INFO_OBJECT (client, "client->uri = %s & state->uri = %s",
-    client->uri, state->uri);
+    client->uri->abspath, state->uri->abspath);
 
   if (!compare_uri (client->uri, state->uri)) {
     /* remove any previously cached values before we try to construct a new
@@ -618,13 +618,15 @@ static gboolean
 do_send_data (GstBuffer * buffer, guint8 channel, GstRTSPClient * client)
 {
   GstRTSPMessage message = { 0 };
+  GstMapInfo mapinfo;
   guint8 *data;
   guint size;
 
   gst_rtsp_message_init_data (&message, channel);
 
-  data = GST_BUFFER_DATA (buffer);
-  size = GST_BUFFER_SIZE (buffer);
+  gst_buffer_map(buffer, &mapinfo, GST_MAP_READ);
+  data = mapinfo.data;
+  size = mapinfo.size;
   gst_rtsp_message_take_body (&message, data, size);
 
   /* FIXME, client->watch could have been finalized here, we need to keep an
@@ -634,6 +636,8 @@ do_send_data (GstBuffer * buffer, guint8 channel, GstRTSPClient * client)
   gst_rtsp_message_steal_body (&message, &data, &size);
   gst_rtsp_message_unset (&message);
 
+  gst_buffer_unmap(buffer, &mapinfo);
+
   return TRUE;
 }
 
@@ -641,18 +645,15 @@ static gboolean
 do_send_data_list (GstBufferList * blist, guint8 channel,
     GstRTSPClient * client)
 {
-  GstBufferListIterator *it;
-
-  it = gst_buffer_list_iterate (blist);
-  while (gst_buffer_list_iterator_next_group (it)) {
-    GstBuffer *group = gst_buffer_list_iterator_merge_group (it);
-
-    if (group == NULL)
-      continue;
-
-    do_send_data (group, channel, client);
-  }
-  gst_buffer_list_iterator_free (it);
+    GstBuffer *buffer;
+    guint length = gst_buffer_list_length(blist);
+    guint i = 0;
+    for(; i < length; ++i)
+    {
+        buffer = gst_buffer_list_get(blist, i);
+        if(buffer)
+            do_send_data (buffer, channel, client);
+    }
 
   return TRUE;
 }
@@ -2002,9 +2003,7 @@ handle_data (GstRTSPClient * client, GstRTSPMessage * message)
   gst_rtsp_message_steal_body (message, &data, &size);
 
   buffer = gst_buffer_new ();
-  GST_BUFFER_DATA (buffer) = data;
-  GST_BUFFER_MALLOCDATA (buffer) = data;
-  GST_BUFFER_SIZE (buffer) = size;
+  gst_buffer_insert_memory(buffer, -1, gst_memory_new_wrapped(0, data, size, 0, size, data, g_free));
 
   handled = FALSE;
   for (walk = client->streams; walk; walk = g_list_next (walk)) {
@@ -2598,17 +2597,20 @@ gst_rtsp_client_accept (GstRTSPClient * client, GIOChannel * channel, GSource *s
   struct sockaddr_storage addr;
   socklen_t addrlen;
   gchar ip[INET6_ADDRSTRLEN];
+  GSocket *socket, *readsocket;
 
   GST_ERROR_OBJECT (client, "Enter accept client...");
 
   /* a new client connected. */
   sock = g_io_channel_unix_get_fd (channel);
+  socket = g_socket_new_from_fd(sock, NULL);
 
   GST_INFO_OBJECT (client, "sock fd  = %d", sock);
 
-  GST_RTSP_CHECK (gst_rtsp_connection_accept (sock, &conn), accept_failed);
-
-  fd = gst_rtsp_connection_get_readfd (conn);
+  GST_RTSP_CHECK (gst_rtsp_connection_accept (socket, &conn, NULL), accept_failed);
+  g_object_unref(socket);
+  readsocket = gst_rtsp_connection_get_read_socket (conn);
+  fd = g_socket_get_fd(readsocket);
   if (fd == -1) {
      res = GST_RTSP_EINVAL;
      goto  accept_failed;
@@ -2713,16 +2715,6 @@ prepare_request (GstRTSPClient *client, GstRTSPMessage *request,
     return res;
   }
 
-  client->cseq++;
-  cseqstr = g_string_new ("");
-  g_string_append_printf (cseqstr,"%d",client->cseq);
-  GST_DEBUG ("CSeq value has been incremented to %d", client->cseq);
-  res = gst_rtsp_message_add_header (request, GST_RTSP_HDR_CSEQ, g_string_free (cseqstr, FALSE));
-  if (res < 0) {
-    GST_ERROR ("Failed to add header");
-    return res;
-  }
-
   switch (method) {
 
     /* Prepare OPTIONS request to send */
@@ -2919,7 +2911,7 @@ prepare_request (GstRTSPClient *client, GstRTSPMessage *request,
           }
       lines = g_string_new ("");
       g_string_append_printf (lines,"rtsp://");
-      g_string_append_printf (lines, client->server_ip);
+      g_string_append_printf (lines, "%s", client->server_ip);
       g_string_append_printf (lines,"/wfd1.0/streamid=0");
       wfd_res = wfdconfig_set_presentation_url(msg4, g_string_free (lines, FALSE), NULL);
       if (wfd_res != WFD_OK) {
@@ -4150,7 +4142,7 @@ pad_added (GstElement* ele, GstPad* pad, gpointer data)
 
     g_print (" =========== >>>>>>>>>> Received VIDEO pad...\n");
 
-    spad = gst_element_get_pad(GST_ELEMENT(client->srcbin->vparse), "sink");
+    spad = gst_element_get_request_pad(GST_ELEMENT(client->srcbin->vparse), "sink");
     if (gst_pad_link(pad, spad)  != GST_PAD_LINK_OK) {
       GST_ERROR ("Failed to link video demuxer pad & video parser sink pad...\n");
       return;
@@ -4176,7 +4168,7 @@ pad_added (GstElement* ele, GstPad* pad, gpointer data)
 #endif
 
     g_print (" =========== >>>>>>>>>> Received AUDIO pad...\n");
-    spad = gst_element_get_pad(GST_ELEMENT(client->srcbin->aqueue), "sink");
+    spad = gst_element_get_request_pad(GST_ELEMENT(client->srcbin->aqueue), "sink");
     if (gst_pad_link(pad, spad)  != GST_PAD_LINK_OK) {
       GST_ERROR ("Failed to link audio demuxer pad & audio parse pad...\n");
       return;
@@ -4319,10 +4311,10 @@ gst_rtsp_client_create_xvcapture_bin (GstRTSPClient * client, GstRTSPClientSrcBi
 
   GST_INFO_OBJECT (client, "picked xvimagesrc as video source");
   g_object_set (G_OBJECT (vcaps), "caps",
-      gst_caps_new_simple ("video/x-raw-yuv",
+      gst_caps_new_simple ("video/x-raw",
           "width", G_TYPE_INT, client->cMaxWidth,
           "height", G_TYPE_INT, client->cMaxHeight,
-          "format", GST_TYPE_FOURCC, GST_MAKE_FOURCC('S','N','1','2'),
+          "format", G_TYPE_STRING, "SN12",
           "framerate", GST_TYPE_FRACTION, 30, 1, NULL), NULL);
 
   if(client->cvCodec == WFD_VIDEO_H264)
@@ -4456,7 +4448,7 @@ gst_rtsp_client_create_srcbin (GstRTSPClient * client)
   srcbin = g_slice_new0 (GstRTSPClientSrcBin);
 
   /* create source bin */
-  srcbin->srcbin = gst_bin_new ("srcbin");
+  srcbin->srcbin = GST_BIN_CAST(gst_bin_new ("srcbin"));
   if (!srcbin->srcbin) {
     GST_ERROR_OBJECT (client, "failed to create source bin...");
     goto create_error;
@@ -4610,27 +4602,28 @@ static gboolean gst_dump_data (GstPad * pad, GstMiniObject * obj, gpointer u_dat
 }
 #endif
 
-static void
-keep_alive_response_check (gpointer *userdata)
+static gboolean
+keep_alive_response_check (gpointer userdata)
 {
   GstRTSPClient *client = (GstRTSPClient *)userdata;
   if (!client) {
-    return;
+    return TRUE;
   }
   if (client->keep_alive_flag) {
-    return;
+    return FALSE;
   }
   else {
     GST_INFO ("%p: source error notification", client);
     g_signal_emit (client, gst_rtsp_client_signals[SIGNAL_ERROR], 0, NULL);
   }
+  return TRUE;
 }
 
 /*CHecking whether source has got response of any request.
  * If yes, keep alive message is sent otherwise error message
  * will be displayed.*/
 gboolean
-keep_alive_condition(gpointer *userdata)
+keep_alive_condition(gpointer userdata)
 {
   GstRTSPClient *client;
   gboolean res;
old mode 100755 (executable)
new mode 100644 (file)
index afe01b3..35b869f
 GST_DEBUG_CATEGORY_STATIC (rtsp_funnel_debug);
 #define GST_CAT_DEFAULT rtsp_funnel_debug
 
-static const GstElementDetails rtsp_funnel_details =
-GST_ELEMENT_DETAILS ("Farsight Funnel pipe fitting",
-    "Generic",
-    "N-to-1 pipe fitting",
-    "Olivier Crete <olivier.crete@collabora.co.uk>");
-
 static GstStaticPadTemplate funnel_sink_template =
 GST_STATIC_PAD_TEMPLATE ("sink%d",
     GST_PAD_SINK,
@@ -60,28 +54,25 @@ GST_STATIC_PAD_TEMPLATE ("src",
 
 
 static void
-_do_init (GType type)
+_do_init (void)
 {
-  GST_DEBUG_CATEGORY_INIT (rtsp_funnel_debug, "rtspfunnel", 0,
-      "rtsp funnel element");
+  GST_DEBUG_CATEGORY_INIT (rtsp_funnel_debug, "rtspfunnel", 0, "rtsp funnel element");
 }
 
-GST_BOILERPLATE_FULL (RTSPFunnel, rtsp_funnel, GstElement, GST_TYPE_ELEMENT,
-    _do_init);
-
+G_DEFINE_TYPE_EXTENDED(RTSPFunnel, rtsp_funnel, GST_TYPE_ELEMENT, 0, _do_init());
 
 
 static GstStateChangeReturn rtsp_funnel_change_state (GstElement * element,
     GstStateChange transition);
 
 static GstPad *rtsp_funnel_request_new_pad (GstElement * element,
-    GstPadTemplate * templ, const gchar * name);
+    GstPadTemplate * templ, const gchar * name, const GstCaps *caps);
 static void rtsp_funnel_release_pad (GstElement * element, GstPad * pad);
 
-static GstFlowReturn rtsp_funnel_chain (GstPad * pad, GstBuffer * buffer);
-static gboolean rtsp_funnel_event (GstPad * pad, GstEvent * event);
-static gboolean rtsp_funnel_src_event (GstPad * pad, GstEvent * event);
-static GstCaps *rtsp_funnel_getcaps (GstPad * pad);
+static GstFlowReturn rtsp_funnel_chain (GstPad * pad, GstObject *parent, GstBuffer * buffer);
+static gboolean rtsp_funnel_event (GstPad * pad, GstObject *parent, GstEvent * event);
+static gboolean rtsp_funnel_src_event (GstPad * pad, GstObject *parent, GstEvent * event);
+static gboolean rtsp_funnel_query_caps (GstPad * pad, GstObject *parent, GstQuery *query);
 
 
 typedef struct
@@ -92,14 +83,6 @@ typedef struct
 static void
 rtsp_funnel_base_init (gpointer g_class)
 {
-  GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
-
-  gst_element_class_set_details (gstelement_class, &rtsp_funnel_details);
-
-  gst_element_class_add_pad_template (gstelement_class,
-      gst_static_pad_template_get (&funnel_sink_template));
-  gst_element_class_add_pad_template (gstelement_class,
-      gst_static_pad_template_get (&funnel_src_template));
 }
 
 
@@ -118,7 +101,7 @@ restart:
     }
   }
 
-  G_OBJECT_CLASS (parent_class)->dispose (object);
+  G_OBJECT_CLASS (rtsp_funnel_parent_class)->dispose (object);
 }
 
 static void
@@ -127,6 +110,13 @@ rtsp_funnel_class_init (RTSPFunnelClass * klass)
   GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
   GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass);
 
+  gst_element_class_set_static_metadata(gstelement_class, "Farsight Funnel pipe fitting", "Generic", "N-to-1 pipe fitting", "Olivier Crete <olivier.crete@collabora.co.uk>");
+
+  gst_element_class_add_pad_template (gstelement_class,
+      gst_static_pad_template_get (&funnel_sink_template));
+  gst_element_class_add_pad_template (gstelement_class,
+      gst_static_pad_template_get (&funnel_src_template));
+
   gobject_class->dispose = GST_DEBUG_FUNCPTR (rtsp_funnel_dispose);
 
   gstelement_class->request_new_pad =
@@ -136,7 +126,7 @@ rtsp_funnel_class_init (RTSPFunnelClass * klass)
 }
 
 static void
-rtsp_funnel_init (RTSPFunnel * funnel, RTSPFunnelClass * g_class)
+rtsp_funnel_init (RTSPFunnel * funnel)
 {
   funnel->srcpad = gst_pad_new_from_static_template (&funnel_src_template,
       "src");
@@ -145,10 +135,9 @@ rtsp_funnel_init (RTSPFunnel * funnel, RTSPFunnelClass * g_class)
   gst_element_add_pad (GST_ELEMENT (funnel), funnel->srcpad);
 }
 
-
 static GstPad *
 rtsp_funnel_request_new_pad (GstElement * element, GstPadTemplate * templ,
-    const gchar * name)
+    const gchar * name, const GstCaps *caps)
 {
   GstPad *sinkpad;
   RTSPFunnelPadPrivate *priv = g_slice_alloc0 (sizeof (RTSPFunnelPadPrivate));
@@ -159,8 +148,6 @@ rtsp_funnel_request_new_pad (GstElement * element, GstPadTemplate * templ,
 
   gst_pad_set_chain_function (sinkpad, GST_DEBUG_FUNCPTR (rtsp_funnel_chain));
   gst_pad_set_event_function (sinkpad, GST_DEBUG_FUNCPTR (rtsp_funnel_event));
-  gst_pad_set_getcaps_function (sinkpad,
-      GST_DEBUG_FUNCPTR (rtsp_funnel_getcaps));
 
   gst_segment_init (&priv->segment, GST_FORMAT_UNDEFINED);
   gst_pad_set_element_private (sinkpad, priv);
@@ -188,23 +175,8 @@ rtsp_funnel_release_pad (GstElement * element, GstPad * pad)
   gst_element_remove_pad (GST_ELEMENT_CAST (funnel), pad);
 }
 
-static GstCaps *
-rtsp_funnel_getcaps (GstPad * pad)
-{
-  RTSPFunnel *funnel = RTSP_FUNNEL (gst_pad_get_parent (pad));
-  GstCaps *caps;
-
-  caps = gst_pad_peer_get_caps (funnel->srcpad);
-  if (caps == NULL)
-    caps = gst_caps_copy (gst_pad_get_pad_template_caps (pad));
-
-  gst_object_unref (funnel);
-
-  return caps;
-}
-
 static GstFlowReturn
-rtsp_funnel_chain (GstPad * pad, GstBuffer * buffer)
+rtsp_funnel_chain (GstPad * pad, GstObject *parent, GstBuffer * buffer)
 {
   GstFlowReturn res;
   RTSPFunnel *funnel = RTSP_FUNNEL (gst_pad_get_parent (pad));
@@ -219,24 +191,33 @@ rtsp_funnel_chain (GstPad * pad, GstBuffer * buffer)
   if (priv->segment.format == GST_FORMAT_UNDEFINED) {
     GST_WARNING_OBJECT (funnel, "Got buffer without segment,"
         " setting segment [0,inf[");
-    gst_segment_set_newsegment_full (&priv->segment, FALSE, 1.0, 1.0,
-        GST_FORMAT_TIME, 0, -1, 0);
+    priv->segment.rate = 1.0;
+    priv->segment.applied_rate = 1.0;
+    priv->segment.format = GST_FORMAT_TIME;
+    priv->segment.start = 0;
+    priv->segment.stop = -1;
+    priv->segment.time = 0;
   }
 
   if (GST_CLOCK_TIME_IS_VALID (GST_BUFFER_TIMESTAMP (buffer)))
-    gst_segment_set_last_stop (&priv->segment, priv->segment.format,
-        GST_BUFFER_TIMESTAMP (buffer));
+      priv->segment.position = GST_BUFFER_TIMESTAMP (buffer);
 
   newts = gst_segment_to_running_time (&priv->segment,
       priv->segment.format, GST_BUFFER_TIMESTAMP (buffer));
   if (newts != GST_BUFFER_TIMESTAMP (buffer)) {
-    buffer = gst_buffer_make_metadata_writable (buffer);
+    buffer = gst_buffer_make_writable (buffer);
     GST_BUFFER_TIMESTAMP (buffer) = newts;
   }
 
   if (!funnel->has_segment) {
-    event = gst_event_new_new_segment_full (FALSE, 1.0, 1.0, GST_FORMAT_TIME,
-        0, -1, 0);
+      GstSegment *segment = gst_segment_new();
+      gst_segment_init(segment, GST_FORMAT_TIME);
+      segment->rate = 1.0;
+      segment->applied_rate = 1.0;
+      segment->start = 0;
+      segment->stop = -1;
+      segment->time = 0;
+      gst_event_new_segment(segment);
     funnel->has_segment = TRUE;
   }
   GST_OBJECT_UNLOCK (funnel);
@@ -251,16 +232,9 @@ rtsp_funnel_chain (GstPad * pad, GstBuffer * buffer)
 
 
   GST_OBJECT_LOCK (pad);
-  padcaps = GST_PAD_CAPS (funnel->srcpad);
+  padcaps = gst_pad_get_current_caps(funnel->srcpad);
   GST_OBJECT_UNLOCK (pad);
 
-  if (GST_BUFFER_CAPS (buffer) && GST_BUFFER_CAPS (buffer) != padcaps) {
-    if (!gst_pad_set_caps (funnel->srcpad, GST_BUFFER_CAPS (buffer))) {
-      res = GST_FLOW_NOT_NEGOTIATED;
-      goto out;
-    }
-  }
-
   res = gst_pad_push (funnel->srcpad, buffer);
 
   GST_LOG_OBJECT (funnel, "handled buffer %s", gst_flow_get_name (res));
@@ -272,7 +246,7 @@ out:
 }
 
 static gboolean
-rtsp_funnel_event (GstPad * pad, GstEvent * event)
+rtsp_funnel_event (GstPad * pad, GstObject *parent, GstEvent * event)
 {
   RTSPFunnel *funnel = RTSP_FUNNEL (gst_pad_get_parent (pad));
   RTSPFunnelPadPrivate *priv = gst_pad_get_element_private (pad);
@@ -280,23 +254,15 @@ rtsp_funnel_event (GstPad * pad, GstEvent * event)
   gboolean res = TRUE;
 
   switch (GST_EVENT_TYPE (event)) {
-    case GST_EVENT_NEWSEGMENT:
+    case GST_EVENT_SEGMENT:
     {
-      gboolean update;
-      gdouble rate, arate;
-      GstFormat format;
-      gint64 start;
-      gint64 stop;
-      gint64 time;
-
-      gst_event_parse_new_segment_full (event, &update, &rate, &arate,
-          &format, &start, &stop, &time);
-
-
+      GstSegment *segment = gst_segment_new();
+      gst_segment_init(segment, GST_FORMAT_UNDEFINED);
+      gst_event_parse_segment(event, &segment);
       GST_OBJECT_LOCK (funnel);
-      gst_segment_set_newsegment_full (&priv->segment, update, rate, arate,
-          format, start, stop, time);
+      gst_segment_copy_into(segment, &priv->segment);
       GST_OBJECT_UNLOCK (funnel);
+      gst_segment_free(segment);
 
       forward = FALSE;
       gst_event_unref (event);
@@ -323,7 +289,7 @@ rtsp_funnel_event (GstPad * pad, GstEvent * event)
 }
 
 static gboolean
-rtsp_funnel_src_event (GstPad * pad, GstEvent * event)
+rtsp_funnel_src_event (GstPad * pad, GstObject *parent, GstEvent * event)
 {
   GstElement *funnel;
   GstIterator *iter;
@@ -362,9 +328,9 @@ rtsp_funnel_src_event (GstPad * pad, GstEvent * event)
 }
 
 static void
-reset_pad (gpointer data, gpointer user_data)
+reset_pad (const GValue * item, gpointer user_data)
 {
-  GstPad *pad = data;
+  GstPad *pad = GST_PAD(item);
   RTSPFunnelPadPrivate *priv = gst_pad_get_element_private (pad);
 
   GST_OBJECT_LOCK (pad);
@@ -403,7 +369,7 @@ rtsp_funnel_change_state (GstElement * element, GstStateChange transition)
       break;
   }
 
-  ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
+  ret = GST_ELEMENT_CLASS (rtsp_funnel_parent_class)->change_state (element, transition);
 
   return ret;
 }
index f44e07a..2f3da91 100755 (executable)
@@ -39,14 +39,9 @@ enum
 };
 
 
-#define RAW_VIDEO_CAPS \
-    "video/x-raw-yuv; " \
-    "video/x-raw-rgb; " \
-    "video/x-raw-gray"
+#define RAW_VIDEO_CAPS "video/x-raw"
 
-#define RAW_AUDIO_CAPS \
-    "audio/x-raw-int; " \
-    "audio/x-raw-float"
+#define RAW_AUDIO_CAPS "audio/x-raw"
 
 static GstStaticCaps raw_video_caps = GST_STATIC_CAPS (RAW_VIDEO_CAPS);
 static GstStaticCaps raw_audio_caps = GST_STATIC_CAPS (RAW_AUDIO_CAPS);
@@ -130,7 +125,6 @@ typedef struct
 static gboolean
 payloader_filter (GstPluginFeature * feature, FilterData * data)
 {
-  gboolean res;
   const gchar *klass;
   GstElementFactory *fact;
   GList **list = NULL;
@@ -156,7 +150,7 @@ payloader_filter (GstPluginFeature * feature, FilterData * data)
     list = &data->payload;
 
   if (list) {
-    GST_DEBUG ("adding %s", GST_PLUGIN_FEATURE_NAME (fact));
+    GST_DEBUG ("adding %s", GST_OBJECT_NAME (fact));
     *list = g_list_prepend (*list, fact);
   }
 
@@ -172,7 +166,7 @@ gst_rtsp_media_factory_uri_init (GstRTSPMediaFactoryURI * factory)
   factory->use_gstpay = DEFAULT_USE_GSTPAY;
 
   /* get the feature list using the filter */
-  gst_default_registry_feature_filter ((GstPluginFeatureFilter)
+  gst_registry_feature_filter (gst_registry_get(), (GstPluginFeatureFilter)
       payloader_filter, FALSE, &data);
   /* sort */
   factory->demuxers =
@@ -399,15 +393,15 @@ pad_added_cb (GstElement * uribin, GstPad * pad, GstElement * element)
   padname = gst_pad_get_name (pad);
 
   /* get pad caps first, then call get_caps, then fail */
-  if ((caps = GST_PAD_CAPS (pad)))
+  if ((caps = gst_pad_get_current_caps(pad)))
     gst_caps_ref (caps);
-  else if ((caps = gst_pad_get_caps (pad)) == NULL)
+  else if ((caps = gst_pad_query_caps (pad, NULL)) == NULL)
     goto no_caps;
 
   /* check for raw caps */
   if (gst_caps_can_intersect (caps, urifact->raw_vcaps)) {
     /* we have raw video caps, insert converter */
-    convert = gst_element_factory_make ("ffmpegcolorspace", NULL);
+    convert = gst_element_factory_make ("videoconvert", NULL);
   } else if (gst_caps_can_intersect (caps, urifact->raw_acaps)) {
     /* we have raw audio caps, insert converter */
     convert = gst_element_factory_make ("audioconvert", NULL);
@@ -428,9 +422,9 @@ pad_added_cb (GstElement * uribin, GstPad * pad, GstElement * element)
 
     /* continue with new pad and caps */
     pad = gst_element_get_static_pad (convert, "src");
-    if ((caps = GST_PAD_CAPS (pad)))
+    if ((caps = gst_pad_get_current_caps(pad)))
       gst_caps_ref (caps);
-    else if ((caps = gst_pad_get_caps (pad)) == NULL)
+    else if ((caps = gst_pad_query_caps (pad, NULL)) == NULL)
       goto no_caps;
   }
 
index cb60359..cb72175 100755 (executable)
@@ -355,14 +355,14 @@ collect_media_stats (GstRTSPMedia * media)
   } else {
     /* get the position */
     format = GST_FORMAT_TIME;
-    if (!gst_element_query_position (media->pipeline, &format, &position)) {
+    if (!gst_element_query_position (media->pipeline, format, &position)) {
       GST_INFO ("position query failed");
       position = 0;
     }
 
     /* get the duration */
     format = GST_FORMAT_TIME;
-    if (!gst_element_query_duration (media->pipeline, &format, &duration)) {
+    if (!gst_element_query_duration (media->pipeline, format, &duration)) {
       GST_INFO ("duration query failed");
       duration = -1;
     }
@@ -827,7 +827,7 @@ alloc_udp_ports (GstRTSPMedia * media, GstRTSPMediaStream * stream)
   /* try to allocate 2 UDP ports, the RTP port should be an even
    * number and the RTCP port should be the next (uneven) port */
 again:
-  udpsrc0 = gst_element_make_from_uri (GST_URI_SRC, host, NULL);
+  udpsrc0 = gst_element_make_from_uri (GST_URI_SRC, host, NULL, NULL);
   if (udpsrc0 == NULL)
     goto no_udp_protocol;
   g_object_set (G_OBJECT (udpsrc0), "port", tmp_rtp, NULL);
@@ -863,7 +863,7 @@ again:
   }
 #endif
   /* allocate port+1 for RTCP now */
-  udpsrc1 = gst_element_make_from_uri (GST_URI_SRC, host, NULL);
+  udpsrc1 = gst_element_make_from_uri (GST_URI_SRC, host, NULL, NULL);
   if (udpsrc1 == NULL)
     goto no_udp_rtcp_protocol;
 
@@ -1001,7 +1001,7 @@ caps_notify (GstPad * pad, GParamSpec * unused, GstRTSPMediaStream * stream)
   gchar *capsstr;
   GstCaps *newcaps, *oldcaps;
 
-  if ((newcaps = GST_PAD_CAPS (pad)))
+  if ((newcaps = gst_pad_get_current_caps (pad)))
     gst_caps_ref (newcaps);
 
   oldcaps = stream->caps;
@@ -1163,16 +1163,24 @@ on_timeout (GObject * session, GObject * source, GstRTSPMediaStream * stream)
 }
 
 static GstFlowReturn
-handle_new_buffer (GstAppSink * sink, gpointer user_data)
+handle_new_sample (GstAppSink * sink, gpointer user_data)
 {
   GList *walk;
+  GstSample *sample;
   GstBuffer *buffer;
   GstRTSPMediaStream *stream;
 
-  buffer = gst_app_sink_pull_buffer (sink);
-  if (!buffer)
+  sample = gst_app_sink_pull_sample(sink);
+  if (!sample)
     return GST_FLOW_OK;
 
+  buffer = gst_sample_get_buffer(sample);
+  if(!buffer)
+  {
+      gst_sample_unref(sample);
+      return GST_FLOW_OK;
+  }
+
   stream = (GstRTSPMediaStream *) user_data;
 
   for (walk = stream->transports; walk; walk = g_list_next (walk)) {
@@ -1188,37 +1196,7 @@ handle_new_buffer (GstAppSink * sink, gpointer user_data)
     }
   }
   gst_buffer_unref (buffer);
-
-  return GST_FLOW_OK;
-}
-
-static GstFlowReturn
-handle_new_buffer_list (GstAppSink * sink, gpointer user_data)
-{
-  GList *walk;
-  GstBufferList *blist;
-  GstRTSPMediaStream *stream;
-
-  blist = gst_app_sink_pull_buffer_list (sink);
-  if (!blist)
-    return GST_FLOW_OK;
-
-  stream = (GstRTSPMediaStream *) user_data;
-
-  for (walk = stream->transports; walk; walk = g_list_next (walk)) {
-    GstRTSPMediaTrans *tr = (GstRTSPMediaTrans *) walk->data;
-
-    if (GST_ELEMENT_CAST (sink) == stream->appsink[0]) {
-      if (tr->send_rtp_list)
-        tr->send_rtp_list (blist, tr->transport->port.min,
-            tr->user_data);
-    } else {
-      if (tr->send_rtcp_list)
-        tr->send_rtcp_list (blist, tr->transport->port.max,
-            tr->user_data);
-    }
-  }
-  gst_buffer_list_unref (blist);
+  gst_sample_unref (sample);
 
   return GST_FLOW_OK;
 }
@@ -1226,8 +1204,7 @@ handle_new_buffer_list (GstAppSink * sink, gpointer user_data)
 static GstAppSinkCallbacks sink_cb = {
   NULL,                         /* not interested in EOS */
   NULL,                         /* not interested in preroll buffers */
-  handle_new_buffer,
-  handle_new_buffer_list
+  handle_new_sample,
 };
 
 /* prepare the pipeline objects to handle @stream in @media */
@@ -1257,7 +1234,6 @@ setup_stream (GstRTSPMediaStream * stream, guint idx, GstRTSPMedia * media)
     stream->appsink[i] = gst_element_factory_make ("appsink", NULL);
     g_object_set (stream->appsink[i], "async", FALSE, "sync", FALSE, NULL);
     g_object_set (stream->appsink[i], "emit-signals", FALSE, NULL);
-    g_object_set (stream->appsink[i], "preroll-queue-len", 1, NULL);
     gst_bin_add (GST_BIN_CAST (media->pipeline), stream->appsink[i]);
     gst_bin_add (GST_BIN_CAST (media->pipeline), stream->appsrc[i]);
     gst_app_sink_set_callbacks (GST_APP_SINK_CAST (stream->appsink[i]),
@@ -1519,7 +1495,7 @@ default_handle_message (GstRTSPMedia * media, GstMessage * message)
 
       //g_print ("\n\n\n\n\n++++++++++++++++Generating dot file ++++++++++++++\n\n\n\n");
 
-      GST_DEBUG_BIN_TO_DOT_FILE(media->pipeline, GST_DEBUG_GRAPH_SHOW_ALL, "wfd-error");
+      GST_DEBUG_BIN_TO_DOT_FILE(GST_BIN_CAST(media->pipeline), GST_DEBUG_GRAPH_SHOW_ALL, "wfd-error");
 
       gst_message_parse_error (message, &gerror, &debug);
 
index 362571c..4644c6d 100755 (executable)
@@ -492,7 +492,8 @@ collect_timeout (gchar * sessionid, GstRTSPSession * sess, GstPoolSource * psrc)
   gint timeout;
   GTimeVal now;
 
-  g_source_get_current_time ((GSource *) psrc, &now);
+  gint64 time = g_source_get_time((GSource *) psrc);
+  GST_TIME_TO_TIMEVAL(time, now);
 
   timeout = gst_rtsp_session_next_timeout (sess, &now);
   GST_INFO ("%p: next timeout: %d", sess, timeout);