summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsh95.park <sh95.park@samsung.com>2015-07-24 13:52:13 +0900
committersh95.park <sh95.park@samsung.com>2015-07-24 14:43:26 +0900
commita8bdf2e3760a3bf64661c0c0847793ab4a865568 (patch)
tree13d6f54ef3c01511d81a796aa5178a21aa0e7929
parente361aba3b0a37edd602ed87b47d8e634fa2d29bc (diff)
downloadtv-player-a8bdf2e3760a3bf64661c0c0847793ab4a865568.tar.gz
tv-player-a8bdf2e3760a3bf64661c0c0847793ab4a865568.tar.bz2
tv-player-a8bdf2e3760a3bf64661c0c0847793ab4a865568.zip
Change-Id: I2d3cea96bc4e6deb1b285cbf92e0f3b5bb0d9530 Signed-off-by: sh95.park <sh95.park@samsung.com>
-rwxr-xr-xlibtv_player_solution/tv_stream_open_source.c42
-rwxr-xr-xlibtv_player_solution_tests/player_dtv_overlay/tv_player_dtv_overlay_test.c4
-rwxr-xr-xtv_player/src/include/tv_stream.h2
-rwxr-xr-xtv_player/src/include/tv_stream_base.h2
-rwxr-xr-xtv_player/src/stream/tv_stream.c4
5 files changed, 38 insertions, 16 deletions
diff --git a/libtv_player_solution/tv_stream_open_source.c b/libtv_player_solution/tv_stream_open_source.c
index 2ca3221..29abbe2 100755
--- a/libtv_player_solution/tv_stream_open_source.c
+++ b/libtv_player_solution/tv_stream_open_source.c
@@ -129,7 +129,7 @@ static int _tv_stream_open_source_set_video_aspect_ratio (GTvStreamBase *stream,
static bool _tv_stream_open_source_get_video_mute (GTvStreamBase *stream);
static int _tv_stream_open_source_set_v4l2_device (GTvStreamBase *stream, gchar *device);
static int _tv_stream_open_source_set_alsasrc_device (GTvStreamBase *stream, gchar *device);
-static int _tv_stream_open_source_set_window_id(GTvStreamBase *stream, guintptr surface_handle, guintptr display_handle);
+static int _tv_stream_open_source_set_window_id(GTvStreamBase *stream, guintptr handle);
static int _tv_stream_open_source_start_monitor(GTvStreamBase *stream, TvSectionCmdType type, gpointer data, gulong *section_id, gint user_param);
static int _tv_stream_open_source_stop_monitor(GTvStreamBase *stream, gulong filter_handler);
static int tv_stream_open_source_monitor_gcompare_handle (gconstpointer data, gconstpointer user_data);
@@ -204,16 +204,39 @@ tv_stream_open_source_set_state (GTvStreamOpenSource *stream, GstState state)
{
GstStateChangeReturn state_ret = GST_STATE_CHANGE_SUCCESS;
GTvStreamBase *base = G_TV_STREAM_BASE_CAST(stream);
+ GstState _state = GST_STATE_VOID_PENDING;
+ GstState _pending_state = GST_STATE_VOID_PENDING;
return_val_if_fail (stream, TV_PLAYER_NOT_INITIALIZED);
return_val_if_fail (base->pipeline, TV_PLAYER_NOT_INITIALIZED);
TV_PLAYER_DEBUG ("set pipeline state %s", gst_element_state_get_name (state));
state_ret = gst_element_set_state(base->pipeline, state);
+ TV_PLAYER_DEBUG ("after set state, current state [%d]", state_ret);
+
if (GST_STATE_CHANGE_FAILURE == state_ret) {
TV_PLAYER_ERROR("pipeline change state fail.");
return TV_PLAYER_INVALID_STATE;
}
+
+ if (state == GST_STATE_NULL || state == GST_STATE_READY) {
+ TV_PLAYER_DEBUG ("changes to state is NULL or READY");
+ state_ret = gst_element_get_state(base->pipeline, &_state, &_pending_state, GST_CLOCK_TIME_NONE);
+ TV_PLAYER_DEBUG ("get pipeline state %s", gst_element_state_get_name (_state));
+ if (state_ret == GST_STATE_CHANGE_FAILURE || (state != _state)) {
+ TV_PLAYER_ERROR("failed to change [%s] element state to [%s] within %d sec\n",
+ GST_ELEMENT_NAME(base->pipeline),
+ gst_element_state_get_name(_state), GST_CLOCK_TIME_NONE);
+
+ TV_PLAYER_ERROR("[%s] state : %s pending : %s \n",
+ GST_ELEMENT_NAME(base->pipeline),
+ gst_element_state_get_name(_state),
+ gst_element_state_get_name(_pending_state));
+
+ return TV_PLAYER_INVALID_STATE;
+ }
+ }
+
return TV_PLAYER_ERROR_NONE;
}
@@ -1369,21 +1392,22 @@ static gboolean _tv_stream_open_source_bus_call (GstBus *bus, GstMessage *msg, g
return ret;
}
-static int _tv_stream_open_source_set_window_id(GTvStreamBase *stream, guintptr surface_handle, guintptr display_handle)
+static int _tv_stream_open_source_set_window_id(GTvStreamBase *stream, guintptr handle)
{
return_val_if_fail (stream, TV_PLAYER_NOT_INITIALIZED);
- return_val_if_fail (surface_handle, TV_PLAYER_NOT_INITIALIZED);
- return_val_if_fail (display_handle, TV_PLAYER_NOT_INITIALIZED);
+ return_val_if_fail (handle, TV_PLAYER_NOT_INITIALIZED);
GTvStreamOpenSource *streaming = (GTvStreamOpenSource *)stream;
GstContext *context = NULL;
+ void* wl_display = NULL;
- if (display_handle)
- context = gst_wayland_display_handle_context_new(display_handle);
- if (context)
+ wl_display = (void *)ecore_wl_display_get();
+ if(wl_display)
+ context = gst_wayland_display_handle_context_new(wl_display);
+ if(context)
gst_element_set_context(GST_ELEMENT(streaming->waylandsink), context);
- TV_PLAYER_DEBUG("stream_name = %d, stream = %p, handle = %p", stream->name, stream, surface_handle);
- gst_video_overlay_set_window_handle (GST_VIDEO_OVERLAY (streaming->waylandsink), (int *)surface_handle);
+ TV_PLAYER_DEBUG("stream_name = %d, stream = %p, handle = %p", stream->name, stream, handle);
+ gst_video_overlay_set_window_handle (GST_VIDEO_OVERLAY (streaming->waylandsink), (int *)handle);
/* After setting window handle, set render rectangle */
gst_video_overlay_set_render_rectangle(
diff --git a/libtv_player_solution_tests/player_dtv_overlay/tv_player_dtv_overlay_test.c b/libtv_player_solution_tests/player_dtv_overlay/tv_player_dtv_overlay_test.c
index 7d9bcb7..d3a40e0 100755
--- a/libtv_player_solution_tests/player_dtv_overlay/tv_player_dtv_overlay_test.c
+++ b/libtv_player_solution_tests/player_dtv_overlay/tv_player_dtv_overlay_test.c
@@ -302,12 +302,10 @@ int main(int argc, char **argv)
#ifdef WAYLAND
Ecore_Wl_Window *wl_win = elm_win_wl_window_get(win);
void* wl_surf=NULL;
- void* wl_display = NULL;
wl_surf = (void *)ecore_wl_window_surface_get(wl_win);
- wl_display = (void *)ecore_wl_display_get();
g_print("@@@ wl_win:%p wl_surf:%p\n",wl_win, wl_surf);
#endif
- tv_stream_set_window_id (stream, wl_surf, wl_display);
+ tv_stream_set_window_id (stream, wl_surf);
if (12 == argc) {
result = tv_stream_set_tune_full(stream, freq, mod, NULL, vpid, apid, ppid);
diff --git a/tv_player/src/include/tv_stream.h b/tv_player/src/include/tv_stream.h
index 906c02e..cbd8d7c 100755
--- a/tv_player/src/include/tv_stream.h
+++ b/tv_player/src/include/tv_stream.h
@@ -919,7 +919,7 @@ int tv_stream_unset_section_callback(TVStream stream);
* @param handle [in] handle ID of video window
* @return TV_PLAYER_ERROR_NONE for success.
*/
-int tv_stream_set_window_id(TVStream stream, guintptr surface_handle, guintptr display_handle );
+int tv_stream_set_window_id(TVStream stream, guintptr handle );
/**
* tv_stream_set_caption_window_id:
diff --git a/tv_player/src/include/tv_stream_base.h b/tv_player/src/include/tv_stream_base.h
index 483f9fb..e02e5c2 100755
--- a/tv_player/src/include/tv_stream_base.h
+++ b/tv_player/src/include/tv_stream_base.h
@@ -124,7 +124,7 @@ struct _GTvStreamBaseClass {
int (*tv_stream_set_section_callback) (GTvStreamBase *stream, TVStreamSectionCallback callback);
int (*tv_stream_unset_section_callback) (GTvStreamBase *stream);
- int (*tv_stream_set_window_id) (TVStream stream, guintptr surface_handle, guintptr display_handle );
+ int (*tv_stream_set_window_id) (TVStream stream, guintptr handle);
int (*tv_stream_start) (GTvStreamBase *stream);
int (*tv_stream_stop) (GTvStreamBase *stream);
diff --git a/tv_player/src/stream/tv_stream.c b/tv_player/src/stream/tv_stream.c
index 62aeae1..eafef81 100755
--- a/tv_player/src/stream/tv_stream.c
+++ b/tv_player/src/stream/tv_stream.c
@@ -478,7 +478,7 @@ int tv_stream_unset_section_callback(TVStream stream)
return ret;
}
-int tv_stream_set_window_id (TVStream stream, guintptr surface_handle, guintptr display_handle )
+int tv_stream_set_window_id (TVStream stream, guintptr handle )
{
return_val_if_fail (stream, TV_PLAYER_NOT_INITIALIZED);
GTvStreamBase *base = G_TV_STREAM_BASE_CAST (stream);
@@ -486,7 +486,7 @@ int tv_stream_set_window_id (TVStream stream, guintptr surface_handle, guintptr
int ret = TV_PLAYER_ERROR_NONE;
if (class->tv_stream_set_window_id)
- ret = class->tv_stream_set_window_id (base, surface_handle, display_handle);
+ ret = class->tv_stream_set_window_id (base, handle);
return ret;
}