movieplayer.cpp: CST - check if ts file is a mp4 container and start it from MB

Origin commit data
------------------
Branch: ni/coolstream
Commit: 93af319b7a
Author: GetAway <get-away@t-online.de>
Date: 2021-12-02 (Thu, 02 Dec 2021)


------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
GetAway
2021-12-02 20:11:06 +01:00
committed by vanhofen
parent 832ade200f
commit fbbbb91554
2 changed files with 34 additions and 1 deletions

View File

@@ -260,6 +260,33 @@ void CMoviePlayerGui::Init(void)
CScreenSaver::getInstance()->resetIdleTime();
}
#if HAVE_CST_HARDWARE
bool CMoviePlayerGui::fh_mediafile_id(const char *fname)
{
int fd;
unsigned char id[12];
fd = open(fname, O_RDONLY); if(fd==-1) return false;
read(fd, id, 12);
close(fd);
// ISO Base Media file (MPEG-4) v1
// 66 74 79 70 69 73 6F 6D ftypisom
if (id[4]=='f' && id[5]=='t' && id[6]=='y' && id[7]=='p'
&& id[8]=='i' && id[9]=='s' && id[10]=='o' && id[11]=='m')
return true;
// MPEG-4 video file
// 66 74 79 70 4D 53 4E 56 ftypMSNV
if (id[4]=='f' && id[5]=='t' && id[6]=='y' && id[7]=='p'
&& id[8]=='M' && id[9]=='S' && id[10]=='N' && id[11]=='V')
return true;
// MPEG-4 video|QuickTime file
// 66 74 79 70 6D 70 34 32 ftypmp42
if (id[4]=='f' && id[5]=='t' && id[6]=='y' && id[7]=='p'
&& id[8]=='m' && id[9]=='p' && id[10]=='4' && id[11]=='2')
return true;
return false;
}
#endif
void CMoviePlayerGui::cutNeutrino()
{
printf("%s: playing %d isUPNP %d\n", __func__, playing, isUPNP);
@@ -467,7 +494,10 @@ int CMoviePlayerGui::exec(CMenuTarget * parent, const std::string & actionKey)
break;
}
do {
#if ! HAVE_CST_HARDWARE
#if HAVE_CST_HARDWARE
if (fh_mediafile_id(file_name.c_str()))
is_file_player = true;
#else
is_file_player = true;
#endif
PlayFile();

View File

@@ -250,6 +250,9 @@ class CMoviePlayerGui : public CMenuTarget
static bool sortStreamList(livestream_info_t info1, livestream_info_t info2);
bool selectLivestream(std::vector<livestream_info_t> &streamList, int res, livestream_info_t* info);
bool luaGetUrl(const std::string &script, const std::string &file, std::vector<livestream_info_t> &streamList);
#if HAVE_CST_HARDWARE
bool fh_mediafile_id(const char *fname);
#endif
CMoviePlayerGui(const CMoviePlayerGui&) {};
CMoviePlayerGui();