conn_http_progressive: seek support
This commit is contained in:
parent
b592d39bfd
commit
ee46a189a6
1 changed files with 11 additions and 3 deletions
|
@ -11,6 +11,7 @@
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
|
#include <sstream>
|
||||||
#include <mist/socket.h>
|
#include <mist/socket.h>
|
||||||
#include <mist/http_parser.h>
|
#include <mist/http_parser.h>
|
||||||
#include <mist/dtsc.h>
|
#include <mist/dtsc.h>
|
||||||
|
@ -34,6 +35,7 @@ namespace Connector_HTTP{
|
||||||
FLV::Tag tag;///< Temporary tag buffer.
|
FLV::Tag tag;///< Temporary tag buffer.
|
||||||
|
|
||||||
unsigned int lastStats = 0;
|
unsigned int lastStats = 0;
|
||||||
|
unsigned int seek_pos = 0;//seek position in milliseconds
|
||||||
conn.setBlocking(false);//do not block on conn.spool() when no data is available
|
conn.setBlocking(false);//do not block on conn.spool() when no data is available
|
||||||
|
|
||||||
while (conn.connected()){
|
while (conn.connected()){
|
||||||
|
@ -45,9 +47,10 @@ namespace Connector_HTTP{
|
||||||
#endif
|
#endif
|
||||||
conn.setHost(HTTP_R.GetHeader("X-Origin"));
|
conn.setHost(HTTP_R.GetHeader("X-Origin"));
|
||||||
//we assume the URL is the stream name with a 3 letter extension
|
//we assume the URL is the stream name with a 3 letter extension
|
||||||
std::string extension = HTTP_R.url.substr(HTTP_R.url.size()-4);
|
std::string streamname(HTTP_R.url);
|
||||||
streamname = HTTP_R.url.substr(0, HTTP_R.url.size()-4);//strip the extension
|
size_t extDot = streamname.rfind('.');
|
||||||
/// \todo VoD streams will need support for position reading from the URL parameters
|
if (extDot != std::string::npos){streamname.resize(extDot);};//strip the extension
|
||||||
|
seek_pos = 1000 * atof(HTTP_R.GetVar("start").c_str());//seconds to ms
|
||||||
ready4data = true;
|
ready4data = true;
|
||||||
HTTP_R.Clean(); //clean for any possible next requests
|
HTTP_R.Clean(); //clean for any possible next requests
|
||||||
}else{
|
}else{
|
||||||
|
@ -71,6 +74,11 @@ namespace Connector_HTTP{
|
||||||
ready4data = false;
|
ready4data = false;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (seek_pos){
|
||||||
|
std::stringstream cmd;
|
||||||
|
cmd << "seek " << seek_pos << "\n";
|
||||||
|
ss.Send(cmd.str().c_str());
|
||||||
|
}
|
||||||
#if DEBUG >= 3
|
#if DEBUG >= 3
|
||||||
fprintf(stderr, "Everything connected, starting to send video data...\n");
|
fprintf(stderr, "Everything connected, starting to send video data...\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Reference in a new issue