}
#endif
-static void
-__mmplayer_videostream_cb(GstElement *element, void *data,
-int width, int height, gpointer user_data) // @
-{
- mm_player_t* player = (mm_player_t*)user_data;
-
- MMPLAYER_RETURN_IF_FAIL ( player );
-
- MMPLAYER_FENTER();
-
- if (player->is_drm_file)
- {
- MMMessageParamType msg_param = { 0, };
- LOGW("not supported in drm file");
- msg_param.code = MM_ERROR_PLAYER_DRM_OUTPUT_PROTECTION;
- MMPLAYER_POST_MSG( player, MM_MESSAGE_ERROR, &msg_param );
- }
- else if ( !player->set_mode.media_packet_video_stream && player->video_stream_cb)
- {
- MMPlayerVideoStreamDataType stream;
-
- /* clear stream data structure */
- memset(&stream, 0x0, sizeof(MMPlayerVideoStreamDataType));
-
- stream.data[0] = data;
- stream.length_total = width * height * 4; // for rgb 32bit
- stream.height = height;
- stream.width = width;
- player->video_stream_cb(&stream, player->video_stream_cb_user_param);
- }
-
- MMPLAYER_FLEAVE();
-}
-
/* This function should be called after the pipeline goes PAUSED or higher
state. */
gboolean
case GST_STATE_PAUSED:
{
gboolean prepare_async = FALSE;
- gboolean is_drm = FALSE;
if ( ! player->audio_cb_probe_id && player->set_mode.pcm_extraction && !player->audio_stream_render_cb_ex)
__mmplayer_configure_audio_callback(player);
player->total_maximum_bitrate, player->total_bitrate);
}
}
-
- /* NOTE : should consider streaming case */
- /* check if drm file */
- if ((player->pipeline->mainbin[MMPLAYER_M_SRC].gst) &&
- (g_object_class_find_property(G_OBJECT_GET_CLASS(player->pipeline->mainbin[MMPLAYER_M_SRC].gst), "is-drm")))
- {
- g_object_get(G_OBJECT(player->pipeline->mainbin[MMPLAYER_M_SRC].gst), "is-drm", &is_drm, NULL);
-
- if (is_drm)
- {
- player->is_drm_file = TRUE;
- }
- }
}
break;
mm_attrs_get_int_by_name (player->attrs, "display_surface_type", &stype);
/* don't make video because of not required, and not support multiple track */
- if (stype == MM_DISPLAY_SURFACE_NULL || stype == MM_DISPLAY_SURFACE_REMOTE)
+ if (stype == MM_DISPLAY_SURFACE_NULL)
{
LOGD ("no video sink by null surface or multiple track (%d)", stype);
MMPlayerResourceState resource_state = RESOURCE_STATE_NONE;
== MM_ERROR_NONE)
{
/* acquire resources for video playing */
- if (resource_state >= RESOURCE_STATE_PREPARED)
+ if (resource_state == RESOURCE_STATE_PREPARED)
{
if (_mmplayer_resource_manager_acquire(&player->resource_manager)
!= MM_ERROR_NONE)
gst_element_set_state (selector, GST_STATE_PAUSED);
gst_bin_add (GST_BIN(pipeline), selector);
- }
- else
- {
+ } else
LOGD ("input-selector is already created.\n");
- selector = player->pipeline->mainbin[elemId].gst;
- }
// link
LOGD ("Calling request pad with selector %p \n", selector);
mm_attrs_get_int_by_name(player->attrs, "display_surface_type", &surface_type);
LOGD("display_surface_type (%d)\n", surface_type);
- if (surface_type == MM_DISPLAY_SURFACE_NULL || surface_type == MM_DISPLAY_SURFACE_REMOTE)
- {
+ if (surface_type == MM_DISPLAY_SURFACE_NULL) {
LOGD("not make videobin because it dose not want\n");
goto ERROR;
}
== MM_ERROR_NONE)
{
/* acquire resources for video playing */
- if (resource_state >= RESOURCE_STATE_PREPARED)
+ if (resource_state == RESOURCE_STATE_PREPARED)
{
if (_mmplayer_resource_manager_acquire(&player->resource_manager)
!= MM_ERROR_NONE)
return MM_ERROR_NONE;
}
-void
-__mmplayer_update_video_stream_callback_video_param(mm_player_t* player)
-{
- MMHandleType attrs = 0;
- int org_angle = 0; // current supported angle values are 0, 90, 180, 270
- int user_angle = 0;
- int rotation_value = 0;
- MMPLAYER_FENTER();
-
- /* check video sinkbin is created */
- if(MM_ERROR_NONE != __mmplayer_video_param_check_video_sink_bin(player))
- return;
-
- attrs = MMPLAYER_GET_ATTRS(player);
- MMPLAYER_RETURN_IF_FAIL (attrs);
-
- __mmplayer_get_video_angle(player, &user_angle, &org_angle);
-
- if (player->set_mode.video_zc)
- {
- gchar *ename = NULL;
- int width = 0;
- int height = 0;
-
- mm_attrs_get_int_by_name(attrs, "display_width", &width);
- mm_attrs_get_int_by_name(attrs, "display_height", &height);
-
- /* resize video frame with requested values for fimcconvert */
- MMPLAYER_RETURN_IF_FAIL (player->pipeline->videobin[MMPLAYER_V_CONV].gst);
-
- ename = GST_OBJECT_NAME(gst_element_get_factory(player->pipeline->videobin[MMPLAYER_V_CONV].gst));
-
- if (ename && g_strrstr(ename, "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);
-
- /* 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);
-
- /* get rotation value to set */
- __mmplayer_get_property_value_for_rotation(player, org_angle+user_angle, &rotation_value);
-
- g_object_set(player->pipeline->videobin[MMPLAYER_V_CONV].gst, "rotate", rotation_value, NULL);
-
- LOGD("updating fimcconvert - r[%d], w[%d], h[%d]", rotation_value, width, height);
- }
- }
- else
- {
- LOGD("using video stream callback with memsink. player handle : [%p]", player);
- MMPLAYER_RETURN_IF_FAIL (player->pipeline->videobin[MMPLAYER_V_FLIP].gst);
-
- /* get rotation value to set */
- __mmplayer_get_property_value_for_rotation(player, org_angle+user_angle, &rotation_value);
-
- g_object_set(player->pipeline->videobin[MMPLAYER_V_FLIP].gst, "method", rotation_value, NULL);
- }
-
-}
-
int
_mmplayer_update_video_param(mm_player_t* player, char *param_name) // @
{
}
LOGD("param_name : %s", param_name);
- /* check video stream callback is used */
- if(!player->set_mode.media_packet_video_stream && player->use_video_stream )
- {
- __mmplayer_update_video_stream_callback_video_param(player);
- return MM_ERROR_NONE;
- }
-
/* update display surface */
mm_attrs_get_int_by_name(attrs, "display_surface_type", &surface_type);
LOGD("check display surface type attribute: %d", surface_type);
}
static int
-__mmplayer_gst_create_video_filters(mm_player_t* player, GList** bucket, gboolean use_video_stream)
+__mmplayer_gst_create_video_filters(mm_player_t* player, GList** bucket)
{
+ MMDisplaySurfaceType surface_type = MM_DISPLAY_SURFACE_NULL;
gchar* video_csc = "videoconvert"; // default colorspace converter
GList* element_bucket = *bucket;
MMPLAYER_FENTER();
- if (!player->set_mode.media_packet_video_stream && use_video_stream)
+ mm_attrs_get_int_by_name (player->attrs, "display_surface_type", (int *)&surface_type);
+
+ if (player->set_mode.video_zc) /* ST12 or SN12 , if player use omx, evasimagesink doesn't use videoconvert */
{
- if (player->set_mode.video_zc && strlen(player->ini.videoconverter_element) > 0)
+ if ( (surface_type == MM_DISPLAY_SURFACE_EVAS) && ( !strcmp(player->ini.videosink_element_evas, "evasimagesink")) )
{
video_csc = player->ini.videoconverter_element;
}
-
- MMPLAYER_CREATE_ELEMENT(player->pipeline->videobin, MMPLAYER_V_CONV, video_csc, "video converter", TRUE, player);
- LOGD("using video converter: %s", video_csc);
-
- if ( !player->set_mode.video_zc)
+ else
{
- gint width = 0; //width of video
- gint height = 0; //height of video
- GstCaps* video_caps = NULL;
- GstStructure *structure = NULL;
-
- /* rotator, scaler and capsfilter */
- MMPLAYER_CREATE_ELEMENT(player->pipeline->videobin, MMPLAYER_V_FLIP, "videoflip", "video rotator", TRUE, player);
- MMPLAYER_CREATE_ELEMENT(player->pipeline->videobin, MMPLAYER_V_SCALE, "videoscale", "video scaler", TRUE, player);
- MMPLAYER_CREATE_ELEMENT(player->pipeline->videobin, MMPLAYER_V_CAPS, "capsfilter", "videocapsfilter", TRUE, player);
-
- /* get video stream caps parsed by demuxer */
-
- mm_attrs_get_int_by_name(player->attrs, "display_width", &width);
-
- if(width)
- structure = gst_structure_new("video/x-raw", "width", G_TYPE_INT, width, NULL);
-
- mm_attrs_get_int_by_name(player->attrs, "display_height", &height);
-
- if(structure && height) {
- gst_structure_set (structure, "height", G_TYPE_INT, height, NULL);
-
- video_caps = gst_caps_new_full(structure, NULL);
- g_object_set (GST_ELEMENT(player->pipeline->videobin[MMPLAYER_V_CAPS].gst), "caps", video_caps, NULL );
- MMPLAYER_LOG_GST_CAPS_TYPE(video_caps);
- gst_caps_unref(video_caps);
- }
- else
- LOGE("fail to set capsfilter %p, width %d, height %d", structure, width, height);
-
- if(structure)
- gst_structure_free(structure);
-
+ video_csc = ""; /* Videosinks don't use videoconvert except evasimagesink which use normal video formats */
}
}
- else
+ else /* sw codec, if player use libav, waylandsink need videoconvert to render shm wl-buffer which support RGB only */
{
- MMDisplaySurfaceType surface_type = MM_DISPLAY_SURFACE_NULL;
- mm_attrs_get_int_by_name (player->attrs, "display_surface_type", (int *)&surface_type);
-
- if (player->set_mode.video_zc) /* ST12 or SN12 , if player use omx, evasimagesink doesn't use videoconvert */
- {
- if ( (surface_type == MM_DISPLAY_SURFACE_EVAS) && ( !strcmp(player->ini.videosink_element_evas, "evasimagesink")) )
- {
- video_csc = player->ini.videoconverter_element;
- }
- else
- {
- video_csc = ""; /* Videosinks don't use videoconvert except evasimagesink which use normal video formats */
- }
- }
- else /* sw codec, if player use libav, waylandsink need videoconvert to render shm wl-buffer which support RGB only */
- {
- if ((surface_type == MM_DISPLAY_SURFACE_OVERLAY) && (!strncmp(player->ini.videosink_element_overlay, "waylandsink", strlen(player->ini.videosink_element_overlay))))
- {
- video_csc = "videoconvert";
- }
- }
- if (video_csc && (strcmp(video_csc, "")))
+ if ((surface_type == MM_DISPLAY_SURFACE_OVERLAY) && (!strncmp(player->ini.videosink_element_overlay, "waylandsink", strlen(player->ini.videosink_element_overlay))))
{
- MMPLAYER_CREATE_ELEMENT(player->pipeline->videobin, MMPLAYER_V_CONV, video_csc, "video converter", TRUE, player);
- LOGD("using video converter: %s", video_csc);
+ video_csc = "videoconvert";
}
+ }
+ if (video_csc && (strcmp(video_csc, "")))
+ {
+ MMPLAYER_CREATE_ELEMENT(player->pipeline->videobin, MMPLAYER_V_CONV, video_csc, "video converter", TRUE, player);
+ LOGD("using video converter: %s", video_csc);
+ }
- /* set video rotator */
- if ( !player->set_mode.video_zc )
- MMPLAYER_CREATE_ELEMENT(player->pipeline->videobin, MMPLAYER_V_FLIP, "videoflip", "video rotator", TRUE, player);
+ /* set video rotator */
+ if ( !player->set_mode.video_zc )
+ MMPLAYER_CREATE_ELEMENT(player->pipeline->videobin, MMPLAYER_V_FLIP, "videoflip", "video rotator", TRUE, player);
- /* videoscaler */
- #if !defined(__arm__)
- MMPLAYER_CREATE_ELEMENT(player->pipeline->videobin, MMPLAYER_V_SCALE, "videoscale", "videoscaler", TRUE, player);
- #endif
- }
+ /* videoscaler */
+ #if !defined(__arm__)
+ MMPLAYER_CREATE_ELEMENT(player->pipeline->videobin, MMPLAYER_V_SCALE, "videoscale", "videoscaler", TRUE, player);
+ #endif
*bucket = element_bucket;
MMPLAYER_FLEAVE();
goto ERROR;
}
- if( player->use_video_stream ) // video stream callback, so send raw video data to application
- {
- LOGD("using memsink\n");
-
- if ( __mmplayer_gst_create_video_filters(player, &element_bucket, TRUE) != MM_ERROR_NONE)
+ if (!player->set_mode.media_packet_video_stream) {
+ if (__mmplayer_gst_create_video_filters(player, &element_bucket) != MM_ERROR_NONE)
goto ERROR;
-
- /* finally, create video sink. output will be BGRA8888. */
- MMPLAYER_CREATE_ELEMENT(videobin, MMPLAYER_V_SINK, "avsysmemsink", "videosink", TRUE, player);
-
- MMPLAYER_SIGNAL_CONNECT( player,
- videobin[MMPLAYER_V_SINK].gst,
- MM_PLAYER_SIGNAL_TYPE_VIDEOBIN,
- "video-stream",
- G_CALLBACK(__mmplayer_videostream_cb),
- player );
}
- else // render video data using sink plugin like xvimagesink
- {
- if ( __mmplayer_gst_create_video_filters(player, &element_bucket, FALSE) != MM_ERROR_NONE)
- goto ERROR;
- /* set video sink */
- switch (surface_type)
- {
- case MM_DISPLAY_SURFACE_OVERLAY:
- if (strlen(player->ini.videosink_element_overlay) > 0)
- videosink_element = player->ini.videosink_element_overlay;
- else
- goto ERROR;
- break;
- case MM_DISPLAY_SURFACE_EVAS:
- if (strlen(player->ini.videosink_element_evas) > 0)
- videosink_element = player->ini.videosink_element_evas;
- else
- goto ERROR;
- break;
- case MM_DISPLAY_SURFACE_NULL:
- if (strlen(player->ini.videosink_element_fake) > 0)
- videosink_element = player->ini.videosink_element_fake;
- else
- goto ERROR;
- break;
- case MM_DISPLAY_SURFACE_REMOTE:
- if (strlen(player->ini.videosink_element_fake) > 0)
- videosink_element = player->ini.videosink_element_fake;
- else
- goto ERROR;
- break;
- default:
- LOGE("unidentified surface type");
+ /* set video sink */
+ switch (surface_type)
+ {
+ case MM_DISPLAY_SURFACE_OVERLAY:
+ if (strlen(player->ini.videosink_element_overlay) > 0)
+ videosink_element = player->ini.videosink_element_overlay;
+ else
goto ERROR;
- }
+ break;
+ case MM_DISPLAY_SURFACE_EVAS:
+ if (strlen(player->ini.videosink_element_evas) > 0)
+ videosink_element = player->ini.videosink_element_evas;
+ else
+ goto ERROR;
+ break;
+ case MM_DISPLAY_SURFACE_NULL:
+ if (strlen(player->ini.videosink_element_fake) > 0)
+ videosink_element = player->ini.videosink_element_fake;
+ else
+ goto ERROR;
+ break;
+ case MM_DISPLAY_SURFACE_REMOTE:
+ if (strlen(player->ini.videosink_element_fake) > 0)
+ videosink_element = player->ini.videosink_element_fake;
+ else
+ goto ERROR;
+ break;
+ default:
+ LOGE("unidentified surface type");
+ goto ERROR;
+ }
+ LOGD("selected videosink name: %s", videosink_element);
- MMPLAYER_CREATE_ELEMENT(videobin, MMPLAYER_V_SINK, videosink_element, videosink_element, TRUE, player);
- LOGD("selected videosink name: %s", videosink_element);
+ MMPLAYER_CREATE_ELEMENT(videobin, MMPLAYER_V_SINK, videosink_element, videosink_element, TRUE, player);
- /* additional setting for sink plug-in */
- switch (surface_type) {
- case MM_DISPLAY_SURFACE_OVERLAY:
+ /* additional setting for sink plug-in */
+ switch (surface_type) {
+ case MM_DISPLAY_SURFACE_OVERLAY:
+ {
+ bool use_tbm = player->set_mode.video_zc;
+ if (!use_tbm)
{
- bool use_tbm = player->set_mode.video_zc;
- if (!use_tbm)
- {
- LOGD("selected videosink name: %s", videosink_element);
+ LOGD("selected videosink name: %s", videosink_element);
- /* support shard memory with S/W codec on HawkP */
- if(strncmp(videosink_element, "waylandsink", strlen(videosink_element)) == 0)
- {
- g_object_set(player->pipeline->videobin[MMPLAYER_V_SINK].gst,
- "use-tbm", use_tbm, NULL);
- }
+ /* support shard memory with S/W codec on HawkP */
+ if(strncmp(videosink_element, "waylandsink", strlen(videosink_element)) == 0)
+ {
+ g_object_set(player->pipeline->videobin[MMPLAYER_V_SINK].gst,
+ "use-tbm", use_tbm, NULL);
}
- else
+ }
+ else
+ {
+ if (attrs)
{
- if (attrs)
- {
- int gapless = 0;
+ int gapless = 0;
- mm_attrs_get_int_by_name (attrs, "gapless_mode", &gapless);
+ mm_attrs_get_int_by_name (attrs, "gapless_mode", &gapless);
- if (gapless > 0) {
- LOGD("disable last-sample");
- g_object_set(player->pipeline->videobin[MMPLAYER_V_SINK].gst, "enable-last-sample", FALSE, NULL);
- }
+ if (gapless > 0) {
+ LOGD("disable last-sample");
+ g_object_set(player->pipeline->videobin[MMPLAYER_V_SINK].gst, "enable-last-sample", FALSE, NULL);
}
}
- break;
- }
- case MM_DISPLAY_SURFACE_REMOTE:
- {
- break;
}
- default:
- break;
+ break;
+ }
+ case MM_DISPLAY_SURFACE_REMOTE:
+ {
+ if (player->set_mode.media_packet_video_stream) {
+ GstPad* sinkpad = NULL;
+ sinkpad = gst_element_get_static_pad (player->pipeline->videobin[MMPLAYER_V_SINK].gst, "sink");
+ g_object_set (player->pipeline->videobin[MMPLAYER_V_SINK].gst, "sync", TRUE, NULL);
+
+ LOGE("add data probe at videosink");
+ player->video_cb_probe_id = gst_pad_add_probe (sinkpad, GST_PAD_PROBE_TYPE_BUFFER, __mmplayer_video_stream_probe, player, NULL);
+ }
+ break;
}
+ default:
+ break;
}
if (_mmplayer_update_video_param(player, "update_all_param") != MM_ERROR_NONE)
MMPLAYER_RETURN_VAL_IF_FAIL ( player, MM_ERROR_PLAYER_NOT_INITIALIZED );
+ if (callback && !player->bufmgr)
+ player->bufmgr = tbm_bufmgr_init(-1);
+
+ player->set_mode.media_packet_video_stream = (callback)?TRUE:FALSE;
player->video_stream_cb = callback;
player->video_stream_cb_user_param = user_param;
- player->use_video_stream = TRUE;
- LOGD("Stream cb Handle value is %p : %p\n", player, player->video_stream_cb);
+
+ LOGD("Stream cb Handle value is %p : %p, enable:%d\n", player, player->video_stream_cb, player->set_mode.media_packet_video_stream);
MMPLAYER_FLEAVE();
player->msg_posted = FALSE;
player->has_many_types = FALSE;
player->no_more_pad = FALSE;
- player->is_drm_file = FALSE;
player->not_found_demuxer = 0;
player->doing_seek = FALSE;
player->max_audio_channels = 0;
mm_attrs_get_int_by_name (player->attrs, "display_surface_type", &stype);
/* don't make video because of not required */
- if (stype == MM_DISPLAY_SURFACE_NULL || stype == MM_DISPLAY_SURFACE_REMOTE)
+ if ((stype == MM_DISPLAY_SURFACE_NULL) &&
+ (player->set_mode.media_packet_video_stream == FALSE))
{
- if (player->set_mode.media_packet_video_stream == FALSE
- && !player->video_stream_cb)
- {
- LOGD ("no video because it's not required. -> return expose");
- result = GST_AUTOPLUG_SELECT_EXPOSE;
- goto DONE;
- }
+ LOGD ("no video because it's not required. -> return expose");
+ result = GST_AUTOPLUG_SELECT_EXPOSE;
+ goto DONE;
}
/* get w/h for omx state-tune */
MMPLAYER_RETURN_IF_FAIL ( player );
- player->use_video_stream = FALSE;
player->video_stream_cb = NULL;
player->video_stream_cb_user_param = NULL;
player->pending_seek.pos = 0;
player->msg_posted = FALSE;
player->has_many_types = FALSE;
- player->is_drm_file = FALSE;
player->max_audio_channels = 0;
player->video_share_api_delta = 0;
player->video_share_clock_delta = 0;
__mmplayer_can_extract_pcm( mm_player_t* player )
{
MMHandleType attrs = 0;
- gboolean is_drm = FALSE;
gboolean sound_extraction = FALSE;
MMPLAYER_RETURN_VAL_IF_FAIL ( player, FALSE );
attrs = MMPLAYER_GET_ATTRS(player);
- if ( !attrs )
+ if (!attrs)
{
LOGE("fail to get attributes.");
return FALSE;
}
- /* check file is drm or not */
- if (g_object_class_find_property(G_OBJECT_GET_CLASS(player->pipeline->mainbin[MMPLAYER_M_SRC].gst), "is-drm"))
- g_object_get(G_OBJECT(player->pipeline->mainbin[MMPLAYER_M_SRC].gst), "is-drm", &is_drm, NULL);
-
/* get sound_extraction property */
mm_attrs_get_int_by_name(attrs, "pcm_extraction", &sound_extraction);
- if ( ! sound_extraction || is_drm )
+ if (!sound_extraction)
{
- LOGD("checking pcm extraction mode : %d, drm : %d", sound_extraction, is_drm);
+ LOGD("checking pcm extraction mode : %d ", sound_extraction);
return FALSE;
}
return MM_ERROR_NONE;
}
-int
-_mmplayer_enable_media_packet_video_stream(MMHandleType hplayer, bool enable)
-{
- mm_player_t* player = (mm_player_t*) hplayer;
-
- MMPLAYER_FENTER();
- MMPLAYER_RETURN_VAL_IF_FAIL (player, MM_ERROR_PLAYER_NOT_INITIALIZED);
-
- if (enable && !player->bufmgr)
- player->bufmgr = tbm_bufmgr_init(-1);
-
- player->set_mode.media_packet_video_stream = enable;
-
- MMPLAYER_FLEAVE();
-
- return MM_ERROR_NONE;
-}
-
void * _mm_player_media_packet_video_stream_internal_buffer_ref(void *buffer)
{
void * ret = NULL