Skip to content

Commit

Permalink
Players now read data from stdin, not from a file. Added '-o none' op…
Browse files Browse the repository at this point in the history
…tion to suppress output file
  • Loading branch information
ColumPaget committed Jun 23, 2017
1 parent a314b7b commit 881c78a
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 14 deletions.
1 change: 1 addition & 0 deletions common.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#define FLAG_HTTPS 131072
#define FLAG_POST 262144
#define FLAG_PLAYER_AUTO 524288
#define FLAG_NOOUT 1048576


extern int Type, Flags;
Expand Down
8 changes: 4 additions & 4 deletions libUseful-2.8/config.log
Original file line number Diff line number Diff line change
Expand Up @@ -284,8 +284,8 @@ configure:3706: $? = 0
configure:3715: result: yes
configure:3731: checking for OpenSSL_add_all_algorithms
configure:3731: gcc -o conftest -g -O2 conftest.c -lcrypto -lssl -lc >&5
/tmp/ccgcl9xZ.o: In function `main':
/home/metacosm89/Movgrab-3.0.4/libUseful-2.8/conftest.c:59: undefined reference to `OpenSSL_add_all_algorithms'
/tmp/ccS3DHI2.o: In function `main':
/home/metacosm89/coding-2017/Movgrab/libUseful-2.8/conftest.c:59: undefined reference to `OpenSSL_add_all_algorithms'
collect2: error: ld returned 1 exit status
configure:3731: $? = 1
configure: failed program was:
Expand Down Expand Up @@ -366,8 +366,8 @@ configure:3731: $? = 0
configure:3731: result: yes
configure:3731: checking for EVP_rc5_32_12_16_cbc
configure:3731: gcc -o conftest -g -O2 conftest.c -lcrypto -lssl -lc >&5
/tmp/ccup7tvX.o: In function `main':
/home/metacosm89/Movgrab-3.0.4/libUseful-2.8/conftest.c:62: undefined reference to `EVP_rc5_32_12_16_cbc'
/tmp/ccSb6JoV.o: In function `main':
/home/metacosm89/coding-2017/Movgrab/libUseful-2.8/conftest.c:62: undefined reference to `EVP_rc5_32_12_16_cbc'
collect2: error: ld returned 1 exit status
configure:3731: $? = 1
configure: failed program was:
Expand Down
2 changes: 1 addition & 1 deletion libUseful-2.8/config.status
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ Copyright (C) 2012 Free Software Foundation, Inc.
This config.status script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it."

ac_pwd='/home/metacosm89/Movgrab-3.0.4/libUseful-2.8'
ac_pwd='/home/metacosm89/coding-2017/Movgrab/libUseful-2.8'
srcdir='.'
test -n "$AWK" || AWK=awk
# The default lists apply if the user does not specify any file.
Expand Down
15 changes: 10 additions & 5 deletions outputfiles.c
Original file line number Diff line number Diff line change
Expand Up @@ -184,11 +184,14 @@ ListNode *Curr;
int val=0, Resume=FALSE;
STREAM *S=NULL;

if (Flags & FLAG_NOOUT) return;
if ((Flags & FLAG_RESUME) && (ListSize(OutputFiles)==1)) Resume=TRUE;

Curr=ListGetNext(OutputFiles);
while (Curr)
{
if (! Curr->Item)
{
if (! StrValid(Curr->Tag))
{
Tempstr=GetSaveFilePath(Tempstr, Title, URL);
Expand All @@ -203,6 +206,7 @@ while (Curr)
Curr->Item=S;
}
else Curr->Item=OpenSaveFile(Curr->Tag, FileSize, Resume);
}

Curr=ListGetNext(Curr);
}
Expand Down Expand Up @@ -261,17 +265,18 @@ Curr=ListGetNext(Curr);
DestroyString(Tempstr);
}

void AddOutputStream(const char *Path, STREAM *S)
{
if (! OutputFiles) OutputFiles=ListCreate();
ListAddNamedItem(OutputFiles,Path,S);
}

void AddOutputFile(const char *Path, int SingleOutput)
{
//if 'SingleOutput' is set then overwrite any existing outputs, this should be the
//only one
if (SingleOutput) ListClear(OutputFiles,NULL);

if (! OutputFiles) OutputFiles=ListCreate();
ListAddNamedItem(OutputFiles,Path,NULL);


AddOutputStream(Path, NULL);
}


Expand Down
2 changes: 2 additions & 0 deletions outputfiles.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@

#include "common.h"


char *OutputFilesGetFilePath();
void OpenOutputFiles(const char *Title, const char *URL, double *FileSize);
void WriteOutputFiles(const char *Data, int Len);
void CloseOutputFiles(char *Extn);
void AddOutputFile(const char *Path, int SingleOutput);
void AddOutputStream(const char *Path, STREAM *S);
char *GuessExtn(const char *ContentType, const char *Format, const char *ID);


Expand Down
11 changes: 9 additions & 2 deletions players.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,19 @@ else Player=CopyStr(Player, Config);
void LaunchPlayer()
{
char *Tempstr=NULL;
STREAM *S;

if (PlayerPid > 0) return;
if (! StrValid(Player)) return;

Tempstr=MCopyStr(Tempstr,Player," ",OutputFilesGetFilePath(),NULL);
PlayerPid=Spawn(Tempstr,"");
//Tempstr=MCopyStr(Tempstr,Player," ",OutputFilesGetFilePath(),NULL);

S=STREAMSpawnCommand(Player,"");
if (S)
{
AddOutputStream(Player, S);
PlayerPid=atoi(STREAMGetValue(S, "PeerPID"));
}

DestroyString(Tempstr);
}
Expand Down
9 changes: 7 additions & 2 deletions settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,13 @@ for (i=1; i < argc; i++)
else if (strcmp(argv[i],"-o")==0)
{
i++;
AddOutputFile(argv[i], TRUE);
if (strcmp(argv[i],"-")==0) Flags |= FLAG_STDOUT;
if (strcmp(argv[i],"none")==0) Flags |= FLAG_NOOUT;
else if (strcmp(argv[i],"-")==0)
{
Flags |= FLAG_STDOUT;
AddOutputFile(argv[i], TRUE);
}
else AddOutputFile(argv[i], TRUE);
}
else if (strcmp(argv[i],"+o")==0)
{
Expand Down

0 comments on commit 881c78a

Please sign in to comment.