summaryrefslogtreecommitdiff
path: root/legacy/emotion/src/generic_players/vlc/emotion_generic_vlc.c
diff options
context:
space:
mode:
authorRafael Antognolli <antognolli@gmail.com>2011-10-03 18:19:48 +0000
committerRafael Antognolli <antognolli@gmail.com>2011-10-03 18:19:48 +0000
commitab80242e86950d7da9e083ab97ac2da21fbc7768 (patch)
tree4b39a4e569e958ed58b35111367f97f60c86ffbe /legacy/emotion/src/generic_players/vlc/emotion_generic_vlc.c
parent620d2573f37e588fea4957bd3e5f5eb916467e0f (diff)
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
Diffstat (limited to '')
-rw-r--r--legacy/emotion/src/generic_players/vlc/emotion_generic_vlc.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/legacy/emotion/src/generic_players/vlc/emotion_generic_vlc.c b/legacy/emotion/src/generic_players/vlc/emotion_generic_vlc.c
index 4fb8ba0b45..848cabb1d6 100644
--- a/legacy/emotion/src/generic_players/vlc/emotion_generic_vlc.c
+++ b/legacy/emotion/src/generic_players/vlc/emotion_generic_vlc.c
@@ -35,6 +35,7 @@ struct _App {
35 libvlc_event_manager_t *mevent_mgr; 35 libvlc_event_manager_t *mevent_mgr;
36 char *filename; 36 char *filename;
37 char *shmname; 37 char *shmname;
38 void *tmpbuffer;
38 int w, h; 39 int w, h;
39 int fd_read; // read commands from theads here 40 int fd_read; // read commands from theads here
40 int fd_write; // write commands from threads here 41 int fd_write; // write commands from threads here
@@ -276,7 +277,8 @@ _display(void *data, void *id)
276static void * 277static void *
277_tmp_lock(void *data, void **pixels) 278_tmp_lock(void *data, void **pixels)
278{ 279{
279 *pixels = NULL; 280 struct _App *app = data;
281 *pixels = app->tmpbuffer;
280 return NULL; 282 return NULL;
281} 283}
282 284
@@ -398,7 +400,7 @@ _file_set(struct _App *app)
398 400
399 app->opening = 1; 401 app->opening = 1;
400 libvlc_video_set_format(app->mp, "RV32", DEFAULTWIDTH, DEFAULTHEIGHT, DEFAULTWIDTH * 4); 402 libvlc_video_set_format(app->mp, "RV32", DEFAULTWIDTH, DEFAULTHEIGHT, DEFAULTWIDTH * 4);
401 libvlc_video_set_callbacks(app->mp, _tmp_lock, _tmp_unlock, _tmp_display, NULL); 403 libvlc_video_set_callbacks(app->mp, _tmp_lock, _tmp_unlock, _tmp_display, app);
402 app->event_mgr = libvlc_media_player_event_manager(app->mp); 404 app->event_mgr = libvlc_media_player_event_manager(app->mp);
403 libvlc_event_attach(app->event_mgr, libvlc_MediaPlayerPositionChanged, 405 libvlc_event_attach(app->event_mgr, libvlc_MediaPlayerPositionChanged,
404 _event_cb, app); 406 _event_cb, app);
@@ -407,6 +409,7 @@ _file_set(struct _App *app)
407 409
408 app->mevent_mgr = libvlc_media_event_manager(app->m); 410 app->mevent_mgr = libvlc_media_event_manager(app->m);
409 411
412 app->tmpbuffer = malloc(sizeof(char) * DEFAULTWIDTH * DEFAULTHEIGHT * 4);
410 libvlc_audio_set_mute(app->mp, 1); 413 libvlc_audio_set_mute(app->mp, 1);
411 libvlc_media_player_play(app->mp); 414 libvlc_media_player_play(app->mp);
412} 415}
@@ -560,6 +563,7 @@ release_resources:
560 { 563 {
561 libvlc_media_release(app->m); 564 libvlc_media_release(app->m);
562 libvlc_media_player_release(app->mp); 565 libvlc_media_player_release(app->mp);
566 free(app->tmpbuffer);
563 } 567 }
564} 568}
565 569