Statistics
| Branch: | Revision:

chunker-player / chunker_player / chunker_player.h @ 76c297b4

History | View | Annotate | Download (3.08 KB)

1
#ifndef _CHUNKER_PLAYER_H
2
#define _CHUNKER_PLAYER_H
3

    
4
#include <SDL.h>
5
#include <SDL_mutex.h>
6

    
7
#include "player_defines.h"
8

    
9
#ifdef __WIN32__
10
#include <windows.h>
11
#endif
12

    
13
#ifdef PSNR_PUBLICATION
14
#include <repoclient.h>
15
#endif
16

    
17
typedef struct SChannel
18
{
19
        char LaunchString[255];
20
        char Title[255];
21
        int Width;
22
        int Height;
23
        float Ratio;
24
        int Bitrate;
25
        int SampleRate;
26
        short int AudioChannels;
27
        int Index;
28
        //quality related info
29
        double instant_score; //updated continuously
30
        double average_score; //updated on a long term time window (i.e. 2 minutes)
31
        double score_history[CHANNEL_SCORE_HISTORY_SIZE];
32
        int history_index;
33
        char quality[255];
34
        int startTime;
35
        char VideoCodec[255];
36
        char AudioCodec[255];
37
#ifndef __WIN32__
38
        pid_t StreamerProcess;
39
#else
40
        PROCESS_INFORMATION StreamerProcess;
41
#endif
42
} SChannel;
43

    
44
SChannel Channels[MAX_CHANNELS_NUM];
45
int SelectedChannel;
46

    
47
SDL_mutex *OverlayMutex;
48
SDL_Surface *MainScreen;
49
int SilentMode;
50
int queue_filling_threshold;
51
int quit;
52
short int QueueFillingMode;
53
int LogTraces;
54
char NetworkID[255];
55
char RepoAddress[2048];
56

    
57
#ifdef PSNR_PUBLICATION
58
HANDLE repoclient;
59
struct timeval LastTimeRepoPublish;
60
#endif
61

    
62
#ifdef EMULATE_CHUNK_LOSS
63
typedef struct
64
{
65
        time_t Time;
66
        unsigned int Value;
67
        unsigned int MinValue;
68
        unsigned int MaxValue;
69
        unsigned int Burstiness;
70
} SChunkLoss;
71
SChunkLoss* ScheduledChunkLosses;
72
int CurrChunkLossIndex, NScheduledChunkLosses;
73
#endif
74

    
75
#ifdef __WIN32__
76
//~ #define KILL_PROCESS(pid) {char command_name[255]; sprintf(command_name, "taskkill /pid %d /F", pid); system(command_name);}
77
#define KILL_PROCESS(handle) {TerminateProcess(((PROCESS_INFORMATION*)handle)->hProcess, 0);}
78
#define KILLALL(pname) {char command_name[255]; sprintf(command_name, "taskkill /im %s /F", pname); system(command_name);}
79
//#endif
80
//#ifdef __LINUX__
81
#else
82
#define KILL_PROCESS(handle) {if(*((pid_t*)handle)>0){char command_name[255]; sprintf(command_name, "kill %d", *((pid_t*)handle)); system(command_name);}}
83
#define KILLALL(pname) {char command_name[255]; sprintf(command_name, "killall %s -9", pname); system(command_name);}
84
#endif
85
//#ifdef __MACOS__
86
//#define KILL_PROCESS(handle) {if(*((pid_t*)handle)>0){char command_name[255]; sprintf(command_name, "kill %d", *((pid_t*)handle)); system(command_name);}}
87
//#define KILLALL(pname) {char command_name[255]; sprintf(command_name, "killall %s -9", pname); system(command_name);}
88
//#endif
89

    
90
#ifdef __LINUX__
91
#define DELETE_DIR(folder) {char command_name[255]; sprintf(command_name, "rm -fR %s", folder); system(command_name); }
92
#define CREATE_DIR(folder) {char command_name[255]; sprintf(command_name, "mkdir %s", folder); system(command_name); }
93
#else
94
#define DELETE_DIR(folder) {char command_name[255]; sprintf(command_name, "rd /S /Q %s", folder); system(command_name); }
95
#define CREATE_DIR(folder) {char command_name[255]; sprintf(command_name, "mkdir %s", folder); system(command_name); }
96
#endif
97

    
98
int FullscreenMode; // fullscreen vs windowized flag
99
int window_width, window_height;
100
int Audio_ON;
101

    
102
void ZapDown();
103
void ZapUp();
104
int ReTune(SChannel* channel);
105
int enqueueBlock(const uint8_t *block, const int block_size);
106

    
107
#endif // _CHUNKER_PLAYER_H