summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorphintuka <phintuka>2010-01-19 22:28:45 +0000
committerphintuka <phintuka>2010-01-19 22:28:45 +0000
commitc60527562b0fcd9d3a4c0ac26ac8dfa50fc91321 (patch)
tree41f3a8de41b7182fb0ab35096adc9b7c4fd7d0f3
parent99bc9402134aaf6196c388adc3b5916d38aeee0e (diff)
downloadxineliboutput-c60527562b0fcd9d3a4c0ac26ac8dfa50fc91321.tar.gz
xineliboutput-c60527562b0fcd9d3a4c0ac26ac8dfa50fc91321.tar.bz2
Cosmetics
Removed dead code
-rw-r--r--menu.c593
1 files changed, 278 insertions, 315 deletions
diff --git a/menu.c b/menu.c
index 70795ddf..c033da25 100644
--- a/menu.c
+++ b/menu.c
@@ -4,7 +4,7 @@
* See the main source file 'xineliboutput.c' for copyright information and
* how to reach the author.
*
- * $Id: menu.c,v 1.74 2010-01-18 22:53:32 phintuka Exp $
+ * $Id: menu.c,v 1.75 2010-01-19 22:28:45 phintuka Exp $
*
*/
@@ -43,7 +43,7 @@
# define HOTKEY_LOCAL_FE k8 /* off, on */
# define HOTKEY_PLAYLIST k9 /* Start replaying playlist or file pointed by
- symlink $(CONFDIR)/plugins/xineliboutput/default_playlist */
+ symlink $(CONFDIR)/plugins/xineliboutput/default_playlist */
# define HOTKEY_ADELAY_UP kUp /* audio delay up */
# define HOTKEY_ADELAY_DOWN kDown /* audio delay down */
# define HOTKEY_TOGGLE_VO_ASPECT kRight
@@ -55,7 +55,7 @@
//--------------------------- cMenuBrowseFiles -------------------------------
-class cMenuBrowseFiles : public cOsdMenu
+class cMenuBrowseFiles : public cOsdMenu
{
protected:
const eMainMenuMode m_Mode;
@@ -64,15 +64,15 @@ class cMenuBrowseFiles : public cOsdMenu
char *m_ConfigLastDir;
const char *help[4];
- virtual bool ScanDir(const char *DirName);
+ virtual bool ScanDir(const char *DirName);
virtual eOSState Open(bool ForceOpen = false, bool Queue = false, bool Rewind = false);
virtual eOSState Delete(void);
virtual eOSState Info(void);
- virtual void Set(void);
- virtual void SetHelpButtons(void);
- cFileListItem *GetCurrent() { return (cFileListItem *)Get(Current()); }
- void StoreConfig(void);
- char *GetLastDir(void);
+ virtual void Set(void);
+ virtual void SetHelpButtons(void);
+ cFileListItem *GetCurrent(void) { return (cFileListItem *)Get(Current()); }
+ void StoreConfig(void);
+ char *GetLastDir(void);
public:
cMenuBrowseFiles(eMainMenuMode mode = ShowFiles, bool OnlyQueue=false);
@@ -85,9 +85,9 @@ static char *ParentDir(const char *dir)
{
char *result = strdup(dir);
char *pt = strrchr(result, '/');
- if(pt) {
+ if (pt) {
*(pt+1)=0;
- if(pt != result)
+ if (pt != result)
*pt = 0;
}
return result;
@@ -96,16 +96,16 @@ static char *ParentDir(const char *dir)
static char *LastDir(const char *dir)
{
const char *pt = strrchr(dir, '/');
- if(pt && pt[0] && pt[1])
+ if (pt && pt[0] && pt[1])
return strdup(pt+1);
return NULL;
}
cMenuBrowseFiles::cMenuBrowseFiles(eMainMenuMode mode, bool OnlyQueue) :
cOsdMenu( ( mode==ShowImages ? tr("Images") :
- mode==ShowMusic ? (!OnlyQueue ? tr("Play music") : tr("Add to playlist")) :
- /*mode==ShowFiles ?*/ tr("Play file")),
- 2, 4),
+ mode==ShowMusic ? (!OnlyQueue ? tr("Play music") : tr("Add to playlist")) :
+ /*mode==ShowFiles ?*/ tr("Play file")),
+ 2, 4),
m_Mode(mode)
{
m_CurrentDir = NULL;
@@ -141,7 +141,7 @@ void cMenuBrowseFiles::Set(void)
{
Clear();
- if(!m_CurrentDir)
+ if (!m_CurrentDir)
m_CurrentDir = strdup(m_ConfigLastDir);
int RootDirLen = strlen(xc.media_root_dir);
@@ -151,13 +151,13 @@ void cMenuBrowseFiles::Set(void)
m_CurrentDir = strdup(xc.media_root_dir);
}
- if(m_CurrentDir[0] != '/') {
+ if (m_CurrentDir[0] != '/') {
free(m_CurrentDir);
m_CurrentDir = strdup(VideoDirectory);
}
// find deepest accessible directory from path
- while(!ScanDir(m_CurrentDir) && strlen(m_CurrentDir) > 1) {
+ while (!ScanDir(m_CurrentDir) && strlen(m_CurrentDir) > 1) {
char *n = ParentDir(m_CurrentDir);
free(m_CurrentDir);
m_CurrentDir = n;
@@ -175,12 +175,12 @@ void cMenuBrowseFiles::Set(void)
// select last selected item
char *lastParent = ParentDir(m_ConfigLastDir);
- if(!strncmp(m_CurrentDir,lastParent,strlen(m_CurrentDir))) {
+ if (!strncmp(m_CurrentDir, lastParent, strlen(m_CurrentDir))) {
char *item = LastDir(m_ConfigLastDir);
- if(item) {
- for(cFileListItem *it = (cFileListItem*)First(); it; it = (cFileListItem*)Next(it))
- if(!strcmp(it->Name(),item))
- SetCurrent(it);
+ if (item) {
+ for (cFileListItem *it = (cFileListItem*)First(); it; it = (cFileListItem*)Next(it))
+ if (!strcmp(it->Name(), item))
+ SetCurrent(it);
free(item);
}
}
@@ -242,17 +242,17 @@ void cMenuBrowseFiles::SetHelpButtons(void)
eOSState cMenuBrowseFiles::Delete(void)
{
cFileListItem *it = GetCurrent();
- if(!it->IsDir()) {
+ if (!it->IsDir()) {
if (Interface->Confirm(trVDR("Delete recording?"))) {
cString name = cString::sprintf("%s/%s", m_CurrentDir, it->Name());
if(!unlink(name)) {
isyslog("file %s deleted", *name);
- if(m_Mode != ShowImages) {
- name = cString::sprintf("%s.resume", *name);
- unlink(name);
- }
+ if (m_Mode != ShowImages) {
+ name = cString::sprintf("%s.resume", *name);
+ unlink(name);
+ }
cOsdMenu::Del(Current());
- SetHelpButtons();
+ SetHelpButtons();
Display();
} else {
Skins.Message(mtError, trVDR("Error while deleting recording!"));
@@ -265,7 +265,7 @@ eOSState cMenuBrowseFiles::Delete(void)
eOSState cMenuBrowseFiles::Open(bool ForceOpen, bool Queue, bool Rewind)
{
- if(!GetCurrent()) {
+ if (!GetCurrent()) {
return osContinue;
}
@@ -280,49 +280,50 @@ eOSState cMenuBrowseFiles::Open(bool ForceOpen, bool Queue, bool Rewind)
/* directory */
} else if (GetCurrent()->IsDir()) {
- if(!ForceOpen && GetCurrent()->IsDvd()) {
+ if (!ForceOpen && GetCurrent()->IsDvd()) {
/* play dvd */
cString f = cString::sprintf("dvd:%s/%s", m_CurrentDir, GetCurrent()->Name());
cControl::Shutdown();
cControl::Launch(new cXinelibDvdPlayerControl(f));
return osEnd;
}
- if(!ForceOpen && GetCurrent()->IsBluRay()) {
+ if (!ForceOpen && GetCurrent()->IsBluRay()) {
/* play BluRay disc/image */
cString f = cString::sprintf("bluray:%s/%s/", m_CurrentDir, GetCurrent()->Name());
cControl::Shutdown();
cControl::Launch(new cXinelibDvdPlayerControl(f));
return osEnd;
}
- if(ForceOpen && GetCurrent()->IsDir() &&
- !GetCurrent()->IsDvd() && !GetCurrent()->IsBluRay()) {
+ if (ForceOpen && GetCurrent()->IsDir() &&
+ !GetCurrent()->IsDvd() &&
+ !GetCurrent()->IsBluRay()) {
/* play all files */
- if(m_Mode != ShowImages) {
+ if (m_Mode != ShowImages) {
- if(m_OnlyQueue && !Queue)
- return osContinue;
+ if (m_OnlyQueue && !Queue)
+ return osContinue;
- cString f = cString::sprintf("%s/%s/", m_CurrentDir, GetCurrent()->Name());
+ cString f = cString::sprintf("%s/%s/", m_CurrentDir, GetCurrent()->Name());
- if(!Queue || !cXinelibPlayerControl::IsOpen())
- cControl::Shutdown();
- if(Queue)
- cXinelibPlayerControl::Queue(f);
- else
- cControl::Launch(new cXinelibPlayerControl(m_Mode, f));
- return Queue ? osContinue : osEnd;
+ if (!Queue || !cXinelibPlayerControl::IsOpen())
+ cControl::Shutdown();
+ if (Queue)
+ cXinelibPlayerControl::Queue(f);
+ else
+ cControl::Launch(new cXinelibPlayerControl(m_Mode, f));
+ return Queue ? osContinue : osEnd;
} else {
- // TODO: show all images
+ // TODO: show all images
}
}
/* go to directory */
const char *d = GetCurrent()->Name();
char *buffer = NULL;
- if(asprintf(&buffer, "%s/%s", m_CurrentDir, d) >= 0) {
- while(buffer[0] == '/' && buffer[1] == '/')
- strcpy(buffer, buffer+1);
+ if (asprintf(&buffer, "%s/%s", m_CurrentDir, d) >= 0) {
+ while (buffer[0] == '/' && buffer[1] == '/')
+ strcpy(buffer, buffer+1);
free(m_CurrentDir);
m_CurrentDir = buffer;
}
@@ -331,43 +332,43 @@ eOSState cMenuBrowseFiles::Open(bool ForceOpen, bool Queue, bool Rewind)
/* regular file */
} else {
- cString f = cString::sprintf("%s%s/%s",
- GetCurrent()->IsDvd() ? "dvd:" : "",
- m_CurrentDir, GetCurrent()->Name());
- if (GetCurrent()->IsDvd())
+ cString f = cString::sprintf("%s%s/%s",
+ GetCurrent()->IsDvd() ? "dvd:" : "",
+ m_CurrentDir, GetCurrent()->Name());
+ if (GetCurrent()->IsDvd())
strn0cpy(m_ConfigLastDir, m_CurrentDir, sizeof(xc.browse_files_dir));
else
strn0cpy(m_ConfigLastDir, f, sizeof(xc.browse_files_dir));
StoreConfig();
- if(m_Mode != ShowImages) {
+ if (m_Mode != ShowImages) {
/* video/audio */
- if(m_OnlyQueue && !Queue)
- return osContinue;
- if(!Queue || !cXinelibPlayerControl::IsOpen())
- cControl::Shutdown();
- if(Queue)
- cXinelibPlayerControl::Queue(f);
- if(!cXinelibPlayerControl::IsOpen()) {
+ if (m_OnlyQueue && !Queue)
+ return osContinue;
+ if (!Queue || !cXinelibPlayerControl::IsOpen())
+ cControl::Shutdown();
+ if (Queue)
+ cXinelibPlayerControl::Queue(f);
+ if (!cXinelibPlayerControl::IsOpen()) {
if (Rewind)
unlink(cString::sprintf("%s.resume", *f));
- cControl::Launch(GetCurrent()->IsDvd()
- ? new cXinelibDvdPlayerControl(f)
- : new cXinelibPlayerControl(m_Mode, f, GetCurrent()->SubFile()));
+ cControl::Launch(GetCurrent()->IsDvd()
+ ? new cXinelibDvdPlayerControl(f)
+ : new cXinelibPlayerControl(m_Mode, f, GetCurrent()->SubFile()));
}
- if(Queue)
- return osContinue;
+ if (Queue)
+ return osContinue;
} else {
/* image */
char **files = new char*[Count()+1];
int i = 0, index = 0;
memset(files, 0, sizeof(char*)*(Count()+1));
- for(cFileListItem *it = (cFileListItem*)First(); it; it=(cFileListItem*)Next(it)) {
- if(it==Get(Current()))
- index = i;
- if(!it->IsDir())
- if(asprintf(&files[i++], "%s/%s", m_CurrentDir, it->Name()) < 0)
- i--;
+ for (cFileListItem *it = (cFileListItem*)First(); it; it=(cFileListItem*)Next(it)) {
+ if (it == Get(Current()))
+ index = i;
+ if (!it->IsDir())
+ if (asprintf(&files[i++], "%s/%s", m_CurrentDir, it->Name()) < 0)
+ i--;
}
cControl::Shutdown();
cControl::Launch(new cXinelibImagesControl(files, index, i));
@@ -379,7 +380,7 @@ eOSState cMenuBrowseFiles::Open(bool ForceOpen, bool Queue, bool Rewind)
eOSState cMenuBrowseFiles::Info(void)
{
- if(GetCurrent() && !GetCurrent()->IsDir()) {
+ if (GetCurrent() && !GetCurrent()->IsDir()) {
cString filename = cString::sprintf("%s/%s", m_CurrentDir, GetCurrent()->Name());
return AddSubMenu(new cMetainfoMenu(filename));
}
@@ -393,45 +394,45 @@ bool cMenuBrowseFiles::ScanDir(const char *DirName)
struct dirent *e;
while ((e = readdir(d)) != NULL) {
if (strcmp(e->d_name, ".") && strcmp(e->d_name, "..")) {
- cString buffer = cString::sprintf("%s/%s", DirName, e->d_name);
+ cString buffer = cString::sprintf("%s/%s", DirName, e->d_name);
struct stat st;
if (stat(buffer, &st) == 0) {
- // check symlink destination
+ // check symlink destination
if (S_ISLNK(st.st_mode)) {
- buffer = ReadLink(buffer);
- if (!*buffer || stat(buffer, &st))
- continue;
- }
+ buffer = ReadLink(buffer);
+ if (!*buffer || stat(buffer, &st))
+ continue;
+ }
- // folders
+ // folders
if (S_ISDIR(st.st_mode)) {
- if(m_Mode == ShowImages || m_Mode == ShowMusic)
- Add(new cFileListItem(e->d_name, true));
- else
- Add(new cFileListItem(e->d_name, true, false, false,
+ if (m_Mode == ShowImages || m_Mode == ShowMusic)
+ Add(new cFileListItem(e->d_name, true));
+ else
+ Add(new cFileListItem(e->d_name, true, false, false,
xc.IsDvdFolder(buffer), xc.IsBluRayFolder(buffer)));
// regular files
- } else if(e->d_name[0] != '.') {
+ } else if (e->d_name[0] != '.') {
- // audio
- if (m_Mode == ShowMusic && xc.IsAudioFile(buffer)) {
- Add(new cFileListItem(e->d_name, false));
+ // audio
+ if (m_Mode == ShowMusic && xc.IsAudioFile(buffer)) {
+ Add(new cFileListItem(e->d_name, false));
- // images
+ // images
} else if(m_Mode == ShowImages && xc.IsImageFile(buffer)) {
- Add(new cFileListItem(e->d_name, false));
+ Add(new cFileListItem(e->d_name, false));
// DVD image (.iso)
- } else if (m_Mode == ShowFiles && xc.IsDvdImage(buffer)) {
- Add(new cFileListItem(e->d_name, false, false, false, true));
+ } else if (m_Mode == ShowFiles && xc.IsDvdImage(buffer)) {
+ Add(new cFileListItem(e->d_name, false, false, false, true));
- // video
- } else if (m_Mode == ShowFiles && xc.IsVideoFile(buffer)) {
- cString subfile;
- cString resumefile;
+ // video
+ } else if (m_Mode == ShowFiles && xc.IsVideoFile(buffer)) {
+ cString subfile;
+ cString resumefile;
// separate subtitles ?
cString basename = cString::sprintf("%s/%s", DirName, e->d_name);
@@ -439,19 +440,19 @@ bool cMenuBrowseFiles::ScanDir(const char *DirName)
if (p)
basename.Truncate(p - basename);
int i;
- for(i=0; xc.s_subExts[i] && !*subfile; i++) {
+ for (i=0; xc.s_subExts[i] && !*subfile; i++) {
cString tmp = cString::sprintf("%s%s", *basename, xc.s_subExts[i]);
if (stat(tmp, &st) == 0)
subfile = tmp;
}
- // resume file ?
- resumefile = cString::sprintf("%s/%s.resume", DirName, e->d_name);
- if (stat(resumefile, &st) != 0)
- resumefile = NULL;
+ // resume file ?
+ resumefile = cString::sprintf("%s/%s.resume", DirName, e->d_name);
+ if (stat(resumefile, &st) != 0)
+ resumefile = NULL;
- Add(new cFileListItem(e->d_name, false, *resumefile, subfile));
- }
+ Add(new cFileListItem(e->d_name, false, *resumefile, subfile));
+ }
}
}
}
@@ -518,9 +519,7 @@ eKeys cMenuXinelib::g_LastHotkey = kNone;
cMenuXinelib::cMenuXinelib()
{
- field_order = xc.field_order;
compression = xc.audio_compression;
- headphone = xc.headphone;
autocrop = xc.autocrop;
overscan = xc.overscan;
@@ -555,36 +554,24 @@ cMenuXinelib::cMenuXinelib()
}
if (xc.media_menu_items & MEDIA_MENU_VIDEO_SETUP) {
- Add(NewTitle(tr("Video settings")));
- Add(ctrl_novideo = new cMenuEditBoolItem(tr("Play only audio"),
- &novideo));
- Add(ctrl_autocrop = new cMenuEditBoolItem(tr("Crop letterbox 4:3 to 16:9"),
- &autocrop));
- Add(ctrl_overscan = new cMenuEditTypedIntItem(tr("Overscan (crop image borders)"), "%",
- &overscan, 0, 10,
- tr("Off")));
-#ifdef HAVE_XV_FIELD_ORDER
- Add(video_ctrl_interlace_order = new cMenuEditStraI18nItem(tr("Interlaced Field Order"),
- &field_order, 2, xc.s_fieldOrder));
-#endif
+ Add(NewTitle(tr("Video settings")));
+ Add(ctrl_novideo = new cMenuEditBoolItem(tr("Play only audio"),
+ &novideo));
+ Add(ctrl_autocrop = new cMenuEditBoolItem(tr("Crop letterbox 4:3 to 16:9"),
+ &autocrop));
+ Add(ctrl_overscan = new cMenuEditTypedIntItem(tr("Overscan (crop image borders)"), "%",
+ &overscan, 0, 10,
+ tr("Off")));
}
if (xc.media_menu_items & MEDIA_MENU_AUDIO_SETUP) {
- Add(NewTitle(tr("Audio settings")));
-#ifdef ENABLE_TEST_POSTPLUGINS
- Add(ctrl_headphone = new cMenuEditBoolItem(tr("Headphone audio mode"),
- &headphone));
-#else
- ctrl_headphone = NULL;
-#endif
-
- Add(audio_ctrl_compress = new cMenuEditTypedIntItem(tr("Audio Compression"),"%",
- &compression, 100, 500, NULL, tr("Off")));
-
- Add(new cOsdItem(tr("Audio equalizer >>"), osUser7));
+ Add(NewTitle(tr("Audio settings")));
+ Add(audio_ctrl_compress = new cMenuEditTypedIntItem(tr("Audio Compression"), "%",
+ &compression, 100, 500, NULL, tr("Off")));
+ Add(new cOsdItem(tr("Audio equalizer >>"), osUser7));
}
- switch(xc.main_menu_mode) {
+ switch (xc.main_menu_mode) {
case ShowFiles: AddSubMenu(new cMenuBrowseFiles(ShowFiles)); break;
case ShowMusic: AddSubMenu(new cMenuBrowseFiles(ShowMusic)); break;
case ShowImages: AddSubMenu(new cMenuBrowseFiles(ShowImages)); break;
@@ -596,34 +583,23 @@ cMenuXinelib::cMenuXinelib()
cMenuXinelib::~cMenuXinelib()
{
-#ifdef HAVE_XV_FIELD_ORDER
- if(xc.field_order != field_order )
- cXinelibDevice::Instance().ConfigureWindow(xc.fullscreen, xc.width, xc.height,
- xc.modeswitch, xc.modeline, xc.display_aspect,
- xc.scale_video, xc.field_order);
-#endif
-
- if(xc.audio_compression != compression)
- cXinelibDevice::Instance().ConfigurePostprocessing(xc.deinterlace_method, xc.audio_delay,
- xc.audio_compression, xc.audio_equalizer,
- xc.audio_surround, xc.speaker_type);
+ if (xc.audio_compression != compression)
+ cXinelibDevice::Instance().ConfigurePostprocessing(xc.deinterlace_method, xc.audio_delay,
+ xc.audio_compression, xc.audio_equalizer,
+ xc.audio_surround, xc.speaker_type);
- if(xc.overscan != overscan)
+ if (xc.overscan != overscan)
cXinelibDevice::Instance().ConfigureVideo(xc.hue, xc.saturation, xc.brightness, xc.sharpness,
- xc.noise_reduction, xc.contrast, xc.overscan,
- xc.vo_aspect_ratio);
-
- if(xc.headphone != headphone)
- cXinelibDevice::Instance().ConfigurePostprocessing("headphone",
- xc.headphone ? true : false);
+ xc.noise_reduction, xc.contrast, xc.overscan,
+ xc.vo_aspect_ratio);
- if(xc.autocrop != autocrop)
- cXinelibDevice::Instance().ConfigurePostprocessing("autocrop",
- xc.autocrop ? true : false,
- xc.AutocropOptions());
+ if (xc.autocrop != autocrop)
+ cXinelibDevice::Instance().ConfigurePostprocessing("autocrop",
+ xc.autocrop ? true : false,
+ xc.AutocropOptions());
int dev_novideo = cXinelibDevice::Instance().GetPlayMode() == pmAudioOnlyBlack ? 1 : 0;
- if(dev_novideo != novideo)
+ if (dev_novideo != novideo)
cXinelibDevice::Instance().SetPlayMode(novideo ? pmAudioOnlyBlack : pmNone);
}
@@ -635,9 +611,9 @@ cOsdMenu *cMenuXinelib::CreateMenuBrowseFiles(eMainMenuMode mode, bool Queue)
eOSState cMenuXinelib::ProcessKey(eKeys Key)
{
/* Hot key support */
- if(hotkey_state == hkInit && Key == kNone)
+ if (hotkey_state == hkInit && Key == kNone)
return osContinue;
- if(hotkey_state == hkInit && Key == HOTKEY_START) {
+ if (hotkey_state == hkInit && Key == HOTKEY_START) {
hotkey_state = hkSeen;
return osContinue;
} else if(hotkey_state == hkSeen && Key != kNone) {
@@ -645,15 +621,15 @@ eOSState cMenuXinelib::ProcessKey(eKeys Key)
return ProcessHotkey(Key);
}
hotkey_state = hkNone;
-
+
cOsdItem *item = Get(Current());
eOSState state = cMenuSetupPage::ProcessKey(Key);
- if(HasSubMenu())
+ if (HasSubMenu())
return state;
- switch(state) {
+ switch (state) {
case osUser1:
AddSubMenu(new cMenuBrowseFiles(ShowFiles));
return osUnknown;
@@ -677,8 +653,8 @@ eOSState cMenuXinelib::ProcessKey(eKeys Key)
return osEnd;
case osUser7:
if(!g_PendingMenuAction) {
- g_PendingMenuAction = new cEqualizer();
- return osPlugin;
+ g_PendingMenuAction = new cEqualizer();
+ return osPlugin;
}
return osContinue;
default: ;
@@ -686,45 +662,32 @@ eOSState cMenuXinelib::ProcessKey(eKeys Key)
Key = NORMALKEY(Key);
- if(Key==kLeft || Key==kRight || ISNUMBERKEY(Key)) {
- if(item == audio_ctrl_compress)
- cXinelibDevice::Instance().ConfigurePostprocessing(xc.deinterlace_method, xc.audio_delay,
- compression, xc.audio_equalizer,
- xc.audio_surround, xc.speaker_type);
- else if(item == ctrl_overscan)
+ if (Key == kLeft || Key == kRight || ISNUMBERKEY(Key)) {
+ if (item == audio_ctrl_compress)
+ cXinelibDevice::Instance().ConfigurePostprocessing(xc.deinterlace_method, xc.audio_delay,
+ compression, xc.audio_equalizer,
+ xc.audio_surround, xc.speaker_type);
+ else if (item == ctrl_overscan)
cXinelibDevice::Instance().ConfigureVideo(xc.hue, xc.saturation, xc.brightness, xc.sharpness,
xc.noise_reduction, xc.contrast, overscan,
xc.vo_aspect_ratio);
}
- if(Key==kLeft || Key==kRight) {
- if(item == ctrl_headphone)
- cXinelibDevice::Instance().ConfigurePostprocessing("headphone", headphone?true:false);
- else if(item == ctrl_autocrop)
+ if (Key == kLeft || Key == kRight) {
+ if (item == ctrl_autocrop)
cXinelibDevice::Instance().ConfigurePostprocessing("autocrop", autocrop?true:false,
- xc.AutocropOptions());
- else if(item == ctrl_novideo)
+ xc.AutocropOptions());
+ else if (item == ctrl_novideo)
cXinelibDevice::Instance().SetPlayMode(novideo ? pmAudioOnlyBlack : pmNone);
-#ifdef HAVE_XV_FIELD_ORDER
- else if(video_ctrl_interlace_order && item == video_ctrl_interlace_order)
- cXinelibDevice::Instance().ConfigureWindow(xc.fullscreen, xc.width, xc.height,
- xc.modeswitch, xc.modeline,
- xc.display_aspect, xc.scale_video,
- field_order);
-#endif
}
-
+
return state;
}
-
+
void cMenuXinelib::Store(void)
{
-#ifdef HAVE_XV_FIELD_ORDER
- xc.field_order = field_order;
-#endif
xc.audio_compression = compression;
xc.autocrop = autocrop;
xc.overscan = overscan;
- xc.headphone = headphone;
}
eOSState cMenuXinelib::ProcessHotkey(eKeys Key)
@@ -734,7 +697,7 @@ eOSState cMenuXinelib::ProcessHotkey(eKeys Key)
time_t now = time(NULL);
bool OnlyInfo = ((g_LastHotkeyTime < now-3) || g_LastHotkey != Key);
- switch(Key) {
+ switch (Key) {
case HOTKEY_DVD:
cControl::Shutdown();
cControl::Launch(new cXinelibDvdPlayerControl("dvd:/"));
@@ -748,188 +711,188 @@ eOSState cMenuXinelib::ProcessHotkey(eKeys Key)
case HOTKEY_LOCAL_FE:
/* off, on */
{
- int local_frontend = strstra(xc.local_frontend, xc.s_frontends, 0);
+ int local_frontend = strstra(xc.local_frontend, xc.s_frontends, 0);
#ifndef OLD_TOGGLE_FE
- if(local_frontend==FRONTEND_NONE)
- // no need to show current frontend if there is no output device ...
- OnlyInfo = false;
+ if (local_frontend==FRONTEND_NONE)
+ // no need to show current frontend if there is no output device ...
+ OnlyInfo = false;
#endif
- if(!OnlyInfo) {
+ if (!OnlyInfo) {
#ifndef OLD_TOGGLE_FE
- static int orig_frontend = -1;
- if(orig_frontend < 0)
- orig_frontend = local_frontend;
-
- if(orig_frontend == FRONTEND_NONE) {
- // no frontends were loaded at startup -> loop thru all frontends
- local_frontend++;
- } else {
- // frontend was loaded at startup -> toggle it on/off
- if(local_frontend == FRONTEND_NONE)
- local_frontend = orig_frontend;
- else
- local_frontend = FRONTEND_NONE;
- }
+ static int orig_frontend = -1;
+ if (orig_frontend < 0)
+ orig_frontend = local_frontend;
+
+ if (orig_frontend == FRONTEND_NONE) {
+ // no frontends were loaded at startup -> loop thru all frontends
+ local_frontend++;
+ } else {
+ // frontend was loaded at startup -> toggle it on/off
+ if (local_frontend == FRONTEND_NONE)
+ local_frontend = orig_frontend;
+ else
+ local_frontend = FRONTEND_NONE;
+ }
#else
- local_frontend++;
+ local_frontend++;
#endif
- if(local_frontend >= FRONTEND_count)
- local_frontend = 0;
- strn0cpy(xc.local_frontend, xc.s_frontends[local_frontend], sizeof(xc.local_frontend));
- cXinelibDevice::Instance().ConfigureWindow(
- xc.fullscreen, xc.width, xc.height, xc.modeswitch, xc.modeline,
- xc.display_aspect, xc.scale_video, xc.field_order);
- }
- Message = cString::sprintf("%s %s %s", tr("Local Frontend"),
- OnlyInfo ? ":" : "->",
- xc.s_frontendNames[local_frontend]);
+ if (local_frontend >= FRONTEND_count)
+ local_frontend = 0;
+ strn0cpy(xc.local_frontend, xc.s_frontends[local_frontend], sizeof(xc.local_frontend));
+ cXinelibDevice::Instance().ConfigureWindow(
+ xc.fullscreen, xc.width, xc.height, xc.modeswitch, xc.modeline,
+ xc.display_aspect, xc.scale_video, xc.field_order);
+ }
+ Message = cString::sprintf("%s %s %s", tr("Local Frontend"),
+ OnlyInfo ? ":" : "->",
+ xc.s_frontendNames[local_frontend]);
}
break;
case HOTKEY_NEXT_ASPECT:
/* auto, 4:3, 16:9, ... */
- if(!OnlyInfo) {
- xc.display_aspect = (xc.display_aspect < ASPECT_count-1) ? xc.display_aspect+1 : 0;
- cXinelibDevice::Instance().ConfigureWindow(xc.fullscreen, xc.width, xc.height,
- xc.modeswitch, xc.modeline, xc.display_aspect,
- xc.scale_video, xc.field_order);
+ if (!OnlyInfo) {
+ xc.display_aspect = (xc.display_aspect < ASPECT_count-1) ? xc.display_aspect+1 : 0;
+ cXinelibDevice::Instance().ConfigureWindow(xc.fullscreen, xc.width, xc.height,
+ xc.modeswitch, xc.modeline, xc.display_aspect,
+ xc.scale_video, xc.field_order);
}
- Message = cString::sprintf("%s %s %s", tr("Aspect ratio"),
- OnlyInfo ? ":" : "->",
- tr(xc.s_aspects[xc.display_aspect]));
+ Message = cString::sprintf("%s %s %s", tr("Aspect ratio"),
+ OnlyInfo ? ":" : "->",
+ tr(xc.s_aspects[xc.display_aspect]));
break;
case HOTKEY_TOGGLE_VO_ASPECT:
/* auto, square, 4:3, anamorphic or DVB */
- if(!OnlyInfo) {
+ if (!OnlyInfo) {
xc.vo_aspect_ratio = (xc.vo_aspect_ratio < VO_ASPECT_count-1) ? xc.vo_aspect_ratio + 1 : 0;
cXinelibDevice::Instance().ConfigureVideo(xc.hue, xc.saturation, xc.brightness, xc.sharpness,
- xc.noise_reduction, xc.contrast, xc.overscan,
- xc.vo_aspect_ratio);
+ xc.noise_reduction, xc.contrast, xc.overscan,
+ xc.vo_aspect_ratio);
}
Message = cString::sprintf("%s %s %s", tr("Video aspect ratio"),
- OnlyInfo ? ":" : "->",
- tr(xc.s_vo_aspects[xc.vo_aspect_ratio]));
+ OnlyInfo ? ":" : "->",
+ tr(xc.s_vo_aspects[xc.vo_aspect_ratio]));
break;
- case HOTKEY_TOGGLE_CROP:
+ case HOTKEY_TOGGLE_CROP:
/* off, force, auto */
- if(!OnlyInfo) {
- if(!xc.autocrop) {
- xc.autocrop = 1;
- xc.autocrop_autodetect = 1;
- } else if(xc.autocrop_autodetect) {
- xc.autocrop_autodetect = 0;
- } else {
- xc.autocrop = 0;
- }
- cXinelibDevice::Instance().ConfigurePostprocessing("autocrop",
- xc.autocrop ? true : false,
- xc.AutocropOptions());
+ if (!OnlyInfo) {
+ if (!xc.autocrop) {
+ xc.autocrop = 1;
+ xc.autocrop_autodetect = 1;
+ } else if (xc.autocrop_autodetect) {
+ xc.autocrop_autodetect = 0;
+ } else {
+ xc.autocrop = 0;
+ }
+ cXinelibDevice::Instance().ConfigurePostprocessing("autocrop",
+ xc.autocrop ? true : false,
+ xc.AutocropOptions());
}
- Message = cString::sprintf("%s %s %s", tr("Crop letterbox 4:3 to 16:9"),
- OnlyInfo ? ":" : "->",
- !xc.autocrop ? tr("Off") : xc.autocrop_autodetect ? tr("automatic") : tr("On"));
+ Message = cString::sprintf("%s %s %s", tr("Crop letterbox 4:3 to 16:9"),
+ OnlyInfo ? ":" : "->",
+ !xc.autocrop ? tr("Off") : xc.autocrop_autodetect ? tr("automatic") : tr("On"));
break;
- case HOTKEY_DEINTERLACE:
+ case HOTKEY_DEINTERLACE:
{
- /* off, on */
- int off = !strcmp(xc.deinterlace_method, "none");
- if(!OnlyInfo) {
- off = !off;
- if(off)
- strcpy(xc.deinterlace_method, "none");
- else
- strcpy(xc.deinterlace_method, "tvtime");
- cXinelibDevice::Instance().ConfigurePostprocessing(xc.deinterlace_method, xc.audio_delay,
- compression, xc.audio_equalizer,
- xc.audio_surround, xc.speaker_type);
- }
- Message = cString::sprintf("%s %s %s", tr("Deinterlacing"),
- OnlyInfo ? ":" : "->",
- tr(off ? "Off":"On"));
+ /* off, on */
+ int off = !strcmp(xc.deinterlace_method, "none");
+ if (!OnlyInfo) {
+ off = !off;
+ if (off)
+ strcpy(xc.deinterlace_method, "none");
+ else
+ strcpy(xc.deinterlace_method, "tvtime");
+ cXinelibDevice::Instance().ConfigurePostprocessing(xc.deinterlace_method, xc.audio_delay,
+ compression, xc.audio_equalizer,
+ xc.audio_surround, xc.speaker_type);
+ }
+ Message = cString::sprintf("%s %s %s", tr("Deinterlacing"),
+ OnlyInfo ? ":" : "->",
+ tr(off ? "Off":"On"));
}
break;
- case HOTKEY_UPMIX:
+ case HOTKEY_UPMIX:
/* off, on */
- if(!OnlyInfo) {
- xc.audio_upmix = xc.audio_upmix ? 0 : 1;
- cXinelibDevice::Instance().ConfigurePostprocessing(
- "upmix", xc.audio_upmix ? true : false, NULL);
+ if (!OnlyInfo) {
+ xc.audio_upmix = xc.audio_upmix ? 0 : 1;
+ cXinelibDevice::Instance().ConfigurePostprocessing(
+ "upmix", xc.audio_upmix ? true : false, NULL);
}
- Message = cString::sprintf("%s %s %s",
- tr("Upmix stereo to 5.1"),
- OnlyInfo ? ":" : "->",
- tr(xc.audio_upmix ? "On" : "Off"));
+ Message = cString::sprintf("%s %s %s",
+ tr("Upmix stereo to 5.1"),
+ OnlyInfo ? ":" : "->",
+ tr(xc.audio_upmix ? "On" : "Off"));
break;
- case HOTKEY_DOWNMIX:
+ case HOTKEY_DOWNMIX:
/* off, on */
- if(!OnlyInfo) {
- xc.audio_surround = xc.audio_surround ? 0 : 1;
- cXinelibDevice::Instance().ConfigurePostprocessing(
- xc.deinterlace_method, xc.audio_delay, xc.audio_compression,
- xc.audio_equalizer, xc.audio_surround, xc.speaker_type);
+ if (!OnlyInfo) {
+ xc.audio_surround = xc.audio_surround ? 0 : 1;
+ cXinelibDevice::Instance().ConfigurePostprocessing(
+ xc.deinterlace_method, xc.audio_delay, xc.audio_compression,
+ xc.audio_equalizer, xc.audio_surround, xc.speaker_type);
}
- Message = cString::sprintf("%s %s %s",
- tr("Downmix AC3 to surround"),
- OnlyInfo ? ":" : "->",
- tr(xc.audio_surround ? "On":"Off"));
+ Message = cString::sprintf("%s %s %s",
+ tr("Downmix AC3 to surround"),
+ OnlyInfo ? ":" : "->",
+ tr(xc.audio_surround ? "On":"Off"));
break;
case HOTKEY_PLAYLIST:
- /* Start replaying playlist or file pointed by
- symlink $(CONFDIR)/plugins/xineliboutput/default_playlist */
- {
- struct stat st;
- cString file = cString::sprintf("%s%s", cPlugin::ConfigDirectory("xineliboutput"), "/default_playlist");
- if (lstat(file, &st) == 0) {
- if (S_ISLNK(st.st_mode)) {
- cString buffer(ReadLink(file), true);
- if (!*buffer || stat(buffer, &st)) {
- Message = tr("Default playlist not found");
- } else {
- LOGDBG("Replaying default playlist: %s", *file);
- cControl::Shutdown();
- cControl::Launch(new cXinelibPlayerControl(CloseOsd, buffer));
- }
- } else {
- Message = tr("Default playlist is not symlink");
- }
- } else {
- Message = tr("Default playlist not defined");
- }
- }
- break;
+ /* Start replaying playlist or file pointed by
+ symlink $(CONFDIR)/plugins/xineliboutput/default_playlist */
+ {
+ struct stat st;
+ cString file = cString::sprintf("%s%s", cPlugin::ConfigDirectory("xineliboutput"), "/default_playlist");
+ if (lstat(file, &st) == 0) {
+ if (S_ISLNK(st.st_mode)) {
+ cString buffer(ReadLink(file), true);
+ if (!*buffer || stat(buffer, &st)) {
+ Message = tr("Default playlist not found");
+ } else {
+ LOGDBG("Replaying default playlist: %s", *file);
+ cControl::Shutdown();
+ cControl::Launch(new cXinelibPlayerControl(CloseOsd, buffer));
+ }
+ } else {
+ Message = tr("Default playlist is not symlink");
+ }
+ } else {
+ Message = tr("Default playlist not defined");
+ }
+ }
+ break;
case HOTKEY_ADELAY_UP:
/* audio delay up */
- if(!OnlyInfo) {
- xc.audio_delay++;
+ if (!OnlyInfo) {
+ xc.audio_delay++;
cXinelibDevice::Instance().ConfigurePostprocessing(xc.deinterlace_method, xc.audio_delay,
xc.audio_compression, xc.audio_equalizer,
xc.audio_surround, xc.speaker_type);
}
Message = cString::sprintf("%s %s %d %s", tr("Delay"),
- OnlyInfo ? ":" : "->",
- xc.audio_delay, tr("ms"));
+ OnlyInfo ? ":" : "->",
+ xc.audio_delay, tr("ms"));
break;
case HOTKEY_ADELAY_DOWN:
/* audio delay up */
- if(!OnlyInfo) {
- xc.audio_delay--;
+ if (!OnlyInfo) {
+ xc.audio_delay--;
cXinelibDevice::Instance().ConfigurePostprocessing(xc.deinterlace_method, xc.audio_delay,
xc.audio_compression, xc.audio_equalizer,
xc.audio_surround, xc.speaker_type);
}
Message = cString::sprintf("%s %s %d %s", tr("Delay"),
- OnlyInfo ? ":" : "->",
- xc.audio_delay, tr("ms"));
+ OnlyInfo ? ":" : "->",
+ xc.audio_delay, tr("ms"));
break;
default:
@@ -937,10 +900,10 @@ eOSState cMenuXinelib::ProcessHotkey(eKeys Key)
break;
}
- if(*Message) {
- if(!g_PendingMenuAction &&
- !cRemote::HasKeys() &&
- cRemote::CallPlugin("xineliboutput"))
+ if (*Message) {
+ if (!g_PendingMenuAction &&
+ !cRemote::HasKeys() &&
+ cRemote::CallPlugin("xineliboutput"))
g_PendingMenuAction = new cDisplayMessage(Message);
}