Statistics
| Branch: | Revision:

chunker-player / chunker_player / chunker_player.h @ 47943338

History | View | Annotate | Download (3.09 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 71fa7249 Csaba Kiraly
        char VideoCodec[255];
31
        char AudioCodec[255];
32 78068e21 GiuseppeTropea
} SChannel;
33
34 10c75ef7 GiuseppeTropea
SDL_mutex *OverlayMutex;
35
SDL_Overlay *YUVOverlay;
36
SDL_Rect OverlayRect;
37
SDL_Surface *MainScreen;
38
int SilentMode;
39
int queue_filling_threshold;
40
int quit;
41
short int QueueFillingMode;
42 e11386c0 CsabaKiraly
int LogTraces;
43 74564eb3 CarmeloDaniele
char NetworkID[255];
44 0cd6b05d CarmeloDaniele
char RepoAddress[2048];
45 b0e46569 GiuseppeTropea
46
#ifdef PSNR_PUBLICATION
47 0cd6b05d CarmeloDaniele
HANDLE repoclient;
48
struct timeval LastTimeRepoPublish;
49 b0e46569 GiuseppeTropea
#endif
50 e11386c0 CsabaKiraly
51
#ifdef EMULATE_CHUNK_LOSS
52
typedef struct
53
{
54
        time_t Time;
55
        unsigned int Value;
56
        unsigned int MinValue;
57
        unsigned int MaxValue;
58
        unsigned int Burstiness;
59
} SChunkLoss;
60
SChunkLoss* ScheduledChunkLosses;
61
int CurrChunkLossIndex, NScheduledChunkLosses;
62
#endif
63
64
void* P2PProcessHandle;
65 10c75ef7 GiuseppeTropea
66
#ifdef __WIN32__
67 e11386c0 CsabaKiraly
//~ #define KILL_PROCESS(pid) {char command_name[255]; sprintf(command_name, "taskkill /pid %d /F", pid); system(command_name);}
68
#define KILL_PROCESS(handle) {TerminateProcess(((PROCESS_INFORMATION*)handle)->hProcess, 0);}
69 10c75ef7 GiuseppeTropea
#define KILLALL(pname) {char command_name[255]; sprintf(command_name, "taskkill /im %s /F", pname); system(command_name);}
70 e11386c0 CsabaKiraly
//#endif
71
//#ifdef __LINUX__
72
#else
73
#define KILL_PROCESS(handle) {if(*((pid_t*)handle)>0){char command_name[255]; sprintf(command_name, "kill %d", *((pid_t*)handle)); system(command_name);}}
74 10c75ef7 GiuseppeTropea
#define KILLALL(pname) {char command_name[255]; sprintf(command_name, "killall %s -9", pname); system(command_name);}
75
#endif
76 e11386c0 CsabaKiraly
//#ifdef __MACOS__
77
//#define KILL_PROCESS(handle) {if(*((pid_t*)handle)>0){char command_name[255]; sprintf(command_name, "kill %d", *((pid_t*)handle)); system(command_name);}}
78
//#define KILLALL(pname) {char command_name[255]; sprintf(command_name, "killall %s -9", pname); system(command_name);}
79
//#endif
80 b9e6f879 CsabaKiraly
81 e11386c0 CsabaKiraly
#ifdef __LINUX__
82
#define DELETE_DIR(folder) {char command_name[255]; sprintf(command_name, "rm -fR %s", folder); system(command_name); }
83
#define CREATE_DIR(folder) {char command_name[255]; sprintf(command_name, "mkdir %s", folder); system(command_name); }
84
#else
85
#define DELETE_DIR(folder) {char command_name[255]; sprintf(command_name, "rd /S /Q %s", folder); system(command_name); }
86
#define CREATE_DIR(folder) {char command_name[255]; sprintf(command_name, "mkdir %s", folder); system(command_name); }
87
#endif
88 10c75ef7 GiuseppeTropea
89
SChannel Channels[MAX_CHANNELS_NUM];
90
int NChannels;
91
int SelectedChannel;
92 e11386c0 CsabaKiraly
char StreamerFilename[255];
93 10c75ef7 GiuseppeTropea
int FullscreenMode; // fullscreen vs windowized flag
94
int window_width, window_height;
95 e11386c0 CsabaKiraly
int Audio_ON;
96
97 327da69f Csaba Kiraly
int Port;
98 78068e21 GiuseppeTropea
99 59e008ed GiuseppeTropea
int CheckForRepoAddress(char* Param);
100 10c75ef7 GiuseppeTropea
void ZapDown();
101
void ZapUp();
102
int ParseConf();
103
int SwitchChannel(SChannel* channel);
104 e11386c0 CsabaKiraly
int ReTune(SChannel* channel);
105 9240dba2 GiuseppeTropea
106 10c75ef7 GiuseppeTropea
#endif // _CHUNKER_PLAYER_H