some fixes/improvements to emotion -> foound some buggers in xine -

tried making gst do it - should kind of work. i think gst is broken tho.



SVN revision: 52800
This commit is contained in:
Carsten Haitzler 2010-09-27 10:11:52 +00:00
parent b04f0b0360
commit 2d488b5d32
6 changed files with 111 additions and 2 deletions

View File

@ -118,6 +118,8 @@ EAPI void _emotion_frame_new(Evas_Object *obj);
EAPI void _emotion_video_pos_update(Evas_Object *obj, double pos, double len);
EAPI void _emotion_frame_resize(Evas_Object *obj, int w, int h, double ratio);
EAPI void _emotion_decode_stop(Evas_Object *obj);
EAPI void _emotion_open_done(Evas_Object *obj);
EAPI void _emotion_playback_started(Evas_Object *obj);
EAPI void _emotion_playback_finished(Evas_Object *obj);
EAPI void _emotion_audio_level_change(Evas_Object *obj);
EAPI void _emotion_channels_change(Evas_Object *obj);

View File

@ -47,6 +47,7 @@ struct _Smart_Data
unsigned char play : 1;
unsigned char seek : 1;
unsigned char seeking : 1;
char *title;
struct {
@ -99,6 +100,7 @@ static const char SIG_POSITION_UPDATE[] = "position_update";
static const char SIG_LENGTH_CHANGE[] = "length_change";
static const char SIG_FRAME_RESIZE[] = "frame_resize";
static const char SIG_DECODE_STOP[] = "decode_stop";
static const char SIG_PLAYBACK_STARTED[] = "playback_started";
static const char SIG_PLAYBACK_FINISHED[] = "playback_finished";
static const char SIG_AUDIO_LEVEL_CHANGE[] = "audio_level_change";
static const char SIG_CHANNELS_CHANGE[] = "channels_change";
@ -107,12 +109,14 @@ static const char SIG_PROGRESS_CHANGE[] = "progress_change";
static const char SIG_REF_CHANGE[] = "ref_change";
static const char SIG_BUTTON_NUM_CHANGE[] = "button_num_change";
static const char SIG_BUTTON_CHANGE[] = "button_change";
static const char SIG_OPEN_DONE[] = "open_done";
static const Evas_Smart_Cb_Description _smart_callbacks[] = {
{SIG_FRAME_DECODE, ""},
{SIG_POSITION_UPDATE, ""},
{SIG_LENGTH_CHANGE, ""},
{SIG_FRAME_RESIZE, ""},
{SIG_DECODE_STOP, ""},
{SIG_PLAYBACK_STARTED, ""},
{SIG_PLAYBACK_FINISHED, ""},
{SIG_AUDIO_LEVEL_CHANGE, ""},
{SIG_CHANNELS_CHANGE, ""},
@ -121,6 +125,7 @@ static const Evas_Smart_Cb_Description _smart_callbacks[] = {
{SIG_REF_CHANGE, ""},
{SIG_BUTTON_NUM_CHANGE, ""},
{SIG_BUTTON_CHANGE, ""},
{SIG_OPEN_DONE, ""},
{NULL, NULL}
};
@ -1013,6 +1018,18 @@ _emotion_decode_stop(Evas_Object *obj)
}
}
EAPI void
_emotion_open_done(Evas_Object *obj)
{
evas_object_smart_callback_call(obj, SIG_OPEN_DONE, NULL);
}
EAPI void
_emotion_playback_started(Evas_Object *obj)
{
evas_object_smart_callback_call(obj, SIG_PLAYBACK_STARTED, NULL);
}
EAPI void
_emotion_playback_finished(Evas_Object *obj)
{
@ -1089,6 +1106,20 @@ _emotion_spu_button_set(Evas_Object *obj, int button)
evas_object_smart_callback_call(obj, SIG_BUTTON_CHANGE, NULL);
}
EAPI void
_emotion_seek_done(Evas_Object *obj)
{
Smart_Data *sd;
E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
if (sd->seeking)
{
sd->seeking = 0;
if (sd->seek) emotion_object_position_set(obj, sd->seek_pos);
}
}
/****************************/
/* Internal object routines */
@ -1143,8 +1174,10 @@ _pos_set_job(void *data)
obj = data;
E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
sd->job = NULL;
if (sd->seeking) return;
if (sd->seek)
{
sd->seeking = 1;
sd->module->pos_set(sd->video, sd->seek_pos);
sd->seek = 0;
}

View File

