try porting to gst 1.0 API devel/gst
authorYan Yin <yan.yin@intel.com>
Fri, 11 Oct 2013 07:30:05 +0000 (15:30 +0800)
committerYan Yin <yan.yin@intel.com>
Fri, 11 Oct 2013 09:00:27 +0000 (17:00 +0800)
Change-Id: Ib6400f53352901cfd842c0bff271bde705b9c134

configure.ac
packaging/libmm-player.spec
src/include/mm_player_utils.h
src/mm_player_attrs.c
src/mm_player_capture.c
src/mm_player_pd.c
src/mm_player_priv.c

index 75c0956c2512e8379de57309c10237ff03a082e1..2bec7fde820bc6ebb51e23e2d5fcea9741ad6346 100755 (executable)
@@ -57,19 +57,19 @@ 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)
 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)
 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_VIDEO, gstreamer-video-1.0 )
+AC_SUBST(GST_VIDEO_CFLAGS)
+AC_SUBST(GST_VIDEO_LIBS)
 
-PKG_CHECK_MODULES(GST_APP, gstreamer-app-0.10 >= 0.10)
+PKG_CHECK_MODULES(GST_APP, gstreamer-app-1.0)
 AC_SUBST(GST_APP_CFLAGS)
 AC_SUBST(GST_APP_LIBS)
 
index 66147fd965e16ca756087460d641b4289046022c..395fa52e39922a12ba8bb7466848d31bb34e9fb3 100644 (file)
@@ -9,10 +9,10 @@ Source0:    %{name}-%{version}.tar.gz
 BuildRequires:  pkgconfig(mm-ta)
 BuildRequires:  pkgconfig(mm-common)
 BuildRequires:  pkgconfig(mm-sound)
-BuildRequires:  pkgconfig(gstreamer-0.10)
-BuildRequires:  pkgconfig(gstreamer-plugins-base-0.10)
-BuildRequires:  pkgconfig(gstreamer-interfaces-0.10)
-BuildRequires:  pkgconfig(gstreamer-app-0.10)
+BuildRequires:  pkgconfig(gstreamer-1.0)
+BuildRequires:  pkgconfig(gstreamer-plugins-base-1.0)
+BuildRequires:  pkgconfig(gstreamer-app-1.0)
+BuildRequires:  pkgconfig(gstreamer-video-1.0)
 BuildRequires:  pkgconfig(mm-session)
 BuildRequires:  pkgconfig(mmutil-imgp)
 BuildRequires:  pkgconfig(audio-session-mgr)
@@ -39,7 +39,7 @@ Multimedia Framework Player Library (DEV).
 ./autogen.sh
 
 CFLAGS+=" -DEXPORT_API=\"__attribute__((visibility(\\\"default\\\")))\" "; export CFLAGS
-LDFLAGS+="-Wl,--rpath=%{_libdir} -Wl,--hash-style=both -Wl,--as-needed"; export LDFLAGS
+LDFLAGS+="-Wl,--rpath=%{_libdir} -lgstvideo-1.0 -Wl,--hash-style=both -Wl,--as-needed"; export LDFLAGS
 
 %configure --disable-static
 
index 480e1b8eecd765cd6e8ec01f4efc91082cccb043..53e5c9c48f3300e93d9dfd41fa03031d02429c46 100644 (file)
@@ -24,6 +24,8 @@
 
 #include <glib.h>
 #include <gst/gst.h>
+#include <stdint.h>
+#include <inttypes.h>
 #include <mm_player_ini.h>
 #include <mm_types.h>
 #include <mm_error.h>
@@ -182,9 +184,9 @@ gboolean __util_gst_pad_probe(GstPad *pad, GstBuffer *buffer, gpointer u_data);
  */
 #define MMPLAYER_ADD_PROBE(x_pad, x_flag) \
 debug_warning("adding pad probe\n"); \
-if ( ! gst_pad_add_buffer_probe(x_pad, \
+if ( ! gst_pad_add_probe(x_pad, \
        G_CALLBACK(__util_gst_pad_probe), \
-       (gpointer)x_flag) ) \
+       (gpointer)x_flag, NULL) ) \
 { \
        debug_error("failed to add pad probe\n"); \
 }
