diff options
author | phintuka <phintuka> | 2007-06-12 15:11:19 +0000 |
---|---|---|
committer | phintuka <phintuka> | 2007-06-12 15:11:19 +0000 |
commit | 8c05310d7b074c6c551f898549765faefd7bfb76 (patch) | |
tree | 9e9b53c77331fe873bef9adddd006e102f83788b | |
parent | 1d624ffe8502ca192a0de2afc33e4ac4489a8d6d (diff) | |
download | xineliboutput-8c05310d7b074c6c551f898549765faefd7bfb76.tar.gz xineliboutput-8c05310d7b074c6c551f898549765faefd7bfb76.tar.bz2 |
If separate subtitle file is detected, save the full name of file instead
of boolean flag.
(Subtitle file name will be sent to player and xine-lib, so that even
http-streamed replay can have separate subtitles)
-rw-r--r-- | menu.c | 11 | ||||
-rw-r--r-- | menuitems.c | 31 | ||||
-rw-r--r-- | menuitems.h | 13 |
3 files changed, 26 insertions, 29 deletions
@@ -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.35 2007-05-17 13:36:40 phintuka Exp $ + * $Id: menu.c,v 1.36 2007-06-12 15:11:19 phintuka Exp $ * */ @@ -403,6 +403,7 @@ bool cMenuBrowseFiles::ScanDir(const char *DirName) } else if (m_Mode == ShowFiles && xc.IsVideoFile(buffer)) { bool resume = false, subs = false, dvd = false; char *pos = strrchr(e->d_name, '.'); + cString subfile; if(pos) { // .iso image -> dvd @@ -410,13 +411,13 @@ bool cMenuBrowseFiles::ScanDir(const char *DirName) dvd = true; // separate subtitles ? - cString sub = cString::sprintf("%s/%s____", DirName, e->d_name); - char *p = strrchr(sub, '.'); + subfile = cString::sprintf("%s/%s____", DirName, e->d_name); + char *p = strrchr(subfile, '.'); if( p ) { int i; for(i=0; xc.s_subExts[i] && !subs; i++) { strcpy(p, xc.s_subExts[i]); - if (stat(sub, &st) == 0) + if (stat(subfile, &st) == 0) subs = true; } } @@ -427,7 +428,7 @@ bool cMenuBrowseFiles::ScanDir(const char *DirName) if (stat(buffer, &st) == 0) resume = true; - Add(new cFileListItem(e->d_name, false, resume, subs, dvd)); + Add(new cFileListItem(e->d_name, false, resume, subs?*subfile:NULL, dvd)); } } } diff --git a/menuitems.c b/menuitems.c index 449f2fe9..7aa80d0c 100644 --- a/menuitems.c +++ b/menuitems.c @@ -4,7 +4,7 @@ * See the main source file 'xineliboutput.c' for copyright information and * how to reach the author. * - * $Id: menuitems.c,v 1.7 2007-05-17 21:41:52 phintuka Exp $ + * $Id: menuitems.c,v 1.8 2007-06-12 15:11:19 phintuka Exp $ * */ @@ -153,54 +153,49 @@ void cMenuEditStraI18nItem::Set(void) cFileListItem::cFileListItem(const char *name, bool isDir) { - m_Name = strdup(name); + m_Name = name; m_IsDir = isDir; m_IsDvd = false; m_HasResume = false; - m_HasSubs = false; + m_SubFile = NULL; m_ShowFlags = false; m_Up = m_IsDir && !strcmp(m_Name, ".."); Set(); } cFileListItem::cFileListItem(const char *name, bool IsDir, - bool HasResume, bool HasSubs, + bool HasResume, const char *subfile, bool IsDvd) { - m_Name = strdup(name); + m_Name = name; m_IsDir = IsDir; m_IsDvd = IsDvd; m_HasResume = HasResume; - m_HasSubs = HasSubs; + m_SubFile = subfile; m_ShowFlags = true; m_Up = m_IsDir && !strcmp(m_Name, ".."); Set(); } -cFileListItem::~cFileListItem() -{ - free(m_Name); -} - void cFileListItem::Set(void) { char *txt = NULL,*pt; if(m_ShowFlags) { if(m_IsDir) { if(m_IsDvd) - asprintf(&txt, "\tD\t[%s] ", m_Name); // text2skin requires space at end of string to display item correctly ... + asprintf(&txt, "\tD\t[%s] ", *m_Name); // text2skin requires space at end of string to display item correctly ... else - asprintf(&txt, "\t\t[%s] ", m_Name); // text2skin requires space at end of string to display item correctly ... + asprintf(&txt, "\t\t[%s] ", *m_Name); // text2skin requires space at end of string to display item correctly ... } else { - asprintf(&txt, "%c\t%c\t%s", m_HasResume ? ' ' : '*', m_HasSubs ? 'S' : m_IsDvd ? 'D' : ' ', m_Name); + asprintf(&txt, "%c\t%c\t%s", m_HasResume ? ' ' : '*', *m_SubFile ? 'S' : m_IsDvd ? 'D' : ' ', *m_Name); if(NULL != (pt = strrchr(txt,'.'))) *pt = 0; } } else { if(m_IsDir) { - asprintf(&txt, "[%s] ", m_Name); // text2skin requires space at end of string to display item correctly ... + asprintf(&txt, "[%s] ", *m_Name); // text2skin requires space at end of string to display item correctly ... } else { - asprintf(&txt, "%s", m_Name); + asprintf(&txt, "%s", *m_Name); if(NULL != (pt = strrchr(txt,'.'))) *pt = 0; } @@ -220,7 +215,7 @@ int cFileListItem::Compare(const cListObject &ListObject) const return -1; if(!m_Up && other->m_Up) return 1; - return strcmp(m_Name,other->m_Name); + return strcmp(m_Name, other->m_Name); } bool cFileListItem::operator< (const cListObject &ListObject) @@ -235,5 +230,5 @@ bool cFileListItem::operator< (const cListObject &ListObject) return true; if(!m_Up && other->m_Up) return false; - return strcmp(m_Name,other->m_Name) < 0; + return strcmp(m_Name, other->m_Name) < 0; } diff --git a/menuitems.h b/menuitems.h index 18dd1af2..51c22710 100644 --- a/menuitems.h +++ b/menuitems.h @@ -4,7 +4,7 @@ * See the main source file 'xineliboutput.c' for copyright information and * how to reach the author. * - * $Id: menuitems.h,v 1.5 2007-05-17 21:41:52 phintuka Exp $ + * $Id: menuitems.h,v 1.6 2007-06-12 15:11:19 phintuka Exp $ * */ @@ -80,8 +80,9 @@ class cMenuEditStraI18nItem : public cMenuEditIntItem class cFileListItem : public cOsdItem { private: - char *m_Name; - bool m_IsDir, m_HasResume, m_HasSubs, m_ShowFlags, m_Up; + cString m_Name; + cString m_SubFile; + bool m_IsDir, m_HasResume, m_ShowFlags, m_Up; bool m_IsDvd; protected: @@ -89,12 +90,12 @@ class cFileListItem : public cOsdItem public: cFileListItem(const char *name, bool isDir, - bool HasResume, bool HasSubs, + bool HasResume, const char *subfile, bool IsDvd = false); cFileListItem(const char *name, bool isDir); - ~cFileListItem(); - const char *Name(void) { return m_Name; } + const char *Name(void) { return m_Name; } + const char *SubFile(void) { return m_SubFile; } bool IsDir(void) { return m_IsDir; } bool IsDvd(void) { return m_IsDvd; } |