gui/movieplayer.cpp: parse m3u files

Origin commit data
------------------
Branch: ni/coolstream
Commit: 1caa062655
Author: [CST] Focus <focus.cst@gmail.com>
Date: 2012-06-18 (Mon, 18 Jun 2012)


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

------------------
This commit was generated by Migit
This commit is contained in:
[CST] Focus
2012-06-18 15:05:16 +04:00
parent ec4c922aaa
commit 10a29e093a

View File

@@ -47,6 +47,9 @@
#include <video.h>
#include "libtuxtxt/teletext.h"
#include <zapit/zapit.h>
#include <fstream>
#include <iostream>
#include <sstream>
//extern CPlugins *g_PluginList;
#if HAVE_TRIPLEDRAGON
@@ -113,6 +116,7 @@ void CMoviePlayerGui::Init(void)
tsfilefilter.addFilter("m2ts");
tsfilefilter.addFilter("mp4");
tsfilefilter.addFilter("mov");
tsfilefilter.addFilter("m3u");
if (strlen(g_settings.network_nfs_moviedir) != 0)
Path_local = g_settings.network_nfs_moviedir;
@@ -292,6 +296,7 @@ bool CMoviePlayerGui::SelectFile()
is_file_player = false;
p_movie_info = NULL;
file_name = "";
printf("CMoviePlayerGui::SelectFile: isBookmark %d timeshift %d isMovieBrowser %d\n", isBookmark, timeshift, isMovieBrowser);
if (has_hdd)
@@ -348,10 +353,34 @@ bool CMoviePlayerGui::SelectFile()
is_file_player = true;
full_name = file->Name.c_str();
ret = true;
if(file->getType() == CFile::FILE_PLAYLIST) {
std::ifstream infile;
char cLine[256];
char name[255] = { 0 };
infile.open(file->Name.c_str(), std::ifstream::in);
while (infile.good())
{
infile.getline(cLine, 255);
if (cLine[strlen(cLine)-1]=='\r')
cLine[strlen(cLine)-1]=0;
int duration;
sscanf(cLine, "#EXTINF:%d,%[^\n]\n", &duration, name);
if (strlen(cLine) > 0 && cLine[0]!='#')
{
char *url = strstr(cLine, "http://");
if (url != NULL) {
printf("name %s [%d] url: %s\n", name, duration, url);
full_name = url;
file_name = name;
}
}
}
}
}
}
}
if(ret) {
if(ret && file_name.empty()) {
std::string::size_type pos = full_name.find_last_of('/');
if(pos != std::string::npos) {
file_name = full_name.substr(pos+1);
@@ -394,6 +423,7 @@ void CMoviePlayerGui::PlayFile(void)
duration = p_movie_info->length * 60 * 1000;
file_prozent = 0;
//full_name = "http://172.16.1.1:49152/content/media/object_id/7/res_id/0/ext/file.avi";
if(!playback->Start((char *) full_name.c_str(), vpid, vtype, currentapid, currentac3, duration)) {
playback->Close();
} else {