mirror of
https://github.com/tuxbox-neutrino/libstb-hal.git
synced 2025-08-26 23:13:16 +02:00
add cookie.patch thx DboxOldie
This commit is contained in:
@@ -70,7 +70,7 @@ class Input
|
||||
|
||||
bool ReadSubtitle(const char *filename, const char *format, int pid);
|
||||
bool ReadSubtitles(const char *filename);
|
||||
bool Init(const char *filename);
|
||||
bool Init(const char *filename, std::string headers = "");
|
||||
bool UpdateTracks();
|
||||
bool Play();
|
||||
bool Stop();
|
||||
|
@@ -103,7 +103,7 @@ class Player {
|
||||
bool FastBackward(int speed);
|
||||
bool FastForward(int speed);
|
||||
|
||||
bool Open(const char *Url, bool noprobe = false);
|
||||
bool Open(const char *Url, bool noprobe = false, std::string headers = "");
|
||||
bool Close();
|
||||
bool Play();
|
||||
bool Pause();
|
||||
|
@@ -372,12 +372,13 @@ bool Input::ReadSubtitles(const char *filename) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool Input::Init(const char *filename)
|
||||
bool Input::Init(const char *filename, std::string headers)
|
||||
{
|
||||
bool find_info = true;
|
||||
abortPlayback = false;
|
||||
av_lockmgr_register(lock_callback);
|
||||
#if ENABLE_LOGGING
|
||||
av_log_set_level(AV_LOG_INFO);
|
||||
av_log_set_callback(log_callback);
|
||||
#endif
|
||||
|
||||
@@ -385,7 +386,16 @@ bool Input::Init(const char *filename)
|
||||
fprintf(stderr, "filename NULL\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!headers.empty())
|
||||
{
|
||||
fprintf(stderr, "%s %s %d: %s\n%s\n", FILENAME, __func__, __LINE__, filename, headers.c_str());
|
||||
headers += "\r\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "%s %s %d: %s\n", FILENAME, __func__, __LINE__, filename);
|
||||
}
|
||||
|
||||
avcodec_register_all();
|
||||
av_register_all();
|
||||
@@ -403,7 +413,14 @@ again:
|
||||
avfc->interrupt_callback.callback = interrupt_cb;
|
||||
avfc->interrupt_callback.opaque = (void *) player;
|
||||
|
||||
int err = avformat_open_input(&avfc, filename, NULL, 0);
|
||||
AVDictionary *options = NULL;
|
||||
av_dict_set(&options, "auth_type", "basic", 0);
|
||||
if (!headers.empty())
|
||||
{
|
||||
av_dict_set(&options, "headers", headers.c_str(), 0);
|
||||
}
|
||||
int err = avformat_open_input(&avfc, filename, NULL, &options);
|
||||
av_dict_free(&options);
|
||||
if (averror(err, avformat_open_input)) {
|
||||
avformat_free_context(avfc);
|
||||
return false;
|
||||
|
@@ -65,7 +65,7 @@ void *Player::playthread(void *arg)
|
||||
pthread_exit(NULL);
|
||||
}
|
||||
|
||||
bool Player::Open(const char *Url, bool _noprobe)
|
||||
bool Player::Open(const char *Url, bool _noprobe, std::string headers)
|
||||
{
|
||||
fprintf(stderr, "URL=%s\n", Url);
|
||||
|
||||
@@ -89,7 +89,7 @@ bool Player::Open(const char *Url, bool _noprobe)
|
||||
return false;
|
||||
}
|
||||
|
||||
return input.Init(url.c_str());
|
||||
return input.Init(url.c_str(), headers);
|
||||
}
|
||||
|
||||
bool Player::Close()
|
||||
|
@@ -54,10 +54,10 @@ void cPlayback::Close(void)
|
||||
|
||||
bool cPlayback::Start(std::string filename, std::string headers)
|
||||
{
|
||||
Start((char*) filename.c_str(),0,0,0,0,0);
|
||||
return Start((char*) filename.c_str(),0,0,0,0,0, headers);
|
||||
}
|
||||
|
||||
bool cPlayback::Start(char *filename, int vpid, int vtype, int apid, int ac3, int)
|
||||
bool cPlayback::Start(char *filename, int vpid, int vtype, int apid, int ac3, int, std::string headers)
|
||||
{
|
||||
bool ret = false;
|
||||
bool isHTTP = false;
|
||||
@@ -82,7 +82,7 @@ bool cPlayback::Start(char *filename, int vpid, int vtype, int apid, int ac3, in
|
||||
} else
|
||||
isHTTP = true;
|
||||
|
||||
if (player->Open(file.c_str(), no_probe)) {
|
||||
if (player->Open(file.c_str(), no_probe, headers)) {
|
||||
if (pm == PLAYMODE_TS) {
|
||||
struct stat64 s;
|
||||
if (!stat64(file.c_str(), &s))
|
||||
|
@@ -40,7 +40,7 @@ class cPlayback
|
||||
|
||||
bool Open(playmode_t PlayMode);
|
||||
void Close(void);
|
||||
bool Start(char *filename, int vpid, int vtype, int apid, int ac3, int duration);
|
||||
bool Start(char *filename, int vpid, int vtype, int apid, int ac3, int duration, std::string headers = "");
|
||||
bool Start(std::string filename, std::string headers = "");
|
||||
bool SetAPid(int pid, bool ac3 = false);
|
||||
bool SetVPid(int pid);
|
||||
|
Reference in New Issue
Block a user