#endif
static gboolean
-__mmplayer_is_hls_type(gchar *type) {
- if (g_strrstr(type, "application/x-hls"))
- return TRUE;
- return FALSE;
-}
-
-static gboolean
-__mmplayer_is_mpegts_type(gchar *type) {
- if (g_strrstr(type, "video/mpegts"))
- return TRUE;
- return FALSE;
-}
-
-static gboolean
-__mmplayer_is_mp3_type(gchar *type) {
- if (g_strrstr(type, "application/x-id3") ||
- (g_strrstr(type, "audio/mpeg") && g_strrstr(type, "mpegversion=(int)1")))
- return TRUE;
- return FALSE;
-}
-
-static gboolean
__mmplayer_check_error_posted_from_activated_track(mmplayer_t *player, gchar *src_element_name)
{
/* check whether the error is posted from not-activated track or not */
__mmplayer_handle_streaming_error(mmplayer_t *player, GstMessage *message)
{
LOGD("\n");
- MMMessageParamType msg_param;
+ MMMessageParamType msg_param = {0, };
gchar *msg_src_element = NULL;
GstStructure *s = NULL;
guint error_id = 0;
if (!gst_buffer_map(buffer, &info, GST_MAP_READ)) {\
LOGD("failed to get image data from tag");\
gst_sample_unref(sample);\
- return FALSE;\
+ break;\
} \
SECURE_LOGD("update album cover data : %p, size : %zu", info.data, info.size);\
MMPLAYER_FREEIF(player->album_art);\
return FALSE;
}
- mainbin[elem_id].id = elem_id;
- mainbin[elem_id].gst = decodebin;
-
/* raw pad handling signal */
_mmplayer_add_signal_connection(player, G_OBJECT(decodebin), MM_PLAYER_SIGNAL_TYPE_AUTOPLUG, "pad-added",
G_CALLBACK(_mmplayer_gst_decode_pad_added), (gpointer)player);
gst_object_unref(GST_OBJECT(sinkpad));
gst_element_sync_state_with_parent(decodebin);
+
+ mainbin[elem_id].id = elem_id;
+ mainbin[elem_id].gst = decodebin;
+
MMPLAYER_FLEAVE();
return TRUE;
if (sinkpad)
gst_object_unref(GST_OBJECT(sinkpad));
- if (mainbin[elem_id].gst) {
- gst_element_set_state(mainbin[elem_id].gst, GST_STATE_NULL);
- gst_bin_remove(GST_BIN(mainbin[MMPLAYER_M_PIPE].gst), mainbin[elem_id].gst);
- gst_object_unref(mainbin[elem_id].gst);
- mainbin[elem_id].gst = NULL;
+ if (decodebin) {
+ gst_element_set_state(decodebin, GST_STATE_NULL);
+ if (!gst_bin_remove(GST_BIN(mainbin[MMPLAYER_M_PIPE].gst), decodebin))
+ gst_object_unref(decodebin);
}
MMPLAYER_FLEAVE();
ERROR:
if (mainbin[src_id].gst) {
gst_element_set_state(mainbin[src_id].gst, GST_STATE_NULL);
- gst_bin_remove(GST_BIN(mainbin[MMPLAYER_M_PIPE].gst), mainbin[src_id].gst);
- gst_object_unref(mainbin[src_id].gst);
+ if (!gst_bin_remove(GST_BIN(mainbin[MMPLAYER_M_PIPE].gst), mainbin[src_id].gst))
+ gst_object_unref(mainbin[src_id].gst);
mainbin[src_id].gst = NULL;
}
if (mainbin[queue_id].gst) {
gst_element_set_state(mainbin[queue_id].gst, GST_STATE_NULL);
- gst_bin_remove(GST_BIN(mainbin[MMPLAYER_M_PIPE].gst), mainbin[queue_id].gst);
- gst_object_unref(mainbin[queue_id].gst);
+ if (!gst_bin_remove(GST_BIN(mainbin[MMPLAYER_M_PIPE].gst), mainbin[queue_id].gst))
+ gst_object_unref(mainbin[queue_id].gst);
mainbin[queue_id].gst = NULL;
}
return TRUE;
}
+static GstElement *
+__mmplayer_gst_find_child_element(GstBin *bin, const gchar *element_name)
+{
+ GstIterator *iter = NULL;
+ GValue item = {0, };
+ GstElement *ch_element = NULL;
+ GstElementFactory *ch_factory = NULL;
+
+ MMPLAYER_FENTER();
+ MMPLAYER_RETURN_VAL_IF_FAIL(bin && element_name, NULL);
+
+ iter = gst_bin_iterate_recurse(bin);
+ if (iter != NULL) {
+ while (gst_iterator_next(iter, &item) == GST_ITERATOR_OK) {
+ ch_element = g_value_get_object(&item);
+ ch_factory = gst_element_get_factory(ch_element);
+ LOGD("children factory %s", GST_OBJECT_NAME(ch_factory));
+ if (g_strrstr(GST_OBJECT_NAME(ch_factory), element_name)) {
+ LOGD("Find %s element", element_name);
+ break;
+ }
+ ch_element = NULL;
+ g_value_reset(&item);
+ }
+ gst_iterator_free(iter);
+ }
+
+ MMPLAYER_FLEAVE();
+ return ch_element;
+}
+
static void
__mmplayer_gst_deep_element_added(GstElement *bin, GstBin *child, GstElement *element, gpointer data)
{
/* NOTE : in case of ts streaming, player could not get the correct duration info *
* skip the pull mode(file or ring buffering) setting. */
if (dur_bytes > 0) {
- if (!(__mmplayer_is_mpegts_type(player->type) || __mmplayer_is_hls_type(player->type)
- || __mmplayer_is_mp3_type(player->type))) {
+ if ((!g_strrstr(player->type, "video/mpegts")) && (!g_strrstr(player->type, "application/x-hls"))) {
type = MUXED_BUFFER_TYPE_MEM_RING_BUFFER;
player->streamer->ring_buffer_size = player->ini.http_ring_buffer_size;
}
(guint64)dur_bytes); /* no meaning at the moment */
return;
}
+ }
- /* update mq setting */
- if (g_strrstr(factory_name, "parsebin") && (!mainbin[MMPLAYER_M_DEMUXED_S_BUFFER].gst)) {
- GstIterator *iter = NULL;
- GValue item = {0, };
- GstElement *ch_element = NULL;
- GstElementFactory *ch_factory = NULL;
-
- iter = gst_bin_iterate_recurse(child);
- if (iter != NULL) {
- while (gst_iterator_next(iter, &item) == GST_ITERATOR_OK) {
- ch_element = g_value_get_object(&item);
- ch_factory = gst_element_get_factory(ch_element);
- LOGD("children factory %s", GST_OBJECT_NAME(ch_factory));
- if (g_strrstr(GST_OBJECT_NAME(ch_factory), "multiqueue")) {
- LOGD("get multiqueue");
- player->pipeline->mainbin[MMPLAYER_M_DEMUXED_S_BUFFER].id = MMPLAYER_M_DEMUXED_S_BUFFER;
- player->pipeline->mainbin[MMPLAYER_M_DEMUXED_S_BUFFER].gst = ch_element;
-
- /* in case of multiqueue, max bytes size is defined with fixed value in mm_player_streaming.h */
- _mm_player_streaming_set_multiqueue(player->streamer, ch_element);
- g_value_reset(&item);
- break;
- }
- g_value_reset(&item);
+ if (g_strrstr(factory_name, "parsebin")) {
+ if ((!MMPLAYER_IS_RTSP_STREAMING(player)) && (!mainbin[MMPLAYER_M_DEMUXED_S_BUFFER].gst)) {
+ GstElement *ch_element = __mmplayer_gst_find_child_element(child, "multiqueue");
+ if (ch_element) {
+ player->pipeline->mainbin[MMPLAYER_M_DEMUXED_S_BUFFER].id = MMPLAYER_M_DEMUXED_S_BUFFER;
+ player->pipeline->mainbin[MMPLAYER_M_DEMUXED_S_BUFFER].gst = ch_element;
+
+ /* in case of multiqueue, max bytes size is defined with fixed value in mm_player_streaming.h */
+ if (MMPLAYER_IS_STREAMING(player)) {
+ _mm_player_streaming_set_multiqueue(player->streamer, ch_element);
+ } else {
+ g_object_set(G_OBJECT(ch_element),
+ "max-size-time", (guint64)(5 * GST_SECOND),
+ "use-interleave", FALSE, NULL);
}
- gst_iterator_free(iter);
}
}
- }
-
- if (g_strrstr(factory_name, "parsebin")) {
int video_codec_type = 0;
int audio_codec_type = 0;