index 4bf031939f35dcc528d7218405b95360ee50b001..9115db61671707adf0cfc51a25d3153cabef4eea 100644 (file)
@@ -27,7 +27,7 @@
 #include <vconf.h>
 #include <mm_attrs_private.h>
 #include <mm_attrs.h>
-#include <gst/interfaces/xoverlay.h>
+#include <gst/video/videooverlay.h>
 
 #include "mm_player_priv.h"
 #include "mm_player_attrs.h"
index 8c333dce968755a58347cf5633f6797c3e6b523c..dbcf3f6e6b86d9fdf212003fd562644bc3d2c5d9 100644 (file)
@@ -170,8 +170,8 @@ _mmplayer_do_video_capture(MMHandleType hplayer)
        pad = gst_element_get_static_pad(player->pipeline->videobin[MMPLAYER_V_SINK].gst, "sink" );
 
        /* register probe */
-       player->video_capture_cb_probe_id = gst_pad_add_buffer_probe (pad,
-               G_CALLBACK (__mmplayer_video_capture_probe), player);
+       player->video_capture_cb_probe_id = gst_pad_add_probe (pad, GST_PAD_PROBE_TYPE_BUFFER,
+               G_CALLBACK (__mmplayer_video_capture_probe), player, NULL);
 
        gst_object_unref(GST_OBJECT(pad));
        pad = NULL;
index a80644eb04f51cf7a7c0069281dae560f0e0d173..1c369e21b7a3206d7b806eb086171a448f8136e1 100644 (file)
@@ -158,7 +158,7 @@ __pd_downloader_callback(GstBus *bus, GstMessage *msg, gpointer data)
                        gint64 size = 0LL;
 
                        /* get total size  of download file, (bytes) */
