emotion: fix priority_set/get

Patch by Sohyun Kim <anna1014.kim@samsung.com>


SVN revision: 75495
This commit is contained in:
Cedric BAIL 2012-08-21 09:17:38 +00:00
parent 3ec12202f9
commit 36bc7b270b
6 changed files with 48 additions and 5 deletions

View File

@ -37,3 +37,7 @@
2012-08-01 Cedric Bail
* Fix race condition in gstreamer render function.
2012-08-10 Sohyun Kim
* Fix priority set/get for gstreamer.

View File

@ -14,6 +14,7 @@ Fixes:
- build out of tree.
- stride of all YUV video
- fix race condition in gstreamer render function on shutdown and file set.
- fix priority set/get for gstreamer.
Improvements:

View File

@ -25,6 +25,7 @@ enum _Thread_Events {
EM_THREAD_POSITION_CHANGED,
EM_THREAD_PLAYBACK_STARTED,
EM_THREAD_PLAYBACK_STOPPED,
EM_THREAD_EOF,
EM_THREAD_LAST
};
@ -311,6 +312,7 @@ _play(struct _App *app)
else
{
libvlc_time_t new_time = pos * 1000;
fprintf(stderr, "pos %f\n", pos);
libvlc_media_player_set_time(app->mp, new_time);
libvlc_media_player_play(app->mp);
app->playing = 1;
@ -371,9 +373,11 @@ _event_cb(const struct libvlc_event_t *ev, void *data)
_send_file_set(app);
break;
case libvlc_MediaPlayerEndReached:
thread_event = EM_THREAD_PLAYBACK_STOPPED;
write(app->fd_write, &thread_event, sizeof(thread_event));
break;
thread_event = EM_THREAD_EOF;
write(app->fd_write, &thread_event, sizeof(thread_event));
/* thread_event = EM_THREAD_PLAYBACK_STOPPED; */
/* write(app->fd_write, &thread_event, sizeof(thread_event)); */
break;
}
}
@ -739,6 +743,10 @@ _process_thread_events(struct _App *app)
case EM_THREAD_PLAYBACK_STARTED:
_send_cmd(app, EM_RESULT_PLAYBACK_STARTED);
break;
case EM_THREAD_EOF:
_send_cmd(app, EM_RESULT_FILE_EOF);
app->playing = 0;
break;
case EM_THREAD_PLAYBACK_STOPPED:
libvlc_media_player_stop(app->mp);
app->playing = 0;

View File

@ -56,6 +56,7 @@ enum _Emotion_Generic_Result
EM_RESULT_SPU_TRACK_INFO, // param: current spu, spu count, spu_id, spu_name, spu_id2, spu_name2, ...
// (int, int, int, string, int, string, ...)
EM_RESULT_META_INFO, // param: title, artist, album, year, genre, comments, disc id, count (all int)
EM_RESULT_FILE_EOF, // param: none
EM_RESULT_LAST
};

View File

@ -587,6 +587,10 @@ _player_cmd_process(Emotion_Generic_Video *ev)
case EM_RESULT_META_INFO:
_player_meta_info_read(ev);
break;
case EM_RESULT_FILE_EOF:
_emotion_decode_stop(ev->obj);
_emotion_playback_finished(ev->obj);
break;
default:
WRN("received wrong command: %d", ev->cmd.type);
}

View File

@ -36,6 +36,8 @@ int _emotion_gstreamer_log_domain = -1;
Eina_Bool debug_fps = EINA_FALSE;
Eina_Bool _ecore_x_available = EINA_FALSE;
static Ecore_Idler *restart_idler;
/* Callbacks to get the eos */
static void _for_each_tag (GstTagList const* list, gchar const* tag, void *data);
static void _free_metadata (Emotion_Gstreamer_Metadata *m);
@ -201,6 +203,8 @@ static GstBusSyncReply _eos_sync_fct(GstBus *bus,
GstMessage *message,
gpointer data);
static Eina_Bool _em_restart_stream(void *data);
/* Module interface */
static Emotion_Video_Module em_module =
@ -439,6 +443,12 @@ em_cleanup(Emotion_Gstreamer_Video *ev)
#endif
}
if (restart_idler)
{
ecore_idler_del(restart_idler);
restart_idler = NULL;
}
EINA_LIST_FREE(ev->audio_streams, astream)
free(astream);
EINA_LIST_FREE(ev->video_streams, vstream)
@ -1275,6 +1285,19 @@ em_priority_set(void *video, Eina_Bool pri)
ev = video;
if (priority_overide > 3) return ; /* If we failed to much to create that pipeline, let's don't wast our time anymore */
if (ev->priority != pri && ev->pipeline)
{
if (ev->threads)
{
Ecore_Thread *t;
EINA_LIST_FREE(ev->threads, t)
ecore_thread_cancel(t);
}
em_cleanup(ev);
restart_idler = ecore_idler_add(_em_restart_stream, ev);
}
ev->priority = pri;
}
@ -1284,7 +1307,7 @@ em_priority_get(void *video)
Emotion_Gstreamer_Video *ev;
ev = video;
return ev->stream;
return !ev->stream;
}
#ifdef HAVE_ECORE_X
@ -1606,6 +1629,8 @@ _em_restart_stream(void *data)
gst_bus_set_sync_handler(ev->eos_bus, _eos_sync_fct, ev);
}
restart_idler = NULL;
return ECORE_CALLBACK_CANCEL;
}
@ -1723,7 +1748,7 @@ _eos_main_fct(void *data)
ev->priority = EINA_FALSE;
priority_overide++;
ecore_idler_add(_em_restart_stream, ev);
restart_idler = ecore_idler_add(_em_restart_stream, ev);
}
break;
default: