Statistics
| Branch: | Revision:

chunker-player / chunker_player / chunker_player.h @ 74564eb3

History | View | Annotate | Download (2.91 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
char NetworkID[255];
38

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

    
52
void* P2PProcessHandle;
53

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

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

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

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

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

    
99
#endif // _CHUNKER_PLAYER_H