-                       if ( ! gst_element_query_duration( pd->downloader_pipeline, &fmt, &size ) )
+                       if ( ! gst_element_query_duration( pd->downloader_pipeline, fmt, &size ) )
                        {
                                GError *err = NULL;
                                GstMessage *new_msg = NULL;
index c1dce91eef811932b9f8741daed04fa0d1080537..d23f042a09cef47ff08b4779082d8eda64e6caed 100755 (executable)
 #include <glib.h>
 #include <gst/gst.h>
 #include <gst/app/gstappsrc.h>
-#include <gst/interfaces/xoverlay.h>
+#include <gst/video/videooverlay.h>
 #include <unistd.h>
 #include <string.h>
 #include <sys/time.h>
+#include <sys/stat.h>
 #include <stdlib.h>
 
 #include <mm_error.h>
@@ -629,7 +630,7 @@ _mmplayer_update_content_attrs(mm_player_t* player, enum content_attr_flag flag)
                debug_log("try to update duration");
                has_duration = FALSE;
 
-               if (gst_element_query_duration(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, &fmt, &dur_nsec ))
+               if (gst_element_query_duration(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, fmt, &dur_nsec ))
                {
                        player->duration = dur_nsec;
                        debug_log("duration : %lld msec", GST_TIME_AS_MSECONDS(dur_nsec));
@@ -1399,6 +1400,9 @@ __mmplayer_gst_callback(GstBus *bus, GstMessage *msg, gpointer data) // @
        return_val_if_fail ( player, FALSE );
        return_val_if_fail ( msg && GST_IS_MESSAGE(msg), FALSE );
 
+    const GstStructure *structure;
+    structure = gst_message_get_structure (msg);
+
        switch ( GST_MESSAGE_TYPE( msg ) )
        {
                case GST_MESSAGE_UNKNOWN:
@@ -1530,7 +1534,7 @@ __mmplayer_gst_callback(GstBus *bus, GstMessage *msg, gpointer data) // @
                        gst_message_parse_error( msg, &error, &debug );
 
                        msg_src_element = GST_ELEMENT_NAME( GST_ELEMENT_CAST( msg->src ) );
-                       if ( gst_structure_has_name ( msg->structure, "streaming_error" ) )
+                       if ( gst_structure_has_name ( structure, "streaming_error" ) )
                        {
                                /* Note : the streaming error from the streaming source is handled
                                 *   using __mmplayer_handle_streaming_error.
@@ -1631,9 +1635,9 @@ __mmplayer_gst_callback(GstBus *bus, GstMessage *msg, gpointer data) // @
                                break;
 
                        /* get state info from msg */
-                       voldstate = gst_structure_get_value (msg->structure, "old-state");
-                       vnewstate = gst_structure_get_value (msg->structure, "new-state");
-                       vpending = gst_structure_get_value (msg->structure, "pending-state");
+                       voldstate = gst_structure_get_value (structure, "old-state");
+                       vnewstate = gst_structure_get_value (structure, "new-state");
+                       vpending = gst_structure_get_value (structure, "pending-state");
 
                        oldstate = (GstState)voldstate->data[0].v_int;
                        newstate = (GstState)vnewstate->data[0].v_int;
@@ -1867,13 +1871,18 @@ value = gst_tag_list_get_value_index(tag_list, gsttag, index); \
 if (value) \
 {\
        buffer = gst_value_get_buffer (value); \
-       debug_log ( "update album cover data : %p, size : %d\n", GST_BUFFER_DATA(buffer), GST_BUFFER_SIZE(buffer)); \
-       player->album_art = (gchar *)g_malloc(GST_BUFFER_SIZE(buffer)); \
+    GstMapInfo info; \
+    gst_buffer_map (buffer, &info, GST_MAP_WRITE); \
+    guint8 *data = info.data; \
+    gsize size = info.size; \
+       debug_log ( "update album cover data : %p, size : %d\n", data, size); \
+       player->album_art = (gchar *)g_malloc(size); \
        if (player->album_art); \
        { \
-               memcpy(player->album_art, GST_BUFFER_DATA(buffer), GST_BUFFER_SIZE(buffer)); \
-               mm_attrs_set_data_by_name(attribute, playertag, (void *)player->album_art, GST_BUFFER_SIZE(buffer)); \
+               memcpy(player->album_art, data, size); \
+               mm_attrs_set_data_by_name(attribute, playertag, (void *)player->album_art, size); \
        } \
+    gst_buffer_unmap (buffer, &info); \
 }
 
 #define MMPLAYER_UPDATE_TAG_UINT(gsttag, attribute, playertag) \
@@ -2788,7 +2797,7 @@ _mmplayer_update_video_param(mm_player_t* player) // @
                 }
 
                                debug_log("set video param : xid %d", *(int*)xid);
-                               gst_x_overlay_set_xwindow_id( GST_X_OVERLAY( player->pipeline->videobin[MMPLAYER_V_SINK].gst ), *(int*)xid );
+                               gst_video_overlay_set_window_handle( GST_VIDEO_OVERLAY( player->pipeline->videobin[MMPLAYER_V_SINK].gst ), *(int*)xid );
                        }
                        else
                        {
@@ -3468,12 +3477,16 @@ __mmplayer_audio_stream_probe (GstPad *pad, GstBuffer *buffer, gpointer u_data)
        gint size;
        guint8 *data;
 
-       data = GST_BUFFER_DATA(buffer);
-       size = GST_BUFFER_SIZE(buffer);
+    GstMapInfo info;
+    gst_buffer_map (buffer, &info, GST_MAP_WRITE);
+       data = info.data;
+       size = info.size;
 
        if (player->audio_stream_cb && size && data)
                player->audio_stream_cb((void *)data, size, player->audio_stream_cb_user_param);
 
+    gst_buffer_unmap (buffer, &info);
+
        return TRUE;
 }
 
@@ -4150,7 +4163,10 @@ __mmplayer_update_subtitle( GstElement* object, GstBuffer *buffer, GstPad *pad,
        return_val_if_fail ( player, FALSE );
        return_val_if_fail ( buffer, FALSE );
 
-       text = GST_BUFFER_DATA(buffer);
+
+    GstMapInfo info;
+    gst_buffer_map (buffer, &info, GST_MAP_WRITE);
+       text = info.data;
        duration = GST_BUFFER_DURATION(buffer);
 
        if ( player->is_subtitle_off )
@@ -4171,6 +4187,7 @@ __mmplayer_update_subtitle( GstElement* object, GstBuffer *buffer, GstPad *pad,
        debug_warning("update subtitle : [%ld msec] %s\n'", msg.subtitle.duration, (char*)msg.data );
 
        MMPLAYER_POST_MSG( player, MM_MESSAGE_UPDATE_SUBTITLE, &msg );
+    gst_buffer_unmap(buffer, &info);
 
        debug_fleave();
 
@@ -4272,8 +4289,11 @@ __gst_appsrc_feed_data_mem(GstElement *element, guint size, gpointer user_data)
                len = buf->len - buf->offset + buf->offset;
        }
 
-       GST_BUFFER_DATA(buffer) = (guint8*)(buf->buf + buf->offset);
-       GST_BUFFER_SIZE(buffer) = len;
+        GstMapInfo info;
+
+        gst_buffer_map (buffer, &info, GST_MAP_WRITE);
+       info.data = (guint8*)(buf->buf + buf->offset);
+       info.size = len;
        GST_BUFFER_OFFSET(buffer) = buf->offset;
        GST_BUFFER_OFFSET_END(buffer) = buf->offset + len;
 
@@ -4281,6 +4301,8 @@ __gst_appsrc_feed_data_mem(GstElement *element, guint size, gpointer user_data)
        g_signal_emit_by_name (appsrc, "push-buffer", buffer, &ret);
 
        buf->offset += len;
+
+        gst_buffer_unmap (buffer, &info);
 }
 
 static gboolean
@@ -4384,12 +4406,15 @@ _mmplayer_push_buffer(MMHandleType hplayer, unsigned char *buf, int size) // @
                return MM_ERROR_NONE;
        }
 
-       GST_BUFFER_DATA(buffer) = (guint8*)(buf);
-       GST_BUFFER_SIZE(buffer) = size;
+        GstMapInfo info;
+        gst_buffer_map (buffer, &info, GST_MAP_WRITE);
+       info.data = (guint8*)(buf);
+       info.size = size;
 
        debug_log("feed buffer %p, length %u\n", buf, size);
        g_signal_emit_by_name (player->pipeline->mainbin[MMPLAYER_M_SRC].gst, "push-buffer", buffer, &gst_ret);
 
+        gst_buffer_unmap (buffer, &info);
        debug_fleave();
 
        return ret;
@@ -4823,7 +4848,7 @@ __mmplayer_gst_create_pipeline(mm_player_t* player) // @
                        debug_error ("fakesink element could not be created\n");
                        goto INIT_ERROR;
                }
