Statistics
| Branch: | Revision:

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

History | View | Annotate | Download (3.11 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 b0e46569 GiuseppeTropea
8
#ifdef PSNR_PUBLICATION
9 0cd6b05d CarmeloDaniele
#include <repoclient.h>
10 b0e46569 GiuseppeTropea
#endif
11 78068e21 GiuseppeTropea
12
typedef struct SChannel
13
{
14
        char LaunchString[255];
15
        char Title[255];
16 3a240a99 GiuseppeTropea
        int Width;
17
        int Height;
18
        float Ratio;
19 e11386c0 CsabaKiraly
        int Bitrate;
20 3a240a99 GiuseppeTropea
        int SampleRate;
21
        short int AudioChannels;
22 10c75ef7 GiuseppeTropea
        int Index;
23 dae4a53f GiuseppeTropea
        //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 78068e21 GiuseppeTropea
} SChannel;
31
32 10c75ef7 GiuseppeTropea
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 e11386c0 CsabaKiraly
int LogTraces;
41 74564eb3 CarmeloDaniele
char NetworkID[255];
42 0cd6b05d CarmeloDaniele
char RepoAddress[2048];
43 b0e46569 GiuseppeTropea
44
#ifdef PSNR_PUBLICATION
45 0cd6b05d CarmeloDaniele
HANDLE repoclient;
46
struct timeval LastTimeRepoPublish;
47 b0e46569 GiuseppeTropea
#endif
48 e11386c0 CsabaKiraly
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 10c75ef7 GiuseppeTropea
64
#ifdef __WIN32__
65 e11386c0 CsabaKiraly
//~ #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 10c75ef7 GiuseppeTropea
#define KILLALL(pname) {char command_name[255]; sprintf(command_name, "taskkill /im %s /F", pname); system(command_name);}
68 e11386c0 CsabaKiraly
//#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 10c75ef7 GiuseppeTropea
#define KILLALL(pname) {char command_name[255]; sprintf(command_name, "killall %s -9", pname); system(command_name);}
73
#endif
74 e11386c0 CsabaKiraly
//#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 b9e6f879 CsabaKiraly
79 e11386c0 CsabaKiraly
#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 10c75ef7 GiuseppeTropea
87
SChannel Channels[MAX_CHANNELS_NUM];
88
int NChannels;
89
int SelectedChannel;
90 e11386c0 CsabaKiraly
char StreamerFilename[255];
91 10c75ef7 GiuseppeTropea
int FullscreenMode; // fullscreen vs windowized flag
92
int window_width, window_height;
93 e11386c0 CsabaKiraly
int Audio_ON;
94
95
#ifdef HTTPIO
96 10c75ef7 GiuseppeTropea
int HttpPort;
97 e11386c0 CsabaKiraly
#else
98
#ifdef TCPIO
99
int TcpPort;
100
#endif
101
#endif
102 78068e21 GiuseppeTropea
103 59e008ed GiuseppeTropea
int CheckForRepoAddress(char* Param);
104 10c75ef7 GiuseppeTropea
void ZapDown();
105
void ZapUp();
106
int ParseConf();
107
int SwitchChannel(SChannel* channel);
108 e11386c0 CsabaKiraly
int ReTune(SChannel* channel);
109 9240dba2 GiuseppeTropea
110 10c75ef7 GiuseppeTropea
#endif // _CHUNKER_PLAYER_H