Statistics
| Branch: | Revision:

chunker-player / chunker_player / chunker_player.h @ eed0812a

History | View | Annotate | Download (3.21 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
        char ChannelGroup[255];        //channel group name. If specified, overrides title when publishing results
22
        int Width;
23
        int Height;
24
        float Ratio;
25
        int Bitrate;
26
        int SampleRate;
27
        short int AudioChannels;
28
        int Index;
29
        //quality related info
30
        double instant_score; //updated continuously
31
        double average_score; //updated on a long term time window (i.e. 2 minutes)
32
        double score_history[CHANNEL_SCORE_HISTORY_SIZE];
33
        int history_index;
34
        char quality[255];
35
        int startTime;
36
        char VideoCodec[255];
37
        char AudioCodec[255];
38
#ifndef __WIN32__
39
        pid_t StreamerProcess;
40
#else
41
        PROCESS_INFORMATION StreamerProcess;
42
#endif
43
} SChannel;
44

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

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

    
60
#ifdef PSNR_PUBLICATION
61
HANDLE repoclient;
62
struct timeval LastTimeRepoPublish;
63
#endif
64

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

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

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

    
101
int FullscreenMode; // fullscreen vs windowized flag
102
int window_width, window_height;
103
int Audio_ON;
104

    
105
void ZapDown();
106
void ZapUp();
107
int ReTune(SChannel* channel);
108
int enqueueBlock(const uint8_t *block, const int block_size);
109

    
110
#endif // _CHUNKER_PLAYER_H