Wasabi ExpressPlay SDK for iOS  1.23.0
WsbMediaFile.h
Go to the documentation of this file.
1 /*****************************************************************
2 |
3 | Wasabi - Media File API
4 |
5 | $Id: WsbMediaFile.h 13807 2018-02-09 10:12:46Z nbanda $
6 | Original author: Gilles Boccon-Gibod
7 |
8 | This software is provided to you pursuant to your agreement
9 | with Intertrust Technologies Corporation ("Intertrust").
10 | This software may be used only in accordance with the terms
11 | of the agreement.
12 |
13 | Copyright (c) 2008-2014 by Intertrust. All rights reserved.
14 |
15 ****************************************************************/
21 #ifndef _WSB_MEDIA_FILE_H_
22 #define _WSB_MEDIA_FILE_H_
23 
24 /*----------------------------------------------------------------------
25 | includes
26 +---------------------------------------------------------------------*/
27 #include "WsbTypes.h"
28 #include "ShiAttributes.h"
29 #include "ShiData.h"
30 
31 /*----------------------------------------------------------------------
32 | types
33 +---------------------------------------------------------------------*/
38 
44 
48 typedef struct WSB_AudioMediaInfo {
52  const char* language;
54 
58 typedef enum {
62 } WSB_HdrType;
63 
67 typedef struct {
70 
74 typedef struct {
78 
82 typedef struct {
86 
90 typedef struct {
92  union {
95  } info;
96 } WSB_HdrInfo;
97 
101 typedef struct WSB_VideoMediaInfo {
107 
111 typedef enum {
116 } WSB_MediaType;
117 
121 typedef enum {
131 
135 typedef enum {
142 
146 typedef struct WSB_MediaInfo {
152  const char* track_name;
153  union {
156  } specific;
157 } WSB_MediaInfo;
158 
162 typedef struct WSB_FileProgress {
167 
171 typedef enum {
178  WSB_PROTECTION_TYPE_CENC = 6,/* Common Encryption cenc scheme */
179  WSB_PROTECTION_TYPE_HLS_AES = 7,/* HLS Encryption defined in IETF draft */
180  WSB_PROTECTION_TYPE_CBCS = 8 /* Common Encryption cbcs scheme */
182 
183 /*----------------------------------------------------------------------
184 | constants
185 +---------------------------------------------------------------------*/
189 #define WSB_CONTENT_TYPE_VIDEO_MP4 "video/mp4"
190 #define WSB_CONTENT_TYPE_VIDEO_M4V "video/m4v"
191 #define WSB_CONTENT_TYPE_AUDIO_MP4 "audio/mp4"
192 #define WSB_CONTENT_TYPE_VIDEO_MPEG2TS "video/MP2T"
193 #define WSB_CONTENT_TYPE_DASH "application/dash+xml"
194 #define WSB_CONTENT_TYPE_HLS "application/vnd.apple.mpegurl"
195 #define WSB_CONTENT_TYPE_DCF "application/vnd.oma.drm.dcf"
196 #define WSB_CONTENT_TYPE_DECE "video/vnd.dece.mp4"
197 #define WSB_CONTENT_TYPE_SUBTITLE_VTT "text/vtt"
198 #define WSB_CONTENT_TYPE_SUBTITLE_MP4 "application/mp4"
199 #define WSB_CONTENT_TYPE_SUBTITLE_TTML "application/ttml+xml"
200 
204 #define WSB_MEDIA_FILE_METADATA_FILTER_MINIMAL_SET 1
205 #define WSB_MEDIA_FILE_METADATA_FILTER_BASIC_SET 2
206 #define WSB_MEDIA_FILE_METADATA_FILTER_EXTENDED_SET 4
207 #define WSB_MEDIA_FILE_METADATA_FILTER_LICENSE 8
208 #define WSB_MEDIA_FILE_METADATA_FILTER_ALL 0xFFFFFFFF
209 
213 #define WSB_MEDIA_FILE_FLAG_PROGRESS_CAN_START 1
214 
218 #define WSB_FILE_METADATA_NAME "Name" /* string */
219 #define WSB_FILE_METADATA_ARTIST "Artist" /* string */
220 #define WSB_FILE_METADATA_ALBUM_ARTIST "AlbumArtist" /* string */
221 #define WSB_FILE_METADATA_COMPOSER "Composer" /* string */
222 #define WSB_FILE_METADATA_WRITER "Writer" /* string */
223 #define WSB_FILE_METADATA_ALBUM "Album" /* string */
224 #define WSB_FILE_METADATA_GENRE_CODE "GenreCode" /* integer */
225 #define WSB_FILE_METADATA_GENRE_NAME "GenreName" /* string */
226 #define WSB_FILE_METADATA_GROUPING "Grouping" /* string */
227 #define WSB_FILE_METADATA_DATE "Date" /* string */
228 #define WSB_FILE_METADATA_ENCODING_TOOL "Tool", /* string */
229 #define WSB_FILE_METADATA_COMMENT "Comment" /* string */
230 #define WSB_FILE_METADATA_LYRICS "Lyrics" /* string */
231 #define WSB_FILE_METADATA_COPYRIGHT "Copyright" /* string */
232 #define WSB_FILE_METADATA_TRACK_NUMBER "Track" /* integer */
233 #define WSB_FILE_METADATA_DISC_NUMBER "Disc" /* integer */
234 #define WSB_FILE_METADATA_COVER_ART "Cover" /* byte array */
235 #define WSB_FILE_METADATA_DESCRIPTION "Description" /* string */
236 #define WSB_FILE_METADATA_RATING "Rating" /* integer */
237 #define WSB_FILE_METADATA_TEMPO "Tempo" /* integer */
238 #define WSB_FILE_METADATA_COMPILATION "Compilation" /* boolean */
239 #define WSB_FILE_METADATA_IS_GAPLESS "IsGapless" /* boolean */
240 #define WSB_FILE_METADATA_TITLE "Title" /* string */
241 #define WSB_FILE_METADATA_STORE_FRONT "StoreFrontId" /* integer */
242 #define WSB_FILE_METADATA_FILE_KIND "FileKind" /* integer */
243 #define WSB_FILE_METADATA_SHOW_NAME "ShowName" /* string */
244 #define WSB_FILE_METADATA_SHOW_SEASON "ShowSeason" /* integer */
245 #define WSB_FILE_METADATA_SHOW_EPISODE_NUM "ShowEpisodeNumber" /* integer */
246 #define WSB_FILE_METADATA_SHOW_EPISONE_NAME "ShowEpisodeName" /* string */
247 #define WSB_FILE_METADATA_TV_NETWORK_NAME "TVNetworkName" /* string */
248 #define WSB_FILE_METADATA_IS_PODCAST "IsPodcast" /* boolean */
249 #define WSB_FILE_METADATA_PODCAST_URL "PodcastUrl" /* string */
250 #define WSB_FILE_METADATA_PODCAST_GUID "PodcastGuid" /* byte array */
251 #define WSB_FILE_METADATA_PODCAST_CATEGORY "PodcastCategory" /* string */
252 #define WSB_FILE_METADATA_KEYWORDS "Keywords" /* string */
253 #define WSB_FILE_METADATA_PURCHASE_DATE "PurchaseDate" /* string */
254 #define WSB_FILE_METADATA_ICON_URI "IconUri" /* string */
255 #define WSB_FILE_METADATA_INFO_URL "Info URL" /* string */
256 #define WSB_FILE_METADATA_COVER_ART_URI "CoverUri" /* string */
257 #define WSB_FILE_METADATA_LYRICS_URI "LyricsUri" /* string */
258 #define WSB_FILE_METADATA_DURATION "Duration" /* integer */
259 #define WSB_FILE_METADATA_PERFORMER "Performer" /* string */
260 #define WSB_FILE_METADATA_AUTHOR "Author" /* string */
261 
265 #define WSB_SLAS_ATTRIBUTE_NAME "SilentLicenseAcquisitionUrls"
266 #define WSB_RI_ATTRIBUTE_NAME "RightsIssuerUrls"
267 
268 /*----------------------------------------------------------------------
269 | functions
270 +---------------------------------------------------------------------*/
271 #if defined(__cplusplus)
272 extern "C" {
273 #endif
274 
290 WSB_EXPORT const char*
292 
303 WSB_EXPORT WSB_UInt32
305 
316 WSB_EXPORT WSB_Result
318  WSB_MediaInfo* media_info);
319 
351 WSB_EXPORT WSB_Result
353  SHI_Attribute** content_protection);
354 
365 WSB_EXPORT void
367 
398 WSB_EXPORT WSB_Result
399 WSB_MediaFile_Open(const char* name, const char* mime_type, WSB_MediaFile** file);
400 
408 WSB_EXPORT WSB_Result
411 
430 WSB_EXPORT WSB_Result
432  SHI_Attribute** metadata);
433 
444 WSB_EXPORT WSB_Result
446  WSB_FileProgress* progress);
447 
457 WSB_EXPORT WSB_Result
459  const void* license_data,
460  WSB_Size license_data_size);
461 
474 WSB_EXPORT const char*
476 
487 WSB_EXPORT const char*
489 
497 WSB_EXPORT WSB_Result
499  WSB_MediaInfo* media_info);
500 
507 WSB_EXPORT WSB_Cardinal
509 
523 WSB_EXPORT WSB_Result
525  WSB_Ordinal index,
526  WSB_TrackInfo** track_info);
527 
539 WSB_EXPORT WSB_Result
541  SHI_Data** license);
542 
560 WSB_EXPORT WSB_Result
562  SHI_Attribute** ri_urls); /* mapping contentid -> ri_urls */
563 
582 WSB_EXPORT WSB_Result
584  SHI_Attribute** slas); /* mapping contentid -> sla */
585 
593 WSB_EXPORT const char*
595 
603 WSB_EXPORT WSB_Result
605  WSB_UInt32 file_ready_timeout_ms);
615 WSB_EXPORT WSB_Result
617 
620 #if defined(__cplusplus)
621 }
622 #endif
623 
624 #endif /* _WSB_MEDIA_FILE_H_ */
WSB_EXPORT WSB_Result WSB_MediaFile_GetMediaInfo(WSB_MediaFile *file, WSB_MediaInfo *media_info)
Gets basic information, such as media type, format, and so on, about the specified media file...
WSB_MediaType type
Definition: WsbMediaFile.h:147
Definition: WsbMediaFile.h:125
WSB_EXPORT const char * WSB_MediaFile_GetContentType(WSB_MediaFile *file)
Gets the specified media file's content type as a MIME type.
const char * language
Definition: WsbMediaFile.h:52
WSB_EXPORT void WSB_TrackInfo_Release(WSB_TrackInfo *track_info)
Releases the specified WSB_TrackInfo object.
WSB_AudioMediaInfo audio
Definition: WsbMediaFile.h:154
Definition: WsbMediaFile.h:123
Definition: WsbMediaFile.h:126
Definition: WsbMediaFile.h:176
WSB_EXPORT WSB_Result WSB_TrackInfo_GetContentProtection(WSB_TrackInfo *track_info, SHI_Attribute **content_protection)
Gets the content protection elements for the specified track.
Definition: WsbMediaFile.h:137
struct WSB_AudioMediaInfo WSB_AudioMediaInfo
Information about audio media.
WSB_Hdr10Info hdr10
Definition: WsbMediaFile.h:93
WSB_EXPORT WSB_Result WSB_MediaFile_GetSilentLicenseAcquisitionUrls(WSB_MediaFile *file, SHI_Attribute **slas)
Gets the silent license acquisition URLs from the specified media file.
Definition: WsbMediaFile.h:61
WSB_EXPORT const char * WSB_TrackInfo_GetContentId(WSB_TrackInfo *track_info)
Gets the content ID for the specified track.
Information about High Dynamic Range (HDR).
Definition: WsbMediaFile.h:90
WSB_Int32 pl_info_count
Definition: WsbMediaFile.h:83
WSB_Int32 level_id
Definition: WsbMediaFile.h:76
Media information about a media file or a track within the media file.
Definition: WsbMediaFile.h:146
Definition: WsbMediaFile.h:179
WSB_VideoMediaInfo video
Definition: WsbMediaFile.h:155
unsigned WSB_CONFIG_INT64_TYPE WSB_LargeSize
Definition: WsbTypes.h:50
Definition: WsbMediaFile.h:178
WSB_UInt32 channel_count
Definition: WsbMediaFile.h:49
Definition: WsbMediaFile.h:177
Definition: WsbMediaFile.h:175
Definition: WsbMediaFile.h:60
struct SHI_Attribute SHI_Attribute
SHI_Attribute objects represent named values that can be arranged in a tree structure.
Definition: ShiAttributes.h:110
WSB_MediaFormat
Identifiers for media formats.
Definition: WsbMediaFile.h:121
WSB_EXPORT WSB_Result WSB_MediaFile_WaitUntilReady(WSB_MediaFile *file, WSB_UInt32 file_ready_timeout_ms)
Waits until the file is ready or the specified timeout has been reached.
WSB_UInt32 reserved
Definition: WsbMediaFile.h:68
WSB_EXPORT WSB_Result WSB_MediaFile_GetRightsIssuerUrls(WSB_MediaFile *file, SHI_Attribute **ri_urls)
Gets the right issuer URLs from the specified media file.
WSB_LargeSize available
number of bytes currently available
Definition: WsbMediaFile.h:164
WSB_StreamEncryptionMethod
Identifiers for stream encryption methods.
Definition: WsbMediaFile.h:135
WSB_HdrType
Identifiers for the different HDR types.
Definition: WsbMediaFile.h:58
WSB_EXPORT WSB_Result WSB_MediaFile_GetTrackInfo(WSB_MediaFile *file, WSB_Ordinal index, WSB_TrackInfo **track_info)
Gets information about a specified track.
WSB_Int32 profile_id
Definition: WsbMediaFile.h:75
WSB_DolbyVisionInfo dolby_vision
Definition: WsbMediaFile.h:94
WSB_UInt32 WSB_Ordinal
An unsigned integer that represents a position in a sequence (such as an index into a list of element...
Definition: WsbTypes.h:127
WSB_EXPORT WSB_Result WSB_MediaFile_Open(const char *name, const char *mime_type, WSB_MediaFile **file)
Opens the specified media file and creates a WSB_MediaFile object referencing it. ...
WSB_UInt32 WSB_Flags
Type used to represent a bit pattern signifying a combination of flags that can be on or off...
Definition: WsbTypes.h:93
Information about video media.
Definition: WsbMediaFile.h:101
WSB_EXPORT WSB_Result WSB_MediaFile_Close(WSB_MediaFile *file)
Closes the media file and releases the WSB_MediaFile object referencing it.
struct WSB_MediaFile WSB_MediaFile
A WSB_MediaFile object represents information about a media file.
Definition: WsbMediaFile.h:37
struct WSB_VideoMediaInfo WSB_VideoMediaInfo
Information about video media.
Information about Dolby Vision.
Definition: WsbMediaFile.h:82
WSB_LargeSize total_size
total number of bytes in the file
Definition: WsbMediaFile.h:165
Definition: WsbMediaFile.h:115
WSB_EXPORT WSB_Result WSB_MediaFile_GetMetadata(WSB_MediaFile *file, SHI_Attribute **metadata)
Returns an attribute list containing all the metadata for the specified media file.
WSB_UInt32 height
Definition: WsbMediaFile.h:103
struct WSB_FileProgress WSB_FileProgress
File progress information.
Definition: WsbMediaFile.h:113
Definition: WsbMediaFile.h:136
struct WSB_MediaInfo WSB_MediaInfo
Media information about a media file or a track within the media file.
WSB_EXPORT WSB_Result WSB_MediaFile_GetProgress(WSB_MediaFile *file, WSB_FileProgress *progress)
Gets file progress information, indicating how many bytes of the file are available, and the total number of bytes in the file.
WSB_EXPORT const char * WSB_MediaFile_GetName(WSB_MediaFile *file)
Gets the name of the media file, which was passed in during creation.
WSB_UInt32 bitrate
in bits/sec
Definition: WsbMediaFile.h:150
WSB_EXPORT const char * WSB_MediaFile_GetContentId(WSB_MediaFile *file)
Returns the content ID for the content in the specified media file.
WSB_UInt32 width
Definition: WsbMediaFile.h:102
WSB_UInt32 depth
Definition: WsbMediaFile.h:104
WSB_UInt32 WSB_Cardinal
An unsigned integer used to represent a quantity that can be counted (such as a number of elements in...
Definition: WsbTypes.h:121
Infomation about Dolby Vision profile and level.
Definition: WsbMediaFile.h:74
Definition: WsbMediaFile.h:122
Definition: WsbMediaFile.h:172
Information about audio media.
Definition: WsbMediaFile.h:48
struct WSB_TrackInfo WSB_TrackInfo
A WSB_TrackInfo object represents information about a track in a media file.
Definition: WsbMediaFile.h:43
WSB_MediaFileProtectionType
Identifiers for media file protection types.
Definition: WsbMediaFile.h:171
int WSB_Result
Signed integer value representing a function or method result (return value).
Definition: WsbTypes.h:83
WSB_EXPORT WSB_UInt32 WSB_TrackInfo_GetTrackId(WSB_TrackInfo *track_info)
Gets the track ID.
Definition: WsbMediaFile.h:112
WSB_EXPORT WSB_Result WSB_MediaFile_SetLicense(WSB_MediaFile *file, const void *license_data, WSB_Size license_data_size)
Attempts to write the given license into the specified file.
Information about HDR10.
Definition: WsbMediaFile.h:67
Definition: WsbMediaFile.h:138
File progress information.
Definition: WsbMediaFile.h:162
WSB_EXPORT WSB_Result WSB_TrackInfo_GetMediaInfo(WSB_TrackInfo *track_info, WSB_MediaInfo *media_info)
Gets the media info for the specified track.
WSB_HdrInfo hdr_info
Definition: WsbMediaFile.h:105
Definition: WsbMediaFile.h:127
unsigned int WSB_UInt32
32-bit (or more) unsigned integer
Definition: WsbTypes.h:36
WSB_EXPORT WSB_Cardinal WSB_MediaFile_GetTrackCount(WSB_MediaFile *file)
Returns the number of tracks in the specified media file.
WSB_UInt32 sample_size
Definition: WsbMediaFile.h:51
WSB_Flags flags
Definition: WsbMediaFile.h:163
Definition: WsbMediaFile.h:140
const char * track_name
for DASH only, corresponds to Representation id
Definition: WsbMediaFile.h:152
Definition: WsbMediaFile.h:114
WSB_MediaType
Identifiers for the different media types.
Definition: WsbMediaFile.h:111
struct SHI_Data SHI_Data
A SHI_Data object represents a typed data object.
Definition: ShiData.h:116
Definition: WsbMediaFile.h:129
Definition: WsbMediaFile.h:124
Definition: WsbMediaFile.h:174
signed int WSB_Int32
32-bit (or more) signed integer
Definition: WsbTypes.h:37
Attributes.
Definition: WsbMediaFile.h:180
Definition: WsbMediaFile.h:59
WSB_MediaFormat format
Definition: WsbMediaFile.h:148
WSB_EXPORT WSB_Result WSB_MediaFile_GetLicense(WSB_MediaFile *file, SHI_Data **license)
Gets the license from the metadata attached to the specified media file.
WSB_UInt32 duration
in ms
Definition: WsbMediaFile.h:149
WSB_EXPORT WSB_Result WSB_MediaFile_GetProtectionType(WSB_MediaFile *file, WSB_MediaFileProtectionType *type)
Gets the type of protection on the specified media file, which may be none (indicated as WSB_PROTECTI...
Wasabi Result.
WSB_HdrType type
Definition: WsbMediaFile.h:91
Definition: WsbMediaFile.h:139
WSB_StreamEncryptionMethod encryption_method
Definition: WsbMediaFile.h:151
Generic Data Objects.
Definition: WsbMediaFile.h:173
WSB_UInt32 WSB_Size
An unsigned integer used to represent a measurable quantity (e.g., the size of a file).
Definition: WsbTypes.h:104
Definition: WsbMediaFile.h:128
const WSB_DolbyVisionProfileLevelInfo * pl_infos
Definition: WsbMediaFile.h:84
WSB_UInt32 sample_rate
Definition: WsbMediaFile.h:50