-               GST_OBJECT_FLAG_UNSET (mainbin[MMPLAYER_M_SRC_FAKESINK].gst, GST_ELEMENT_IS_SINK);
+               GST_OBJECT_FLAG_UNSET (mainbin[MMPLAYER_M_SRC_FAKESINK].gst, GST_ELEMENT_FLAG_SINK);
 
                /* take ownership of fakesink. we are reusing it */
                gst_object_ref( mainbin[MMPLAYER_M_SRC_FAKESINK].gst );
@@ -4857,7 +4882,7 @@ __mmplayer_gst_create_pipeline(mm_player_t* player) // @
        }
 
        /* set sync handler to get tag synchronously */
-       gst_bus_set_sync_handler(bus, __mmplayer_bus_sync_callback, player);
+       gst_bus_set_sync_handler(bus, __mmplayer_bus_sync_callback, player, NULL);
 
        /* finished */
        gst_object_unref(GST_OBJECT(bus));
@@ -4987,7 +5012,7 @@ __mmplayer_gst_destroy_pipeline(mm_player_t* player) // @
                        MMPlayerGstElement* videobin = player->pipeline->videobin;
                        MMPlayerGstElement* textbin = player->pipeline->textbin;
                        GstBus *bus = gst_pipeline_get_bus (GST_PIPELINE (mainbin[MMPLAYER_M_PIPE].gst));
