diff options
author | phintuka <phintuka> | 2012-03-19 11:57:18 +0000 |
---|---|---|
committer | phintuka <phintuka> | 2012-03-19 11:57:18 +0000 |
commit | 99a05d138cd7bf440c5e69c66eb8f878ad91f7e1 (patch) | |
tree | 53aac8c5ea400548b5aa8a74ae55ff7383b9032f | |
parent | fd3ac02950f6454542ff7bdae89f08659cbdd395 (diff) | |
download | xineliboutput-99a05d138cd7bf440c5e69c66eb8f878ad91f7e1.tar.gz xineliboutput-99a05d138cd7bf440c5e69c66eb8f878ad91f7e1.tar.bz2 |
Send incoming messages to corresponding device instance
-rw-r--r-- | frontend.c | 32 | ||||
-rw-r--r-- | frontend.h | 8 | ||||
-rw-r--r-- | frontend_local.c | 21 |
3 files changed, 33 insertions, 28 deletions
@@ -4,7 +4,7 @@ * See the main source file 'xineliboutput.c' for copyright information and * how to reach the author. * - * $Id: frontend.c,v 1.100 2012-03-18 12:19:15 phintuka Exp $ + * $Id: frontend.c,v 1.101 2012-03-19 11:57:18 phintuka Exp $ * */ @@ -142,22 +142,22 @@ void cXinelibThread::InfoHandler(const char *info) char *lang = map; while(*map && *map != ' ') map++; if(*map == ' ') { *map = 0; map++; }; - cXinelibDevice::Instance().SetAvailableTrack(ttSubtitle, id, id+1, iso639_1_to_iso639_2(lang) ?: *cString::sprintf("%03d", id+1)); + m_Dev->SetAvailableTrack(ttSubtitle, id, id+1, iso639_1_to_iso639_2(lang) ?: *cString::sprintf("%03d", id+1)); if (Current) CurrentTrack = id; } } if (CurrentTrack == ttXSubtitleAuto) - cXinelibDevice::Instance().EnsureSubtitleTrack(); + m_Dev->EnsureSubtitleTrack(); else if (CurrentTrack == ttXSubtitleNone) - cXinelibDevice::Instance().SetCurrentSubtitleTrack(ttNone, true); + m_Dev->SetCurrentSubtitleTrack(ttNone, true); else - cXinelibDevice::Instance().SetCurrentSubtitleTrack(eTrackType(CurrentTrack+ttSubtitleFirst), true); + m_Dev->SetCurrentSubtitleTrack(eTrackType(CurrentTrack+ttSubtitleFirst), true); } else if(!strncmp(info, "TRACKMAP AUDIO", 14)) { map += 14; - cXinelibDevice::Instance().ClrAvailableTracks(); + m_Dev->ClrAvailableTracks(); while(*map) { bool Current = false; while(*map == ' ') map++; @@ -171,9 +171,9 @@ void cXinelibThread::InfoHandler(const char *info) char *lang = map; while(*map && *map != ' ') map++; if(*map == ' ') { *map = 0; map++; }; - cXinelibDevice::Instance().SetAvailableTrack(ttDolby, id, ttDolby+id, iso639_1_to_iso639_2(lang) ?: *cString::sprintf("%03d", id+1)); + m_Dev->SetAvailableTrack(ttDolby, id, ttDolby+id, iso639_1_to_iso639_2(lang) ?: *cString::sprintf("%03d", id+1)); if(Current) - cXinelibDevice::Instance().SetCurrentAudioTrack((eTrackType)(ttDolby+id)); + m_Dev->SetCurrentAudioTrack((eTrackType)(ttDolby+id)); } } @@ -192,13 +192,13 @@ void cXinelibThread::InfoHandler(const char *info) *end = 0; if(!strcmp(map, "title")) - cXinelibDevice::Instance().SetMetaInfo(miTitle, next); + m_Dev->SetMetaInfo(miTitle, next); if(!strcmp(map, "tracknumber")) - cXinelibDevice::Instance().SetMetaInfo(miTracknumber, next); + m_Dev->SetMetaInfo(miTracknumber, next); if(!strcmp(map, "album")) - cXinelibDevice::Instance().SetMetaInfo(miAlbum, next); + m_Dev->SetMetaInfo(miAlbum, next); if(!strcmp(map, "artist")) - cXinelibDevice::Instance().SetMetaInfo(miArtist, next); + m_Dev->SetMetaInfo(miArtist, next); map = end+1; } } @@ -206,21 +206,21 @@ void cXinelibThread::InfoHandler(const char *info) else if(!strncmp(info, "DVDBUTTONS ", 11)) { map += 11; while(*map == ' ') map++; - cXinelibDevice::Instance().SetMetaInfo(miDvdButtons, map); + m_Dev->SetMetaInfo(miDvdButtons, map); } else if(!strncmp(info, "TITLE ", 6)) { map += 6; while(*map == ' ') map++; - cXinelibDevice::Instance().SetMetaInfo(miTitle, map); + m_Dev->SetMetaInfo(miTitle, map); } else if(!strncmp(info, "DVDTITLE ", 9)) { map += 9; while(*map == ' ') map++; - cXinelibDevice::Instance().SetMetaInfo(miDvdTitleNo, map); + m_Dev->SetMetaInfo(miDvdTitleNo, map); if (*map == '0') // DVD Menu, set spu track to 0 - cXinelibDevice::Instance().SetCurrentSubtitleTrack(ttSubtitleFirst); + m_Dev->SetCurrentSubtitleTrack(ttSubtitleFirst); } else if (!strncmp(info, "WINDOW ", 7)) { @@ -4,7 +4,7 @@ * See the main source file 'xineliboutput.c' for copyright information and * how to reach the author. * - * $Id: frontend.h,v 1.44 2012-03-17 20:19:27 phintuka Exp $ + * $Id: frontend.h,v 1.45 2012-03-19 11:57:18 phintuka Exp $ * */ @@ -106,9 +106,9 @@ class cXinelibThread : public cThread, public cListObject int SizeX, int SizeY) { return NULL; } // Control from frontend - static void KeypressHandler(const char *keymap, const char *key, - bool repeat, bool release); - static void InfoHandler(const char *info); + void KeypressHandler(const char *keymap, const char *key, + bool repeat, bool release); + void InfoHandler(const char *info); // // Configuration diff --git a/frontend_local.c b/frontend_local.c index 17db7b98..1f871247 100644 --- a/frontend_local.c +++ b/frontend_local.c @@ -4,7 +4,7 @@ * See the main source file 'xineliboutput.c' for copyright information and * how to reach the author. * - * $Id: frontend_local.c,v 1.59 2012-03-19 11:51:22 phintuka Exp $ + * $Id: frontend_local.c,v 1.60 2012-03-19 11:57:18 phintuka Exp $ * */ @@ -51,21 +51,26 @@ class cRwLockBlock //----------------- keyboard control handler (C callback) -------------------- extern "C" { - static void keypress_handler(void *h, const char *keymap, const char *key) + static void keypress_handler(void *handle, const char *keymap, const char *key) { - if(!strncmp("INFO ", keymap, 5)) { - - cXinelibThread::InfoHandler(keymap+5); + if (!handle) { + LOGMSG("keypress_handler(): missing handle"); + return; + } + + cXinelibThread *t = (cXinelibThread *)handle; - } else if(!xc.use_x_keyboard || !key) { + if (!strncmp("INFO ", keymap, 5)) { + t->InfoHandler(keymap+5); + + } else if (!xc.use_x_keyboard || !key) { /* Only X11 key events came this way in local mode. Keyboard is handled by vdr. */ LOGMSG("keypress_handler(%s): X11 Keyboard disabled in config", key); } else { - - cXinelibThread::KeypressHandler(keymap, key, false, false); + t->KeypressHandler(keymap, key, false, false); } } |