]> git.sesse.net Git - vlc/blob - modules/gui/macosx/iTunes.h
demux: ts: split PES header parsing
[vlc] / modules / gui / macosx / iTunes.h
1 /*****************************************************************************
2  * iTunes.h
3  *****************************************************************************
4  * Copyright (C) 2013-2014 VLC authors and VideoLAN
5  * $Id$
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
20  *****************************************************************************/
21
22 #import <AppKit/AppKit.h>
23 #import <ScriptingBridge/ScriptingBridge.h>
24
25
26 @class iTunesPrintSettings, iTunesApplication, iTunesItem, iTunesArtwork, iTunesEncoder, iTunesEQPreset, iTunesPlaylist, iTunesAudioCDPlaylist, iTunesLibraryPlaylist, iTunesRadioTunerPlaylist, iTunesSource, iTunesTrack, iTunesAudioCDTrack, iTunesFileTrack, iTunesSharedTrack, iTunesURLTrack, iTunesUserPlaylist, iTunesFolderPlaylist, iTunesVisual, iTunesWindow, iTunesBrowserWindow, iTunesEQWindow, iTunesPlaylistWindow;
27
28 enum iTunesEKnd {
29         iTunesEKndTrackListing = 'kTrk' /* a basic listing of tracks within a playlist */,
30         iTunesEKndAlbumListing = 'kAlb' /* a listing of a playlist grouped by album */,
31         iTunesEKndCdInsert = 'kCDi' /* a printout of the playlist for jewel case inserts */
32 };
33 typedef enum iTunesEKnd iTunesEKnd;
34
35 enum iTunesEnum {
36         iTunesEnumStandard = 'lwst' /* Standard PostScript error handling */,
37         iTunesEnumDetailed = 'lwdt' /* print a detailed report of PostScript errors */
38 };
39 typedef enum iTunesEnum iTunesEnum;
40
41 enum iTunesEPlS {
42         iTunesEPlSStopped = 'kPSS',
43         iTunesEPlSPlaying = 'kPSP',
44         iTunesEPlSPaused = 'kPSp',
45         iTunesEPlSFastForwarding = 'kPSF',
46         iTunesEPlSRewinding = 'kPSR'
47 };
48 typedef enum iTunesEPlS iTunesEPlS;
49
50 enum iTunesERpt {
51         iTunesERptOff = 'kRpO',
52         iTunesERptOne = 'kRp1',
53         iTunesERptAll = 'kAll'
54 };
55 typedef enum iTunesERpt iTunesERpt;
56
57 enum iTunesEVSz {
58         iTunesEVSzSmall = 'kVSS',
59         iTunesEVSzMedium = 'kVSM',
60         iTunesEVSzLarge = 'kVSL'
61 };
62 typedef enum iTunesEVSz iTunesEVSz;
63
64 enum iTunesESrc {
65         iTunesESrcLibrary = 'kLib',
66         iTunesESrcIPod = 'kPod',
67         iTunesESrcAudioCD = 'kACD',
68         iTunesESrcMP3CD = 'kMCD',
69         iTunesESrcRadioTuner = 'kTun',
70         iTunesESrcSharedLibrary = 'kShd',
71         iTunesESrcUnknown = 'kUnk'
72 };
73 typedef enum iTunesESrc iTunesESrc;
74
75 enum iTunesESrA {
76         iTunesESrAAlbums = 'kSrL' /* albums only */,
77         iTunesESrAAll = 'kAll' /* all text fields */,
78         iTunesESrAArtists = 'kSrR' /* artists only */,
79         iTunesESrAComposers = 'kSrC' /* composers only */,
80         iTunesESrADisplayed = 'kSrV' /* visible text fields */,
81         iTunesESrASongs = 'kSrS' /* song names only */
82 };
83 typedef enum iTunesESrA iTunesESrA;
84
85 enum iTunesESpK {
86         iTunesESpKNone = 'kNon',
87         iTunesESpKBooks = 'kSpA',
88         iTunesESpKFolder = 'kSpF',
89         iTunesESpKGenius = 'kSpG',
90         iTunesESpKITunesU = 'kSpU',
91         iTunesESpKLibrary = 'kSpL',
92         iTunesESpKMovies = 'kSpI',
93         iTunesESpKMusic = 'kSpZ',
94         iTunesESpKPodcasts = 'kSpP',
95         iTunesESpKPurchasedMusic = 'kSpM',
96         iTunesESpKTVShows = 'kSpT'
97 };
98 typedef enum iTunesESpK iTunesESpK;
99
100 enum iTunesEVdK {
101         iTunesEVdKNone = 'kNon' /* not a video or unknown video kind */,
102         iTunesEVdKMovie = 'kVdM' /* movie track */,
103         iTunesEVdKMusicVideo = 'kVdV' /* music video track */,
104         iTunesEVdKTVShow = 'kVdT' /* TV show track */
105 };
106 typedef enum iTunesEVdK iTunesEVdK;
107
108 enum iTunesERtK {
109         iTunesERtKUser = 'kRtU' /* user-specified rating */,
110         iTunesERtKComputed = 'kRtC' /* iTunes-computed rating */
111 };
112 typedef enum iTunesERtK iTunesERtK;
113
114
115
116 /*
117  * Standard Suite
118  */
119
120 @interface iTunesPrintSettings : SBObject
121
122 @property (readonly) NSInteger copies;  // the number of copies of a document to be printed
123 @property (readonly) BOOL collating;  // Should printed copies be collated?
124 @property (readonly) NSInteger startingPage;  // the first page of the document to be printed
125 @property (readonly) NSInteger endingPage;  // the last page of the document to be printed
126 @property (readonly) NSInteger pagesAcross;  // number of logical pages laid across a physical page
127 @property (readonly) NSInteger pagesDown;  // number of logical pages laid out down a physical page
128 @property (readonly) iTunesEnum errorHandling;  // how errors are handled
129 @property (copy, readonly) NSDate *requestedPrintTime;  // the time at which the desktop printer should print the document
130 @property (copy, readonly) NSArray *printerFeatures;  // printer specific options
131 @property (copy, readonly) NSString *faxNumber;  // for fax number
132 @property (copy, readonly) NSString *targetPrinter;  // for target printer
133
134 - (void) printPrintDialog:(BOOL)printDialog withProperties:(iTunesPrintSettings *)withProperties kind:(iTunesEKnd)kind theme:(NSString *)theme;  // Print the specified object(s)
135 - (void) close;  // Close an object
136 - (void) delete;  // Delete an element from an object
137 - (SBObject *) duplicateTo:(SBObject *)to;  // Duplicate one or more object(s)
138 - (BOOL) exists;  // Verify if an object exists
139 - (void) open;  // open the specified object(s)
140 - (void) playOnce:(BOOL)once;  // play the current track or the specified track or file.
141
142 @end
143
144
145
146 /*
147  * iTunes Suite
148  */
149
150 // The application program
151 @interface iTunesApplication : SBApplication
152
153 - (SBElementArray *) browserWindows;
154 - (SBElementArray *) encoders;
155 - (SBElementArray *) EQPresets;
156 - (SBElementArray *) EQWindows;
157 - (SBElementArray *) playlistWindows;
158 - (SBElementArray *) sources;
159 - (SBElementArray *) visuals;
160 - (SBElementArray *) windows;
161
162 @property (copy) iTunesEncoder *currentEncoder;  // the currently selected encoder (MP3, AIFF, WAV, etc.)
163 @property (copy) iTunesEQPreset *currentEQPreset;  // the currently selected equalizer preset
164 @property (copy, readonly) iTunesPlaylist *currentPlaylist;  // the playlist containing the currently targeted track
165 @property (copy, readonly) NSString *currentStreamTitle;  // the name of the current song in the playing stream (provided by streaming server)
166 @property (copy, readonly) NSString *currentStreamURL;  // the URL of the playing stream or streaming web site (provided by streaming server)
167 @property (copy, readonly) iTunesTrack *currentTrack;  // the current targeted track
168 @property (copy) iTunesVisual *currentVisual;  //  the currently selected visual plug-in
169 @property BOOL EQEnabled;  // is the equalizer enabled?
170 @property BOOL fixedIndexing;  // true if all AppleScript track indices should be independent of the play order of the owning playlist.
171 @property BOOL frontmost;  // is iTunes the frontmost application?
172 @property BOOL fullScreen;  // are visuals displayed using the entire screen?
173 @property (copy, readonly) NSString *name;  // the name of the application
174 @property BOOL mute;  // has the sound output been muted?
175 @property NSInteger playerPosition;  // the player’s position within the currently playing track in seconds.
176 @property (readonly) iTunesEPlS playerState;  // is iTunes stopped, paused, or playing?
177 @property (copy, readonly) SBObject *selection;  // the selection visible to the user
178 @property NSInteger soundVolume;  // the sound output volume (0 = minimum, 100 = maximum)
179 @property (copy, readonly) NSString *version;  // the version of iTunes
180 @property BOOL visualsEnabled;  // are visuals currently being displayed?
181 @property iTunesEVSz visualSize;  // the size of the displayed visual
182
183 - (void) printPrintDialog:(BOOL)printDialog withProperties:(iTunesPrintSettings *)withProperties kind:(iTunesEKnd)kind theme:(NSString *)theme;  // Print the specified object(s)
184 - (void) run;  // run iTunes
185 - (void) quit;  // quit iTunes
186 - (iTunesTrack *) add:(NSArray *)x to:(SBObject *)to;  // add one or more files to a playlist
187 - (void) backTrack;  // reposition to beginning of current track or go to previous track if already at start of current track
188 - (iTunesTrack *) convert:(NSArray *)x;  // convert one or more files or tracks
189 - (void) fastForward;  // skip forward in a playing track
190 - (void) nextTrack;  // advance to the next track in the current playlist
191 - (void) pause;  // pause playback
192 - (void) playOnce:(BOOL)once;  // play the current track or the specified track or file.
193 - (void) playpause;  // toggle the playing/paused state of the current track
194 - (void) previousTrack;  // return to the previous track in the current playlist
195 - (void) resume;  // disable fast forward/rewind and resume playback, if playing.
196 - (void) rewind;  // skip backwards in a playing track
197 - (void) stop;  // stop playback
198 - (void) update;  // update the specified iPod
199 - (void) eject;  // eject the specified iPod
200 - (void) subscribe:(NSString *)x;  // subscribe to a podcast feed
201 - (void) updateAllPodcasts;  // update all subscribed podcast feeds
202 - (void) updatePodcast;  // update podcast feed
203 - (void) openLocation:(NSString *)x;  // Opens a Music Store or audio stream URL
204
205 @end
206
207 // an item
208 @interface iTunesItem : SBObject
209
210 @property (copy, readonly) SBObject *container;  // the container of the item
211 - (NSInteger) id;  // the id of the item
212 @property (readonly) NSInteger index;  // The index of the item in internal application order.
213 @property (copy) NSString *name;  // the name of the item
214 @property (copy, readonly) NSString *persistentID;  // the id of the item as a hexadecimal string. This id does not change over time.
215
216 - (void) printPrintDialog:(BOOL)printDialog withProperties:(iTunesPrintSettings *)withProperties kind:(iTunesEKnd)kind theme:(NSString *)theme;  // Print the specified object(s)
217 - (void) close;  // Close an object
218 - (void) delete;  // Delete an element from an object
219 - (SBObject *) duplicateTo:(SBObject *)to;  // Duplicate one or more object(s)
220 - (BOOL) exists;  // Verify if an object exists
221 - (void) open;  // open the specified object(s)
222 - (void) playOnce:(BOOL)once;  // play the current track or the specified track or file.
223 - (void) reveal;  // reveal and select a track or playlist
224
225 @end
226
227 // a piece of art within a track
228 @interface iTunesArtwork : iTunesItem
229
230 @property (copy) NSImage *data;  // data for this artwork, in the form of a picture
231 @property (copy) NSString *objectDescription;  // description of artwork as a string
232 @property (readonly) BOOL downloaded;  // was this artwork downloaded by iTunes?
233 @property (copy, readonly) NSNumber *format;  // the data format for this piece of artwork
234 @property NSInteger kind;  // kind or purpose of this piece of artwork
235 @property (copy) NSData *rawData;  // data for this artwork, in original format
236
237
238 @end
239
240 // converts a track to a specific file format
241 @interface iTunesEncoder : iTunesItem
242
243 @property (copy, readonly) NSString *format;  // the data format created by the encoder
244
245
246 @end
247
248 // equalizer preset configuration
249 @interface iTunesEQPreset : iTunesItem
250
251 @property double band1;  // the equalizer 32 Hz band level (-12.0 dB to +12.0 dB)
252 @property double band2;  // the equalizer 64 Hz band level (-12.0 dB to +12.0 dB)
253 @property double band3;  // the equalizer 125 Hz band level (-12.0 dB to +12.0 dB)
254 @property double band4;  // the equalizer 250 Hz band level (-12.0 dB to +12.0 dB)
255 @property double band5;  // the equalizer 500 Hz band level (-12.0 dB to +12.0 dB)
256 @property double band6;  // the equalizer 1 kHz band level (-12.0 dB to +12.0 dB)
257 @property double band7;  // the equalizer 2 kHz band level (-12.0 dB to +12.0 dB)
258 @property double band8;  // the equalizer 4 kHz band level (-12.0 dB to +12.0 dB)
259 @property double band9;  // the equalizer 8 kHz band level (-12.0 dB to +12.0 dB)
260 @property double band10;  // the equalizer 16 kHz band level (-12.0 dB to +12.0 dB)
261 @property (readonly) BOOL modifiable;  // can this preset be modified?
262 @property double preamp;  // the equalizer preamp level (-12.0 dB to +12.0 dB)
263 @property BOOL updateTracks;  // should tracks which refer to this preset be updated when the preset is renamed or deleted?
264
265
266 @end
267
268 // a list of songs/streams
269 @interface iTunesPlaylist : iTunesItem
270
271 - (SBElementArray *) tracks;
272
273 @property (readonly) NSInteger duration;  // the total length of all songs (in seconds)
274 @property (copy) NSString *name;  // the name of the playlist
275 @property (copy, readonly) iTunesPlaylist *parent;  // folder which contains this playlist (if any)
276 @property BOOL shuffle;  // play the songs in this playlist in random order?
277 @property (readonly) long long size;  // the total size of all songs (in bytes)
278 @property iTunesERpt songRepeat;  // playback repeat mode
279 @property (readonly) iTunesESpK specialKind;  // special playlist kind
280 @property (copy, readonly) NSString *time;  // the length of all songs in MM:SS format
281 @property (readonly) BOOL visible;  // is this playlist visible in the Source list?
282
283 - (void) moveTo:(SBObject *)to;  // Move playlist(s) to a new location
284 - (iTunesTrack *) searchFor:(NSString *)for_ only:(iTunesESrA)only;  // search a playlist for tracks matching the search string. Identical to entering search text in the Search field in iTunes.
285
286 @end
287
288 // a playlist representing an audio CD
289 @interface iTunesAudioCDPlaylist : iTunesPlaylist
290
291 - (SBElementArray *) audioCDTracks;
292
293 @property (copy) NSString *artist;  // the artist of the CD
294 @property BOOL compilation;  // is this CD a compilation album?
295 @property (copy) NSString *composer;  // the composer of the CD
296 @property NSInteger discCount;  // the total number of discs in this CD’s album
297 @property NSInteger discNumber;  // the index of this CD disc in the source album
298 @property (copy) NSString *genre;  // the genre of the CD
299 @property NSInteger year;  // the year the album was recorded/released
300
301
302 @end
303
304 // the master music library playlist
305 @interface iTunesLibraryPlaylist : iTunesPlaylist
306
307 - (SBElementArray *) fileTracks;
308 - (SBElementArray *) URLTracks;
309 - (SBElementArray *) sharedTracks;
310
311
312 @end
313
314 // the radio tuner playlist
315 @interface iTunesRadioTunerPlaylist : iTunesPlaylist
316
317 - (SBElementArray *) URLTracks;
318
319
320 @end
321
322 // a music source (music library, CD, device, etc.)
323 @interface iTunesSource : iTunesItem
324
325 - (SBElementArray *) audioCDPlaylists;
326 - (SBElementArray *) libraryPlaylists;
327 - (SBElementArray *) playlists;
328 - (SBElementArray *) radioTunerPlaylists;
329 - (SBElementArray *) userPlaylists;
330
331 @property (readonly) long long capacity;  // the total size of the source if it has a fixed size
332 @property (readonly) long long freeSpace;  // the free space on the source if it has a fixed size
333 @property (readonly) iTunesESrc kind;
334
335 - (void) update;  // update the specified iPod
336 - (void) eject;  // eject the specified iPod
337
338 @end
339
340 // playable audio source
341 @interface iTunesTrack : iTunesItem
342
343 - (SBElementArray *) artworks;
344
345 @property (copy) NSString *album;  // the album name of the track
346 @property (copy) NSString *albumArtist;  // the album artist of the track
347 @property NSInteger albumRating;  // the rating of the album for this track (0 to 100)
348 @property (readonly) iTunesERtK albumRatingKind;  // the rating kind of the album rating for this track
349 @property (copy) NSString *artist;  // the artist/source of the track
350 @property (readonly) NSInteger bitRate;  // the bit rate of the track (in kbps)
351 @property double bookmark;  // the bookmark time of the track in seconds
352 @property BOOL bookmarkable;  // is the playback position for this track remembered?
353 @property NSInteger bpm;  // the tempo of this track in beats per minute
354 @property (copy) NSString *category;  // the category of the track
355 @property (copy) NSString *comment;  // freeform notes about the track
356 @property BOOL compilation;  // is this track from a compilation album?
357 @property (copy) NSString *composer;  // the composer of the track
358 @property (readonly) NSInteger databaseID;  // the common, unique ID for this track. If two tracks in different playlists have the same database ID, they are sharing the same data.
359 @property (copy, readonly) NSDate *dateAdded;  // the date the track was added to the playlist
360 @property (copy) NSString *objectDescription;  // the description of the track
361 @property NSInteger discCount;  // the total number of discs in the source album
362 @property NSInteger discNumber;  // the index of the disc containing this track on the source album
363 @property (readonly) double duration;  // the length of the track in seconds
364 @property BOOL enabled;  // is this track checked for playback?
365 @property (copy) NSString *episodeID;  // the episode ID of the track
366 @property NSInteger episodeNumber;  // the episode number of the track
367 @property (copy) NSString *EQ;  // the name of the EQ preset of the track
368 @property double finish;  // the stop time of the track in seconds
369 @property BOOL gapless;  // is this track from a gapless album?
370 @property (copy) NSString *genre;  // the music/audio genre (category) of the track
371 @property (copy) NSString *grouping;  // the grouping (piece) of the track. Generally used to denote movements within a classical work.
372 @property (copy, readonly) NSString *kind;  // a text description of the track
373 @property (copy) NSString *longDescription;
374 @property (copy) NSString *lyrics;  // the lyrics of the track
375 @property (copy, readonly) NSDate *modificationDate;  // the modification date of the content of this track
376 @property NSInteger playedCount;  // number of times this track has been played
377 @property (copy) NSDate *playedDate;  // the date and time this track was last played
378 @property (readonly) BOOL podcast;  // is this track a podcast episode?
379 @property NSInteger rating;  // the rating of this track (0 to 100)
380 @property (readonly) iTunesERtK ratingKind;  // the rating kind of this track
381 @property (copy, readonly) NSDate *releaseDate;  // the release date of this track
382 @property (readonly) NSInteger sampleRate;  // the sample rate of the track (in Hz)
383 @property NSInteger seasonNumber;  // the season number of the track
384 @property BOOL shufflable;  // is this track included when shuffling?
385 @property NSInteger skippedCount;  // number of times this track has been skipped
386 @property (copy) NSDate *skippedDate;  // the date and time this track was last skipped
387 @property (copy) NSString *show;  // the show name of the track
388 @property (copy) NSString *sortAlbum;  // override string to use for the track when sorting by album
389 @property (copy) NSString *sortArtist;  // override string to use for the track when sorting by artist
390 @property (copy) NSString *sortAlbumArtist;  // override string to use for the track when sorting by album artist
391 @property (copy) NSString *sortName;  // override string to use for the track when sorting by name
392 @property (copy) NSString *sortComposer;  // override string to use for the track when sorting by composer
393 @property (copy) NSString *sortShow;  // override string to use for the track when sorting by show name
394 @property (readonly) NSInteger size;  // the size of the track (in bytes)
395 @property double start;  // the start time of the track in seconds
396 @property (copy, readonly) NSString *time;  // the length of the track in MM:SS format
397 @property NSInteger trackCount;  // the total number of tracks on the source album
398 @property NSInteger trackNumber;  // the index of the track on the source album
399 @property BOOL unplayed;  // is this track unplayed?
400 @property iTunesEVdK videoKind;  // kind of video track
401 @property NSInteger volumeAdjustment;  // relative volume adjustment of the track (-100% to 100%)
402 @property NSInteger year;  // the year the track was recorded/released
403
404
405 @end
406
407 // a track on an audio CD
408 @interface iTunesAudioCDTrack : iTunesTrack
409
410 @property (copy, readonly) NSURL *location;  // the location of the file represented by this track
411
412
413 @end
414
415 // a track representing an audio file (MP3, AIFF, etc.)
416 @interface iTunesFileTrack : iTunesTrack
417
418 @property (copy) NSURL *location;  // the location of the file represented by this track
419
420 - (void) refresh;  // update file track information from the current information in the track’s file
421
422 @end
423
424 // a track residing in a shared library
425 @interface iTunesSharedTrack : iTunesTrack
426
427
428 @end
429
430 // a track representing a network stream
431 @interface iTunesURLTrack : iTunesTrack
432
433 @property (copy) NSString *address;  // the URL for this track
434
435 - (void) download;  // download podcast episode
436
437 @end
438
439 // custom playlists created by the user
440 @interface iTunesUserPlaylist : iTunesPlaylist
441
442 - (SBElementArray *) fileTracks;
443 - (SBElementArray *) URLTracks;
444 - (SBElementArray *) sharedTracks;
445
446 @property BOOL shared;  // is this playlist shared?
447 @property (readonly) BOOL smart;  // is this a Smart Playlist?
448
449
450 @end
451
452 // a folder that contains other playlists
453 @interface iTunesFolderPlaylist : iTunesUserPlaylist
454
455
456 @end
457
458 // a visual plug-in
459 @interface iTunesVisual : iTunesItem
460
461
462 @end
463
464 // any window
465 @interface iTunesWindow : iTunesItem
466
467 @property NSRect bounds;  // the boundary rectangle for the window
468 @property (readonly) BOOL closeable;  // does the window have a close box?
469 @property (readonly) BOOL collapseable;  // does the window have a collapse (windowshade) box?
470 @property BOOL collapsed;  // is the window collapsed?
471 @property NSPoint position;  // the upper left position of the window
472 @property (readonly) BOOL resizable;  // is the window resizable?
473 @property BOOL visible;  // is the window visible?
474 @property (readonly) BOOL zoomable;  // is the window zoomable?
475 @property BOOL zoomed;  // is the window zoomed?
476
477
478 @end
479
480 // the main iTunes window
481 @interface iTunesBrowserWindow : iTunesWindow
482
483 @property BOOL minimized;  // is the small player visible?
484 @property (copy, readonly) SBObject *selection;  // the selected songs
485 @property (copy) iTunesPlaylist *view;  // the playlist currently displayed in the window
486
487
488 @end
489
490 // the iTunes equalizer window
491 @interface iTunesEQWindow : iTunesWindow
492
493 @property BOOL minimized;  // is the small EQ window visible?
494
495
496 @end
497
498 // a sub-window showing a single playlist
499 @interface iTunesPlaylistWindow : iTunesWindow
500
501 @property (copy, readonly) SBObject *selection;  // the selected songs
502 @property (copy, readonly) iTunesPlaylist *view;  // the playlist displayed in the window
503
504
505 @end
506