Statistics
| Branch: | Revision:

chunker-player / chunker_player / chunker_player.h @ e11386c0

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

    
28
SDL_mutex *OverlayMutex;
29
SDL_Overlay *YUVOverlay;
30
SDL_Rect OverlayRect;
31
SDL_Surface *MainScreen;
32
int SilentMode;
33
int queue_filling_threshold;
34
int quit;
35
short int QueueFillingMode;
36
int LogTraces;
37

    
38
#ifdef EMULATE_CHUNK_LOSS
39
typedef struct
40
{
41
        time_t Time;
42
        unsigned int Value;
43
        unsigned int MinValue;
44
        unsigned int MaxValue;
45
        unsigned int Burstiness;
46
} SChunkLoss;
47
SChunkLoss* ScheduledChunkLosses;
48
int CurrChunkLossIndex, NScheduledChunkLosses;
49
#endif
50

    
51
void* P2PProcessHandle;
52

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

    
68
#ifdef __LINUX__
69
#define DELETE_DIR(folder) {char command_name[255]; sprintf(command_name, "rm -fR %s", folder); system(command_name); }
70
#define CREATE_DIR(folder) {char command_name[255]; sprintf(command_name, "mkdir %s", folder); system(command_name); }
71
#else
72
#define DELETE_DIR(folder) {char command_name[255]; sprintf(command_name, "rd /S /Q %s", folder); system(command_name); }
73
#define CREATE_DIR(folder) {char command_name[255]; sprintf(command_name, "mkdir %s", folder); system(command_name); }
74
#endif
75

    
76
SChannel Channels[MAX_CHANNELS_NUM];
77
int NChannels;
78
int SelectedChannel;
79
char StreamerFilename[255];
80
int FullscreenMode; // fullscreen vs windowized flag
81
int window_width, window_height;
82
int Audio_ON;
83

    
84
#ifdef HTTPIO
85
int HttpPort;
86
#else
87
#ifdef TCPIO
88
int TcpPort;
89
#endif
90
#endif
91

    
92
void ZapDown();
93
void ZapUp();
94
int ParseConf();
95
int SwitchChannel(SChannel* channel);
96
int ReTune(SChannel* channel);
97

    
98
#endif // _CHUNKER_PLAYER_H