forked from enlightenment/efl
emotion/generic/vlc: VLC needs to write data somewhere.
It seems that depending on the system, vlc can't use a NULL pointer to the pixels where it should write its data. So a small amount of memory should be allocated and passed to its rendering callbacks (specifically, the lock callback) when the file is being opened and decoded for the first time. Then this memory can be freed, since the real rendering will happen on the shared memory area. SVN revision: 63777
This commit is contained in:
parent
620d2573f3
commit
ab80242e86
|
@ -35,6 +35,7 @@ struct _App {
|
||||||
libvlc_event_manager_t *mevent_mgr;
|
libvlc_event_manager_t *mevent_mgr;
|
||||||
char *filename;
|
char *filename;
|
||||||
char *shmname;
|
char *shmname;
|
||||||
|
void *tmpbuffer;
|
||||||
int w, h;
|
int w, h;
|
||||||
int fd_read; // read commands from theads here
|
int fd_read; // read commands from theads here
|
||||||
int fd_write; // write commands from threads here
|
int fd_write; // write commands from threads here
|
||||||
|
@ -276,7 +277,8 @@ _display(void *data, void *id)
|
||||||
static void *
|
static void *
|
||||||
_tmp_lock(void *data, void **pixels)
|
_tmp_lock(void *data, void **pixels)
|
||||||
{
|
{
|
||||||
*pixels = NULL;
|
struct _App *app = data;
|
||||||
|
*pixels = app->tmpbuffer;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -398,7 +400,7 @@ _file_set(struct _App *app)
|
||||||
|
|
||||||
app->opening = 1;
|
app->opening = 1;
|
||||||
libvlc_video_set_format(app->mp, "RV32", DEFAULTWIDTH, DEFAULTHEIGHT, DEFAULTWIDTH * 4);
|
libvlc_video_set_format(app->mp, "RV32", DEFAULTWIDTH, DEFAULTHEIGHT, DEFAULTWIDTH * 4);
|
||||||
libvlc_video_set_callbacks(app->mp, _tmp_lock, _tmp_unlock, _tmp_display, NULL);
|
libvlc_video_set_callbacks(app->mp, _tmp_lock, _tmp_unlock, _tmp_display, app);
|
||||||
app->event_mgr = libvlc_media_player_event_manager(app->mp);
|
app->event_mgr = libvlc_media_player_event_manager(app->mp);
|
||||||
libvlc_event_attach(app->event_mgr, libvlc_MediaPlayerPositionChanged,
|
libvlc_event_attach(app->event_mgr, libvlc_MediaPlayerPositionChanged,
|
||||||
_event_cb, app);
|
_event_cb, app);
|
||||||
|
@ -407,6 +409,7 @@ _file_set(struct _App *app)
|
||||||
|
|
||||||
app->mevent_mgr = libvlc_media_event_manager(app->m);
|
app->mevent_mgr = libvlc_media_event_manager(app->m);
|
||||||
|
|
||||||
|
app->tmpbuffer = malloc(sizeof(char) * DEFAULTWIDTH * DEFAULTHEIGHT * 4);
|
||||||
libvlc_audio_set_mute(app->mp, 1);
|
libvlc_audio_set_mute(app->mp, 1);
|
||||||
libvlc_media_player_play(app->mp);
|
libvlc_media_player_play(app->mp);
|
||||||
}
|
}
|
||||||
|
@ -560,6 +563,7 @@ release_resources:
|
||||||
{
|
{
|
||||||
libvlc_media_release(app->m);
|
libvlc_media_release(app->m);
|
||||||
libvlc_media_player_release(app->mp);
|
libvlc_media_player_release(app->mp);
|
||||||
|
free(app->tmpbuffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue