-
Notifications
You must be signed in to change notification settings - Fork 2
/
CdsMediaObject.h
224 lines (187 loc) · 7.63 KB
/
CdsMediaObject.h
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
214
215
216
217
218
219
220
221
222
223
224
/*****************************************************************************
* Copyright (C) 2012- Brad Love : b-rad at next dimension dot cc
* Next Dimension Innovations : http://nextdimension.cc
* http://b-rad.cc
* Copyright 2006 - 2011 Intel Corporation
*
* This file is part of TV-Now
* TV-Now is an Open Source DLNA Media Server. TV-Now's purpose is
* to serve Live TV (and recorded content) over the local network
* to televisions, computers, media players, tablets, and consoles.
* TV-Now delivers EPG data in the DLNA container for compatible
* clients and also offers an html5+jquery tv player with full EPG.
* TV-Now uses the libdvbtee library as its backend.
*
* TV-Now is compatible with:
* - ATSC
* - Clear QAM
* - DVB-T
*
* TV-Now is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Note: All additional terms from Section 7 of GPLv3 apply to this software.
* This includes requiring preservation of specified reasonable legal
* notices or author attributions in the material or in the Appropriate
* Legal Notices displayed by this software.
*
* You should have received a copy of the GNU General Public License v3
* along with TV-Now. If not, see <http://www.gnu.org/licenses/>.
*
* An Apache 2.0 licensed version of this software is privately maintained
* for licensing to interested commercial parties. Apache 2.0 license is
* compatible with the GPLv3, which allows the Apache 2.0 version to be
* included in proprietary systems, while keeping the public GPLv3 version
* completely open source. GPLv3 can NOT be re-licensed as Apache 2.0, since
* Apache 2.0 license is only a subset of GPLv3. To inquire about licensing
* the commercial version of TV-Now contact: tv-now at nextdimension dot cc
*
* Note about contributions and patch submissions:
* The commercial Apache 2.0 version of TV-Now is used as the master.
* The GPLv3 version of TV-Now will be identical to the Apache 2.0 version.
* All contributions and patches are licensed under Apache 2.0
* By submitting a patch you implicitly agree to
* http://www.apache.org/licenses/icla.txt
* You retain ownership and when merged the license will be upgraded to GPLv3.
*
*****************************************************************************/
#ifndef _CDS_MEDIA_OBJECT_H
#define _CDS_MEDIA_OBJECT_H
/*
* Provides the convenient means of manipulating/reading of CdsMediaObject.MediaClass field.
*/
#include <stdint.h>
#include "CdsMediaClass.h"
/*
* This module provides minimal data structures to represent
* media objects and their resource elements.
*
* Vendors that want to increase the supported metadata elements
* should modify these structures appropriately.
*
* This library does not presume use specifically for control point
* or device-implementation software.
*/
enum CdsObjectProperties
{
CDS_OBJPROP_FLAGS_Restricted = 0x0001, /* restricted attribute of media object */
CDS_OBJPROP_FLAGS_Searchable = 0x0002 /* container is searchable */
};
enum CdsAllocatable
{
CDS_ALLOC_ID = 0x0001,
CDS_ALLOC_ParentID = 0x0002,
CDS_ALLOC_RefID = 0x0004,
CDS_ALLOC_Title = 0x0008,
CDS_ALLOC_Creator = 0x0010,
CDS_ALLOC_Album = 0x0020,
CDS_ALLOC_Genre = 0x0040
};
enum CdsResAllocatable
{
CDS_ALLOC_ProtInfo = 0x0001,
CDS_ALLOC_Protection= 0x0002
};
/*
* Minimalistic representation of a resource.
*
* All strings are assumed to be in UTF8 form.
*/
struct CdsMediaResource
{
unsigned char Allocated; /*
* Indicates if protocolInfo and protection need to be deallocated.
* Mapped by CDS_ALLOC_ProtInfo and CDS_ALLOC_Protection.
*/
char *Value; /*
* This is the text that provide's the resource's value.
* Usually, this a URI. URI must be properly URI-escaped
* according to the rules of the URI's scheme. Note, URI-escaping
* is different than XML-escaped.
*/
char *ProtocolInfo; /* the protocolInfo of the resource */
int ResolutionX; /* the horizontal resolution. Negative value means value is not set.*/
int ResolutionY; /* the vertical resolution. Negative value means value is not set.*/
int Duration; /* the duration, in number of seconds. Negative value means value is not set.*/
int Bitrate; /* the bitrate of the resource. If negative, treat as an unset value. */
int ColorDepth; /* the color depth of the resource. If negative, treat as an unset value. */
uint64_t Size; /* the file size of the resource. If negative, treat as an unset value. */
int BitsPerSample; /* the number of bits per sample - should always accompany a valid SampleFrequency. Negative if unknown. */
int SampleFrequency; /* the sampling frequency - should always accompany BitsPerSample. Negative if unknown. */
int NrAudioChannels; /* number of audio channels. Negative indicates unknown */
char *Protection; /* app-defined DRM protection string. NULL if not present. */
struct CdsMediaResource *Next; /* allows the struct to be used in a linked list */
};
/*
* Provides a minimal representation of a media object.
*/
struct CdsMediaObject
{
/*
* Bit string masked by enum CdsAllocatable.
* If the bit is set, then the corresponding field should not be
* deleted in a call to CDS_DestroyObjects().
*/
unsigned int DeallocateThese;
char *ID; /* Object ID */
char *ParentID; /* Parent object ID */
char *RefID; /* Object ID of underlying item: for reference item only*/
char *uri_target; /* any special formatting the uri requires */
char *ProtocolInfo; /* the protocolInfo of the resource */
char *Title; /* Title metadata */
char *LongDescription;
char *Creator; /* Creator metadata */
char *Album; /* Album metadata */
char *AlbumArtURI;
int Recordable;
char *epgProviderName;
char *serviceProvider;
char *Genre; /* Genre metadata */
char *GenreExtended;
char *Language;
char *Rating;
char *RatingType;
/* EPG related */
time_t Date;
time_t ScheduledStartTime;
time_t ScheduledEndTime;
time_t ScheduledDurationTime;
struct {
time_t start;
time_t duration;
} DateTimeRange;
/* VideoBroadcast related */
char *ChannelID;
char *ChannelNr;
char *ChannelName;
char *CallSign;
char *NetworkAffiliation;
char *ProgramID;
char *SeriesID;
char *EpisodeType;
char *EpisodeSeason;
char *EpisodeNumber;
/* TODO: support multiple actors */
char *Actor;
/* media class of object. See [CdsMediaObject.h] */
unsigned int MediaClass;
/* number of children that this object has - valid only for container objects */
int ChildCount;
/*
* Boolean flags for representing object boolean properties.
* Individual bits can be accessed through (enum CdsObjectProperties).
*/
unsigned int Flags;
struct CdsMediaResource *Res; /* first resource for the media object */
struct CdsMediaObject *Next; /* allows struct to be used in a linked list*/
};
/* Allocates the memory for a CdsMediaObject, with all memory set to zero */
struct CdsMediaObject* CDS_AllocateObject();
struct CdsMediaResource* CDS_AllocateResource();
/* Deallocates all of the memory for the linked list of CdsMediaObject and its associated resources. */
void CDS_DestroyObjects(struct CdsMediaObject *cdsObjList);
/* Deallocates all of the memory for the linked list of CdsResources */
void CDS_DestroyResources(struct CdsMediaResource *resList);
#endif