@ -441,6 +441,7 @@ em_file_open(const char *file,
em_audio_channel_volume_set(ev, ev->volume);
_eos_timer_fct(ev);
_emotion_open_done(ev->obj);
return 1;
}
@ -498,6 +499,7 @@ em_play(void *video,
ev = (Emotion_Gstreamer_Video *)video;
gst_element_set_state(ev->pipeline, GST_STATE_PLAYING);
ev->play = 1;
ev->play_started = 1;
/* eos */
ev->eos_timer = ecore_timer_add(0.1, _eos_timer_fct, ev);
@ -1385,6 +1387,11 @@ _eos_timer_fct(void *data)
GstMessage *msg;
ev = (Emotion_Gstreamer_Video *)data;
if (ev->play_started)
{
_emotion_playback_started(ev->obj);
ev->play_started = 0;
}
while ((msg = gst_bus_poll(ev->eos_bus, GST_MESSAGE_ERROR | GST_MESSAGE_EOS | GST_MESSAGE_TAG, 0)))
{
switch (GST_MESSAGE_TYPE(msg))

View File

@ -87,6 +87,7 @@ struct _Emotion_Gstreamer_Video
Emotion_Vis vis;
unsigned char play : 1;
unsigned char play_started : 1;
unsigned char video_mute : 1;
unsigned char audio_mute : 1;
};

View File

@ -430,7 +430,14 @@ em_shutdown(void *ef)
ev->delete_me = 1;
printf("EXM del fds %p\n", ev);
ecore_main_fd_handler_del(ev->fd_handler);
ev->fd_handler = NULL;
ecore_main_fd_handler_del(ev->fd_ev_handler);
ev->fd_ev_handler = NULL;
if (ev->anim)
{
ecore_animator_del(ev->anim);
ev->anim = NULL;
}
ev->closing = 1;
_em_slave_event(ev, 3, NULL);
@ -1218,6 +1225,16 @@ _em_module_event(void *data, int type)
write(ev->fd_ev_write, buf, sizeof(buf));
}
static Eina_Bool
_em_audio_only_poller(void *data)
{
Emotion_Xine_Video *ev;
ev = data;
_em_get_pos_len(ev);
return EINA_TRUE;
}
static Eina_Bool
_em_fd_ev_active(void *data, Ecore_Fd_Handler *fdh)
{
@ -1243,20 +1260,55 @@ _em_fd_ev_active(void *data, Ecore_Fd_Handler *fdh)
break;
case 2: /* open done */
ev->play_ok = 1;
if (ev->anim)
{
ecore_animator_del(ev->anim);
ev->anim = NULL;
}
_emotion_open_done(ev->obj);
break;
case 3: /* shutdown done */
if (ev->anim)
{
ecore_animator_del(ev->anim);
ev->anim = NULL;
}
ev->play_ok = 1;
break;
case 4: /* play done */
ev->play_ok = 1;
if (ev->anim)
{
ecore_animator_del(ev->anim);
ev->anim = NULL;
}
if ((!(xine_get_stream_info(ev->stream, XINE_STREAM_INFO_HAS_VIDEO) &&
xine_get_stream_info(ev->stream, XINE_STREAM_INFO_VIDEO_HANDLED))) &&
(xine_get_stream_info(ev->stream, XINE_STREAM_INFO_HAS_AUDIO) &&
xine_get_stream_info(ev->stream, XINE_STREAM_INFO_AUDIO_HANDLED)))
ev->anim = ecore_animator_add(_em_audio_only_poller, ev);
_emotion_playback_started(ev->obj);
break;
case 5: /* stop done */
if (ev->anim)
{
ecore_animator_del(ev->anim);
ev->anim = NULL;
}
ev->play_ok = 1;
break;
case 6: /* seek done */
ev->play_ok = 1;
_emotion_seek_done(ev->obj);
_em_get_pos_len(ev);
_emotion_video_pos_update(ev->obj, ev->pos, ev->len);
break;
case 7: /* eject done */
if (ev->anim)
{
ecore_animator_del(ev->anim);
ev->anim = NULL;
}
ev->play_ok = 1;
break;
case 8: /* spu mute done */
@ -1269,8 +1321,20 @@ _em_fd_ev_active(void *data, Ecore_Fd_Handler *fdh)
ev->play_ok = 1;
break;
case 11: /* close done */
if (ev->anim)
{
ecore_animator_del(ev->anim);
ev->anim = NULL;
}
ev->play_ok = 1;
break;
case 15: /* get pos done */
if (ev->last_pos != ev->pos)
{
ev->last_pos = ev->pos;
_emotion_video_pos_update(ev->obj, ev->pos, ev->len);
}
break;
default:
break;
}
@ -1409,6 +1473,7 @@ _em_get_pos_len_th(void *par)
}
}
ev->get_poslen = 0;
_em_module_event(ev, 15); /* event - getpos done */
//printf("get pos %3.3f\n", ev->pos);
}
if (ev->delete_me)
@ -1424,7 +1489,6 @@ static void
_em_get_pos_len(Emotion_Xine_Video *ev)
{
if (!ev->play_ok) return;
if (ev->get_poslen) return;
ev->get_poslen = 1;
pthread_mutex_lock(&(ev->get_pos_len_mutex));
pthread_cond_broadcast(&(ev->get_pos_len_cond));

View File

@ -20,6 +20,7 @@ struct _Emotion_Xine_Video
xine_event_queue_t *queue;
volatile double len;
volatile double pos;
volatile double last_pos;
volatile double volume;
double fps;
double ratio;
@ -32,12 +33,13 @@ struct _Emotion_Xine_Video
volatile int video_channel;
volatile int fq;
Emotion_Vis vis;
int fd_read;
int fd_read;
int fd_write;
Ecore_Fd_Handler *fd_handler;
int fd_ev_read;
int fd_ev_write;
Ecore_Fd_Handler *fd_ev_handler;
Ecore_Animator *anim;
unsigned char play : 1;
unsigned char just_loaded : 1;
unsigned char video_mute : 1;