home *** CD-ROM | disk | FTP | other *** search
/ OpenStep 4.2J (Developer) / os42jdev.iso / NextLibrary / Frameworks / NEXTIME.framework / Versions / A / Headers / NTMediaController.h < prev    next >
Encoding:
Text File  |  1995-08-30  |  6.7 KB  |  169 lines

  1. /*
  2.  *  NTMediaController.h
  3.  *     Copyright 1994, NeXT Computer, Inc.
  4.  *    
  5.  *    A set of protocols defining expected API in components used to
  6.  *    control hardware or digital media.
  7.  *
  8.  *    8 March 1994 mpaque Created.
  9.  */
  10. #import <Foundation/NSObject.h>
  11. #import <Foundation/NSDictionary.h>
  12. #import "NTMovie.h"
  13. #import "NTProgressMonitor.h"
  14.  
  15.  
  16. /*
  17.  * The following optional API may be implemented by objects complying with
  18.  * media control APIs specified in this file, for support of video input.
  19.  */
  20. @protocol NTVideoInputMediaControl <NSObject>
  21. - (BOOL)canRecord;        /* Returns YES if recording can be started */
  22. - (void)record;            /* The stop method terminates this. */
  23.  
  24. - (BOOL)canMonitorVideo; /* Returns YES if video can be monitored in NTView */
  25. - (void)monitorVideo;        /* The stop method terminates this. */
  26. @end
  27.  
  28. /*
  29.  * The following optional API may be implemented by objects complying with
  30.  * media control APIs specified in this file, for support of audio IO.
  31.  */
  32. @protocol NTAudioMediaControl <NSObject>
  33. - (void)setSoundFocus:(BOOL)focus;/* tell controller that it has snd focus */
  34. - (BOOL)soundFocus;        /* Current sound focus */
  35. - (void)setMute:(BOOL)mute;    /* Mute, or audio enable/disable */
  36. - (BOOL)isMuted;        /* Current audio state. */
  37. @end
  38.  
  39. /*
  40.  * The following optional API may be implemented by objects complying with
  41.  * media control APIs which support cut and paste data operations.
  42.  */
  43. @protocol NTEditableMediaControl <NSObject>
  44. - (NSData *) cutFromTime:(double)time duration:(double)dur;
  45. - (void) deleteFromTime:(double)time duration:(double)dur;
  46. - (NSData *) copyFromTime:(double)time duration:(double)dur;
  47. - (void) pasteMovie:(NSData *)movieData atTime:(double)time;
  48. - (void) undo;    /* undo/redo toggle */
  49. @end
  50.  
  51. /*
  52.  * Basic Media Control API, suitable for use by any sort of media player or
  53.  * monitor.  For example, this API could be used to control one channel of a
  54.  * simple video switcher to enable or disable a video feed.
  55.  */
  56. @protocol NTSimpleMediaControl <NSObject>
  57. - (BOOL)setConfiguration:(bycopy NSDictionary *)configuration;
  58.   /* Set a configuration.  The contents of the configuration dictionary
  59.    * depend on the nature of the component. Returns NO if setup fails. */
  60. - (bycopy NSDictionary *) configuration;
  61.   /* report the current configuration.  This may not match the initial
  62.    * configuration passed in through setConfiguration. */
  63. - (void)run;        /* Start media playback */
  64. - (BOOL)isRunning;    /* Media playback is in progress */
  65. - (void)stop;        /* Stop, generating a still image if possible */
  66. @end
  67.  
  68. /*
  69.  * Seekable Media Control API, suitable for use by any sort of stored media
  70.  * player.  This API could be used to control a simple laser disk or video tape
  71.  * player, or an unindexed digital stored media such as an MPEG stream from
  72.  * disk.
  73.  */
  74. @protocol NTSeekableMediaControl <NTSimpleMediaControl>
  75. - (void)rewind;        /* Seek to beginning of media, displaying a still */
  76.             /* frame (poster frame) if possible. */
  77. - (void)stepForward;    /* Jog to the next displayable frame */
  78. - (void)stepReverse;    /* Jog to the previous displayable frame */
  79. - (void)fastForward;    /* Quickly forward through frames. Stop using stop */
  80. - (void)fastReverse;    /* Quickly forward through frames. Stop using stop */
  81. @end
  82.  
  83.  
  84.  
  85. /*
  86.  * Precise Media Control API, suitable for use by a stored media player with
  87.  * precise control over media position.  This API could be used to control a
  88.  * high end laser disk or video tape deck, an ABEKAS video storage device, or
  89.  * indexed digital stored media such as NEXTIME movies.
  90.  */
  91. typedef enum
  92. {
  93.     NTTimePosition,
  94.     NTFramePosition
  95. } NTPosition;
  96.  
  97. @protocol NTPreciseMediaControl <NTSeekableMediaControl>
  98. - (void)seekToPosition:(double)pos ofType:(NTPosition)type;
  99.   /* Select a position in the media by time or frame, and display image */
  100. - (void)runToPosition:(double)pos ofType:(NTPosition)type;
  101.   /* Run from the current position until the specified position */
  102. - (double)currentPositionOfType:(NTPosition)type;
  103.   /* Report current position by time in seconds or frame number */
  104. - (NTSampleFlags)currentFrameFlags;
  105.   /* Report the sample flags for the current video frame */
  106. - (double)duration;    /* Duration of media in seconds, or -1.0 if unknown */
  107. - (double)startTime;    /* Starting time media in seconds, -1.0 if unknown */
  108. - (BOOL)canSeekContinuously;
  109.   /* YES if we can seek through the media and display frames continuously */
  110. @end
  111.  
  112. /*
  113.  * A controller for samples stored in a file has additional capabilities.
  114.  * Since the controller is embedded in the NEXTSTEP environment, it may be
  115.  * able to take advantage of knowing when it has the user's focus to
  116.  * optimize it's  behavior.
  117.  * It can vend the NEXTIME representation of the movie, for use
  118.  * in digital editing programs.
  119.  * The NTEditableMediaControl API should be present, to support cut/paste
  120.  * editing operations.
  121.  * It should be able to provide digital sample recording services.
  122.  * The NEXTSTEP environment's audio features are also available.
  123.  * Since progress through a disk file is easy to monitor, we also
  124.  * mandate support for progress monitors.
  125.  */
  126. @protocol NTFileBasedMediaControl    <NTPreciseMediaControl,
  127.                     NTEditableMediaControl,
  128.                     NTVideoInputMediaControl,
  129.                     NTAudioMediaControl,
  130.                     NTProgressController>
  131. - (bycopy NSDictionary *)currentMovieParameters;
  132.   /* Return a dictionary describing the filename, file type, and media encoding
  133.    * found in the currently open file.  Returns nil if no file is currently
  134.    * open.
  135.    */
  136. - (BOOL)openFileWithParameters:(bycopy NSDictionary *)param;
  137.   /* Open an existing file/type as a movie.  The NTFilename and NTFileType
  138.    * keys in param are used to specify the file to be opened.
  139.    * Any old movie object in the controller is freed on success.
  140.    * Returns NO on failure.
  141.    */
  142. - (BOOL)newFileWithParameters:(bycopy NSDictionary *)param;
  143.   /* Creates a new movie file of type 'type'. The NTFilename and NTFileType
  144.    * keys in param are used to specify the file to be opened.  Media keys may
  145.    * also be supplied, indicating media to be configured in the new movie.
  146.    * Any existing file may be destroyed.
  147.    * Any old movie object in the controller is freed on success.
  148.    * Returns NO on failure.
  149.    */
  150. - (BOOL)saveAndFlatten:(BOOL)squashItLikeABug;
  151. - (BOOL)saveWithParameters:(bycopy NSDictionary *)parameters
  152.      andFlatten:(BOOL)squashItLikeABug;
  153.   /* Save the file to disk, optionally flattening the file by resolving
  154.    * external data references and removing unused samples and tracks.
  155.    * The file name and type may be specified in parameters using the
  156.    * NTFilename and NTFileType keys.
  157.    */
  158. - (id <NTMovie>)movie;
  159.   /* Returns an NTMovie compliant object, or nil if the controller is not */
  160.   /* associated with a digitally stored movie. */
  161.  
  162.  
  163. /* Notification methods used to alert the controller when it has user focus. */
  164. - (void)controllerDidBecomeKey;
  165. - (void)controllerDidResignKey;
  166.  
  167. @end
  168.  
  169.