Name: libmm-player
Summary: Multimedia Framework Player Library
-Version: 0.5.85
+Version: 0.5.86
Release: 0
Group: Multimedia/Libraries
License: Apache-2.0
gchar videosink_element_overlay[PLAYER_INI_MAX_STRLEN];
gchar videosink_element_evas[PLAYER_INI_MAX_STRLEN];
gchar videosink_element_fake[PLAYER_INI_MAX_STRLEN];
- gchar videosink_element_remote[PLAYER_INI_MAX_STRLEN];
- gchar videosrc_element_remote[PLAYER_INI_MAX_STRLEN];
gchar videoconverter_element[PLAYER_INI_MAX_STRLEN];
+ gchar videocodec_element_hw[PLAYER_INI_MAX_STRLEN];
gchar audioresampler_element[PLAYER_INI_MAX_STRLEN];
gchar audiosink_element[PLAYER_INI_MAX_STRLEN];
gboolean skip_rescan;
#define DEFAULT_VIDEOSINK_OVERLAY "waylandsink"
#define DEFAULT_VIDEOSINK_EVAS "evasimagesink"
#define DEFAULT_VIDEOSINK_FAKE "fakesink"
-#define DEFAULT_VIDEOSINK_REMOTE "shmsink"
-#define DEFAULT_VIDEOSRC_REMOTE "shmsrc"
#define DEFAULT_AUDIORESAMPLER "audioresample"
#define DEFAULT_AUDIOSINK "pulsesink"
+#define DEFAULT_VIDEOCODEC_HW ""
#define DEFAULT_GST_PARAM ""
-#define DEFAULT_EXCLUDE_KEYWORD ""
+#define DEFAULT_EXCLUDE_KEYWORD ""
#define DEFAULT_ASYNC_START TRUE
#define DEFAULT_DISABLE_SEGTRAP TRUE
#define DEFAULT_VIDEO_CONVERTER ""
extern "C" {
#endif
+#define MMPLAYER_RESOURCE_ACQUIRE_TIMEOUT 5
+
+#define MMPLAYER_GET_RESOURCE_LOCK(rm) (&((MMPlayerResourceManager *)rm)->lock)
+#define MMPLAYER_RESOURCE_LOCK(rm) (g_mutex_lock(MMPLAYER_GET_RESOURCE_LOCK(rm)))
+#define MMPLAYER_RESOURCE_UNLOCK(rm) (g_mutex_unlock(MMPLAYER_GET_RESOURCE_LOCK(rm)))
+
+#define MMPLAYER_GET_RESOURCE_COND(rm) (&((MMPlayerResourceManager *)rm)->cond)
+#define MMPLAYER_RESOURCE_WAIT(rm) g_cond_wait(MMPLAYER_GET_RESOURCE_COND(rm), MMPLAYER_GET_RESOURCE_LOCK(rm)
+#define MMPLAYER_RESOURCE_WAIT_UNTIL(rm, end_time) \
+ g_cond_wait_until(MMPLAYER_GET_RESOURCE_COND(rm), MMPLAYER_GET_RESOURCE_LOCK(rm), end_time)
+#define MMPLAYER_RESOURCE_SIGNAL(rm) g_cond_signal(MMPLAYER_GET_RESOURCE_COND(rm));
+
typedef enum {
RESOURCE_TYPE_VIDEO_DECODER,
RESOURCE_TYPE_VIDEO_OVERLAY,
RESOURCE_STATE_MAX,
} MMPlayerResourceState;
-
typedef struct {
mrp_mainloop_t *mloop;
mrp_res_context_t *context;
bool is_connected;
void *user_data;
bool by_rm_cb;
+ GCond cond;
+ GMutex lock;
} MMPlayerResourceManager;
int _mmplayer_resource_manager_init(MMPlayerResourceManager *resource_manager, void *user_data);
MMPLAYER_INI_GET_STRING(dict, ini->videosink_element_overlay, "general:videosink element overlay", DEFAULT_VIDEOSINK_OVERLAY);
MMPLAYER_INI_GET_STRING(dict, ini->videosink_element_evas, "general:videosink element evas", DEFAULT_VIDEOSINK_EVAS);
MMPLAYER_INI_GET_STRING(dict, ini->videosink_element_fake, "general:videosink element fake", DEFAULT_VIDEOSINK_FAKE);
- MMPLAYER_INI_GET_STRING(dict, ini->videosink_element_remote, "general:videosink element remote", DEFAULT_VIDEOSINK_REMOTE);
- MMPLAYER_INI_GET_STRING(dict, ini->videosrc_element_remote, "general:videosrc element remote", DEFAULT_VIDEOSRC_REMOTE);
MMPLAYER_INI_GET_STRING(dict, ini->audioresampler_element, "general:audio resampler element", DEFAULT_AUDIORESAMPLER );
MMPLAYER_INI_GET_STRING(dict, ini->audiosink_element, "general:audiosink element", DEFAULT_AUDIOSINK );
+ MMPLAYER_INI_GET_STRING(dict, ini->videocodec_element_hw, "general:video codec element hw", DEFAULT_VIDEOCODEC_HW);
MMPLAYER_INI_GET_STRING(dict, ini->videoconverter_element, "general:video converter element", DEFAULT_VIDEO_CONVERTER );
__get_element_list(ini,
strncpy( ini->videosink_element_overlay, DEFAULT_VIDEOSINK_OVERLAY, PLAYER_INI_MAX_STRLEN - 1 );
strncpy( ini->videosink_element_evas, DEFAULT_VIDEOSINK_EVAS, PLAYER_INI_MAX_STRLEN - 1 );
strncpy( ini->videosink_element_fake, DEFAULT_VIDEOSINK_FAKE, PLAYER_INI_MAX_STRLEN - 1 );
- strncpy( ini->videosink_element_remote, DEFAULT_VIDEOSINK_REMOTE, PLAYER_INI_MAX_STRLEN - 1 );
- strncpy( ini->videosrc_element_remote, DEFAULT_VIDEOSRC_REMOTE, PLAYER_INI_MAX_STRLEN - 1 );
ini->generate_dot = DEFAULT_GENERATE_DOT;
ini->use_system_clock = DEFAULT_USE_SYSTEM_CLOCK;
ini->live_state_change_timeout = DEFAULT_LIVE_STATE_CHANGE_TIMEOUT;
strncpy( ini->audioresampler_element, DEFAULT_AUDIORESAMPLER, PLAYER_INI_MAX_STRLEN -1 );
strncpy( ini->audiosink_element, DEFAULT_AUDIOSINK, PLAYER_INI_MAX_STRLEN -1 );
+ strncpy( ini->videocodec_element_hw, DEFAULT_VIDEOCODEC_HW, PLAYER_INI_MAX_STRLEN - 1 );
strncpy( ini->videoconverter_element, DEFAULT_VIDEO_CONVERTER, PLAYER_INI_MAX_STRLEN -1 );
__get_element_list(ini, DEFAULT_EXCLUDE_KEYWORD, KEYWORD_EXCLUDE);
LOGD("videosink element overlay: %s\n", ini->videosink_element_overlay);
LOGD("videosink element evas: %s\n", ini->videosink_element_evas);
LOGD("videosink element fake: %s\n", ini->videosink_element_fake);
- LOGD("videosink element remote: %s\n", ini->videosink_element_remote);
- LOGD("videosrc element remote: %s\n", ini->videosrc_element_remote);
LOGD("video converter element : %s\n", ini->videoconverter_element);
+ LOGD("video codec element(hw) : %s\n", ini->videocodec_element_hw);
LOGD("audio resampler element : %s\n", ini->audioresampler_element);
LOGD("audiosink element : %s\n", ini->audiosink_element);
LOGD("generate dot : %d\n", ini->generate_dot);
return;
}
-#ifdef _MM_PLAYER_ALP_PARSER
-void check_name (void *data, void *user_data)
-{
- mm_player_t* player = user_data;
-
- if (g_strrstr((gchar*)data, "mpegaudioparse"))
- {
- LOGD("mpegaudioparse - set alp-mp3dec\n");
- g_object_set(player->pipeline->mainbin[MMPLAYER_M_DEMUX].gst, "alp-mp3dec", TRUE, NULL);
- }
-}
-#endif
-
static GstElement *
__mmplayer_create_decodebin (mm_player_t* player)
{
factory = element_facory;
name_to_plug = GST_OBJECT_NAME(factory);
}
-
- /* make parser alp mode */
- #ifdef _MM_PLAYER_ALP_PARSER
- g_list_foreach (player->parsers, check_name, player);
- #endif
}
}
}
__mmplayer_set_audio_attrs (player, caps);
}
}
- else if ((g_strrstr(klass, "Codec/Decoder/Video")))
+ else if (g_strrstr(klass, "Codec/Decoder/Video"))
{
- if (g_strrstr(factory_name, "omx"))
+ if ((strlen(player->ini.videocodec_element_hw) > 0) &&
+ (g_strrstr(factory_name, player->ini.videocodec_element_hw)))
{
- char *env = getenv ("MM_PLAYER_HW_CODEC_DISABLE");
- if (env != NULL)
- {
- if (strncasecmp(env, "yes", 3) == 0)
- {
- LOGD ("skipping [%s] by disabled\n", factory_name);
- result = GST_AUTOPLUG_SELECT_SKIP;
- goto DONE;
- }
- }
-
/* prepare resource manager for video decoder */
MMPlayerResourceState resource_state = RESOURCE_STATE_NONE;
if (_mmplayer_resource_manager_get_state(&player->resource_manager, &resource_state) == MM_ERROR_NONE)
{
- /* prepare resource manager for video overlay */
+ /* prepare resource manager for video decoder */
if (resource_state >= RESOURCE_STATE_INITIALIZED)
{
if (_mmplayer_resource_manager_prepare(&player->resource_manager, RESOURCE_TYPE_VIDEO_DECODER)
g_object_set(G_OBJECT(element), "http-pull-mp3dec", TRUE, NULL);
}
}
- else if (g_strrstr(factory_name, "omx"))
+ else if (g_strrstr(factory_name, player->ini.videocodec_element_hw))
{
- if (g_strrstr(klass, "Codec/Decoder/Video"))
- {
- gboolean ret = FALSE;
-
- if (player->v_stream_caps != NULL)
- {
- GstPad *pad = gst_element_get_static_pad(element, "sink");
-
- if (pad)
- {
- ret = gst_pad_set_caps(pad, player->v_stream_caps);
- LOGD("found omx decoder, setting gst_pad_set_caps for omx (ret:%d)", ret);
- MMPLAYER_LOG_GST_CAPS_TYPE(player->v_stream_caps);
- gst_object_unref (pad);
- }
- }
- g_object_set (G_OBJECT(element), "state-tuning", TRUE, NULL);
- }
-#ifdef _MM_PLAYER_ALP_PARSER
- if (g_strrstr(factory_name, "omx_mp3dec"))
- {
- g_list_foreach (player->parsers, check_name, player);
- }
-#endif
player->pipeline->mainbin[MMPLAYER_M_DEC1].gst = element;
}
MMPLAYER_FENTER();
- if(!mrp_res_equal_resource_set(rs, player->resource_manager.rset)){
+ if(!mrp_res_equal_resource_set(rs, player->resource_manager.rset)) {
LOGW("- resource set(%p) is not same as this player handle's(%p)", rs, player->resource_manager.rset);
return;
}
- if (rs->state == MRP_RES_RESOURCE_ACQUIRED)
+ if (rs->state == MRP_RES_RESOURCE_ACQUIRED) {
player->resource_manager.state = RESOURCE_STATE_ACQUIRED;
+ MMPLAYER_RESOURCE_LOCK(&player->resource_manager);
+ MMPLAYER_RESOURCE_SIGNAL(&player->resource_manager);
+ MMPLAYER_RESOURCE_UNLOCK(&player->resource_manager);
+ }
+
LOGD(" - resource set state of player(%p) is changed to [%s]\n", player, state_to_str(rs->state));
for (i = 0; i < MRP_RESOURCE_MAX; i++)
{
}
resource_manager->state = RESOURCE_STATE_INITIALIZED;
+ g_mutex_init(&resource_manager->lock);
+ g_cond_init(&resource_manager->cond);
MMPLAYER_FLEAVE();
}
else
{
+ MMPLAYER_RESOURCE_LOCK(resource_manager);
+
ret = mrp_res_acquire_resource_set(resource_manager->rset);
if (ret)
{
LOGE("- could not acquire resource, ret(%d)\n", ret);
ret = MM_ERROR_RESOURCE_INTERNAL;
}
+ else
+ {
+ gint64 end_time = g_get_monotonic_time() + MMPLAYER_RESOURCE_ACQUIRE_TIMEOUT*G_TIME_SPAN_SECOND;
+
+ LOGD("- acquire resource waiting..%p till %lld\n", resource_manager, end_time);
+ if (!MMPLAYER_RESOURCE_WAIT_UNTIL(resource_manager, end_time))
+ {
+ LOGE("- could not acquire resource\n");
+ ret = MM_ERROR_RESOURCE_INTERNAL;
+ } else {
+ LOGD("- resources are acquired\n");
+ }
+ }
+
+ MMPLAYER_RESOURCE_UNLOCK(resource_manager);
}
}
}
resource_manager->state = RESOURCE_STATE_NONE;
+ g_mutex_clear(&resource_manager->lock);
+ g_cond_clear(&resource_manager->cond);
MMPLAYER_FLEAVE();