Statistics
| Branch: | Revision:

chunker-player / chunker_player / chunker_player.h @ 1125a7ba

History | View | Annotate | Download (3.09 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
#ifdef PSNR_PUBLICATION
9
#include <repoclient.h>
10
#endif
11

    
12
typedef struct SChannel
13
{
14
        char LaunchString[255];
15
        char Title[255];
16
        int Width;
17
        int Height;
18
        float Ratio;
19
        int Bitrate;
20
        int SampleRate;
21
        short int AudioChannels;
22
        int Index;
23
        //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
        char VideoCodec[255];
31
        char AudioCodec[255];
32
} SChannel;
33

    
34
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
int LogTraces;
43
char NetworkID[255];
44
char RepoAddress[2048];
45

    
46
#ifdef PSNR_PUBLICATION
47
HANDLE repoclient;
48
struct timeval LastTimeRepoPublish;
49
#endif
50

    
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

    
66
#ifdef __WIN32__
67
//~ #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
#define KILLALL(pname) {char command_name[255]; sprintf(command_name, "taskkill /im %s /F", pname); system(command_name);}
70
//#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
#define KILLALL(pname) {char command_name[255]; sprintf(command_name, "killall %s -9", pname); system(command_name);}
75
#endif
76
//#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

    
81
#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

    
89
SChannel Channels[MAX_CHANNELS_NUM];
90
int NChannels;
91
int SelectedChannel;
92
char StreamerFilename[255];
93
int FullscreenMode; // fullscreen vs windowized flag
94
int window_width, window_height;
95
int Audio_ON;
96

    
97
int Port;
98

    
99
int CheckForRepoAddress(char* Param);
100
void ZapDown();
101
void ZapUp();
102
int ParseConf();
103
int SwitchChannel(SChannel* channel);
104
int ReTune(SChannel* channel);
105

    
106
#endif // _CHUNKER_PLAYER_H