Statistics
| Branch: | Revision:

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

History | View | Annotate | Download (3.01 KB)

1 1e69ae95 GiuseppeTropea
#ifndef _CHUNKER_PLAYER_H
2
#define _CHUNKER_PLAYER_H
3
4 10c75ef7 GiuseppeTropea
#include "player_defines.h"
5
#include <SDL.h>
6
#include <SDL_mutex.h>
7 0cd6b05d CarmeloDaniele
#include <repoclient.h>
8 78068e21 GiuseppeTropea
9
typedef struct SChannel
10
{
11
        char LaunchString[255];
12
        char Title[255];
13 3a240a99 GiuseppeTropea
        int Width;
14
        int Height;
15
        float Ratio;
16 e11386c0 CsabaKiraly
        int Bitrate;
17 3a240a99 GiuseppeTropea
        int SampleRate;
18
        short int AudioChannels;
19 10c75ef7 GiuseppeTropea
        int Index;
20 dae4a53f GiuseppeTropea
        //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 78068e21 GiuseppeTropea
} SChannel;
28
29 10c75ef7 GiuseppeTropea
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 e11386c0 CsabaKiraly
int LogTraces;
38 74564eb3 CarmeloDaniele
char NetworkID[255];
39 0cd6b05d CarmeloDaniele
char RepoAddress[2048];
40
HANDLE repoclient;
41
struct timeval LastTimeRepoPublish;
42 e11386c0 CsabaKiraly
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 10c75ef7 GiuseppeTropea
58
#ifdef __WIN32__
59 e11386c0 CsabaKiraly
//~ #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 10c75ef7 GiuseppeTropea
#define KILLALL(pname) {char command_name[255]; sprintf(command_name, "taskkill /im %s /F", pname); system(command_name);}
62 e11386c0 CsabaKiraly
//#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 10c75ef7 GiuseppeTropea
#define KILLALL(pname) {char command_name[255]; sprintf(command_name, "killall %s -9", pname); system(command_name);}
67
#endif
68 e11386c0 CsabaKiraly
//#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 b9e6f879 CsabaKiraly
73 e11386c0 CsabaKiraly
#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 10c75ef7 GiuseppeTropea
81
SChannel Channels[MAX_CHANNELS_NUM];
82
int NChannels;
83
int SelectedChannel;
84 e11386c0 CsabaKiraly
char StreamerFilename[255];
85 10c75ef7 GiuseppeTropea
int FullscreenMode; // fullscreen vs windowized flag
86
int window_width, window_height;
87 e11386c0 CsabaKiraly
int Audio_ON;
88
89
#ifdef HTTPIO
90 10c75ef7 GiuseppeTropea
int HttpPort;
91 e11386c0 CsabaKiraly
#else
92
#ifdef TCPIO
93
int TcpPort;
94
#endif
95
#endif
96 78068e21 GiuseppeTropea
97 10c75ef7 GiuseppeTropea
void ZapDown();
98
void ZapUp();
99
int ParseConf();
100
int SwitchChannel(SChannel* channel);
101 e11386c0 CsabaKiraly
int ReTune(SChannel* channel);
102 9240dba2 GiuseppeTropea
103 10c75ef7 GiuseppeTropea
#endif // _CHUNKER_PLAYER_H