movieplayer arm: add option to play separate audio file

Origin commit data
------------------
Commit: 47914fbdc5
Author: Jacek Jendrzej <overx300@gmail.com>
Date: 2019-11-03 (Sun, 03 Nov 2019)
This commit is contained in:
Jacek Jendrzej
2019-11-03 18:42:05 +01:00
committed by vanhofen
parent 223938cfd8
commit 29a7c81dab
6 changed files with 39 additions and 15 deletions

View File

@@ -2260,8 +2260,8 @@ bool CStreamRec::Open(CZapitChannel * channel)
if (url.empty())
return false;
std::string pretty_name,headers;
if (!CMoviePlayerGui::getInstance(true).getLiveUrl(channel->getUrl(), channel->getScriptName(), url, pretty_name, recMovieInfo->epgInfo1, recMovieInfo->epgInfo2,headers)) {
std::string pretty_name,headers,dumb;
if (!CMoviePlayerGui::getInstance(true).getLiveUrl(channel->getUrl(), channel->getScriptName(), url, pretty_name, recMovieInfo->epgInfo1, recMovieInfo->epgInfo2,headers,dumb)) {
printf("%s: getLiveUrl() [%s] failed!\n", __FUNCTION__, url.c_str());
return false;
}

View File

@@ -814,8 +814,8 @@ bool CStreamStream::Open()
if (url.empty())
return false;
std::string pretty_name, livestreamInfo1, livestreamInfo2, headers;
if (!CMoviePlayerGui::getInstance(true).getLiveUrl(channel->getUrl(), channel->getScriptName(), url, pretty_name, livestreamInfo1, livestreamInfo2,headers)) {
std::string pretty_name, livestreamInfo1, livestreamInfo2, headers, dumb;
if (!CMoviePlayerGui::getInstance(true).getLiveUrl(channel->getUrl(), channel->getScriptName(), url, pretty_name, livestreamInfo1, livestreamInfo2,headers,dumb)) {
printf("%s: getLiveUrl() [%s] failed!\n", __FUNCTION__, url.c_str());
return false;
}

View File

@@ -4,4 +4,4 @@
* to luainstance.h changes
*/
#define LUA_API_VERSION_MAJOR 1
#define LUA_API_VERSION_MINOR 82
#define LUA_API_VERSION_MINOR 83

View File

@@ -182,6 +182,7 @@ int CLuaInstVideo::PlayFile(lua_State *L)
const char *info1 = "";
const char *info2 = "";
const char *fname;
const char *fname2 = "";
title = luaL_checkstring(L, 2);
fname = luaL_checkstring(L, 3);
@@ -189,14 +190,17 @@ int CLuaInstVideo::PlayFile(lua_State *L)
info1 = luaL_checkstring(L, 4);
if (numargs > 4)
info2 = luaL_checkstring(L, 5);
if (numargs > 5)
fname2 = luaL_checkstring(L, 6);
printf("CLuaInstVideo::%s: title %s file %s\n", __func__, title, fname);
std::string st(title);
std::string si1(info1);
std::string si2(info2);
std::string sf(fname);
std::string sf2(fname2);
if (D != NULL && !D->infoFunc.empty())
CMoviePlayerGui::getInstance().setLuaInfoFunc(L, true);
CMoviePlayerGui::getInstance().SetFile(st, sf, si1, si2);
CMoviePlayerGui::getInstance().SetFile(st, sf, si1, si2,sf2);
CMoviePlayerGui::getInstance().exec(NULL, "http_lua");
CMoviePlayerGui::getInstance().setLuaInfoFunc(L, false);
if (D != NULL && !D->infoFunc.empty())

View File

@@ -849,8 +849,11 @@ bool CMoviePlayerGui::StartWebtv(void)
clearSubtitle();
playback->Open(is_file_player ? PLAYMODE_FILE : PLAYMODE_TS);
#if HAVE_ARM_HARDWARE
bool res = playback->Start(file_name, cookie_header, second_file_name);//url with cookies and optional second audio file
#else
bool res = playback->Start((char *) file_name.c_str(), cookie_header);//url with cookies
#endif
if (res)
playback->SetSpeed(1);
if (!res) {
@@ -966,7 +969,7 @@ bool CMoviePlayerGui::luaGetUrl(const std::string &script, const std::string &fi
bool haveurl = false;
if ( !root.isObject() ) {
for (Json::Value::iterator it = root.begin(); it != root.end(); ++it) {
info.url=""; info.name=""; info.header=""; info.bandwidth = 1; info.resolution=""; info.res1 = 1;
info.url=""; info.url2=""; info.name=""; info.header=""; info.bandwidth = 1; info.resolution=""; info.res1 = 1;
tmp = "0";
Json::Value object_it = *it;
for (Json::Value::iterator iti = object_it.begin(); iti != object_it.end(); iti++) {
@@ -974,6 +977,9 @@ bool CMoviePlayerGui::luaGetUrl(const std::string &script, const std::string &fi
if (name=="url") {
info.url = (*iti).asString();
haveurl = true;
//url2 for separate audio file
} else if (name=="url2") {
info.url2 = (*iti).asString();
} else if (name=="name") {
info.name = (*iti).asString();
}
@@ -998,12 +1004,15 @@ bool CMoviePlayerGui::luaGetUrl(const std::string &script, const std::string &fi
}
if (root.isObject()) {
for (Json::Value::iterator it = root.begin(); it != root.end(); ++it) {
info.url=""; info.name=""; info.header=""; info.bandwidth = 1; info.resolution=""; info.res1 = 1;
info.url=""; info.url2=""; info.name=""; info.header=""; info.bandwidth = 1; info.resolution=""; info.res1 = 1;
tmp = "0";
std::string name = it.name();
if (name=="url") {
info.url = (*it).asString();
haveurl = true;
//url2 for separate audio file
} else if (name=="url2") {
info.url2 = (*it).asString();
} else if (name=="name") {
info.name = (*it).asString();
} else if (name=="header") {
@@ -1064,6 +1073,7 @@ bool CMoviePlayerGui::selectLivestream(std::vector<livestream_info_t> &streamLis
_info = &(streamList[i]);
if (_info->res1 == _res) {
info->url = _info->url;
info->url2 = _info->url2;
info->name = _info->name;
info->header = _info->header;
info->resolution = _info->resolution;
@@ -1095,7 +1105,7 @@ bool CMoviePlayerGui::selectLivestream(std::vector<livestream_info_t> &streamLis
return false;
}
bool CMoviePlayerGui::getLiveUrl(const std::string &url, const std::string &script, std::string &realUrl, std::string &_pretty_name, std::string &info1, std::string &info2, std::string &header)
bool CMoviePlayerGui::getLiveUrl(const std::string &url, const std::string &script, std::string &realUrl, std::string &_pretty_name, std::string &info1, std::string &info2, std::string &header, std::string &url2)
{
std::vector<livestream_info_t> liveStreamList;
livestream_info_t info;
@@ -1176,6 +1186,9 @@ bool CMoviePlayerGui::getLiveUrl(const std::string &url, const std::string &scri
if (!info.header.empty()) {
header = info.header;
}
if (!info.url2.empty()) {
url2 = info.url2;
}
#if 0
if (!info.resolution.empty())
@@ -1230,9 +1243,11 @@ bool CMoviePlayerGui::PlayBackgroundStart(const std::string &file, const std::st
}
std::string realUrl;
std::string Url2;
std::string _pretty_name = name;
cookie_header.clear();
if (!getLiveUrl(file, script, realUrl, _pretty_name, livestreamInfo1, livestreamInfo2, cookie_header)) {
second_file_name.clear();
if (!getLiveUrl(file, script, realUrl, _pretty_name, livestreamInfo1, livestreamInfo2, cookie_header,Url2)) {
return false;
}
@@ -1244,6 +1259,7 @@ bool CMoviePlayerGui::PlayBackgroundStart(const std::string &file, const std::st
instance_bg->is_file_player = true;
instance_bg->isHTTP = true;
instance_bg->file_name = realUrl;
instance_bg->second_file_name = Url2;
instance_bg->pretty_name = _pretty_name;
instance_bg->cookie_header = cookie_header;
@@ -1377,9 +1393,11 @@ bool CMoviePlayerGui::PlayFileStart(void)
if (is_audio_playing)
frameBuffer->showFrame("mp3.jpg");
#if HAVE_ARM_HARDWARE
bool res = playback->Start((char *) file_name.c_str(), vpid, vtype, currentapid, currentac3, duration,"",second_file_name);
#else
bool res = playback->Start((char *) file_name.c_str(), vpid, vtype, currentapid, currentac3, duration);
#endif
if (thrStartHint) {
showStartingHint = false;
pthread_join(thrStartHint, NULL);

View File

@@ -100,6 +100,7 @@ class CMoviePlayerGui : public CMenuTarget
typedef struct livestream_info_t
{
std::string url;
std::string url2;//separate audio file
std::string name;
std::string resolution;
std::string header;//cookie
@@ -250,6 +251,7 @@ class CMoviePlayerGui : public CMenuTarget
MI_MOVIE_INFO * p_movie_info;
std::string file_name;
std::string second_file_name;//separate audio file for ARM BOX
std::string pretty_name;
int exec(CMenuTarget* parent, const std::string & actionKey);
bool Playing() { return playing; };
@@ -264,7 +266,7 @@ class CMoviePlayerGui : public CMenuTarget
void moveTimeshift() { timeshift_to_record = true; }
int file_prozent;
cPlayback *getPlayback() { return playback; }
void SetFile(std::string &name, std::string &file, std::string info1="", std::string info2="") { pretty_name = name; file_name = file; info_1 = info1; info_2 = info2; }
void SetFile(std::string &name, std::string &file, std::string info1="", std::string info2="", std::string file2="") { pretty_name = name; file_name = file; info_1 = info1; info_2 = info2; second_file_name = file2; }
bool PlayBackgroundStart(const std::string &file, const std::string &name, t_channel_id chan, const std::string &script="");
void stopPlayBack(void);
void stopTimeshift(void);
@@ -286,7 +288,7 @@ class CMoviePlayerGui : public CMenuTarget
bool getBlockedFromPlugin() { return blockedFromPlugin; };
void setLuaInfoFunc(lua_State* L, bool func) { luaState = L; haveLuaInfoFunc = func; };
void getLivestreamInfo(std::string *i1, std::string *i2) { *i1=livestreamInfo1; *i2=livestreamInfo2; };
bool getLiveUrl(const std::string &url, const std::string &script, std::string &realUrl, std::string &_pretty_name, std::string &info1, std::string &info2, std::string &header);
bool getLiveUrl(const std::string &url, const std::string &script, std::string &realUrl, std::string &_pretty_name, std::string &info1, std::string &info2, std::string &header, std::string &url2);
bool IsAudioPlaying() { return is_audio_playing; };
void showMovieInfo();
};