-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2a768bd
commit a314b7b
Showing
2 changed files
with
73 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
#include "players.h" | ||
|
||
ListNode *Players=NULL; | ||
char *Player=NULL; | ||
pid_t PlayerPid=0; | ||
|
||
void ParsePlayer(const char *Config) | ||
{ | ||
char *ContentType=NULL; | ||
const char *ptr; | ||
|
||
ptr=GetToken(Config,"\\S",&ContentType,GETTOKEN_QUOTES); | ||
if (! Players) Players=ListCreate(); | ||
SetVar(Players,ContentType,ptr); | ||
|
||
DestroyString(ContentType); | ||
} | ||
|
||
|
||
|
||
char *SelectPlayer(const char *ContentType) | ||
{ | ||
ListNode *Curr; | ||
|
||
Curr=ListGetNext(Players); | ||
while (Curr) | ||
{ | ||
if (fnmatch(Curr->Tag, ContentType, 0)==0) | ||
{ | ||
printf("PLAYER: [%s] %s\n",ContentType,Curr->Item); | ||
Player=CopyStr(Player, (char *) Curr->Item); | ||
return((char *) Curr->Item); | ||
} | ||
Curr=ListGetNext(Curr); | ||
} | ||
|
||
return(NULL); | ||
} | ||
|
||
void SetPlayer(const char *Config) | ||
{ | ||
if (strcmp(Config, "auto")==0) Flags |= FLAG_PLAYER_AUTO; | ||
else Player=CopyStr(Player, Config); | ||
} | ||
|
||
|
||
void LaunchPlayer() | ||
{ | ||
char *Tempstr=NULL; | ||
|
||
if (PlayerPid > 0) return; | ||
if (! StrValid(Player)) return; | ||
|
||
Tempstr=MCopyStr(Tempstr,Player," ",OutputFilesGetFilePath(),NULL); | ||
PlayerPid=Spawn(Tempstr,""); | ||
|
||
DestroyString(Tempstr); | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#ifndef MOVGRAB_PLAYERS_H | ||
#define MOVGRAB_PLAYERS_H | ||
|
||
#include "common.h" | ||
|
||
extern int DisplayTitleWidth; | ||
|
||
void ParsePlayer(const char *Config); | ||
char *SelectPlayer(const char *ContentType); | ||
void SetPlayer(const char *Config); | ||
void LaunchPlayer(); | ||
|
||
#endif |