MI_MOVIE_INFO: add constructor

Conflicts:
	src/driver/record.cpp
	src/gui/moviebrowser.cpp
	src/gui/movieinfo.cpp
	src/gui/movieplayer.cpp
This commit is contained in:
martii
2014-01-23 20:05:48 +01:00
committed by [CST] Focus
parent 1f8bb7dfae
commit e611ed381d
4 changed files with 47 additions and 50 deletions

View File

@@ -245,7 +245,7 @@ bool CRecordInstance::Stop(bool remove_event)
struct stat test; struct stat test;
snprintf(buf,sizeof(buf), "%s.xml", filename); snprintf(buf,sizeof(buf), "%s.xml", filename);
if(stat(buf, &test) == 0){ if(stat(buf, &test) == 0){
cMovieInfo->clearMovieInfo(recMovieInfo); recMovieInfo->clear();
snprintf(buf,sizeof(buf), "%s.ts", filename); snprintf(buf,sizeof(buf), "%s.ts", filename);
recMovieInfo->file.Name = buf; recMovieInfo->file.Name = buf;
cMovieInfo->loadMovieInfo(recMovieInfo);//restore user bookmark cMovieInfo->loadMovieInfo(recMovieInfo);//restore user bookmark
@@ -552,7 +552,7 @@ void CRecordInstance::FillMovieInfo(CZapitChannel * channel, APIDList & apid_lis
{ {
std::string info1, info2; std::string info1, info2;
cMovieInfo->clearMovieInfo(recMovieInfo); recMovieInfo->clear();
std::string tmpstring = channel->getName(); std::string tmpstring = channel->getName();

View File

@@ -2684,7 +2684,6 @@ bool CMovieBrowser::loadTsFileNamesFromDir(const std::string & dirname)
if(readDir(dirname, &flist) == true) if(readDir(dirname, &flist) == true)
{ {
MI_MOVIE_INFO movieInfo; MI_MOVIE_INFO movieInfo;
//m_movieInfo.clearMovieInfo(&movieInfo); // refresh structure
for(unsigned int i = 0; i < flist.size(); i++) for(unsigned int i = 0; i < flist.size(); i++)
{ {
if( S_ISDIR(flist[i].Mode)) if( S_ISDIR(flist[i].Mode))
@@ -2702,7 +2701,7 @@ bool CMovieBrowser::loadTsFileNamesFromDir(const std::string & dirname)
} }
else else
{ {
m_movieInfo.clearMovieInfo(&movieInfo); // refresh structure movieInfo.clear();
movieInfo.file.Name = flist[i].Name; movieInfo.file.Name = flist[i].Name;
if(m_movieInfo.loadMovieInfo(&movieInfo)) { //FIXME atm we show only ts+xml (records) here if(m_movieInfo.loadMovieInfo(&movieInfo)) { //FIXME atm we show only ts+xml (records) here
movieInfo.file.Mode = flist[i].Mode; 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(); yt_video_list_t &ylist = ytparser.GetVideoList();
for (unsigned i = 0; i < ylist.size(); i++) { for (unsigned i = 0; i < ylist.size(); i++) {
MI_MOVIE_INFO movieInfo; MI_MOVIE_INFO movieInfo;
m_movieInfo.clearMovieInfo(&movieInfo); // refresh structure
movieInfo.epgChannel = ylist[i].author; movieInfo.epgChannel = ylist[i].author;
movieInfo.epgTitle = ylist[i].title; movieInfo.epgTitle = ylist[i].title;
movieInfo.epgInfo1 = ylist[i].category; 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) static void save_info(CMovieInfo * cmovie, MI_MOVIE_INFO * minfo, char * dpart, off64_t spos, off64_t secsize)
{ {
MI_MOVIE_INFO ninfo; MI_MOVIE_INFO ninfo = *minfo;
ninfo = *minfo;
ninfo.file.Name = dpart; ninfo.file.Name = dpart;
ninfo.file.Size = spos; ninfo.file.Size = spos;
ninfo.length = spos/secsize/60; 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->saveMovieInfo(ninfo);
cmovie->clearMovieInfo(&ninfo);
reset_atime(dpart, minfo->file.Time); reset_atime(dpart, minfo->file.Time);
} }

View File

@@ -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; tm timePlay;
timePlay.tm_hour = 0; timePlay.tm_hour = 0;
timePlay.tm_min = 0; timePlay.tm_min = 0;
@@ -874,49 +874,49 @@ void CMovieInfo::clearMovieInfo(MI_MOVIE_INFO * movie_info)
timePlay.tm_mday = 0; timePlay.tm_mday = 0;
timePlay.tm_mon = 1; timePlay.tm_mon = 1;
movie_info->file.Name = ""; file.Name = "";
movie_info->file.Url = ""; file.Url = "";
movie_info->file.Size = 0; // Megabytes file.Size = 0; // Megabytes
movie_info->file.Time = mktime(&timePlay); file.Time = mktime(&timePlay);
movie_info->dateOfLastPlay = mktime(&timePlay); // (date, month, year) dateOfLastPlay = mktime(&timePlay); // (date, month, year)
movie_info->dirItNr = 0; // dirItNr = 0; //
movie_info->genreMajor = 0; //genreMajor; genreMajor = 0; //genreMajor;
movie_info->genreMinor = 0; //genreMinor; genreMinor = 0; //genreMinor;
movie_info->length = 0; // (minutes) length = 0; // (minutes)
movie_info->quality = 0; // (3 stars: classics, 2 stars: very good, 1 star: good, 0 stars: OK) quality = 0; // (3 stars: classics, 2 stars: very good, 1 star: good, 0 stars: OK)
movie_info->productionDate = 0; // (Year) years since 1900 productionDate = 0; // (Year) years since 1900
movie_info->parentalLockAge = 0; // MI_PARENTAL_LOCKAGE (0,6,12,16,18) parentalLockAge = 0; // MI_PARENTAL_LOCKAGE (0,6,12,16,18)
movie_info->format = 0; // MI_VIDEO_FORMAT(16:9, 4:3) format = 0; // MI_VIDEO_FORMAT(16:9, 4:3)
movie_info->audio = 0; // MI_AUDIO (AC3, Deutsch, Englisch) audio = 0; // MI_AUDIO (AC3, Deutsch, Englisch)
movie_info->epgId = 0; epgId = 0;
movie_info->epgEpgId = 0; epgEpgId = 0;
movie_info->epgMode = 0; epgMode = 0;
movie_info->epgVideoPid = 0; epgVideoPid = 0;
movie_info->VideoType = 0; VideoType = 0;
movie_info->epgVTXPID = 0; epgVTXPID = 0;
movie_info->audioPids.clear(); audioPids.clear();
movie_info->productionCountry = ""; productionCountry = "";
movie_info->epgTitle = ""; epgTitle = "";
movie_info->epgInfo1 = ""; //epgInfo1 epgInfo1 = ""; //epgInfo1
movie_info->epgInfo2 = ""; //epgInfo2 epgInfo2 = ""; //epgInfo2
movie_info->epgChannel = ""; epgChannel = "";
movie_info->serieName = ""; // (name e.g. 'StarWars) serieName = ""; // (name e.g. 'StarWars)
movie_info->bookmarks.end = 0; bookmarks.end = 0;
movie_info->bookmarks.start = 0; bookmarks.start = 0;
movie_info->bookmarks.lastPlayStop = 0; bookmarks.lastPlayStop = 0;
for (int i = 0; i < MI_MOVIE_BOOK_USER_MAX; i++) { for (int i = 0; i < MI_MOVIE_BOOK_USER_MAX; i++) {
movie_info->bookmarks.user[i].pos = 0; bookmarks.user[i].pos = 0;
movie_info->bookmarks.user[i].length = 0; bookmarks.user[i].length = 0;
movie_info->bookmarks.user[i].name = ""; bookmarks.user[i].name = "";
} }
movie_info->tfile.clear(); tfile = "";
movie_info->ytdate.clear(); ytdate = "";
movie_info->ytid.clear(); ytid = "";
movie_info->ytitag = 0; ytitag = 0;
movie_info->marked = false; marked = false;
} }
/************************************************************************ /************************************************************************

View File

@@ -182,6 +182,9 @@ class MI_MOVIE_INFO
enum miSource { UNKNOWN = 0, YT, NK }; enum miSource { UNKNOWN = 0, YT, NK };
miSource source; miSource source;
void clear(void);
MI_MOVIE_INFO() { clear(); }
}; };
typedef std::vector<MI_MOVIE_INFO> MI_MOVIE_LIST; typedef std::vector<MI_MOVIE_INFO> 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 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 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 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 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 private:// Functions