-                       gst_bus_set_sync_handler (bus, NULL, NULL);
+                       gst_bus_set_sync_handler (bus, NULL, NULL, NULL);
                        gst_object_unref(bus);
 
                        debug_log("pipeline status before set state to NULL\n");
@@ -5464,7 +5489,7 @@ int __gst_resume(mm_player_t* player, gboolean async) // @
 
        /* clean bus sync handler because it's not needed any more */
        bus = gst_pipeline_get_bus (GST_PIPELINE(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst));
-       gst_bus_set_sync_handler (bus, NULL, NULL);
+       gst_bus_set_sync_handler (bus, NULL, NULL, NULL);
        gst_object_unref(bus);
 
        /* set pipeline state to PLAYING */
@@ -5523,7 +5548,7 @@ __gst_set_position(mm_player_t* player, int format, unsigned long position, gboo
         */
        if ( !player->duration )
        {
-               if ( !gst_element_query_duration( player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, &fmt, &dur_nsec ))
+               if ( !gst_element_query_duration( player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, fmt, &dur_nsec ))
                {
                        goto SEEK_ERROR;
                }
@@ -5666,7 +5691,7 @@ __gst_get_position(mm_player_t* player, int format, unsigned long* position) //
         */
        if ( current_state != MM_PLAYER_STATE_PAUSED )
        {
-               ret = gst_element_query_position(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, &fmt, &pos_msec);
+               ret = gst_element_query_position(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, fmt, &pos_msec);
        }
 
        /* NOTE : get last point to overcome some bad operation of some elements
@@ -7317,7 +7342,7 @@ _mmplayer_pause(MMHandleType hplayer) // @
                        * ( returning zero when getting current position in paused state) of some
                        * elements
                        */
-                       if ( !gst_element_query_position(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, &fmt, &pos_msec))
+                       if ( !gst_element_query_position(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, fmt, &pos_msec))
                                debug_warning("getting current position failed in paused\n");
 
                        player->last_position = pos_msec;
@@ -7476,7 +7501,7 @@ __mmplayer_set_pcm_extraction(mm_player_t* player)
        }
 
        /* get duration */
-       ret = gst_element_query_duration(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, &fmt, &dur_nsec);
+       ret = gst_element_query_duration(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, fmt, &dur_nsec);
        if ( !ret )
        {
                debug_error("failed to get duration");
@@ -7528,7 +7553,7 @@ _mmplayer_deactivate_section_repeat(MMHandleType hplayer)
 
        __mmplayer_set_play_count( player, onetime );
 
-       gst_element_query_position(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, &fmt, &cur_pos);
+       gst_element_query_position(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, fmt, &cur_pos);
 
        if ( (!__gst_seek( player, player->pipeline->mainbin[MMPLAYER_M_PIPE].gst,
                                        1.0,
@@ -7580,7 +7605,7 @@ _mmplayer_set_playspeed(MMHandleType hplayer, gdouble rate)
        current_state = MMPLAYER_CURRENT_STATE(player);
 
        if ( current_state != MM_PLAYER_STATE_PAUSED )
-               ret = gst_element_query_position(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, &format, &pos_msec);
+               ret = gst_element_query_position(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, format, &pos_msec);
 
        debug_log ("pos_msec = %"GST_TIME_FORMAT" and ret = %d and state = %d", GST_TIME_ARGS (pos_msec), ret, current_state);
 
@@ -8722,7 +8747,7 @@ const char *padname, const GList *templlist)
 
                                        if ( !MMPLAYER_IS_HTTP_LIVE_STREAMING(player))
                                         {
-                                               if ( !gst_element_query_duration(player->pipeline->mainbin[MMPLAYER_M_SRC].gst, &fmt, &dur_bytes))
+                                               if ( !gst_element_query_duration(player->pipeline->mainbin[MMPLAYER_M_SRC].gst, fmt, &dur_bytes))
                                                        debug_error("fail to get duration.\n");
 
                                                if (dur_bytes>0)