Statistics
| Branch: | Revision:

chunker-player / chunker_player / chunker_player.h @ 59e008ed

History | View | Annotate | Download (3.11 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

    
8
#ifdef PSNR_PUBLICATION
9
#include <repoclient.h>
10
#endif
11

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

    
32
SDL_mutex *OverlayMutex;
33
SDL_Overlay *YUVOverlay;
34
SDL_Rect OverlayRect;
35
SDL_Surface *MainScreen;
36
int SilentMode;
37
int queue_filling_threshold;
38
int quit;
39
short int QueueFillingMode;
40
int LogTraces;
41
char NetworkID[255];
42
char RepoAddress[2048];
43

    
44
#ifdef PSNR_PUBLICATION
45
HANDLE repoclient;
46
struct timeval LastTimeRepoPublish;
47
#endif
48

    
49
#ifdef EMULATE_CHUNK_LOSS
50
typedef struct
51
{
52
        time_t Time;
53
        unsigned int Value;
54
        unsigned int MinValue;
55
        unsigned int MaxValue;
56
        unsigned int Burstiness;
57
} SChunkLoss;
58
SChunkLoss* ScheduledChunkLosses;
59
int CurrChunkLossIndex, NScheduledChunkLosses;
60
#endif
61

    
62
void* P2PProcessHandle;
63

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

    
79
#ifdef __LINUX__
80
#define DELETE_DIR(folder) {char command_name[255]; sprintf(command_name, "rm -fR %s", folder); system(command_name); }
81
#define CREATE_DIR(folder) {char command_name[255]; sprintf(command_name, "mkdir %s", folder); system(command_name); }
82
#else
83
#define DELETE_DIR(folder) {char command_name[255]; sprintf(command_name, "rd /S /Q %s", folder); system(command_name); }
84
#define CREATE_DIR(folder) {char command_name[255]; sprintf(command_name, "mkdir %s", folder); system(command_name); }
85
#endif
86

    
87
SChannel Channels[MAX_CHANNELS_NUM];
88
int NChannels;
89
int SelectedChannel;
90
char StreamerFilename[255];
91
int FullscreenMode; // fullscreen vs windowized flag
92
int window_width, window_height;
93
int Audio_ON;
94

    
95
#ifdef HTTPIO
96
int HttpPort;
97
#else
98
#ifdef TCPIO
99
int TcpPort;
100
#endif
101
#endif
102

    
103
int CheckForRepoAddress(char* Param);
104
void ZapDown();
105
void ZapUp();
106
int ParseConf();
107
int SwitchChannel(SChannel* channel);
108
int ReTune(SChannel* channel);
109

    
110
#endif // _CHUNKER_PLAYER_H