summaryrefslogtreecommitdiff
path: root/inc/profiles/profile_data.h
blob: 7ae01d2991f42394145def23f0c40fe38983533a (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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
/* 
 * File:   profile_data.h
 * Author: savop
 *
 * Created on 5. Januar 2010, 12:27
 */

#ifndef _PROFILE_DATA_H
#define	_PROFILE_DATA_H

#ifdef __cplusplus
#include <vdr/tools.h>
extern "C" {
#include <libavformat/avformat.h>
#include <libavcodec/avcodec.h>
}
#endif

#define MAX_BITRATES        32  ///< maximum amount of different CBR bitrates
#define MAX_CHANNEL_LAYOUTS 20  ///< maximum amount of different channel layout modes
#define MAX_SAMPLE_RATES    16  ///< maximum amount of different sampling rates

#define Kbps(x)             x*1000          ///< Kbit per second
#define Mbps(x)             x*1000*1000     ///< Mbit per second
#define KHz(x)              x*1000
#define MHz(x)              x*1000*1000

#define CHANNEL_LAYOUT_10   CH_LAYOUT_MONO                      ///< 1/0    1
#define CHANNEL_LAYOUT_10_1 (CHANNEL_LAYOUT_10|CH_LOW_FREQUENCY)///< 1/0    1.1 (incl. LFE)
#define CHANNEL_LAYOUT_20   CH_LAYOUT_STEREO                    ///< 2/0    2
#define CHANNEL_LAYOUT_20_1 (CHANNEL_LAYOUT_20|CH_LOW_FREQUENCY)///< 2/0    2.1 (incl. LFE)
#define CHANNEL_LAYOUT_21   (CH_LAYOUT_STEREO|CH_BACK_CENTER)   ///< 2/1    3
#define CHANNEL_LAYOUT_21_1 (CHANNEL_LAYOUT_21|CH_LOW_FREQUENCY)///< 2/1    3.1 (incl. LFE)
#define CHANNEL_LAYOUT_22   CH_LAYOUT_QUAD                      ///< 2/2    4
#define CHANNEL_LAYOUT_22_1 (CHANNEL_LAYOUT_22|CH_LOW_FREQUENCY)///< 2/2    4.1 (incl. LFE)
#define CHANNEL_LAYOUT_30   CH_LAYOUT_SURROUND                  ///< 3/0    3
#define CHANNEL_LAYOUT_30_1 (CHANNEL_LAYOUT_30|CH_LOW_FREQUENCY)///< 3/0    3.1 (incl. LFE)
#define CHANNEL_LAYOUT_31   (CH_LAYOUT_SURROUND|CH_BACK_CENTER) ///< 3/1    4
#define CHANNEL_LAYOUT_31_1 (CHANNEL_LAYOUT_31|CH_LOW_FREQUENCY)///< 3/1    4.1 (incl. LFE)
#define CHANNEL_LAYOUT_32   CH_LAYOUT_5POINT0                   ///< 3/2    5
#define CHANNEL_LAYOUT_5_1  CH_LAYOUT_5POINT1                   ///< 5.1    5.1 (incl. LFE)
#define CHANNEL_LAYOUT_7_1  CH_LAYOUT_7POINT1                   ///< 7.1    7.1 (incl. LFE)

/**
 * The combination of DLNA profile ID and the corresponding mime type
 *
 * This complies with the DLNA media format guidelines. Though this is very
 * similar to the profile structure of libdlna, it comes without the additional
 * label field as it seams to be not needed.
 */
struct DLNAProfile {
    const char* ID;     ///< the DLNA profile ID
    const char* mime;   ///< the mime type of the resource
};

/**
 * The DLNA profile for a icon image
 *
 * This complies with the DLNA media format guidelines. It contains a valid
 * mime type, the resolution of the image and the corresponding bit depth
 */
struct DLNAIconProfile {
    const char* mime;       ///< the mime type of the image
    unsigned short width;   ///< image width in pixel
    unsigned short height;  ///< image height in pixel
    unsigned char bitDepth; ///< bit depth in bits per pixel
};

enum VideoContainerProfile {
    DLNA_VCP_UNKNOWN=-1,
    DLNA_VCP_MPEG1=0,
    DLNA_VCP_MPEG2_PS,
    DLNA_VCP_MPEG2_TS,
    DLNA_VCP_MPEG2_TS_T,
    DLNA_VCP_MPEG2_TS_ISO,
    DLNA_VCP_MP4,
    DLNA_VCP_3GPP,
    DLNA_VCP_ASF,
};

enum VideoPortionProfile {
    DLNA_VPP_UNKNOWN=-1,
    DLNA_VPP_MPEG1=0,
    DLNA_VPP_MPEG2_PAL_SD,
    DLNA_VPP_MPEG2_PAL_HD,
    DLNA_VPP_MPEG2_NTSC_SD,
    DLNA_VPP_MPEG2_NTSC_HD,
    DLNA_VPP_MPEG2_SP,
    DLNA_VPP_MPEG2_MP_LL,
    DLNA_VPP_MPEG4_P2_SP_L0B,
    DLNA_VPP_MPEG4_P2_SP_L2,
    DLNA_VPP_MPEG4_P2_SP_L3,
    DLNA_VPP_MPEG4_P2_SP_L3_VGA,
    DLNA_VPP_MPEG4_P2_ASP_L5,
    DLNA_VPP_MPEG4_P2_ASP_L5_SO,
    DLNA_VPP_MPEG4_P2_ASP_L4_SO,
    DLNA_VPP_MPEG4_P2_H263_P0_L10,
    DLNA_VPP_MPEG4_P2_H263_P3_L10,
    DLNA_VPP_MPEG4_P2_CO,
    DLNA_VPP_MPEG4_P10_MP_SD,
    DLNA_VPP_MPEG4_P10_MP_HD,
    DLNA_VPP_MPEG4_P10_BL_L3_SD,
    DLNA_VPP_MPEG4_P10_BL_L3L_SD,
    DLNA_VPP_MPEG4_P10_BL_CIF30,
    DLNA_VPP_MPEG4_P10_BL_L2_CIF30,
    DLNA_VPP_MPEG4_P10_BL_CIF15,
    DLNA_VPP_MPEG4_P10_BL_L12_CIF15,
    DLNA_VPP_MPEG4_P10_BL_L1B_QCIF
};

enum AudioPortionProfile {
    DLNA_APP_UNKNOWN=-1,
    DLNA_APP_LPCM=0,
    DLNA_APP_MPEG1_L1,
    DLNA_APP_MPEG1_L2,
    DLNA_APP_MPEG1_L3,
    DLNA_APP_MPEG1_L3X,
    DLNA_APP_MPEG2_L2,          //TODO: Distinguish MPEG1 oder MPEG2 audio with FFMPEG
    DLNA_APP_AAC,
    DLNA_APP_AAC_MULT5,
    DLNA_APP_AAC_LTP,
    DLNA_APP_AAC_LTP_MULT5,
    DLNA_APP_AAC_LTP_MULT7,
    DLNA_APP_HEAAC,
    DLNA_APP_HEAAC_L2,
    DLNA_APP_HEAAC_MULT5,
    DLNA_APP_ATRAC3plus,
    DLNA_APP_AC3,
    DLNA_APP_XAC3,
    DLNA_APP_G726,
    DLNA_APP_AMR,
    DLNA_APP_AMR_WBplus,
    DLNA_APP_BL_QCIF15,
    DLNA_APP_BSAC,
    DLNA_APP_BSAC_MULT5
};

struct DLNAVideoMapping {
    DLNAProfile*            Profile;
    VideoContainerProfile   VideoContainer;
    VideoPortionProfile     VideoProfile;
    AudioPortionProfile     AudioProfile;
};

struct AcceptedBitrates {
    /**
     * <b>true</b> if VBR, <b>false</b> otherwise
     */
    bool                    VBR;            
    /** 
     * list of valid bitrates.
     * 
     * if VBR is true, the array must contain exactly two items.
     * The first item is the minimum and the second item is the maximum bitrate
     *
     * The bitrate unit is bps. So, if you have 15bps, it is 15000000bps
     */
    int                     bitrates[MAX_BITRATES];
};

struct AcceptedResolution {
    /**
     * Screen width
     */
    int                     width;
    /**
     * Screen height
     */
    int                     height;
    /**
     * Frames per second
     *
     * this value may contain a higher value which is divided by the multiplier
     * given in <b>multiplier</b>
     */
    int                     fps;
    /**
     * Multiplier for calculating FPS
     *
     * The multiplier typically contains values like 1 or 1001 to calculate
     * the exact frame rate of 29,97 FPS in most NTSC systems
     */
    int                     multiplier;
};

struct AcceptedAudioChannels {
    int                     max_channels;
    int64_t                 layouts[MAX_CHANNEL_LAYOUTS];
    bool                    supportsLFE;
};

struct AcceptedSamplingRates {
    int                     rates[MAX_SAMPLE_RATES];
};

class cDLNAProfiler {
public:
    virtual DLNAProfile* probeDLNAProfile(AVFormatContext* FormatCtx) = 0;
};

class cAudioProfiler {
public:
    virtual AudioPortionProfile probeAudioProfile(AVFormatContext* FormatCtx) = 0;
};

class cVideoProfiler {
public:
    virtual VideoPortionProfile probeVideoProfile(AVFormatContext* FormatCtx) = 0;
    virtual VideoContainerProfile probeContainerProfile(AVFormatContext* FormatCtx) = 0;
};

#endif	/* _PROFILE_DATA_H */