Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handling of query string in manifest media URLs #16

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Handling of query string in manifest media URLs
Media URLs in the manifest can contain query string (called "auth" here), e.g. <media url="some?name=value" ...>. The fragment URLs then would be "...someSegX-FragY?name=value". Ideally, there should be a command-line switch for controlling this behavior, because I can easily imagine a situation where the segment and fragment numbers are passed via the query string, e.g. <media url="some?name=value&frag=" -> "...some?name=value&frag=SegX-FragY".
n0spam committed Aug 12, 2013
commit b7276e7a450d68ba173e5118460ba0e2354b7868
13 changes: 12 additions & 1 deletion AdobeHDS.php
Original file line number Diff line number Diff line change
@@ -505,6 +505,17 @@ function ParseManifest($cc, $parentManifest)
if (isRtmpUrl($mediaEntry['baseUrl']) or isRtmpUrl($mediaEntry['url']))
LogError("Provided manifest is not a valid HDS manifest");

$idx = strpos($mediaEntry['url'], '?');
if ($idx !== FALSE)
{
$mediaEntry['queryString'] = substr($mediaEntry['url'], $idx);
$mediaEntry['url'] = substr($mediaEntry['url'], 0, $idx);
if (strlen($this->auth) != 0 && strcmp($this->auth, $mediaEntry['queryString']) != 0)
LogInfo("Manifest overrides 'auth': " . $mediaEntry['queryString']);
}
else
$mediaEntry['queryString'] = $this->auth;

if (isset($stream[strtolower('bootstrapInfoId')]))
$bootstrap = $xml->xpath("/ns:manifest/ns:bootstrapInfo[@id='" . $stream[strtolower('bootstrapInfoId')] . "']");
else
@@ -906,7 +917,7 @@ function DownloadFragments($cc, $manifest, $opt = array())

LogDebug("Adding fragment $fragNum to download queue");
$segNum = $this->GetSegmentFromFragment($fragNum);
$cc->addDownload($this->fragUrl . "Seg" . $segNum . "-Frag" . $fragNum . $this->auth, $fragNum);
$cc->addDownload($this->fragUrl . "Seg" . $segNum . "-Frag" . $fragNum . $this->media['queryString'], $fragNum);
}

$downloads = $cc->checkDownloads();