1/*
2 * Broadcast.h --
3 *
4 *      This module implements a "broadcast" widget that is object
5 *      based. It is part of the QuickTimeTcl package.
6 *      It provides an interface to the (ill docoumented) QuickTime broadcaster
7 *      API's. This includes the Presentation and Sourcer classes of APIs.
8 *
9 * Copyright (c) 2003 Mats Bengtsson
10 *
11 * $Id: Broadcast.h,v 1.2 2003/09/28 06:14:51 matben Exp $
12 */
13
14#ifndef INCLUDED_BROADCAST_H
15#define INCLUDED_BROADCAST_H
16
17#include "QuickTimeTcl.h"
18#if TARGET_OS_MAC
19#	if TARGET_API_MAC_CARBON
20#	else
21#		include <QuickTimeStreaming.h>
22#		include <QTStreamingComponents.h>
23#	endif
24#endif
25
26
27#define kDefaultPresTimeScale		600
28
29#define kReturnChar                 '\r'
30#define kNewlineChar                '\n'
31
32/* QuickTime Streaming Errors */
33/*
34enum {
35    qtsBadSelectorErr           = -5400,
36    qtsBadStateErr              = -5401,
37    qtsBadDataErr               = -5402,
38    qtsUnsupportedDataTypeErr   = -5403,
39    qtsUnsupportedRateErr       = -5404,
40    qtsUnsupportedFeatureErr    = -5405,
41    qtsTooMuchDataErr           = -5406,
42    qtsUnknownValueErr          = -5407,
43    qtsTimeoutErr               = -5408,
44    qtsConnectionFailedErr      = -5420,
45    qtsAddressBusyErr           = -5421
46};
47*/
48
49/*
50 * Constants for the 'state' and 'targetState' members of MovieBroadcast.
51 */
52
53typedef enum PresentationState {
54	kPresentationStateIdle          = 1,    /* Initial state. */
55	kPresentationStateStartingPreview,
56	kPresentationStatePreviewing,
57	kPresentationStateStartingPreroll,
58	kPresentationStateReadyToPlay,	        /* Sucessfully prerolled */
59	kPresentationStateStarting,
60	kPresentationStatePlaying
61} PresentationState;
62
63/*
64 * Keep record for each sourcer.
65 * Each broadcaster may have a number of sourcers associated with it.
66 */
67
68typedef struct BcastSourcerInfo {
69    struct BcastSourcerInfo    *next;
70    QTSPresentation     presentation;
71    QTSStream           stream;
72    Component           component;
73    ComponentInstance   sourcer;
74    OSType              trackType;
75	Track				track;
76	Boolean				done;
77} BcastSourcerInfo;
78
79/*
80 * A data structure of the following type is kept for each
81 * widget managed by this file:
82 */
83
84typedef struct {
85    Tk_Window           tkwin;		/* Window that embodies the widget.  NULL
86				                     * means window has been deleted but
87				                     * widget record hasn't been cleaned up yet. */
88    Display             *display;   /* X's token for the window's display. */
89    Tcl_Interp          *interp;    /* Interpreter associated with widget. */
90    Tcl_Command         widgetCmd;	/* Token for square's widget command. */
91    Tk_OptionTable      optionTable;/* Token representing the configuration
92				                     * specifications. */
93    /*
94     * Widget specific members.
95     */
96
97    int                 height;
98    int                 width;
99    char                *command;
100    long                flags;
101    QTSPresentation     presentation;
102    Tcl_Obj             *sdpListPtr;
103    double              targetFrameRate;
104    UInt32              targetDataRate;
105    int                 haveAudioStream;
106    int                 haveVideoStream;
107    int                 haveTextStream;
108    long                state;
109    long                targetState;
110	GWorldPtr           grafPtr;    /* We save the actual graf port so we don't
111									 * need to call QTSPresSetGWorld. */
112    BcastSourcerInfo   	*sourcerInfoListPtr;
113
114    int                 indSize;
115    Tcl_Obj             *sizeObjPtr;
116    int                 srcWidth;
117    int                 srcHeight;
118} MovieBroadcast;
119
120/*
121 * We need a (single) linked list for our broadcasters.
122 */
123
124typedef struct MovieBroadcastList {
125    struct MovieBroadcastList    *next;
126    MovieBroadcast           *bcastPtr;
127} MovieBroadcastList;
128
129
130/*
131 * Flag bits for grabber used in 'flags' in MovieBroadcast struct:
132 *
133 * REDRAW_PENDING:		Non-zero means a DoWhenIdle handler
134 *						has already been queued to redraw
135 *						this window.
136 * NEWGWORLD:			Non-zero means this widget has a new GWorld, and that we need
137 *						to associate the sequence grabber with this GWorld. Need to
138 *						know when displaying.
139 */
140
141#define REDRAW_PENDING 	0x0001
142#define NEWGWORLD 		0x0002
143
144
145#endif INCLUDED_BROADCAST_H
146