player: require "seek" before outputting
This commit is contained in:
parent
96f0ade4ca
commit
b592d39bfd
4 changed files with 17 additions and 0 deletions
|
@ -184,6 +184,7 @@ namespace Connector_HTTP{
|
||||||
#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
|
||||||
|
ss.Send("play\n");ss.flush();
|
||||||
inited = true;
|
inited = true;
|
||||||
}
|
}
|
||||||
if ((Flash_RequestPending > 0) && !Flash_FragBuffer.empty()){
|
if ((Flash_RequestPending > 0) && !Flash_FragBuffer.empty()){
|
||||||
|
|
|
@ -74,6 +74,7 @@ namespace Connector_HTTP{
|
||||||
#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
|
||||||
|
ss.Send("play\n");ss.flush();
|
||||||
inited = true;
|
inited = true;
|
||||||
}
|
}
|
||||||
unsigned int now = time(0);
|
unsigned int now = time(0);
|
||||||
|
|
|
@ -89,6 +89,7 @@ int Connector_RTMP::Connector_RTMP(Socket::Connection conn){
|
||||||
#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
|
||||||
|
SS.Send("play\n");SS.flush();
|
||||||
inited = true;
|
inited = true;
|
||||||
}
|
}
|
||||||
if (inited && !nostats){
|
if (inited && !nostats){
|
||||||
|
|
|
@ -147,9 +147,14 @@ seekDone:
|
||||||
/// Reads a command from stdin. Returns true if a command was read.
|
/// Reads a command from stdin. Returns true if a command was read.
|
||||||
bool File::readCommand() {
|
bool File::readCommand() {
|
||||||
char line[512];
|
char line[512];
|
||||||
|
size_t line_len;
|
||||||
if (fgets(line, sizeof(line), stdin) == NULL){
|
if (fgets(line, sizeof(line), stdin) == NULL){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
line_len = strlen(line);
|
||||||
|
if (line[line_len - 1] == '\n'){
|
||||||
|
line[--line_len] = 0;
|
||||||
|
}
|
||||||
{
|
{
|
||||||
int position = INT_MAX;// special value that says "invalid"
|
int position = INT_MAX;// special value that says "invalid"
|
||||||
if (!strncmp("seek ", line, sizeof("seek ") - 1)){
|
if (!strncmp("seek ", line, sizeof("seek ") - 1)){
|
||||||
|
@ -164,6 +169,9 @@ seekDone:
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!strcmp("play", line)){
|
||||||
|
playing = true;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -173,6 +181,12 @@ seekDone:
|
||||||
if (readCommand()) {
|
if (readCommand()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (!playing){
|
||||||
|
setBlocking(STDIN_FILENO, true);
|
||||||
|
continue;
|
||||||
|
}else{
|
||||||
|
setBlocking(STDIN_FILENO, false);
|
||||||
|
}
|
||||||
now = getNowMS();
|
now = getNowMS();
|
||||||
if (now - timeDiff >= lastTime || lastTime - (now - timeDiff) > 5000) {
|
if (now - timeDiff >= lastTime || lastTime - (now - timeDiff) > 5000) {
|
||||||
if (nextPacket()) {
|
if (nextPacket()) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue