IsochronousDataHandler.h
上传用户:xjjlds
上传日期:2015-12-05
资源大小:22823k
文件大小:18k
源码类别:

多媒体编程

开发平台:

Visual C++

  1. /*
  2.      File:       IsochronousDataHandler.h
  3.  
  4.      Contains:   The defines the client API to an Isochronous Data Handler, which is
  5.  
  6.      Version:    Technology: xxx put version here xxx
  7.                  Release:    QuickTime 6.0.2
  8.  
  9.      Copyright:  (c) 1997-2001 by Apple Computer, Inc., all rights reserved.
  10.  
  11.      Bugs?:      For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. //
  18. // Check for Prior Inclusion of IsochronousDataHandler.r
  19. //  If this header is trying to be included via a Rez path, make it act
  20. //  as a NOP.  This will allow both Rez & C files to get to use the
  21. //  contants for the component type, subtype, and interface version.
  22. #ifndef __ISOCHRONOUSDATAHANDLER_R__
  23. #ifndef __ISOCHRONOUSDATAHANDLER__
  24. #define __ISOCHRONOUSDATAHANDLER__
  25. #ifndef __MACTYPES__
  26. #include "MacTypes.h"
  27. #endif
  28. #ifndef __MOVIESFORMAT__
  29. #include "MoviesFormat.h"
  30. #endif
  31. #ifndef __QUICKTIMECOMPONENTS__
  32. #include "QuickTimeComponents.h"
  33. #endif
  34. #if PRAGMA_ONCE
  35. #pragma once
  36. #endif
  37. #ifdef __cplusplus
  38. extern "C" {
  39. #endif
  40. #if PRAGMA_IMPORT
  41. #pragma import on
  42. #endif
  43. #if PRAGMA_STRUCT_ALIGN
  44.     #pragma options align=mac68k
  45. #elif PRAGMA_STRUCT_PACKPUSH
  46.     #pragma pack(push, 2)
  47. #elif PRAGMA_STRUCT_PACK
  48.     #pragma pack(2)
  49. #endif
  50. enum {
  51.     kIDHComponentType           = FOUR_CHAR_CODE('ihlr'),       /* Component type*/
  52.     kIDHSubtypeDV               = FOUR_CHAR_CODE('dv  '),       /* Subtype for DV (over FireWire)*/
  53.     kIDHSubtypeFireWireConference = FOUR_CHAR_CODE('fwc ')      /* Subtype for FW Conference*/
  54. };
  55. /* Version of Isochronous Data Handler API*/
  56. enum {
  57.     kIDHInterfaceVersion1       = 0x0001                        /* Initial relase (Summer '99)*/
  58. };
  59. /* atom types*/
  60. enum {
  61.     kIDHDeviceListAtomType      = FOUR_CHAR_CODE('dlst'),
  62.     kIDHDeviceAtomType          = FOUR_CHAR_CODE('devc'),       /* to be defined elsewhere*/
  63.     kIDHIsochServiceAtomType    = FOUR_CHAR_CODE('isoc'),
  64.     kIDHIsochModeAtomType       = FOUR_CHAR_CODE('mode'),
  65.     kIDHDeviceIDType            = FOUR_CHAR_CODE('dvid'),
  66.     kIDHDefaultIOType           = FOUR_CHAR_CODE('dfio'),
  67.     kIDHIsochVersionAtomType    = FOUR_CHAR_CODE('iver'),
  68.     kIDHUniqueIDType            = FOUR_CHAR_CODE('unid'),
  69.     kIDHNameAtomType            = FOUR_CHAR_CODE('name'),
  70.     kIDHUseCMPAtomType          = FOUR_CHAR_CODE('ucmp'),
  71.     kIDHIsochMediaType          = FOUR_CHAR_CODE('av  '),
  72.     kIDHDataTypeAtomType        = FOUR_CHAR_CODE('dtyp'),
  73.     kIDHDataSizeAtomType        = FOUR_CHAR_CODE('dsiz'),       /* ??? packet size vs. buffer size*/
  74.     kIDHDataBufferSizeAtomType  = FOUR_CHAR_CODE('dbuf'),       /* ??? packet size vs. buffer size*/
  75.     kIDHDataIntervalAtomType    = FOUR_CHAR_CODE('intv'),
  76.     kIDHDataIODirectionAtomType = FOUR_CHAR_CODE('ddir'),
  77.     kIDHSoundMediaAtomType      = FOUR_CHAR_CODE('soun'),
  78.     kIDHSoundTypeAtomType       = FOUR_CHAR_CODE('type'),
  79.     kIDHSoundChannelCountAtomType = FOUR_CHAR_CODE('ccnt'),
  80.     kIDHSoundSampleSizeAtomType = FOUR_CHAR_CODE('ssiz'),
  81.     kIDHSoundSampleRateAtomType = FOUR_CHAR_CODE('srat'),       /* same as video out... (what does this comment mean?)*/
  82.     kIDHVideoMediaAtomType      = FOUR_CHAR_CODE('vide'),
  83.     kIDHVideoDimensionsAtomType = FOUR_CHAR_CODE('dimn'),
  84.     kIDHVideoResolutionAtomType = FOUR_CHAR_CODE('resl'),
  85.     kIDHVideoRefreshRateAtomType = FOUR_CHAR_CODE('refr'),
  86.     kIDHVideoPixelTypeAtomType  = FOUR_CHAR_CODE('pixl'),
  87.     kIDHVideoDecompressorAtomType = FOUR_CHAR_CODE('deco'),
  88.     kIDHVideoDecompressorTypeAtomType = FOUR_CHAR_CODE('dety'),
  89.     kIDHVideoDecompressorContinuousAtomType = FOUR_CHAR_CODE('cont'),
  90.     kIDHVideoDecompressorComponentAtomType = FOUR_CHAR_CODE('cmpt')
  91. };
  92. /* I/O Flags */
  93. enum {
  94.     kIDHDataTypeIsInput         = 1L << 0,
  95.     kIDHDataTypeIsOutput        = 1L << 1,
  96.     kIDHDataTypeIsInputAndOutput = 1L << 2
  97. };
  98. /* Permission Flags */
  99. enum {
  100.     kIDHOpenForReadTransactions = 1L << 0,
  101.     kIDHOpenForWriteTransactions = 1L << 1,
  102.     kIDHOpenWithExclusiveAccess = 1L << 2,
  103.     kIDHOpenWithHeldBuffers     = 1L << 3,                      /* IDH will hold buffer until ReleaseBuffer()*/
  104.     kIDHCloseForReadTransactions = 1L << 4,
  105.     kIDHCloseForWriteTransactions = 1L << 5
  106. };
  107. /*
  108.    Errors 
  109.     These REALLY need to be moved into Errors.h
  110.    ooo.needs officially assigned numbers
  111. */
  112. enum {
  113.     kIDHErrDeviceDisconnected   = -14101,
  114.     kIDHErrInvalidDeviceID      = -14102,
  115.     kIDHErrDeviceInUse          = -14104,
  116.     kIDHErrDeviceNotOpened      = -14105,
  117.     kIDHErrDeviceBusy           = -14106,
  118.     kIDHErrDeviceReadError      = -14107,
  119.     kIDHErrDeviceWriteError     = -14108,
  120.     kIDHErrDeviceNotConfigured  = -14109,
  121.     kIDHErrDeviceList           = -14110,
  122.     kIDHErrCompletionPending    = -14111,
  123.     kIDHErrDeviceTimeout        = -14112,
  124.     kIDHErrInvalidIndex         = -14113,
  125.     kIDHErrDeviceCantRead       = -14114,
  126.     kIDHErrDeviceCantWrite      = -14115,
  127.     kIDHErrCallNotSupported     = -14116
  128. };
  129. /* Holds Device Identification...*/
  130. typedef UInt32                          IDHDeviceID;
  131. enum {
  132.     kIDHInvalidDeviceID         = 0,
  133.     kIDHDeviceIDEveryDevice     = (long)0xFFFFFFFF
  134. };
  135. /* Values for 5 bit STYPE part of CIP header*/
  136. enum {
  137.     kIDHDV_SD                   = 0,
  138.     kIDHDV_SDL                  = 1,
  139.     kIDHDV_HD                   = 2,
  140.     kIDHDVCPro_25               = 0x1E
  141. };
  142. /*  Isoch Interval Atom Data*/
  143. struct IDHIsochInterval {
  144.     SInt32                          duration;
  145.     TimeScale                       scale;
  146. };
  147. typedef struct IDHIsochInterval         IDHIsochInterval;
  148. /* Need to fix this.  For now, cast this as a FWReferenceID*/
  149. typedef struct OpaquePsuedoID*          PsuedoID;
  150. /*
  151.    Isoch Device Status
  152.     This is atom-like, but isn't an atom
  153. */
  154. struct IDHDeviceStatus {
  155.     UInt32                          version;
  156.     Boolean                         physicallyConnected;
  157.     Boolean                         readEnabled;
  158.     Boolean                         writeEnabled;
  159.     Boolean                         exclusiveAccess;
  160.     UInt32                          currentBandwidth;
  161.     UInt32                          currentChannel;
  162.     PsuedoID                        localNodeID;                /*ooo.may go in atoms */
  163.     SInt16                          inputStandard;              /* One of the QT input standards*/
  164.     Boolean                         deviceActive;
  165.     UInt8                           inputFormat;                /* Expected STYPE of data from device, if version >= 0x200*/
  166.     UInt32                          outputFormats;              /* Bitmask for supported STYPE values, if version >= 0x200*/
  167. };
  168. typedef struct IDHDeviceStatus          IDHDeviceStatus;
  169. /*
  170.    Isochronous Data Handler Events
  171.     
  172. */
  173. typedef UInt32 IDHEvent;
  174. enum {
  175.     kIDHEventInvalid            = 0,
  176.     kIDHEventDeviceAdded        = 1L << 0,                      /* A new device has been added to the bus*/
  177.     kIDHEventDeviceRemoved      = 1L << 1,                      /* A device has been removed from the bus*/
  178.     kIDHEventDeviceChanged      = 1L << 2,                      /* Some device has changed state on the bus*/
  179.     kIDHEventReadEnabled        = 1L << 3,                      /* A client has enabled a device for read*/
  180.     kIDHEventReserved1          = 1L << 4,                      /* Reserved for future use*/
  181.     kIDHEventReadDisabled       = 1L << 5,                      /* A client has disabled a device from read*/
  182.     kIDHEventWriteEnabled       = 1L << 6,                      /* A client has enabled a device for write*/
  183.     kIDHEventReserved2          = 1L << 7,                      /* Reserved for future use*/
  184.     kIDHEventWriteDisabled      = 1L << 8,                      /* A client has disabled a device for write*/
  185.     kIDHEventEveryEvent         = (unsigned long)0xFFFFFFFF
  186. };
  187. typedef UInt32                          IDHNotificationID;
  188. struct IDHEventHeader {
  189.     IDHDeviceID                     deviceID;                   /* Device which generated event*/
  190.     IDHNotificationID               notificationID;
  191.     IDHEvent                        event;                      /* What the event is*/
  192. };
  193. typedef struct IDHEventHeader           IDHEventHeader;
  194. /*
  195.    IDHGenericEvent
  196.     An IDH will often have to post events from at interrupt time.  Since memory
  197.     allocation cannot occur from the interrupt handler, the IDH can preallocate
  198.     storage needed for handling the event by creating some IDHGenericEvent items.
  199.     Subsequently, when an event is generated, the type of event (specified in the
  200.     IDHEventHeader) will dictate how the IDHGenericEvent should be interpretted.
  201.     
  202.     IMPORTANT NOTE : This means that a specific event structure can NEVER be greater
  203.     than the size of the generic one.
  204.     
  205. */
  206. struct IDHGenericEvent {
  207.     IDHEventHeader                  eventHeader;
  208.     UInt32                          pad[4];
  209. };
  210. typedef struct IDHGenericEvent          IDHGenericEvent;
  211. /*
  212.    IDHDeviceConnectionEvent
  213.     For kIDHEventDeviceAdded or kIDHEventDeviceRemoved events.
  214. */
  215. struct IDHDeviceConnectionEvent {
  216.     IDHEventHeader                  eventHeader;
  217. };
  218. typedef struct IDHDeviceConnectionEvent IDHDeviceConnectionEvent;
  219. /*
  220.    IDHDeviceIOEnableEvent
  221.     For kIDHEventReadEnabled, kIDHEventReadDisabled, kIDHEventWriteEnabled, or
  222.     kIDHEventWriteDisabled.
  223. */
  224. struct IDHDeviceIOEnableEvent {
  225.     IDHEventHeader                  eventHeader;
  226. };
  227. typedef struct IDHDeviceIOEnableEvent   IDHDeviceIOEnableEvent;
  228. typedef CALLBACK_API_C( OSStatus , IDHNotificationProcPtr )(IDHGenericEvent *event, void *userData);
  229. typedef IDHNotificationProcPtr          IDHNotificationProc;
  230. typedef TVECTOR_UPP_TYPE(IDHNotificationProcPtr)                IDHNotificationUPP;
  231. struct IDHParameterBlock {
  232.     UInt32                          reserved1;
  233.     UInt16                          reserved2;
  234.     void *                          buffer;
  235.     ByteCount                       requestedCount;
  236.     ByteCount                       actualCount;
  237.     IDHNotificationUPP              completionProc;
  238.     void *                          refCon;
  239.     OSErr                           result;
  240. };
  241. typedef struct IDHParameterBlock        IDHParameterBlock;
  242. struct IDHResolution {
  243.     UInt32                          x;
  244.     UInt32                          y;
  245. };
  246. typedef struct IDHResolution            IDHResolution;
  247. struct IDHDimension {
  248.     Fixed                           x;
  249.     Fixed                           y;
  250. };
  251. typedef struct IDHDimension             IDHDimension;
  252. EXTERN_API( ComponentResult )
  253. IDHGetDeviceList                (ComponentInstance      idh,
  254.                                  QTAtomContainer *      deviceList)                         FIVEWORDINLINE(0x2F3C, 0x0004, 0x0001, 0x7000, 0xA82A);
  255. EXTERN_API( ComponentResult )
  256. IDHGetDeviceConfiguration       (ComponentInstance      idh,
  257.                                  QTAtomSpec *           configurationID)                    FIVEWORDINLINE(0x2F3C, 0x0004, 0x0002, 0x7000, 0xA82A);
  258. EXTERN_API( ComponentResult )
  259. IDHSetDeviceConfiguration       (ComponentInstance      idh,
  260.                                  const QTAtomSpec *     configurationID)                    FIVEWORDINLINE(0x2F3C, 0x0004, 0x0003, 0x7000, 0xA82A);
  261. EXTERN_API( ComponentResult )
  262. IDHGetDeviceStatus              (ComponentInstance      idh,
  263.                                  const QTAtomSpec *     configurationID,
  264.                                  IDHDeviceStatus *      status)                             FIVEWORDINLINE(0x2F3C, 0x0008, 0x0004, 0x7000, 0xA82A);
  265. EXTERN_API( ComponentResult )
  266. IDHGetDeviceClock               (ComponentInstance      idh,
  267.                                  Component *            clock)                              FIVEWORDINLINE(0x2F3C, 0x0004, 0x0005, 0x7000, 0xA82A);
  268. EXTERN_API( ComponentResult )
  269. IDHOpenDevice                   (ComponentInstance      idh,
  270.                                  UInt32                 permissions)                        FIVEWORDINLINE(0x2F3C, 0x0004, 0x0006, 0x7000, 0xA82A);
  271. EXTERN_API( ComponentResult )
  272. IDHCloseDevice                  (ComponentInstance      idh)                                FIVEWORDINLINE(0x2F3C, 0x0000, 0x0007, 0x7000, 0xA82A);
  273. EXTERN_API( ComponentResult )
  274. IDHRead                         (ComponentInstance      idh,
  275.                                  IDHParameterBlock *    pb)                                 FIVEWORDINLINE(0x2F3C, 0x0004, 0x0008, 0x7000, 0xA82A);
  276. EXTERN_API( ComponentResult )
  277. IDHWrite                        (ComponentInstance      idh,
  278.                                  IDHParameterBlock *    pb)                                 FIVEWORDINLINE(0x2F3C, 0x0004, 0x0009, 0x7000, 0xA82A);
  279. EXTERN_API( ComponentResult )
  280. IDHNewNotification              (ComponentInstance      idh,
  281.                                  IDHDeviceID            deviceID,
  282.                                  IDHNotificationUPP     notificationProc,
  283.                                  void *                 userData,
  284.                                  IDHNotificationID *    notificationID)                     FIVEWORDINLINE(0x2F3C, 0x0010, 0x000A, 0x7000, 0xA82A);
  285. EXTERN_API( ComponentResult )
  286. IDHNotifyMeWhen                 (ComponentInstance      idh,
  287.                                  IDHNotificationID      notificationID,
  288.                                  IDHEvent               events)                             FIVEWORDINLINE(0x2F3C, 0x0008, 0x000B, 0x7000, 0xA82A);
  289. EXTERN_API( ComponentResult )
  290. IDHCancelNotification           (ComponentInstance      idh,
  291.                                  IDHNotificationID      notificationID)                     FIVEWORDINLINE(0x2F3C, 0x0004, 0x000C, 0x7000, 0xA82A);
  292. EXTERN_API( ComponentResult )
  293. IDHDisposeNotification          (ComponentInstance      idh,
  294.                                  IDHNotificationID      notificationID)                     FIVEWORDINLINE(0x2F3C, 0x0004, 0x000D, 0x7000, 0xA82A);
  295. EXTERN_API( ComponentResult )
  296. IDHReleaseBuffer                (ComponentInstance      idh,
  297.                                  IDHParameterBlock *    pb)                                 FIVEWORDINLINE(0x2F3C, 0x0004, 0x000E, 0x7000, 0xA82A);
  298. EXTERN_API( ComponentResult )
  299. IDHCancelPendingIO              (ComponentInstance      idh,
  300.                                  IDHParameterBlock *    pb)                                 FIVEWORDINLINE(0x2F3C, 0x0004, 0x000F, 0x7000, 0xA82A);
  301. EXTERN_API( ComponentResult )
  302. IDHGetDeviceControl             (ComponentInstance      idh,
  303.                                  ComponentInstance *    deviceControl)                      FIVEWORDINLINE(0x2F3C, 0x0004, 0x0010, 0x7000, 0xA82A);
  304. EXTERN_API( ComponentResult )
  305. IDHUpdateDeviceList             (ComponentInstance      idh,
  306.                                  QTAtomContainer *      deviceList)                         FIVEWORDINLINE(0x2F3C, 0x0004, 0x0011, 0x7000, 0xA82A);
  307. EXTERN_API( ComponentResult )
  308. IDHGetDeviceTime                (ComponentInstance      idh,
  309.                                  TimeRecord *           deviceTime)                         FIVEWORDINLINE(0x2F3C, 0x0004, 0x0012, 0x7000, 0xA82A);
  310. EXTERN_API( ComponentResult )
  311. IDHSetFormat                    (ComponentInstance      idh,
  312.                                  UInt32                 format)                             FIVEWORDINLINE(0x2F3C, 0x0004, 0x0013, 0x7000, 0xA82A);
  313. EXTERN_API( ComponentResult )
  314. IDHGetFormat                    (ComponentInstance      idh,
  315.                                  UInt32 *               format)                             FIVEWORDINLINE(0x2F3C, 0x0004, 0x0014, 0x7000, 0xA82A);
  316. #if OPAQUE_UPP_TYPES
  317.     EXTERN_API(IDHNotificationUPP)
  318.     NewIDHNotificationUPP          (IDHNotificationProcPtr  userRoutine);
  319.     EXTERN_API(void)
  320.     DisposeIDHNotificationUPP      (IDHNotificationUPP      userUPP);
  321.     EXTERN_API(OSStatus)
  322.     InvokeIDHNotificationUPP       (IDHGenericEvent *       event,
  323.                                     void *                  userData,
  324.                                     IDHNotificationUPP      userUPP);
  325. #else
  326.     #define NewIDHNotificationUPP(userRoutine)                      (userRoutine)
  327.     #define DisposeIDHNotificationUPP(userUPP)                      
  328.     #define InvokeIDHNotificationUPP(event, userData, userUPP)      (*userUPP)(event, userData)
  329. #endif
  330. /* selectors for component calls */
  331. enum {
  332.     kIDHGetDeviceListSelect                    = 0x0001,
  333.     kIDHGetDeviceConfigurationSelect           = 0x0002,
  334.     kIDHSetDeviceConfigurationSelect           = 0x0003,
  335.     kIDHGetDeviceStatusSelect                  = 0x0004,
  336.     kIDHGetDeviceClockSelect                   = 0x0005,
  337.     kIDHOpenDeviceSelect                       = 0x0006,
  338.     kIDHCloseDeviceSelect                      = 0x0007,
  339.     kIDHReadSelect                             = 0x0008,
  340.     kIDHWriteSelect                            = 0x0009,
  341.     kIDHNewNotificationSelect                  = 0x000A,
  342.     kIDHNotifyMeWhenSelect                     = 0x000B,
  343.     kIDHCancelNotificationSelect               = 0x000C,
  344.     kIDHDisposeNotificationSelect              = 0x000D,
  345.     kIDHReleaseBufferSelect                    = 0x000E,
  346.     kIDHCancelPendingIOSelect                  = 0x000F,
  347.     kIDHGetDeviceControlSelect                 = 0x0010,
  348.     kIDHUpdateDeviceListSelect                 = 0x0011,
  349.     kIDHGetDeviceTimeSelect                    = 0x0012,
  350.     kIDHSetFormatSelect                        = 0x0013,
  351.     kIDHGetFormatSelect                        = 0x0014
  352. };
  353. #endif /* ifndef __ISOCHRONOUSDATAHANDLER_R__ */
  354. #if PRAGMA_STRUCT_ALIGN
  355.     #pragma options align=reset
  356. #elif PRAGMA_STRUCT_PACKPUSH
  357.     #pragma pack(pop)
  358. #elif PRAGMA_STRUCT_PACK
  359.     #pragma pack()
  360. #endif
  361. #ifdef PRAGMA_IMPORT_OFF
  362. #pragma import off
  363. #elif PRAGMA_IMPORT
  364. #pragma import reset
  365. #endif
  366. #ifdef __cplusplus
  367. }
  368. #endif
  369. #endif /* __ISOCHRONOUSDATAHANDLER__ */