/usr/include/gpac/internal/mpd.h is in libgpac-dev 0.5.2-426-gc5ad4e4+dfsg5-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 | /*
* GPAC - Multimedia Framework C SDK
*
* Authors: Jean Le Feuvre - Cyril Concolato
* Copyright (c) Telecom ParisTech 2010-2012
* All rights reserved
*
* This file is part of GPAC / 3GPP/MPEG Media Presentation Description input module
*
* GPAC is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* GPAC is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#ifndef _MPD_H_
#define _MPD_H_
#include <gpac/constants.h>
#include <gpac/xml.h>
#include <gpac/media_tools.h>
/*TODO*/
typedef struct
{
u32 dummy;
} GF_MPD_Metrics;
/*TODO*/
typedef struct
{
u32 dummy;
} GF_MPD_ContentComponent;
//some elments are typically overloaded in XML, we keep the attributes / childrne nodes here. The attributes list is NULL if no extensions were found, otherwise it is a list of @GF_XMLAttribute.
//The children list is NULL if no extensions were found, otherwise it is a list of @GF_XMLNode
#define MPD_EXTENSIBLE \
GF_List *attributes; \
GF_List *children; \
typedef struct
{
MPD_EXTENSIBLE
} GF_MPD_ExtensibleVirtual;
typedef struct
{
MPD_EXTENSIBLE
char *scheme_id_uri; /*MANDATORY*/
char *value;
char *id;
} GF_MPD_Descriptor;
/*TODO*/
typedef struct
{
u32 dummy;
} GF_MPD_Subset;
typedef struct
{
u64 start_time;
u32 duration; /*MANDATORY*/
//may be -1 (FIXME this needs further testing)
u32 repeat_count;
} GF_MPD_SegmentTimelineEntry;
typedef struct
{
GF_List *entries;
} GF_MPD_SegmentTimeline;
typedef struct
{
u64 start_range, end_range;
} GF_MPD_ByteRange;
typedef struct
{
char *URL;
char *service_location;
GF_MPD_ByteRange *byte_range;
} GF_MPD_BaseURL;
typedef struct
{
char *sourceURL;
GF_MPD_ByteRange *byte_range;
//GPAC internal - indicates the URL has already been solved
Bool is_resolved;
} GF_MPD_URL;
typedef struct
{
u32 num, den;
} GF_MPD_Fractional;
typedef struct
{
u32 trackID;
char *stsd;
s64 mediaOffset;
} GF_MPD_ISOBMFInfo;
#define GF_MPD_SEGMENT_BASE \
u32 timescale; \
u64 presentation_time_offset; \
u32 time_shift_buffer_depth; /* expressed in milliseconds */ \
GF_MPD_ByteRange *index_range; \
Bool index_range_exact; \
Double availability_time_offset; \
GF_MPD_URL *initialization_segment; \
GF_MPD_URL *representation_index; \
typedef struct
{
GF_MPD_SEGMENT_BASE
} GF_MPD_SegmentBase;
/*WARNING: duration is expressed in GF_MPD_SEGMENT_BASE@timescale unit*/
#define GF_MPD_MULTIPLE_SEGMENT_BASE \
GF_MPD_SEGMENT_BASE \
u64 duration; \
u32 start_number; \
GF_MPD_SegmentTimeline *segment_timeline; \
GF_MPD_URL *bitstream_switching_url; \
typedef struct
{
GF_MPD_MULTIPLE_SEGMENT_BASE
} GF_MPD_MultipleSegmentBase;
typedef struct
{
char *media;
GF_MPD_ByteRange *media_range;
char *index;
GF_MPD_ByteRange *index_range;
u64 duration;
char *key_url;
bin128 key_iv;
} GF_MPD_SegmentURL;
typedef struct
{
GF_MPD_MULTIPLE_SEGMENT_BASE
/*list of segments - can be NULL if no segment*/
GF_List *segment_URLs;
char *xlink_href;
Bool xlink_actuate_on_load;
} GF_MPD_SegmentList;
typedef struct
{
GF_MPD_MULTIPLE_SEGMENT_BASE
char *media;
char *index;
char *initialization;
char *bitstream_switching;
} GF_MPD_SegmentTemplate;
typedef enum
{
GF_MPD_SCANTYPE_UNKNWON,
GF_MPD_SCANTYPE_PROGRESSIVE,
GF_MPD_SCANTYPE_INTERLACED
} GF_MPD_ScanType;
/*MANDATORY:
mime_type
codecs
*/
#define GF_MPD_COMMON_ATTRIBUTES_ELEMENTS \
char *profiles; \
u32 width; \
u32 height; \
GF_MPD_Fractional *sar; \
GF_MPD_Fractional *framerate; \
u32 samplerate; \
char *mime_type; \
char *segmentProfiles; \
char *codecs; \
u32 maximum_sap_period; \
Bool starts_with_sap; \
Double max_playout_rate; \
Bool coding_dependency; \
GF_MPD_ScanType scan_type; \
GF_List *frame_packing; \
GF_List *audio_channels; \
GF_List *content_protection; \
GF_List *essential_properties; \
GF_List *supplemental_properties; \
GF_List *isobmf_tracks; \
typedef struct {
GF_MPD_COMMON_ATTRIBUTES_ELEMENTS
} GF_MPD_CommonAttributes;
typedef struct {
GF_MPD_COMMON_ATTRIBUTES_ELEMENTS
u32 level;
char *dependecy_level;
u32 bandwidth; /*MANDATORY if level set*/
char *content_components;
} GF_MPD_SubRepresentation;
typedef struct
{
Bool disabled;
char *cached_init_segment_url;
u64 init_start_range, init_end_range;
u32 probe_switch_count;
char *init_segment_data;
u32 init_segment_size;
char *key_url;
bin128 key_IV;
} GF_DASH_RepresentationPlayback;
typedef struct {
GF_MPD_COMMON_ATTRIBUTES_ELEMENTS
char *id; /*MANDATORY*/
u32 bandwidth; /*MANDATORY*/
u32 quality_ranking;
char *dependency_id;
char *media_stream_structure_id;
GF_List *base_URLs;
GF_MPD_SegmentBase *segment_base;
GF_MPD_SegmentList *segment_list;
GF_MPD_SegmentTemplate *segment_template;
GF_List *sub_representations;
/*index of the next enhancement representation plus 1, 0 is reserved in case of the highest representation*/
u32 enhancement_rep_index_plus_one;
/*GPAC playback implementation*/
GF_DASH_RepresentationPlayback playback;
} GF_MPD_Representation;
typedef struct
{
GF_MPD_COMMON_ATTRIBUTES_ELEMENTS
u32 id;
/*default value is -1: not set in MPD*/
s32 group;
char *lang;
char *content_type;
GF_MPD_Fractional *par;
u32 min_bandwidth;
u32 max_bandwidth;
u32 min_width;
u32 max_width;
u32 min_height;
u32 max_height;
u32 min_framerate;
u32 max_framerate;
Bool segment_alignment;
Bool bitstream_switching;
Bool subsegment_alignment;
Bool subsegment_starts_with_sap;
GF_List *accessibility;
GF_List *role;
GF_List *rating;
GF_List *viewpoint;
GF_List *content_component;
GF_List *base_URLs;
GF_MPD_SegmentBase *segment_base;
GF_MPD_SegmentList *segment_list;
GF_MPD_SegmentTemplate *segment_template;
GF_List *representations;
char *xlink_href;
Bool xlink_actuate_on_load;
} GF_MPD_AdaptationSet;
typedef struct
{
char *ID;
u32 start; /* expressed in ms, relative to the start of the MPD */
u32 duration; /* expressed in ms*/
Bool bitstream_switching;
GF_List *base_URLs;
GF_MPD_SegmentBase *segment_base;
GF_MPD_SegmentList *segment_list;
GF_MPD_SegmentTemplate *segment_template;
GF_List *adaptation_sets;
GF_List *subsets;
char *xlink_href;
Bool xlink_actuate_on_load;
} GF_MPD_Period;
typedef struct
{
char *lang;
char *title;
char *source;
char *copyright;
char *more_info_url;
} GF_MPD_ProgramInfo;
typedef enum {
GF_MPD_TYPE_STATIC,
GF_MPD_TYPE_DYNAMIC,
} GF_MPD_Type;
typedef struct {
MPD_EXTENSIBLE
char *ID;
char *profiles; /*MANDATORY*/
GF_MPD_Type type;
u64 availabilityStartTime; /* expressed in milliseconds */ /*MANDATORY if type=dynamic*/
u64 availabilityEndTime;/* expressed in milliseconds */
u64 publishTime;/* expressed in milliseconds */
u32 media_presentation_duration; /* expressed in milliseconds */ /*MANDATORY if type=static*/
u32 minimum_update_period; /* expressed in milliseconds */
u32 min_buffer_time; /* expressed in milliseconds */ /*MANDATORY*/
u32 time_shift_buffer_depth; /* expressed in milliseconds */
u32 suggested_presentaton_delay; /* expressed in milliseconds */
u32 max_segment_duration; /* expressed in milliseconds */
u32 max_subsegment_duration; /* expressed in milliseconds */
/*list of GF_MPD_ProgramInfo */
GF_List *program_infos;
/*list of GF_MPD_BaseURL */
GF_List *base_URLs;
/*list of strings */
GF_List *locations;
/*list of Metrics */
GF_List *metrics;
/*list of GF_MPD_Period */
GF_List *periods;
/*set during parsing*/
const char *xml_namespace;
} GF_MPD;
GF_Err gf_mpd_init_from_dom(GF_XMLNode *root, GF_MPD *mpd, const char *base_url);
GF_Err gf_mpd_complete_from_dom(GF_XMLNode *root, GF_MPD *mpd, const char *base_url);
GF_MPD *gf_mpd_new();
void gf_mpd_del(GF_MPD *mpd);
/*frees a GF_MPD_SegmentURL structure (type-casted to void *)*/
void gf_mpd_segment_url_free(void *ptr);
void gf_mpd_segment_base_free(void *ptr);
void gf_mpd_period_free(void *_item);
GF_Err gf_mpd_write_file(GF_MPD *mpd, char *file_name);
typedef struct _gf_file_get GF_FileDownload;
struct _gf_file_get
{
GF_Err (*new_session)(GF_FileDownload *getter, char *url);
void (*del_session)(GF_FileDownload *getter);
const char *(*get_cache_name)(GF_FileDownload *getter);
void *udta;
/*created by udta after new_session*/
void *session;
};
/*converts M3U8 to MPD - getter is optional (download will still be processed if NULL)*/
GF_Err gf_m3u8_to_mpd(const char *m3u8_file, const char *base_url, const char *mpd_file, u32 reload_count, char *mimeTypeForM3U8Segments, Bool do_import, Bool use_mpd_templates, GF_FileDownload *getter);
typedef enum
{
GF_MPD_RESOLVE_URL_MEDIA,
GF_MPD_RESOLVE_URL_INIT,
GF_MPD_RESOLVE_URL_INDEX,
//same as GF_MPD_RESOLVE_URL_MEDIA but does not replace $Time$ and $Number$
GF_MPD_RESOLVE_URL_MEDIA_TEMPLATE,
} GF_MPD_URLResolveType;
/*resolves a URL based for a given segment, based on the MPD url, the type of resolution
item_index: current downloading index of the segment
nb_segments_removed: number of segments removed when pruging the MPD after updates (can be 0). The start number will be offset by this value
*/
GF_Err gf_mpd_resolve_url(GF_MPD *mpd, GF_MPD_Representation *rep, GF_MPD_AdaptationSet *set, GF_MPD_Period *period, const char *mpd_url, GF_MPD_URLResolveType resolve_type, u32 item_index, u32 nb_segments_removed,
char **out_url, u64 *out_range_start, u64 *out_range_end, u64 *segment_duration, Bool *is_in_base_url, char **out_key_url, bin128 *key_iv);
#endif // _MPD_H_
|