diff options
author | Eunhae Choi <eunhae1.choi@samsung.com> | 2016-02-17 17:00:37 +0900 |
---|---|---|
committer | Eunhae Choi <eunhae1.choi@samsung.com> | 2016-02-17 17:00:37 +0900 |
commit | aa6637df278a85dfa536cf665aae954da5218a8d (patch) | |
tree | 7bad6ade583bbb7c9d0e24504d94d26ee8395ae6 | |
parent | cbac9a4321bc63e85306efdf44f0561e3d91d9b2 (diff) | |
download | libmm-player-submit/tizen_common/20160222.091425.tar.gz libmm-player-submit/tizen_common/20160222.091425.tar.bz2 libmm-player-submit/tizen_common/20160222.091425.zip |
remove client pipelinesubmit/tizen_common/20160222.091425submit/tizen/20160218.094257submit/tizen/20160218.050430accepted/tizen/wearable/20160219.002405accepted/tizen/tv/20160219.002349accepted/tizen/mobile/20160219.002336accepted/tizen/ivi/20160219.002425accepted/tizen/common/20160222.162029
Change-Id: Ib235ebe998a265678c313d3768ee8cc8db78a6c9
-rw-r--r-- | AUTHORS | 3 | ||||
-rw-r--r-- | Makefile.am | 2 | ||||
-rw-r--r-- | configure.ac | 1 | ||||
-rw-r--r-- | mm-playerclient.pc.in | 11 | ||||
-rw-r--r-- | packaging/libmm-player.spec | 7 | ||||
-rw-r--r-- | src/Makefile.am | 57 | ||||
-rw-r--r-- | src/client/mm_player_client.c | 1532 | ||||
-rw-r--r-- | src/include/mm_player.h | 13 | ||||
-rw-r--r-- | src/include/mm_player_mused.h | 87 | ||||
-rw-r--r--[-rwxr-xr-x] | src/include/mm_player_priv.h | 3 | ||||
-rw-r--r-- | src/mm_player.c (renamed from src/server/mm_player.c) | 46 | ||||
-rw-r--r-- | src/mm_player_attrs.c | 9 | ||||
-rw-r--r-- | src/mm_player_audioeffect.c (renamed from src/server/mm_player_audioeffect.c) | 0 | ||||
-rw-r--r-- | src/mm_player_capture.c (renamed from src/server/mm_player_capture.c) | 0 | ||||
-rw-r--r-- | src/mm_player_common_priv.c | 15 | ||||
-rw-r--r-- | src/mm_player_es.c (renamed from src/server/mm_player_es.c) | 0 | ||||
-rw-r--r-- | src/mm_player_pd.c (renamed from src/server/mm_player_pd.c) | 0 | ||||
-rw-r--r-- | src/mm_player_priv.c (renamed from src/server/mm_player_priv.c) | 50 | ||||
-rw-r--r-- | src/mm_player_resource.c (renamed from src/server/mm_player_resource.c) | 0 | ||||
-rw-r--r-- | src/mm_player_sound_focus.c (renamed from src/server/mm_player_sound_focus.c) | 0 | ||||
-rw-r--r-- | src/mm_player_streaming.c (renamed from src/server/mm_player_streaming.c) | 0 | ||||
-rw-r--r-- | src/mm_player_tracks.c (renamed from src/server/mm_player_tracks.c) | 0 | ||||
-rw-r--r-- | src/mm_player_utils.c (renamed from src/server/mm_player_utils.c) | 0 |
23 files changed, 20 insertions, 1816 deletions
@@ -1 +1,2 @@ -JongHyuk Choi <jhchoi.choi@samsung.com>
+HeeChul Jeon <heechul.jeon@samsung.com>
+
diff --git a/Makefile.am b/Makefile.am index 63ba01d..7ee8b62 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,7 +1,7 @@ ACLOCAL_AMFLAGS='-I m4' SUBDIRS = src -pcfiles = mm-player.pc mm-playerclient.pc +pcfiles = mm-player.pc pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = $(pcfiles) EXTRA_DIST = $(pcfiles) diff --git a/configure.ac b/configure.ac index 13c5a3c..b2a745d 100644 --- a/configure.ac +++ b/configure.ac @@ -147,6 +147,5 @@ AM_CONDITIONAL([IS_SDK], [test "x$IS_SDK" = "xyes"]) AC_CONFIG_FILES([Makefile src/Makefile mm-player.pc - mm-playerclient.pc ]) AC_OUTPUT diff --git a/mm-playerclient.pc.in b/mm-playerclient.pc.in deleted file mode 100644 index 924eb51..0000000 --- a/mm-playerclient.pc.in +++ /dev/null @@ -1,11 +0,0 @@ -prefix = @prefix@ -exec_prefix=@exec_prefix@ -libdir = @libdir@ -includedir = @includedir@ - -Name : mm-playerclient -Description : Multimedia Framework Player Library -Requires : mm-common -Version : @VERSION@ -Libs : -L${libdir} -lmmfplayerclient -Cflags : -I${includedir}/mmf diff --git a/packaging/libmm-player.spec b/packaging/libmm-player.spec index 8c8e297..ec0530c 100644 --- a/packaging/libmm-player.spec +++ b/packaging/libmm-player.spec @@ -3,7 +3,7 @@ Name: libmm-player Summary: Multimedia Framework Player Library -Version: 0.5.75 +Version: 0.5.76 Release: 0 Group: Multimedia/Libraries License: Apache-2.0 @@ -71,8 +71,6 @@ CFLAGS=$CFLAGS LDFLAGS=$LDFLAGS ./configure --enable-sdk --prefix=%{_prefix} --d make %{?jobs:-j%jobs} %install -mkdir -p %{buildroot}%{_datadir}/license -cp -rf LICENSE.APLv2 %{buildroot}%{_datadir}/license/%{name} %make_install %post -p /sbin/ldconfig @@ -81,9 +79,10 @@ cp -rf LICENSE.APLv2 %{buildroot}%{_datadir}/license/%{name} %files %manifest %{name}.manifest +%license LICENSE.APLv2 %defattr(-,root,root,-) %{_libdir}/*.so.* -%{_datadir}/license/%{name} + %files devel %manifest %{name}.manifest diff --git a/src/Makefile.am b/src/Makefile.am index d9c38a7..975dae4 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,28 +1,22 @@ -lib_LTLIBRARIES = libmmfplayer.la libmmfplayerclient.la +lib_LTLIBRARIES = libmmfplayer.la includelibmmfplayerdir = $(includedir)/mmf includelibmmfplayer_HEADERS = include/mm_player.h \ include/mm_player_internal.h \ - include/mm_player_audioeffect.h \ - include/mm_player_mused.h + include/mm_player_audioeffect.h -libmmfplayer_la_SOURCES = server/mm_player.c \ - server/mm_player_priv.c \ - server/mm_player_utils.c \ - server/mm_player_resource.c \ - server/mm_player_sound_focus.c \ - server/mm_player_capture.c \ - server/mm_player_pd.c \ - server/mm_player_streaming.c \ - server/mm_player_tracks.c \ - server/mm_player_audioeffect.c \ - server/mm_player_es.c \ - mm_player_common_priv.c \ - mm_player_attrs.c \ - mm_player_ini.c - -libmmfplayerclient_la_SOURCES = client/mm_player_client.c \ +libmmfplayer_la_SOURCES = mm_player.c \ + mm_player_priv.c \ + mm_player_utils.c \ + mm_player_resource.c \ + mm_player_sound_focus.c \ + mm_player_capture.c \ + mm_player_pd.c \ + mm_player_streaming.c \ + mm_player_tracks.c \ + mm_player_audioeffect.c \ + mm_player_es.c \ mm_player_common_priv.c \ mm_player_attrs.c \ mm_player_ini.c @@ -46,18 +40,6 @@ libmmfplayer_la_CFLAGS = -I$(srcdir)/include \ $(ECORE_CFLAGS) \ -Werror -Wno-deprecated -Wno-deprecated-declarations -Wno-cpp -libmmfplayerclient_la_CFLAGS = -I$(srcdir)/include \ - $(MMCOMMON_CFLAGS) \ - $(MMUTIL_CFLAGS) \ - $(GST_CFLAGS) \ - $(GST_VIDEO_CFLAGS) \ - $(GST_APP_CFLAGS) \ - $(VCONF_CFLAGS) \ - $(DLOG_CFLAGS) \ - $(EVAS_CFLAGS) \ - $(ECORE_CFLAGS) \ - -Werror -Wno-deprecated -Wno-deprecated-declarations -Wno-cpp - noinst_HEADERS = include/mm_player_utils.h \ include/mm_player_ini.h \ include/mm_player_priv.h \ @@ -88,17 +70,6 @@ libmmfplayer_la_LIBADD = $(GST_LIBS) \ $(EVAS_LIBS) \ $(ECORE_LIBS) -libmmfplayerclient_la_LIBADD = $(GST_LIBS) \ - $(MMCOMMON_LIBS) \ - $(MMUTIL_LIBS) \ - $(GST_INTERFACE_LIBS) \ - $(GST_VIDEO_LIBS) \ - $(GST_APP_LIBS) \ - $(INIPARSER_LIBS) \ - $(DLOG_LIBS) \ - $(VCONF_LIBS) \ - $(EVAS_LIBS) \ - $(ECORE_LIBS) if IS_SDK libmmfplayer_la_CFLAGS += -DIS_SDK @@ -107,6 +78,4 @@ endif if WAYLAND_SUPPORT libmmfplayer_la_CFLAGS += $(GST_WAYLAND_CFLAGS) libmmfplayer_la_LIBADD += $(GST_WAYLAND_LIBS) -libmmfplayerclient_la_CFLAGS += $(GST_WAYLAND_CFLAGS) -libmmfplayerclient_la_LIBADD += $(GST_WAYLAND_LIBS) endif diff --git a/src/client/mm_player_client.c b/src/client/mm_player_client.c deleted file mode 100644 index ffa0ff1..0000000 --- a/src/client/mm_player_client.c +++ /dev/null @@ -1,1532 +0,0 @@ -/* - * libmm-player - * - * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. - * - * Contact: YoungHwan An <younghwan_.an@samsung.com> - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -/*=========================================================================================== -| | -| INCLUDE FILES | -| | -========================================================================================== */ -#include <glib.h> -#include <gst/gst.h> -#include <gst/app/gstappsrc.h> -#include <gst/video/videooverlay.h> -#ifdef HAVE_WAYLAND -#include <gst/wayland/wayland.h> -#endif -#include <unistd.h> -#include <sys/stat.h> -#include <string.h> -#include <sys/time.h> -#include <stdlib.h> -#include <dlog.h> - -#include <mm_error.h> -#include <mm_attrs.h> -#include <mm_attrs_private.h> - -#include "mm_player_priv.h" -#include "mm_player_ini.h" -#include "mm_player_attrs.h" -#include "mm_player_utils.h" -#include <sched.h> -#include <Evas.h> - - -/*=========================================================================================== -| | -| LOCAL DEFINITIONS AND DECLARATIONS FOR MODULE | -| | -========================================================================================== */ - -/*--------------------------------------------------------------------------- -| GLOBAL CONSTANT DEFINITIONS: | ----------------------------------------------------------------------------*/ - -/*--------------------------------------------------------------------------- -| IMPORTED VARIABLE DECLARATIONS: | ----------------------------------------------------------------------------*/ - -/*--------------------------------------------------------------------------- -| IMPORTED FUNCTION DECLARATIONS: | ----------------------------------------------------------------------------*/ - -/*--------------------------------------------------------------------------- -| LOCAL #defines: | ----------------------------------------------------------------------------*/ -/* setting player state */ -#define MMPLAYER_MUSED_SET_STATE( x_player, x_state ) \ -LOGD("update state machine to %d\n", x_state); \ -__mmplayer_mused_set_state(x_player, x_state); - -/*--------------------------------------------------------------------------- -| LOCAL CONSTANT DEFINITIONS: | ----------------------------------------------------------------------------*/ - -/*--------------------------------------------------------------------------- -| LOCAL DATA TYPE DEFINITIONS: | ----------------------------------------------------------------------------*/ - -/*--------------------------------------------------------------------------- -| GLOBAL VARIABLE DEFINITIONS: | ----------------------------------------------------------------------------*/ - -/*--------------------------------------------------------------------------- -| LOCAL VARIABLE DEFINITIONS: | ----------------------------------------------------------------------------*/ - -/*--------------------------------------------------------------------------- -| LOCAL FUNCTION PROTOTYPES: | ----------------------------------------------------------------------------*/ -static gboolean _mmplayer_mused_init_gst(mm_player_t* player); -static int _mmplayer_mused_realize(mm_player_t *player, char *string_caps); -static int _mmplayer_mused_unrealize(mm_player_t *player); -static MMHandleType _mmplayer_mused_construct_attribute(mm_player_t *player); -static int __mmplayer_mused_gst_destroy_pipeline(mm_player_t *player); -static int _mmplayer_mused_gst_pause(mm_player_t *player); -static gboolean __mmplayer_mused_gst_callback(GstBus *bus, GstMessage *msg, gpointer data); -static GstBusSyncReply __mmplayer_mused_bus_sync_callback (GstBus * bus, GstMessage * message, gpointer data); -static int __mmplayer_mused_set_state(mm_player_t* player, int state); - -/*=========================================================================================== -| | -| FUNCTION DEFINITIONS | -| | -========================================================================================== */ - -int mm_player_mused_create(MMHandleType *player) -{ - int result = MM_ERROR_NONE; - mm_player_t* new_player = NULL; - - MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); - - /* alloc player structure */ - new_player = g_malloc0(sizeof(mm_player_t)); - if ( ! new_player ) - { - LOGE("Cannot allocate memory for player\n"); - goto ERROR; - } - - /* create player lock */ - g_mutex_init(&new_player->cmd_lock); - - /* load ini files */ - result = mm_player_ini_load(&new_player->ini); - if(result != MM_ERROR_NONE) - { - LOGE("can't load ini"); - goto ERROR; - } - - /* initialize player state */ - MMPLAYER_CURRENT_STATE(new_player) = MM_PLAYER_STATE_NONE; - MMPLAYER_PREV_STATE(new_player) = MM_PLAYER_STATE_NONE; - MMPLAYER_PENDING_STATE(new_player) = MM_PLAYER_STATE_NONE; - MMPLAYER_TARGET_STATE(new_player) = MM_PLAYER_STATE_NONE; - - /* check current state */ - if (__mmplayer_check_state ( new_player, MMPLAYER_COMMAND_CREATE ) - != MM_ERROR_NONE) - goto ERROR; - - /* construct attributes */ - new_player->attrs = _mmplayer_mused_construct_attribute(new_player); - - if ( !new_player->attrs ) - { - LOGE("Failed to construct attributes\n"); - goto ERROR; - } - - /* initialize gstreamer with configured parameter */ - if ( ! _mmplayer_mused_init_gst(new_player) ) - { - LOGE("Initializing gstreamer failed\n"); - goto ERROR; - } - MMPLAYER_MUSED_SET_STATE ( new_player, MM_PLAYER_STATE_NULL ); - MMPLAYER_STATE_CHANGE_TIMEOUT(new_player) = new_player->ini.localplayback_state_change_timeout; - - *player = (MMHandleType)new_player; - return result; -ERROR: - if( new_player ) { - g_mutex_clear(&new_player->cmd_lock); - _mmplayer_deconstruct_attribute(new_player); - g_free( new_player ); - } - - *player = NULL; - return MM_ERROR_PLAYER_NO_FREE_SPACE; -} - -static gboolean -_mmplayer_mused_init_gst(mm_player_t *player) -{ - static gboolean initialized = FALSE; - static const int max_argc = 50; - gint* argc = NULL; - gchar** argv = NULL; - gchar** argv2 = NULL; - GError *err = NULL; - int i = 0; - int arg_count = 0; - - if ( initialized ) - { - LOGD("gstreamer already initialized.\n"); - return TRUE; - } - - /* alloc */ - argc = malloc( sizeof(int) ); - argv = malloc( sizeof(gchar*) * max_argc ); - argv2 = malloc( sizeof(gchar*) * max_argc ); - - if ( !argc || !argv || !argv2) - goto GST_INIT_EXIT; - - memset( argv, 0, sizeof(gchar*) * max_argc ); - memset( argv2, 0, sizeof(gchar*) * max_argc ); - - /* add initial */ - *argc = 1; - argv[0] = g_strdup( "mused_client" ); - - /* add gst_param */ - for ( i = 0; i < 5; i++ ) /* FIXIT : num of param is now fixed to 5. make it dynamic */ - { - if ( strlen( player->ini.gst_param[i] ) > 0 ) - { - argv[*argc] = g_strdup( player->ini.gst_param[i] ); - (*argc)++; - } - } - - /* we would not do fork for scanning plugins */ - argv[*argc] = g_strdup("--gst-disable-registry-fork"); - (*argc)++; - - /* check disable registry scan */ - if ( player->ini.skip_rescan ) - { - argv[*argc] = g_strdup("--gst-disable-registry-update"); - (*argc)++; - } - - /* check disable segtrap */ - if ( player->ini.disable_segtrap ) - { - argv[*argc] = g_strdup("--gst-disable-segtrap"); - (*argc)++; - } - - arg_count = *argc; - - for ( i = 0; i < arg_count; i++ ) - argv2[i] = argv[i]; - - /* initializing gstreamer */ - if ( ! gst_init_check (argc, &argv, &err)) - { - LOGE("Could not initialize GStreamer: %s\n", err ? err->message : "unknown error occurred"); - if (err) - { - g_error_free (err); - } - } - - initialized = TRUE; -GST_INIT_EXIT: - /* release */ - for ( i = 0; i < arg_count; i++ ) - { - MMPLAYER_FREEIF( argv2[i] ); - } - - MMPLAYER_FREEIF( argv ); - MMPLAYER_FREEIF( argv2 ); - MMPLAYER_FREEIF( argc ); - - return initialized; -} - -int mm_player_mused_destroy(MMHandleType player) -{ - int result = MM_ERROR_NONE; - - MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); - - MMPLAYER_CMD_LOCK( player ); - - /* destroy can called at anytime */ - MMPLAYER_CHECK_STATE ( player, MMPLAYER_COMMAND_DESTROY ); - - __mmplayer_mused_gst_destroy_pipeline(player); - - /* release attributes */ - if( !_mmplayer_deconstruct_attribute( player ) ) { - LOGE("failed to deconstruct attribute"); - result = MM_ERROR_PLAYER_INTERNAL; - } - - MMPLAYER_CMD_UNLOCK( player ); - - g_mutex_clear(&((mm_player_t*)player)->cmd_lock); - g_free( player ); - return result; -} - - -int mm_player_mused_realize(MMHandleType player, char *caps) -{ - int result = MM_ERROR_NONE; - - MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); - - MMPLAYER_CMD_LOCK( player ); - - result = _mmplayer_mused_realize((mm_player_t *)player, caps); - - MMPLAYER_CMD_UNLOCK( player ); - - return result; -} - -static int _mmplayer_mused_realize(mm_player_t *player, char *string_caps) -{ - int result = MM_ERROR_NONE; - GstElement *src; - GstElement *sink; - GstElement *conv; - GstBus *bus; - GstCaps *caps; - MMPlayerGstElement *mainbin = NULL; - MMHandleType attrs = MMPLAYER_GET_ATTRS(player); - gboolean link; - char *stream_path = NULL; - int attr_ret; - int surface_type = 0; - gchar *videosink_element = NULL; - gchar *videosrc_element = NULL; - gboolean use_tbm = FALSE; - gchar* video_csc = "videoconvert"; // default colorspace converter - - /* check current state */ - MMPLAYER_CHECK_STATE( player, MMPLAYER_COMMAND_REALIZE ); - - /* create pipeline handles */ - if ( player->pipeline ) - { - LOGW("pipeline should be released before create new one\n"); - return result; - } - /* alloc handles */ - player->pipeline = (MMPlayerGstPipelineInfo*) g_malloc0( sizeof(MMPlayerGstPipelineInfo) ); - if (player->pipeline == NULL) - return MM_ERROR_PLAYER_NO_FREE_SPACE; - - /* create mainbin */ - mainbin = (MMPlayerGstElement*) g_malloc0( sizeof(MMPlayerGstElement) * MMPLAYER_M_NUM ); - if (!mainbin) { - result = MM_ERROR_OUT_OF_MEMORY; - goto REALIZE_ERROR; - } - - /* create pipeline */ - mainbin[MMPLAYER_M_PIPE].id = MMPLAYER_M_PIPE; - mainbin[MMPLAYER_M_PIPE].gst = gst_pipeline_new("playerClient"); - LOGD("gst new %p", mainbin[MMPLAYER_M_PIPE].gst); - if ( ! mainbin[MMPLAYER_M_PIPE].gst ) - { - LOGE("failed to create pipeline\n"); - result = MM_ERROR_PLAYER_INTERNAL; - goto REALIZE_ERROR; - } - - if (strlen(player->ini.videosrc_element_remote) > 0) - videosrc_element = player->ini.videosrc_element_remote; - else { - LOGE("fail to find source element"); - result = MM_ERROR_PLAYER_INTERNAL; - goto REALIZE_ERROR; - } - - /* create source */ - src = gst_element_factory_make(videosrc_element, videosrc_element); - if ( !src ) { - LOGE("faile to create %s", videosrc_element); - result = MM_ERROR_PLAYER_INTERNAL; - goto REALIZE_ERROR; - } - - if(string_caps && (strstr(string_caps, "ST12") || strstr(string_caps, "SN12"))) { - LOGD("using TBM"); - use_tbm = TRUE; - } - - if(strcmp(videosrc_element, "shmsrc") == 0) { - attr_ret = mm_attrs_get_string_by_name ( attrs, "shm_stream_path", &stream_path ); - if(attr_ret == MM_ERROR_NONE && stream_path) { - LOGD("stream path : %s", stream_path); - g_object_set(G_OBJECT(src), - "socket-path", stream_path, - "is-live", TRUE, - "use-tbm", use_tbm, - NULL); - } else { - result = MM_ERROR_PLAYER_INTERNAL; - goto REALIZE_ERROR; - } - } - - mainbin[MMPLAYER_M_SRC].id = MMPLAYER_M_SRC; - mainbin[MMPLAYER_M_SRC].gst = src; - - /* create sink */ - mm_attrs_get_int_by_name (player->attrs, "display_surface_type", &surface_type); - switch(surface_type) - { - case MM_DISPLAY_SURFACE_OVERLAY: - if (strlen(player->ini.videosink_element_overlay) > 0) - videosink_element = player->ini.videosink_element_overlay; - else { - result = MM_ERROR_PLAYER_NOT_INITIALIZED; - goto REALIZE_ERROR; - } - break; - case MM_DISPLAY_SURFACE_EVAS: - if (strlen(player->ini.videosink_element_evas) > 0) - videosink_element = player->ini.videosink_element_evas; - else { - result = MM_ERROR_PLAYER_NOT_INITIALIZED; - goto REALIZE_ERROR; - } - break; - - default: - LOGE("Not support surface type %d", surface_type); - result = MM_ERROR_INVALID_ARGUMENT; - goto REALIZE_ERROR; - } - sink = gst_element_factory_make(videosink_element, videosink_element); - if ( !sink ) { - LOGE("faile to create %s", videosink_element); - result = MM_ERROR_PLAYER_INTERNAL; - goto REALIZE_ERROR; - } - mainbin[MMPLAYER_M_V_SINK].id = MMPLAYER_M_V_SINK; - mainbin[MMPLAYER_M_V_SINK].gst = sink; - - /* support using shard memory with S/W codec on HawkP */ - if(strncmp(videosink_element, "waylandsink", strlen(videosink_element)) == 0) { - g_object_set(mainbin[MMPLAYER_M_V_SINK].gst, "use-tbm", use_tbm, NULL); - } - - /* now we have completed mainbin. take it */ - player->pipeline->mainbin = mainbin; - - result = _mmplayer_update_video_param(player); - if(result != MM_ERROR_NONE) - goto REALIZE_ERROR; - - caps = gst_caps_from_string(string_caps); - - /* add and link */ - if(surface_type == MM_DISPLAY_SURFACE_EVAS) { - conv = gst_element_factory_make(video_csc, video_csc); - if ( !conv ) { - LOGE("faile to create %s", video_csc); - result = MM_ERROR_PLAYER_INTERNAL; - goto REALIZE_ERROR; - } - mainbin[MMPLAYER_M_V_CONV].id = MMPLAYER_M_V_CONV; - mainbin[MMPLAYER_M_V_CONV].gst = conv; - gst_bin_add_many(GST_BIN(mainbin[MMPLAYER_M_PIPE].gst), - mainbin[MMPLAYER_M_SRC].gst, - mainbin[MMPLAYER_M_V_CONV].gst, - mainbin[MMPLAYER_M_V_SINK].gst, - NULL); - - link = gst_element_link_filtered(mainbin[MMPLAYER_M_SRC].gst, - mainbin[MMPLAYER_M_V_CONV].gst, - caps); - if(link) { - link = gst_element_link(mainbin[MMPLAYER_M_V_CONV].gst, - mainbin[MMPLAYER_M_V_SINK].gst); - } - else - LOGE("gst_element_link_filterd error"); - - - } else { - if (!use_tbm) { - /* SHM need videoconvert, wayland support RGB SHM format only*/ - conv = gst_element_factory_make(video_csc, video_csc); - if (!conv ) { - LOGE("faile to create %s", video_csc); - result = MM_ERROR_PLAYER_INTERNAL; - goto REALIZE_ERROR; - } - mainbin[MMPLAYER_M_V_CONV].id = MMPLAYER_M_V_CONV; - mainbin[MMPLAYER_M_V_CONV].gst = conv; - gst_bin_add_many(GST_BIN(mainbin[MMPLAYER_M_PIPE].gst), - mainbin[MMPLAYER_M_SRC].gst, - mainbin[MMPLAYER_M_V_CONV].gst, - mainbin[MMPLAYER_M_V_SINK].gst, - NULL); - - link = gst_element_link_filtered(mainbin[MMPLAYER_M_SRC].gst, - mainbin[MMPLAYER_M_V_CONV].gst, - caps); - if (link) { - link = gst_element_link(mainbin[MMPLAYER_M_V_CONV].gst, - mainbin[MMPLAYER_M_V_SINK].gst); - } else { - LOGE("gst_element_link_filterd error"); - } - }else { - gst_bin_add_many(GST_BIN(mainbin[MMPLAYER_M_PIPE].gst), - mainbin[MMPLAYER_M_SRC].gst, - mainbin[MMPLAYER_M_V_SINK].gst, - NULL); - - link = gst_element_link_filtered(mainbin[MMPLAYER_M_SRC].gst, - mainbin[MMPLAYER_M_V_SINK].gst, - caps); - } - } - - gst_caps_unref(caps); - if(!link) { - LOGE("element link error"); - result = MM_ERROR_PLAYER_INTERNAL; - goto REALIZE_ERROR; - } - - /* connect bus callback */ - bus = gst_pipeline_get_bus(GST_PIPELINE(mainbin[MMPLAYER_M_PIPE].gst)); - if ( !bus ) { - LOGE ("cannot get bus from pipeline.\n"); - result = MM_ERROR_PLAYER_INTERNAL; - goto REALIZE_ERROR; - } - - player->bus_watcher = gst_bus_add_watch(bus, (GstBusFunc)__mmplayer_mused_gst_callback, player); - - player->context.thread_default = g_main_context_get_thread_default(); - - if (NULL == player->context.thread_default) - { - player->context.thread_default = g_main_context_default(); - LOGD("thread-default context is the global default context"); - } - LOGD("bus watcher thread context = %p, watcher : %d", player->context.thread_default, player->bus_watcher); - - /* set sync handler to get tag synchronously */ - gst_bus_set_sync_handler(bus, __mmplayer_mused_bus_sync_callback, player, NULL); - - gst_object_unref(GST_OBJECT(bus)); - - /* warm up */ - if ( GST_STATE_CHANGE_FAILURE == - gst_element_set_state(mainbin[MMPLAYER_M_PIPE].gst, GST_STATE_READY ) ) { - LOGE("failed to set state(READY) to pipeline"); - result = MM_ERROR_PLAYER_INVALID_STATE; - goto REALIZE_ERROR; - } - /* run */ - if (GST_STATE_CHANGE_FAILURE == - gst_element_set_state (mainbin[MMPLAYER_M_PIPE].gst, GST_STATE_PAUSED)) { - LOGE("failed to set state(PAUSE) to pipeline"); - result = MM_ERROR_PLAYER_INVALID_STATE; - goto REALIZE_ERROR; - } - if (GST_STATE_CHANGE_FAILURE == - gst_element_set_state (mainbin[MMPLAYER_M_PIPE].gst, GST_STATE_PLAYING)) { - LOGE("failed to set state(PLAYING) to pipeline"); - result = MM_ERROR_PLAYER_INVALID_STATE; - goto REALIZE_ERROR; - } - - MMPLAYER_MUSED_SET_STATE ( player, MM_PLAYER_STATE_READY ); - return result; - -REALIZE_ERROR: - __mmplayer_mused_gst_destroy_pipeline(player); - return result; -} - -static gboolean -__mmplayer_get_property_value_for_rotation(mm_player_t* player, int rotation_angle, int *value) -{ - int pro_value = 0; // in the case of expection, default will be returned. - int dest_angle = rotation_angle; - int rotation_type = ROTATION_USING_FLIP; - int surface_type = 0; - - MMPLAYER_RETURN_VAL_IF_FAIL(player, FALSE); - MMPLAYER_RETURN_VAL_IF_FAIL(value, FALSE); - MMPLAYER_RETURN_VAL_IF_FAIL(rotation_angle >= 0, FALSE); - - if (rotation_angle >= 360) - { - dest_angle = rotation_angle - 360; - } - - /* chech if supported or not */ - if ( dest_angle % 90 ) - { - LOGD("not supported rotation angle = %d", rotation_angle); - return FALSE; - } - - mm_attrs_get_int_by_name(player->attrs, "display_surface_type", &surface_type); - LOGD("check display surface type attribute: %d", surface_type); - - if ((surface_type == MM_DISPLAY_SURFACE_OVERLAY) || - (surface_type == MM_DISPLAY_SURFACE_EVAS && - !strcmp(player->ini.videosink_element_evas, "evaspixmapsink"))) - rotation_type = ROTATION_USING_SINK; - - LOGD("using %d type for rotation", rotation_type); - - /* get property value for setting */ - switch(rotation_type) { - case ROTATION_USING_SINK: // waylandsink, xvimagesink - switch (dest_angle) { - case 0: - break; - case 90: - pro_value = 3; // clockwise 90 - break; - case 180: - pro_value = 2; - break; - case 270: - pro_value = 1; // counter-clockwise 90 - break; - } - break; - case ROTATION_USING_FLIP: // videoflip - pro_value = dest_angle / 90; - break; - } - - LOGD("setting rotation property value : %d, used rotation type : %d", pro_value, rotation_type); - - *value = pro_value; - - return TRUE; -} -int _mmplayer_update_video_param(mm_player_t *player) -{ - MMHandleType attrs = 0; - int surface_type = 0; - int rotation_value = 0; - int org_angle = 0; - int user_angle = 0; - MMPlayerGstElement* mainbin = player->pipeline->mainbin; - - if( !mainbin ) { - LOGE("mainbin was not created"); - return MM_ERROR_PLAYER_INTERNAL; - } - attrs = MMPLAYER_GET_ATTRS(player); - if ( !attrs ) { - LOGE("cannot get content attribute"); - return MM_ERROR_PLAYER_INTERNAL; - } - - __mmplayer_get_video_angle(player, &user_angle, &org_angle); - - /* update display surface */ - mm_attrs_get_int_by_name(attrs, "display_surface_type", &surface_type); - LOGD("check display surface type attribute: %d", surface_type); - - /* configuring display */ - switch ( surface_type ) - { - case MM_DISPLAY_SURFACE_OVERLAY: - { - /* ximagesink or xvimagesink */ - void *surface = NULL; - -#ifdef HAVE_WAYLAND - /*set wl_display*/ - void* wl_display = NULL; - GstContext *context = NULL; - int wl_window_x = 0; - int wl_window_y = 0; - int wl_window_width = 0; - int wl_window_height = 0; - int display_method = 0; - - mm_attrs_get_data_by_name(attrs, "wl_display", &wl_display); - if (wl_display) - context = gst_wayland_display_handle_context_new(wl_display); - if (context) - gst_element_set_context(GST_ELEMENT(mainbin[MMPLAYER_M_V_SINK].gst), context); - - /*It should be set after setting window*/ - mm_attrs_get_int_by_name(attrs, "wl_window_render_x", &wl_window_x); - mm_attrs_get_int_by_name(attrs, "wl_window_render_y", &wl_window_y); - mm_attrs_get_int_by_name(attrs, "wl_window_render_width", &wl_window_width); - mm_attrs_get_int_by_name(attrs, "wl_window_render_height", &wl_window_height); - mm_attrs_get_int_by_name(attrs, "display_method", &display_method); -#endif - mm_attrs_get_data_by_name(attrs, "display_overlay", &surface); - if ( surface ) { -#ifdef HAVE_WAYLAND - guintptr wl_surface = (guintptr)surface; - LOGD("set video param : surface %p", wl_surface); - gst_video_overlay_set_window_handle( - GST_VIDEO_OVERLAY( mainbin[MMPLAYER_M_V_SINK].gst ), - wl_surface ); - /* After setting window handle, set render rectangle */ - gst_video_overlay_set_render_rectangle( - GST_VIDEO_OVERLAY( mainbin[MMPLAYER_M_V_SINK].gst ), - wl_window_x,wl_window_y,wl_window_width,wl_window_height); - - __mmplayer_get_property_value_for_rotation(player, org_angle+user_angle, &rotation_value); - g_object_set(mainbin[MMPLAYER_M_V_SINK].gst, - "display-geometry-method", display_method, - "rotate", rotation_value, - NULL); -#else - int xwin_id = 0; - xwin_id = *(int*)surface; - LOGD("set video param : xid %d", xwin_id); - if (xwin_id) - { - gst_video_overlay_set_window_handle( - GST_VIDEO_OVERLAY( mainbin[MMPLAYER_M_V_SINK].gst ), - xwin_id ); - } -#endif - } - else - LOGW("still we don't have surface on player attribute. create it's own surface."); - } - break; - case MM_DISPLAY_SURFACE_EVAS: - { - void *object = NULL; - int scaling = 0; - gboolean visible = TRUE; - int display_method = 0; - - /* common case if using evas surface */ - mm_attrs_get_data_by_name(attrs, "display_overlay", &object); - mm_attrs_get_int_by_name(attrs, "display_visible", &visible); - mm_attrs_get_int_by_name(attrs, "display_evas_do_scaling", &scaling); - mm_attrs_get_int_by_name(attrs, "display_method", &display_method); - - /* if evasimagesink */ - if (!strcmp(player->ini.videosink_element_evas,"evasimagesink")) - { - if (object) - { - /* if it is evasimagesink, we are not supporting rotation */ - if (user_angle!=0) - { - mm_attrs_set_int_by_name(attrs, "display_rotation", MM_DISPLAY_ROTATION_NONE); - if (mmf_attrs_commit (attrs)) /* return -1 if error */ - LOGE("failed to commit\n"); - LOGW("unsupported feature"); - return MM_ERROR_NOT_SUPPORT_API; - } - __mmplayer_get_property_value_for_rotation(player, org_angle+user_angle, &rotation_value); - g_object_set(mainbin[MMPLAYER_M_V_SINK].gst, - "evas-object", object, - "visible", visible, - /* Not supported "display-geometry-method", display_method, */ - "rotate", rotation_value, - NULL); - LOGD("set video param : method %d", display_method); - LOGD("set video param : evas-object %x, visible %d", object, visible); - LOGD("set video param : evas-object %x, rotate %d", object, rotation_value); - } - else - { - LOGE("no evas object"); - return MM_ERROR_PLAYER_INTERNAL; - } - - - /* if evasimagesink using converter */ - if (player->set_mode.video_zc && player->pipeline->mainbin[MMPLAYER_M_V_CONV].gst) - { - int width = 0; - int height = 0; - int no_scaling = !scaling; - - mm_attrs_get_int_by_name(attrs, "display_width", &width); - mm_attrs_get_int_by_name(attrs, "display_height", &height); - - /* NOTE: fimcconvert does not manage index of src buffer from upstream src-plugin, decoder gives frame information in output buffer with no ordering */ - g_object_set(player->pipeline->videobin[MMPLAYER_V_CONV].gst, "src-rand-idx", TRUE, NULL); - g_object_set(player->pipeline->videobin[MMPLAYER_V_CONV].gst, "dst-buffer-num", 5, NULL); - - if (no_scaling) - { - /* no-scaling order to fimcconvert, original width, height size of media src will be passed to sink plugin */ - g_object_set(player->pipeline->videobin[MMPLAYER_V_CONV].gst, - "dst-width", 0, /* setting 0, output video width will be media src's width */ - "dst-height", 0, /* setting 0, output video height will be media src's height */ - NULL); - } - else - { - /* scaling order to fimcconvert */ - if (width) - { - g_object_set(player->pipeline->videobin[MMPLAYER_V_CONV].gst, "dst-width", width, NULL); - } - if (height) - { - g_object_set(player->pipeline->videobin[MMPLAYER_V_CONV].gst, "dst-height", height, NULL); - } - LOGD("set video param : video frame scaling down to width(%d) height(%d)", width, height); - } - LOGD("set video param : display_evas_do_scaling %d", scaling); - } - } - - /* if evaspixmapsink */ - if (!strcmp(player->ini.videosink_element_evas,"evaspixmapsink")) - { - if (object) - { - //__mmplayer_get_property_value_for_rotation(player, org_angle+user_angle, &rotation_value); - g_object_set(mainbin[MMPLAYER_M_V_SINK].gst, - "evas-object", object, - "visible", visible, - "display-geometry-method", display_method, - "rotate", rotation_value, - NULL); - LOGD("set video param : method %d", display_method); - LOGD("set video param : evas-object %x, visible %d", object, visible); - LOGD("set video param : evas-object %x, rotate %d", object, rotation_value); - } - else - { - LOGE("no evas object"); - return MM_ERROR_PLAYER_INTERNAL; - } - - int display_method = 0; - int roi_x = 0; - int roi_y = 0; - int roi_w = 0; - int roi_h = 0; - int origin_size = !scaling; - - mm_attrs_get_int_by_name(attrs, "display_method", &display_method); - mm_attrs_get_int_by_name(attrs, "display_roi_x", &roi_x); - mm_attrs_get_int_by_name(attrs, "display_roi_y", &roi_y); - mm_attrs_get_int_by_name(attrs, "display_roi_width", &roi_w); - mm_attrs_get_int_by_name(attrs, "display_roi_height", &roi_h); - - /* get rotation value to set */ - //__mmplayer_get_property_value_for_rotation(player, org_angle+user_angle, &rotation_value); - - g_object_set(mainbin[MMPLAYER_M_V_SINK].gst, - "origin-size", origin_size, - "rotate", rotation_value, - "dst-roi-x", roi_x, - "dst-roi-y", roi_y, - "dst-roi-w", roi_w, - "dst-roi-h", roi_h, - "display-geometry-method", display_method, - NULL ); - - LOGD("set video param : method %d", display_method); - LOGD("set video param : dst-roi-x: %d, dst-roi-y: %d, dst-roi-w: %d, dst-roi-h: %d", - roi_x, roi_y, roi_w, roi_h ); - LOGD("set video param : display_evas_do_scaling %d (origin-size %d)", scaling, origin_size); - } - } - break; - default: - LOGD("Noting to update"); - break; - } - - return MM_ERROR_NONE; -} - -int mm_player_mused_unrealize(MMHandleType player) -{ - int result = MM_ERROR_NONE; - - MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); - - MMPLAYER_CMD_LOCK( player ); - - result = _mmplayer_mused_unrealize(player); - - MMPLAYER_CMD_UNLOCK( player ); - - return result; -} - -static int _mmplayer_mused_unrealize(mm_player_t *player) -{ - int ret = MM_ERROR_NONE; - - /* check current state */ - MMPLAYER_CHECK_STATE( player, MMPLAYER_COMMAND_UNREALIZE ); - - ret = __mmplayer_mused_gst_destroy_pipeline(player); - - MMPLAYER_MUSED_SET_STATE ( player, MM_PLAYER_STATE_NULL ); - - return ret; -} - -static int __mmplayer_mused_gst_destroy_pipeline(mm_player_t *player) -{ - int ret = MM_ERROR_NONE; - /* cleanup gst stuffs */ - if ( player->pipeline ) { - MMPlayerGstElement* mainbin = player->pipeline->mainbin; - - /* disconnecting bus watch */ - if ( player->bus_watcher ) - __mmplayer_remove_g_source_from_context( - player->context.thread_default, player->bus_watcher); - player->bus_watcher = 0; - - if ( mainbin ) { - gint timeout; - GstBus *bus = gst_pipeline_get_bus (GST_PIPELINE (mainbin[MMPLAYER_M_PIPE].gst)); - gst_bus_set_sync_handler (bus, NULL, NULL, NULL); - gst_object_unref(bus); - - timeout = MMPLAYER_STATE_CHANGE_TIMEOUT(player); - ret = __mmplayer_gst_set_state ( player, mainbin[MMPLAYER_M_PIPE].gst, GST_STATE_NULL, FALSE, timeout ); - if ( ret != MM_ERROR_NONE ) { - LOGE("fail to change state to NULL\n"); - return MM_ERROR_PLAYER_INTERNAL; - } - LOGD("succeeded in chaning state to NULL\n"); - - LOGD("gst unref %p", mainbin[MMPLAYER_M_PIPE].gst); - gst_object_unref(GST_OBJECT(mainbin[MMPLAYER_M_PIPE].gst)); - - LOGD("free mainbin"); - MMPLAYER_FREEIF( player->pipeline->mainbin ); - } - LOGD("free pipelin"); - MMPLAYER_FREEIF( player->pipeline ); - } - LOGD("finished destroy pipeline"); - - return ret; -} - -static int _mmplayer_mused_gst_pause(mm_player_t *player) -{ - /* check current state */ - MMPLAYER_CHECK_STATE( player, MMPLAYER_COMMAND_UNREALIZE ); - - int ret = MM_ERROR_NONE; - if ( player->pipeline ) { - MMPlayerGstElement* mainbin = player->pipeline->mainbin; - - if ( mainbin ) { - gint timeout; - - timeout = MMPLAYER_STATE_CHANGE_TIMEOUT(player); - ret = __mmplayer_gst_set_state ( player, mainbin[MMPLAYER_M_PIPE].gst, GST_STATE_PAUSED, FALSE, timeout ); - if ( ret != MM_ERROR_NONE ) { - LOGE("fail to change state to PAUSED"); - return MM_ERROR_PLAYER_INTERNAL; - } - LOGD("succeeded in chaning state to PAUSED"); - MMPLAYER_MUSED_SET_STATE ( player, MM_PLAYER_STATE_PAUSED ); - } - } - - return MM_ERROR_NONE; -} - -int mm_player_mused_pre_unrealize(MMHandleType player) -{ - int result = MM_ERROR_NONE; - - MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); - - MMPLAYER_CMD_LOCK( player ); - - result = _mmplayer_mused_gst_pause(player); - - MMPLAYER_CMD_UNLOCK( player ); - - return result; -} - -int mm_player_set_attribute(MMHandleType player, char **err_attr_name, const char *first_attribute_name, ...) -{ - int result = MM_ERROR_NONE; - va_list var_args; - - MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); - MMPLAYER_RETURN_VAL_IF_FAIL(first_attribute_name, MM_ERROR_COMMON_INVALID_ARGUMENT); - - MMPLAYER_CMD_LOCK( player ); - - va_start (var_args, first_attribute_name); - result = _mmplayer_set_attribute(player, err_attr_name, first_attribute_name, var_args); - va_end (var_args); - - MMPLAYER_CMD_UNLOCK( player ); - - return result; -} - -int mm_player_get_attribute(MMHandleType player, char **err_attr_name, const char *first_attribute_name, ...) -{ - int result = MM_ERROR_NONE; - va_list var_args; - - MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); - MMPLAYER_RETURN_VAL_IF_FAIL(first_attribute_name, MM_ERROR_COMMON_INVALID_ARGUMENT); - - MMPLAYER_CMD_LOCK( player ); - - va_start (var_args, first_attribute_name); - result = _mmplayer_get_attribute(player, err_attr_name, first_attribute_name, var_args); - va_end (var_args); - - MMPLAYER_CMD_UNLOCK( player ); - - return result; -} - -static MMHandleType _mmplayer_mused_construct_attribute(mm_player_t *player) -{ - int idx = 0; - MMHandleType attrs = 0; - int num_of_attrs = 0; - mmf_attrs_construct_info_t *base = NULL; - - MMPlayerAttrsSpec player_attrs[] = - { - { - "display_surface_type", - MM_ATTRS_TYPE_INT, - MM_ATTRS_FLAG_RW, - (void *) MM_DISPLAY_SURFACE_NULL, - MM_ATTRS_VALID_TYPE_INT_RANGE, - MM_DISPLAY_SURFACE_OVERLAY, - MM_DISPLAY_SURFACE_NULL - }, - { - "display_overlay", - MM_ATTRS_TYPE_DATA, - MM_ATTRS_FLAG_RW, - (void *) NULL, - MM_ATTRS_VALID_TYPE_NONE, - 0, - 0 - }, -#ifdef HAVE_WAYLAND - { - "wl_display", - MM_ATTRS_TYPE_DATA, - MM_ATTRS_FLAG_RW, - (void *) NULL, - MM_ATTRS_VALID_TYPE_NONE, - 0, - 0 - }, - { - "wl_window_render_x", - MM_ATTRS_TYPE_INT, - MM_ATTRS_FLAG_RW, - (void *) 0, - MM_ATTRS_VALID_TYPE_INT_RANGE, - 0, - MMPLAYER_MAX_INT - }, - { - "wl_window_render_y", - MM_ATTRS_TYPE_INT, - MM_ATTRS_FLAG_RW, - (void *) 0, - MM_ATTRS_VALID_TYPE_INT_RANGE, - 0, - MMPLAYER_MAX_INT - }, - { - "wl_window_render_width", - MM_ATTRS_TYPE_INT, - MM_ATTRS_FLAG_RW, - (void *) 0, - MM_ATTRS_VALID_TYPE_INT_RANGE, - 0, - MMPLAYER_MAX_INT - }, - { - "wl_window_render_height", - MM_ATTRS_TYPE_INT, - MM_ATTRS_FLAG_RW, - (void *) 0, - MM_ATTRS_VALID_TYPE_INT_RANGE, - 0, - MMPLAYER_MAX_INT - }, -#endif - { - "display_rotation", - MM_ATTRS_TYPE_INT, - MM_ATTRS_FLAG_RW, - (void *) MM_DISPLAY_ROTATION_NONE, - MM_ATTRS_VALID_TYPE_INT_RANGE, - MM_DISPLAY_ROTATION_NONE, - MM_DISPLAY_ROTATION_270 - }, - { - "display_visible", - MM_ATTRS_TYPE_INT, - MM_ATTRS_FLAG_RW, - (void *) FALSE, - MM_ATTRS_VALID_TYPE_INT_RANGE, - 0, - 1 - }, - { - "display_method", - MM_ATTRS_TYPE_INT, - MM_ATTRS_FLAG_RW, - (void *) MM_DISPLAY_METHOD_LETTER_BOX, - MM_ATTRS_VALID_TYPE_INT_RANGE, - MM_DISPLAY_METHOD_LETTER_BOX, - MM_DISPLAY_METHOD_CUSTOM_ROI - }, - { - "shm_stream_path", - MM_ATTRS_TYPE_STRING, - MM_ATTRS_FLAG_RW, - (void *) NULL, - MM_ATTRS_VALID_TYPE_NONE, - 0, - 0 - }, - { - "pipeline_type", - MM_ATTRS_TYPE_INT, - MM_ATTRS_FLAG_RW, - (void *) MM_PLAYER_PIPELINE_LEGACY, - MM_ATTRS_VALID_TYPE_INT_RANGE, - MM_PLAYER_PIPELINE_LEGACY, - MM_PLAYER_PIPELINE_MAX - 1 - } - }; - num_of_attrs = ARRAY_SIZE(player_attrs); - base = (mmf_attrs_construct_info_t* )malloc(num_of_attrs * sizeof(mmf_attrs_construct_info_t)); - if ( !base ) - { - LOGE("failed to alloc attrs constructor"); - return 0; - } - - /* initialize values of attributes */ - for ( idx = 0; idx < num_of_attrs; idx++ ) - { - base[idx].name = player_attrs[idx].name; - base[idx].value_type = player_attrs[idx].value_type; - base[idx].flags = player_attrs[idx].flags; - base[idx].default_value = player_attrs[idx].default_value; - } - - attrs = mmf_attrs_new_from_data( - "mmplayer_attrs", - base, - num_of_attrs, - NULL, - NULL); - - /* clean */ - MMPLAYER_FREEIF(base); - - if ( !attrs ) - { - LOGE("failed to create player attrs"); - return 0; - } - - /* set validity type and range */ - for ( idx = 0; idx < num_of_attrs; idx++ ) - { - switch ( player_attrs[idx].valid_type) - { - case MM_ATTRS_VALID_TYPE_INT_RANGE: - { - mmf_attrs_set_valid_type (attrs, idx, MM_ATTRS_VALID_TYPE_INT_RANGE); - mmf_attrs_set_valid_range (attrs, idx, - player_attrs[idx].value_min, - player_attrs[idx].value_max, - (int)(intptr_t)(player_attrs[idx].default_value)); - } - break; - - case MM_ATTRS_VALID_TYPE_INT_ARRAY: - case MM_ATTRS_VALID_TYPE_DOUBLE_ARRAY: - case MM_ATTRS_VALID_TYPE_DOUBLE_RANGE: - default: - break; - } - } - - /* commit */ - mmf_attrs_commit(attrs); - - return attrs; -} - - -static GstBusSyncReply -__mmplayer_mused_bus_sync_callback (GstBus * bus, GstMessage * message, gpointer data) -{ - mm_player_t *player = (mm_player_t *)data; - GstBusSyncReply reply = GST_BUS_DROP; - - if ( ! ( player->pipeline && player->pipeline->mainbin ) ) - { - LOGE("player pipeline handle is null"); - return GST_BUS_PASS; - } - - if (!__mmplayer_check_useful_message(player, message)) - { - gst_message_unref (message); - return GST_BUS_DROP; - } - - switch (GST_MESSAGE_TYPE (message)) - { - case GST_MESSAGE_STATE_CHANGED: - /* post directly for fast launch */ - if (player->sync_handler) { - __mmplayer_mused_gst_callback(NULL, message, player); - reply = GST_BUS_DROP; - } - else { - reply = GST_BUS_PASS; - } - break; - default: - reply = GST_BUS_PASS; - break; - } - - if (reply == GST_BUS_DROP) - gst_message_unref (message); - - return reply; -} - -static gboolean -__mmplayer_mused_gst_callback(GstBus *bus, GstMessage *msg, gpointer data) // @ -{ - mm_player_t* player = (mm_player_t*) data; - gboolean ret = TRUE; - - MMPLAYER_RETURN_VAL_IF_FAIL ( player, FALSE ); - MMPLAYER_RETURN_VAL_IF_FAIL ( msg && GST_IS_MESSAGE(msg), FALSE ); - - switch ( GST_MESSAGE_TYPE( msg ) ) - { - case GST_MESSAGE_UNKNOWN: - LOGD("unknown message received\n"); - break; - - case GST_MESSAGE_EOS: - { - LOGD("GST_MESSAGE_EOS received\n"); - - /* NOTE : EOS event is comming multiple time. watch out it */ - /* check state. we only process EOS when pipeline state goes to PLAYING */ - if ( ! (player->cmd == MMPLAYER_COMMAND_START || player->cmd == MMPLAYER_COMMAND_RESUME) ) - { - LOGD("EOS received on non-playing state. ignoring it\n"); - break; - } - } - break; - - case GST_MESSAGE_ERROR: - { - GError *error = NULL; - gchar* debug = NULL; - - /* generating debug info before returning error */ - MMPLAYER_GENERATE_DOT_IF_ENABLED ( player, "pipeline-status-error" ); - - /* get error code */ - gst_message_parse_error( msg, &error, &debug ); - - /* traslate gst error code to msl error code. then post it - * to application if needed - */ - __mmplayer_handle_gst_error( player, msg, error ); - - if (debug) - { - LOGE ("error debug : %s", debug); - } - - MMPLAYER_FREEIF( debug ); - g_error_free( error ); - } - break; - - case GST_MESSAGE_WARNING: - { - char* debug = NULL; - GError* error = NULL; - - gst_message_parse_warning(msg, &error, &debug); - - LOGD("warning : %s\n", error->message); - LOGD("debug : %s\n", debug); - - MMPLAYER_FREEIF( debug ); - g_error_free( error ); - } - break; - - case GST_MESSAGE_TAG: - { - LOGD("GST_MESSAGE_TAG\n"); - } - break; - - case GST_MESSAGE_BUFFERING: - break; - - case GST_MESSAGE_STATE_CHANGED: - { - MMPlayerGstElement *mainbin; - const GValue *voldstate, *vnewstate, *vpending; - GstState oldstate, newstate, pending; - - if ( ! ( player->pipeline && player->pipeline->mainbin ) ) - { - LOGE("player pipeline handle is null"); - break; - } - - mainbin = player->pipeline->mainbin; - - /* we only handle messages from pipeline */ - if( msg->src != (GstObject *)mainbin[MMPLAYER_M_PIPE].gst ) - break; - - /* get state info from msg */ - voldstate = gst_structure_get_value (gst_message_get_structure(msg), "old-state"); - vnewstate = gst_structure_get_value (gst_message_get_structure(msg), "new-state"); - vpending = gst_structure_get_value (gst_message_get_structure(msg), "pending-state"); - - oldstate = (GstState)voldstate->data[0].v_int; - newstate = (GstState)vnewstate->data[0].v_int; - pending = (GstState)vpending->data[0].v_int; - - LOGD("state changed [%s] : %s ---> %s final : %s\n", - GST_OBJECT_NAME(GST_MESSAGE_SRC(msg)), - gst_element_state_get_name( (GstState)oldstate ), - gst_element_state_get_name( (GstState)newstate ), - gst_element_state_get_name( (GstState)pending ) ); - - if (oldstate == newstate) - { - LOGD("pipeline reports state transition to old state"); - break; - } - - switch(newstate) - { - case GST_STATE_VOID_PENDING: - break; - - case GST_STATE_NULL: - break; - - case GST_STATE_READY: - break; - - case GST_STATE_PAUSED: - { - gboolean prepare_async = FALSE; - - if ( ! player->sent_bos && oldstate == GST_STATE_READY) // managed prepare async case - { - mm_attrs_get_int_by_name(player->attrs, "profile_prepare_async", &prepare_async); - LOGD("checking prepare mode for async transition - %d", prepare_async); - } - } - break; - - case GST_STATE_PLAYING: - break; - - default: - break; - } - } - break; - - case GST_MESSAGE_CLOCK_LOST: - { - GstClock *clock = NULL; - gst_message_parse_clock_lost (msg, &clock); - LOGD("GST_MESSAGE_CLOCK_LOST : %s\n", (clock ? GST_OBJECT_NAME (clock) : "NULL")); - } - break; - - case GST_MESSAGE_NEW_CLOCK: - { - GstClock *clock = NULL; - gst_message_parse_new_clock (msg, &clock); - LOGD("GST_MESSAGE_NEW_CLOCK : %s\n", (clock ? GST_OBJECT_NAME (clock) : "NULL")); - } - break; - - case GST_MESSAGE_ELEMENT: - { - LOGD("GST_MESSAGE_ELEMENT"); - } - break; - - case GST_MESSAGE_DURATION_CHANGED: - { - LOGD("GST_MESSAGE_DURATION_CHANGED"); - } - - break; - - case GST_MESSAGE_ASYNC_START: - { - LOGD("GST_MESSAGE_ASYNC_START : %s", GST_ELEMENT_NAME(GST_MESSAGE_SRC(msg))); - } - break; - - case GST_MESSAGE_ASYNC_DONE: - { - LOGD("GST_MESSAGE_ASYNC_DONE : %s", GST_ELEMENT_NAME(GST_MESSAGE_SRC(msg))); - } - break; - - default: - break; - } - - /* FIXIT : this cause so many warnings/errors from glib/gstreamer. we should not call it since - * gst_element_post_message api takes ownership of the message. - */ - //gst_message_unref( msg ); - - return ret; -} - -int mm_player_set_shm_stream_path(MMHandleType player, const char *path) -{ - int result = MM_ERROR_NONE; - - MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); - MMPLAYER_RETURN_VAL_IF_FAIL(path, MM_ERROR_INVALID_ARGUMENT); - - MMPLAYER_CMD_LOCK( player ); - - result = _mmplayer_set_shm_stream_path(player, path); - - MMPLAYER_CMD_UNLOCK( player ); - - return result; - -} - -static int __mmplayer_mused_set_state(mm_player_t* player, int state) -{ - int ret = MM_ERROR_NONE; - - MMPLAYER_RETURN_VAL_IF_FAIL ( player, FALSE ); - - if ( MMPLAYER_CURRENT_STATE(player) == state ) - { - LOGW("already same state(%s)\n", MMPLAYER_STATE_GET_NAME(state)); - MMPLAYER_PENDING_STATE(player) = MM_PLAYER_STATE_NONE; - return ret; - } - - /* update player states */ - MMPLAYER_PREV_STATE(player) = MMPLAYER_CURRENT_STATE(player); - MMPLAYER_CURRENT_STATE(player) = state; - - /* FIXIT : it's better to do like below code - if ( MMPLAYER_CURRENT_STATE(player) == MMPLAYER_TARGET_STATE(player) ) - MMPLAYER_PENDING_STATE(player) = MM_PLAYER_STATE_NONE; - and add more code to handling PENDING_STATE. - */ - if ( MMPLAYER_CURRENT_STATE(player) == MMPLAYER_PENDING_STATE(player) ) - MMPLAYER_PENDING_STATE(player) = MM_PLAYER_STATE_NONE; - - /* print state */ - MMPLAYER_PRINT_STATE(player); - - /* post message to application */ - if (MMPLAYER_TARGET_STATE(player) == state) - { - LOGD ("player reach the target state (%s)", MMPLAYER_STATE_GET_NAME(MMPLAYER_TARGET_STATE(player))); - } - else - { - LOGD ("intermediate state, do nothing.\n"); - MMPLAYER_PRINT_STATE(player); - return ret; - } - - return ret; -} - -int mm_player_get_state_timeout(MMHandleType player, int *timeout, bool is_streaming) -{ - mm_player_t* handle = (mm_player_t*) player; - - MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); - MMPLAYER_RETURN_VAL_IF_FAIL(timeout, MM_ERROR_INVALID_ARGUMENT); - - MMPLAYER_CMD_LOCK( player ); - - if(is_streaming) - *timeout = handle->ini.live_state_change_timeout; - else - *timeout = handle->ini.localplayback_state_change_timeout; - - MMPLAYER_CMD_UNLOCK( player ); - - return MM_ERROR_NONE; -} - diff --git a/src/include/mm_player.h b/src/include/mm_player.h index 63f5ba7..5ab27f9 100644 --- a/src/include/mm_player.h +++ b/src/include/mm_player.h @@ -2245,19 +2245,6 @@ int mm_player_set_audio_stream_changed_callback(MMHandleType player, mm_player_s int mm_player_set_video_stream_changed_callback(MMHandleType player, mm_player_stream_changed_callback callback, void *user_param); /** - * This function check the content is streaming or not\n - * It's only supported when video stream is included in file. \n - * - * @param player [in] Handle of player. - * @param is_streaming [out] flag of content type. - * - * @return This function returns zero on success, or negative value with error - * code. - * @since 3.0 - */ -int mm_player_is_streaming(MMHandleType player, bool *is_streaming); - -/** @} */ diff --git a/src/include/mm_player_mused.h b/src/include/mm_player_mused.h deleted file mode 100644 index c888ded..0000000 --- a/src/include/mm_player_mused.h +++ /dev/null @@ -1,87 +0,0 @@ -/* - * libmm-player - * - * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. - * - * Contact: JongHyuk Choi <jhchoi.choi@samsung.com> - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#ifndef __MM_PLAYER_MUSED_H__ -#define __MM_PLAYER_MUSED_H__ - -/*=========================================================================================== -| | -| INCLUDE FILES | -| | -========================================================================================== */ -#include "mm_types.h" -#include <Elementary.h> - -/*=========================================================================================== -| | -| GLOBAL DEFINITIONS AND DECLARATIONS FOR MODULE | -| | -========================================================================================== */ - -/*--------------------------------------------------------------------------- -| GLOBAL #defines: | ----------------------------------------------------------------------------*/ - -#ifdef __cplusplus - extern "C" { -#endif - -int mm_player_mused_create(MMHandleType *player); -int mm_player_mused_destroy(MMHandleType player); -int mm_player_mused_realize(MMHandleType player, char *caps); -int mm_player_mused_unrealize(MMHandleType player); -int mm_player_mused_pre_unrealize(MMHandleType player); -int mm_player_get_state_timeout(MMHandleType player, int *timeout, bool is_streaming); - - -/** - * This function get string of raw video caps. - * To be used by server. - * - * @param player [in] Handle of player. - * @param caps [out] String of caps. Should be freed after used. - * - * @return This function returns zero on success, or negative value with error - * code. - * @see - * @since - */ -int mm_player_get_raw_video_caps(MMHandleType player, char **caps); - -/** - * This function set "socket-path" element property of shmsink/src. - * To be used by both server and client. - * - * @param player [in] Handle of player. - * @param path [in] Local file path. - * - * @return This function returns zero on success, or negative value with error - * code. - * @see - * @since - */ -int mm_player_set_shm_stream_path(MMHandleType player, const char *path); - -#ifdef __cplusplus - } -#endif - -#endif /* __MM_PLAYER_MUSED_H__ */ diff --git a/src/include/mm_player_priv.h b/src/include/mm_player_priv.h index c406dae..877eb6c 100755..100644 --- a/src/include/mm_player_priv.h +++ b/src/include/mm_player_priv.h @@ -857,10 +857,7 @@ gint __gst_handle_core_error( mm_player_t* player, int code ); gint __gst_handle_library_error( mm_player_t* player, int code ); gint __gst_handle_resource_error( mm_player_t* player, int code ); gint __gst_handle_stream_error( mm_player_t* player, GError* error, GstMessage * message ); -int _mmplayer_set_shm_stream_path(MMHandleType hplayer, const char *path); -int _mmplayer_get_raw_video_caps(mm_player_t *player, char **caps); int _mmplayer_sound_register_with_pid(MMHandleType hplayer, int pid); -int _mmplayer_is_streaming(MMHandleType hplayer, bool* is_streaming); int __mmplayer_get_video_angle(mm_player_t* player, int *user_angle, int *org_angle); #ifdef __cplusplus } diff --git a/src/server/mm_player.c b/src/mm_player.c index 2108355..d40a468 100644 --- a/src/server/mm_player.c +++ b/src/mm_player.c @@ -1251,49 +1251,3 @@ int mm_player_set_pcm_spec(MMHandleType player, int samplerate, int channel) return result; } -int mm_player_set_shm_stream_path(MMHandleType player, const char *path) -{ - int result = MM_ERROR_NONE; - - MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); - MMPLAYER_RETURN_VAL_IF_FAIL(path, MM_ERROR_INVALID_ARGUMENT); - - MMPLAYER_CMD_LOCK( player ); - - result = _mmplayer_set_shm_stream_path(player, path); - - MMPLAYER_CMD_UNLOCK( player ); - - return result; - -} - -int mm_player_get_raw_video_caps(MMHandleType player, char **caps) -{ - int result = MM_ERROR_NONE; - - MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); - MMPLAYER_RETURN_VAL_IF_FAIL(caps, MM_ERROR_INVALID_ARGUMENT); - - MMPLAYER_CMD_LOCK( player ); - - result = _mmplayer_get_raw_video_caps(player, caps); - - MMPLAYER_CMD_UNLOCK( player ); - - return result; -} - -int mm_player_is_streaming(MMHandleType player, bool *is_streaming) -{ - MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); - MMPLAYER_RETURN_VAL_IF_FAIL(is_streaming, MM_ERROR_INVALID_ARGUMENT); - - MMPLAYER_CMD_LOCK( player ); - - *is_streaming = MMPLAYER_IS_STREAMING(player); - - MMPLAYER_CMD_UNLOCK( player ); - - return MM_ERROR_NONE; -} diff --git a/src/mm_player_attrs.c b/src/mm_player_attrs.c index cfe2cfe..a5a6f46 100644 --- a/src/mm_player_attrs.c +++ b/src/mm_player_attrs.c @@ -1061,15 +1061,6 @@ _mmplayer_construct_attribute(MMHandleType handle) 0 }, { - "shm_stream_path", - MM_ATTRS_TYPE_STRING, - MM_ATTRS_FLAG_RW, - (void *) NULL, - MM_ATTRS_VALID_TYPE_NONE, - 0, - 0 - }, - { "display_surface_client_type", MM_ATTRS_TYPE_INT, MM_ATTRS_FLAG_RW, diff --git a/src/server/mm_player_audioeffect.c b/src/mm_player_audioeffect.c index 3b560a5..3b560a5 100644 --- a/src/server/mm_player_audioeffect.c +++ b/src/mm_player_audioeffect.c diff --git a/src/server/mm_player_capture.c b/src/mm_player_capture.c index e91d13e..e91d13e 100644 --- a/src/server/mm_player_capture.c +++ b/src/mm_player_capture.c diff --git a/src/mm_player_common_priv.c b/src/mm_player_common_priv.c index 570c5f5..5bcab73 100644 --- a/src/mm_player_common_priv.c +++ b/src/mm_player_common_priv.c @@ -1068,18 +1068,3 @@ __mmplayer_get_video_angle(mm_player_t* player, int *user_angle, int *org_angle) return MM_ERROR_NONE; } -int _mmplayer_set_shm_stream_path(MMHandleType hplayer, const char *path) -{ - mm_player_t* player = (mm_player_t*) hplayer; - int result; - - MMPLAYER_FENTER(); - - MMPLAYER_RETURN_VAL_IF_FAIL ( player, MM_ERROR_PLAYER_NOT_INITIALIZED ); - MMPLAYER_RETURN_VAL_IF_FAIL(path, MM_ERROR_INVALID_ARGUMENT); - - result = mm_attrs_set_string_by_name(player->attrs, "shm_stream_path", path) - - MMPLAYER_FLEAVE(); - return result; -} diff --git a/src/server/mm_player_es.c b/src/mm_player_es.c index e821e1e..e821e1e 100644 --- a/src/server/mm_player_es.c +++ b/src/mm_player_es.c diff --git a/src/server/mm_player_pd.c b/src/mm_player_pd.c index f090664..f090664 100644 --- a/src/server/mm_player_pd.c +++ b/src/mm_player_pd.c diff --git a/src/server/mm_player_priv.c b/src/mm_player_priv.c index 7c15641..af94be4 100644 --- a/src/server/mm_player_priv.c +++ b/src/mm_player_priv.c @@ -4153,7 +4153,7 @@ _mmplayer_update_video_param(mm_player_t* player) // @ #ifdef HAVE_WAYLAND unsigned int wl_surface_id = 0; wl_surface_id = *(int*)handle; - LOGD("set video param : wl_surface_id %d %p",wl_surface_id, *(int*)handle); + LOGD("set video param : wl_surface_id %d %p", wl_surface_id, *(int*)handle); gst_video_overlay_set_wl_window_wl_surface_id( GST_VIDEO_OVERLAY( player->pipeline->videobin[MMPLAYER_V_SINK].gst ), *(int*)handle ); @@ -16273,51 +16273,3 @@ _mmplayer_set_pcm_spec(MMHandleType hplayer, int samplerate, int channel) return MM_ERROR_NONE; } -int _mmplayer_get_raw_video_caps(mm_player_t *player, char **caps) -{ - GstCaps *v_caps = NULL; - GstPad *pad = NULL; - GstElement *gst; - gint stype = 0; - - if(!player->videosink_linked) { - LOGD("No video sink"); - return MM_ERROR_NONE; - } - mm_attrs_get_int_by_name (player->attrs, "display_surface_type", &stype); - - if (stype == MM_DISPLAY_SURFACE_NULL) { - LOGD("Display type is NULL"); - if(!player->video_fakesink) { - LOGE("No fakesink"); - return MM_ERROR_PLAYER_INVALID_STATE; - } - gst = player->video_fakesink; - } - else { - if ( !player->pipeline || !player->pipeline->videobin || - !player->pipeline->videobin[MMPLAYER_V_SINK].gst ) { - LOGE("No video pipeline"); - return MM_ERROR_PLAYER_INVALID_STATE; - } - gst = player->pipeline->videobin[MMPLAYER_V_SINK].gst; - } - pad = gst_element_get_static_pad(gst, "sink"); - if(!pad) { - LOGE("static pad is NULL"); - return MM_ERROR_PLAYER_INVALID_STATE; - } - v_caps = gst_pad_get_current_caps(pad); - gst_object_unref( pad ); - - if(!v_caps) { - LOGE("fail to get caps"); - return MM_ERROR_PLAYER_INVALID_STATE; - } - - *caps = gst_caps_to_string(v_caps); - - gst_caps_unref(v_caps); - - return MM_ERROR_NONE; -} diff --git a/src/server/mm_player_resource.c b/src/mm_player_resource.c index f922738..f922738 100644 --- a/src/server/mm_player_resource.c +++ b/src/mm_player_resource.c diff --git a/src/server/mm_player_sound_focus.c b/src/mm_player_sound_focus.c index 88eed87..88eed87 100644 --- a/src/server/mm_player_sound_focus.c +++ b/src/mm_player_sound_focus.c diff --git a/src/server/mm_player_streaming.c b/src/mm_player_streaming.c index dd83d31..dd83d31 100644 --- a/src/server/mm_player_streaming.c +++ b/src/mm_player_streaming.c diff --git a/src/server/mm_player_tracks.c b/src/mm_player_tracks.c index b6b433f..b6b433f 100644 --- a/src/server/mm_player_tracks.c +++ b/src/mm_player_tracks.c diff --git a/src/server/mm_player_utils.c b/src/mm_player_utils.c index 6430cc2..6430cc2 100644 --- a/src/server/mm_player_utils.c +++ b/src/mm_player_utils.c |