Statistics
| Branch: | Revision:

chunker-player / chunker_player / chunker_player.h @ 0cd6b05d

History | View | Annotate | Download (3.01 KB)

1
#ifndef _CHUNKER_PLAYER_H
2
#define _CHUNKER_PLAYER_H
3

    
4
#include "player_defines.h"
5
#include <SDL.h>
6
#include <SDL_mutex.h>
7
#include <repoclient.h>
8

    
9
typedef struct SChannel
10
{
11
        char LaunchString[255];
12
        char Title[255];
13
        int Width;
14
        int Height;
15
        float Ratio;
16
        int Bitrate;
17
        int SampleRate;
18
        short int AudioChannels;
19
        int Index;
20
        //quality related info
21
        double instant_score; //updated continuously
22
        double average_score; //updated on a long term time window (i.e. 2 minutes)
23
        double score_history[CHANNEL_SCORE_HISTORY_SIZE];
24
        int history_index;
25
        char quality[255];
26
        int startTime;
27
} SChannel;
28

    
29
SDL_mutex *OverlayMutex;
30
SDL_Overlay *YUVOverlay;
31
SDL_Rect OverlayRect;
32
SDL_Surface *MainScreen;
33
int SilentMode;
34
int queue_filling_threshold;
35
int quit;
36
short int QueueFillingMode;
37
int LogTraces;
38
char NetworkID[255];
39
char RepoAddress[2048];
40
HANDLE repoclient;
41
struct timeval LastTimeRepoPublish;
42

    
43
#ifdef EMULATE_CHUNK_LOSS
44
typedef struct
45
{
46
        time_t Time;
47
        unsigned int Value;
48
        unsigned int MinValue;
49
        unsigned int MaxValue;
50
        unsigned int Burstiness;
51
} SChunkLoss;
52
SChunkLoss* ScheduledChunkLosses;
53
int CurrChunkLossIndex, NScheduledChunkLosses;
54
#endif
55

    
56
void* P2PProcessHandle;
57

    
58
#ifdef __WIN32__
59
//~ #define KILL_PROCESS(pid) {char command_name[255]; sprintf(command_name, "taskkill /pid %d /F", pid); system(command_name);}
60
#define KILL_PROCESS(handle) {TerminateProcess(((PROCESS_INFORMATION*)handle)->hProcess, 0);}
61
#define KILLALL(pname) {char command_name[255]; sprintf(command_name, "taskkill /im %s /F", pname); system(command_name);}
62
//#endif
63
//#ifdef __LINUX__
64
#else
65
#define KILL_PROCESS(handle) {if(*((pid_t*)handle)>0){char command_name[255]; sprintf(command_name, "kill %d", *((pid_t*)handle)); system(command_name);}}
66
#define KILLALL(pname) {char command_name[255]; sprintf(command_name, "killall %s -9", pname); system(command_name);}
67
#endif
68
//#ifdef __MACOS__
69
//#define KILL_PROCESS(handle) {if(*((pid_t*)handle)>0){char command_name[255]; sprintf(command_name, "kill %d", *((pid_t*)handle)); system(command_name);}}
70
//#define KILLALL(pname) {char command_name[255]; sprintf(command_name, "killall %s -9", pname); system(command_name);}
71
//#endif
72

    
73
#ifdef __LINUX__
74
#define DELETE_DIR(folder) {char command_name[255]; sprintf(command_name, "rm -fR %s", folder); system(command_name); }
75
#define CREATE_DIR(folder) {char command_name[255]; sprintf(command_name, "mkdir %s", folder); system(command_name); }
76
#else
77
#define DELETE_DIR(folder) {char command_name[255]; sprintf(command_name, "rd /S /Q %s", folder); system(command_name); }
78
#define CREATE_DIR(folder) {char command_name[255]; sprintf(command_name, "mkdir %s", folder); system(command_name); }
79
#endif
80

    
81
SChannel Channels[MAX_CHANNELS_NUM];
82
int NChannels;
83
int SelectedChannel;
84
char StreamerFilename[255];
85
int FullscreenMode; // fullscreen vs windowized flag
86
int window_width, window_height;
87
int Audio_ON;
88

    
89
#ifdef HTTPIO
90
int HttpPort;
91
#else
92
#ifdef TCPIO
93
int TcpPort;
94
#endif
95
#endif
96

    
97
void ZapDown();
98
void ZapUp();
99
int ParseConf();
100
int SwitchChannel(SChannel* channel);
101
int ReTune(SChannel* channel);
102

    
103
#endif // _CHUNKER_PLAYER_H