summaryrefslogtreecommitdiff
path: root/command/global.h
blob: af2d3a152d99e261e847e098c5b32c772d2cc8ef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
/*
 * global.h: A program for the Video Disk Recorder
 *
 * See the README file for copyright information and how to reach the author.
 *
 */

#ifndef __global_h_
#define __global_h_

#include <time.h>

#ifndef uchar
typedef unsigned char uchar;
#endif

#define MA_I_TYPE 1
#define MA_P_TYPE 2
#define MA_B_TYPE 3
#define MA_D_TYPE 4
#define MA_SI_TYPE 5
#define MA_SP_TYPE 6
#define MA_BI_TYPE 7

#define MT_START          1
#define MT_STOP           2

#define MT_ASSUMED        0x10
#define MT_ASSUMEDSTART   0x11
#define MT_ASSUMEDSTOP    0x12

#define MT_LOGOCHANGE     0x20
#define MT_LOGOSTART      0x21
#define MT_LOGOSTOP       0x22

#define MT_HBORDERCHANGE  0x30
#define MT_HBORDERSTART   0x31
#define MT_HBORDERSTOP    0x32

#define MT_VBORDERCHANGE  0x40
#define MT_VBORDERSTART   0x41
#define MT_VBORDERSTOP    0x42

#define MT_ASPECTCHANGE   0x50
#define MT_ASPECTSTART    0x51
#define MT_ASPECTSTOP     0x52

#define MT_CHANNELCHANGE  0x60
#define MT_CHANNELSTART   0x61
#define MT_CHANNELSTOP    0x62

#define MT_MOVED          0xE0
#define MT_ALL            0xFF

typedef struct config
{
    char logoDirectory[1024];
    char LogoDir[1024];
    char markFileName[1024];
    char svdrphost[1024];

    int logoExtraction;
    int logoWidth;
    int logoHeight;
    int ignoreInfo;
    int svdrpport;
    int threads;

    bool DecodeVideo;
    bool DecodeAudio;
    bool BackupMarks;

    bool NoPid;
    bool OSD;
    bool Before;
    bool GenIndex;
    bool SaveInfo;
} MarkAdConfig;

typedef struct MarkAdPos
{
    int FrameNumberBefore;
    int FrameNumberAfter;
} MarkAdPos;

typedef struct MarkAdAspectRatio
{
    int Num;
    int Den;
} MarkAdAspectRatio;

typedef struct MarkAdMark
{
    char Type;
    int Position;
    int ChannelsBefore;
    int ChannelsAfter;
    MarkAdAspectRatio AspectRatioBefore;
    MarkAdAspectRatio AspectRatioAfter;
} MarkAdMark;

typedef struct MarkAdMarks
{
    static const int maxCount=4;
    MarkAdMark Number[maxCount];
    int Count;
} MarkAdMarks;

#define MARKAD_PIDTYPE_VIDEO_H262 0x10
#define MARKAD_PIDTYPE_VIDEO_H264 0x11
#define MARKAD_PIDTYPE_AUDIO_AC3  0x20
#define MARKAD_PIDTYPE_AUDIO_MP2  0x21

typedef struct MarkAdPid
{
    int Num;
    int Type;
} MarkAdPid;

typedef struct MarkAdContext
{
    const MarkAdConfig *Config;

    struct Info
    {

        MarkAdAspectRatio AspectRatio;
        int Channels;

        char *ChannelName;
        MarkAdPid VPid;
        MarkAdPid APid;
        MarkAdPid DPid;
    } Info;

    struct Video
    {
        struct Options
        {
            bool IgnoreAspectRatio;
            bool IgnoreLogoDetection;
        } Options;

        struct Info
        {
            int Width;  // width of pic
            int Height; // height of pic
            int Pict_Type; // picture type (I,P,B,S,SI,SP,BI)
            int Pix_Fmt; // Pixel format (see libavutil/pixfmt.h)
            MarkAdAspectRatio AspectRatio;
            double FramesPerSecond;
            bool Interlaced;
        } Info;

        struct Data
        {
            bool Valid; // flag, if true data is valid
            uchar *Plane[4];  // picture planes (YUV420)
            int PlaneLinesize[4]; // size int bytes of each picture plane line
        } Data;
    } Video;

    struct Audio
    {
        struct Info
        {
            int Channels; // number of audio channels
            int SampleRate;
        } Info;
        struct Data
        {
            bool Valid;
            short *SampleBuf;
            int SampleBufLen;
        } Data;
    } Audio;

} MarkAdContext;

#endif