From e611ed381d8bb5b5ea412f0302cd315e9c87ca23 Mon Sep 17 00:00:00 2001 From: martii Date: Thu, 23 Jan 2014 20:05:48 +0100 Subject: [PATCH] MI_MOVIE_INFO: add constructor Conflicts: src/driver/record.cpp src/gui/moviebrowser.cpp src/gui/movieinfo.cpp src/gui/movieplayer.cpp --- src/driver/record.cpp | 4 +- src/gui/moviebrowser.cpp | 9 +---- src/gui/movieinfo.cpp | 80 ++++++++++++++++++++-------------------- src/gui/movieinfo.h | 4 +- 4 files changed, 47 insertions(+), 50 deletions(-) diff --git a/src/driver/record.cpp b/src/driver/record.cpp index 7dbae6f32..280f201d8 100644 --- a/src/driver/record.cpp +++ b/src/driver/record.cpp @@ -245,7 +245,7 @@ bool CRecordInstance::Stop(bool remove_event) struct stat test; snprintf(buf,sizeof(buf), "%s.xml", filename); if(stat(buf, &test) == 0){ - cMovieInfo->clearMovieInfo(recMovieInfo); + recMovieInfo->clear(); snprintf(buf,sizeof(buf), "%s.ts", filename); recMovieInfo->file.Name = buf; cMovieInfo->loadMovieInfo(recMovieInfo);//restore user bookmark @@ -552,7 +552,7 @@ void CRecordInstance::FillMovieInfo(CZapitChannel * channel, APIDList & apid_lis { std::string info1, info2; - cMovieInfo->clearMovieInfo(recMovieInfo); + recMovieInfo->clear(); std::string tmpstring = channel->getName(); diff --git a/src/gui/moviebrowser.cpp b/src/gui/moviebrowser.cpp index d30099323..ad358f76e 100644 --- a/src/gui/moviebrowser.cpp +++ b/src/gui/moviebrowser.cpp @@ -2684,7 +2684,6 @@ bool CMovieBrowser::loadTsFileNamesFromDir(const std::string & dirname) if(readDir(dirname, &flist) == true) { MI_MOVIE_INFO movieInfo; - //m_movieInfo.clearMovieInfo(&movieInfo); // refresh structure for(unsigned int i = 0; i < flist.size(); i++) { if( S_ISDIR(flist[i].Mode)) @@ -2702,7 +2701,7 @@ bool CMovieBrowser::loadTsFileNamesFromDir(const std::string & dirname) } else { - m_movieInfo.clearMovieInfo(&movieInfo); // refresh structure + movieInfo.clear(); movieInfo.file.Name = flist[i].Name; if(m_movieInfo.loadMovieInfo(&movieInfo)) { //FIXME atm we show only ts+xml (records) here movieInfo.file.Mode = flist[i].Mode; @@ -3711,7 +3710,6 @@ void CMovieBrowser::loadYTitles(int mode, std::string search, std::string id) yt_video_list_t &ylist = ytparser.GetVideoList(); for (unsigned i = 0; i < ylist.size(); i++) { MI_MOVIE_INFO movieInfo; - m_movieInfo.clearMovieInfo(&movieInfo); // refresh structure movieInfo.epgChannel = ylist[i].author; movieInfo.epgTitle = ylist[i].title; movieInfo.epgInfo1 = ylist[i].category; @@ -4518,9 +4516,7 @@ static int read_psi(char * spart, unsigned char * buf) static void save_info(CMovieInfo * cmovie, MI_MOVIE_INFO * minfo, char * dpart, off64_t spos, off64_t secsize) { - MI_MOVIE_INFO ninfo; - - ninfo = *minfo; + MI_MOVIE_INFO ninfo = *minfo; ninfo.file.Name = dpart; ninfo.file.Size = spos; ninfo.length = spos/secsize/60; @@ -4534,7 +4530,6 @@ static void save_info(CMovieInfo * cmovie, MI_MOVIE_INFO * minfo, char * dpart, } } cmovie->saveMovieInfo(ninfo); - cmovie->clearMovieInfo(&ninfo); reset_atime(dpart, minfo->file.Time); } diff --git a/src/gui/movieinfo.cpp b/src/gui/movieinfo.cpp index c1291722e..1ba69272e 100644 --- a/src/gui/movieinfo.cpp +++ b/src/gui/movieinfo.cpp @@ -863,9 +863,9 @@ bool CMovieInfo::addNewBookmark(MI_MOVIE_INFO * movie_info, MI_BOOKMARK & new_bo /************************************************************************ ************************************************************************/ -void CMovieInfo::clearMovieInfo(MI_MOVIE_INFO * movie_info) + +void MI_MOVIE_INFO::clear(void) { - //TRACE("[mi]->clearMovieInfo \r\n"); tm timePlay; timePlay.tm_hour = 0; timePlay.tm_min = 0; @@ -874,49 +874,49 @@ void CMovieInfo::clearMovieInfo(MI_MOVIE_INFO * movie_info) timePlay.tm_mday = 0; timePlay.tm_mon = 1; - movie_info->file.Name = ""; - movie_info->file.Url = ""; - movie_info->file.Size = 0; // Megabytes - movie_info->file.Time = mktime(&timePlay); - movie_info->dateOfLastPlay = mktime(&timePlay); // (date, month, year) - movie_info->dirItNr = 0; // - movie_info->genreMajor = 0; //genreMajor; - movie_info->genreMinor = 0; //genreMinor; - movie_info->length = 0; // (minutes) - movie_info->quality = 0; // (3 stars: classics, 2 stars: very good, 1 star: good, 0 stars: OK) - movie_info->productionDate = 0; // (Year) years since 1900 - movie_info->parentalLockAge = 0; // MI_PARENTAL_LOCKAGE (0,6,12,16,18) - movie_info->format = 0; // MI_VIDEO_FORMAT(16:9, 4:3) - movie_info->audio = 0; // MI_AUDIO (AC3, Deutsch, Englisch) + file.Name = ""; + file.Url = ""; + file.Size = 0; // Megabytes + file.Time = mktime(&timePlay); + dateOfLastPlay = mktime(&timePlay); // (date, month, year) + dirItNr = 0; // + genreMajor = 0; //genreMajor; + genreMinor = 0; //genreMinor; + length = 0; // (minutes) + quality = 0; // (3 stars: classics, 2 stars: very good, 1 star: good, 0 stars: OK) + productionDate = 0; // (Year) years since 1900 + parentalLockAge = 0; // MI_PARENTAL_LOCKAGE (0,6,12,16,18) + format = 0; // MI_VIDEO_FORMAT(16:9, 4:3) + audio = 0; // MI_AUDIO (AC3, Deutsch, Englisch) - movie_info->epgId = 0; - movie_info->epgEpgId = 0; - movie_info->epgMode = 0; - movie_info->epgVideoPid = 0; - movie_info->VideoType = 0; - movie_info->epgVTXPID = 0; + epgId = 0; + epgEpgId = 0; + epgMode = 0; + epgVideoPid = 0; + VideoType = 0; + epgVTXPID = 0; - movie_info->audioPids.clear(); + audioPids.clear(); - movie_info->productionCountry = ""; - movie_info->epgTitle = ""; - movie_info->epgInfo1 = ""; //epgInfo1 - movie_info->epgInfo2 = ""; //epgInfo2 - movie_info->epgChannel = ""; - movie_info->serieName = ""; // (name e.g. 'StarWars) - movie_info->bookmarks.end = 0; - movie_info->bookmarks.start = 0; - movie_info->bookmarks.lastPlayStop = 0; + productionCountry = ""; + epgTitle = ""; + epgInfo1 = ""; //epgInfo1 + epgInfo2 = ""; //epgInfo2 + epgChannel = ""; + serieName = ""; // (name e.g. 'StarWars) + bookmarks.end = 0; + bookmarks.start = 0; + bookmarks.lastPlayStop = 0; for (int i = 0; i < MI_MOVIE_BOOK_USER_MAX; i++) { - movie_info->bookmarks.user[i].pos = 0; - movie_info->bookmarks.user[i].length = 0; - movie_info->bookmarks.user[i].name = ""; + bookmarks.user[i].pos = 0; + bookmarks.user[i].length = 0; + bookmarks.user[i].name = ""; } - movie_info->tfile.clear(); - movie_info->ytdate.clear(); - movie_info->ytid.clear(); - movie_info->ytitag = 0; - movie_info->marked = false; + tfile = ""; + ytdate = ""; + ytid = ""; + ytitag = 0; + marked = false; } /************************************************************************ diff --git a/src/gui/movieinfo.h b/src/gui/movieinfo.h index ae57d18f7..99be15e31 100644 --- a/src/gui/movieinfo.h +++ b/src/gui/movieinfo.h @@ -182,6 +182,9 @@ class MI_MOVIE_INFO enum miSource { UNKNOWN = 0, YT, NK }; miSource source; + + void clear(void); + MI_MOVIE_INFO() { clear(); } }; typedef std::vector MI_MOVIE_LIST; @@ -199,7 +202,6 @@ class CMovieInfo bool saveMovieInfo(MI_MOVIE_INFO& movie_info, CFile* file = NULL ); // encode the movie_info structure to xml and save it to the given .xml filename. If there is no filename, the filename (ts) from movie_info is converted to xml and used instead void showMovieInfo(MI_MOVIE_INFO& movie_info); // open a Hintbox and show the movie info void printDebugMovieInfo(MI_MOVIE_INFO& movie_info); // print movie info on debug channel (RS232) - void clearMovieInfo(MI_MOVIE_INFO* movie_info); // Set movie info structure to initial values bool addNewBookmark(MI_MOVIE_INFO* movie_info,MI_BOOKMARK &new_bookmark); // add a new bookmark to the given movie info. If there is no space false is returned private:// Functions