sbIMediacoreAudioProcessor.idl
Go to the documentation of this file.
1 /*
2  //
3 // BEGIN SONGBIRD GPL
4 //
5 // This file is part of the Songbird web player.
6 //
7 // Copyright(c) 2005-2010 POTI, Inc.
8 // http://songbirdnest.com
9 //
10 // This file may be licensed under the terms of of the
11 // GNU General Public License Version 2 (the "GPL").
12 //
13 // Software distributed under the License is distributed
14 // on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either
15 // express or implied. See the GPL for the specific language
16 // governing rights and limitations.
17 //
18 // You should have received a copy of the GPL along with this
19 // program. If not, go to http://www.gnu.org/licenses/gpl.html
20 // or write to the Free Software Foundation, Inc.,
21 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 //
23 // END SONGBIRD GPL
24 //
25  */
26 
27 #include "nsISupports.idl"
28 
29 interface nsIVariant;
30 
31 interface sbIMediaItem;
32 interface sbIMediaFormatAudio;
34 
35 [scriptable, uuid(8d5cc71a-b3af-40b3-bcb3-cf128ec49bcd)]
37 {
38  /* Initialise the processor with a listener to receive audio
39  * data and events.
40  */
41  void init(in sbIMediacoreAudioProcessorListener aListener);
42 
43  /* Constraints on the decoded audio format.
44  *
45  * This allows the caller to constrain the format that will be
46  * delivered to the listener. For example, if the listener desires
47  * only mono audio, then rather than receiving arbirary numbers of
48  * channels, and having to implement down-mixing internally, the
49  * caller could set the channels constraint to 1. The AudioProcessor
50  * will then internally downmix (if needed) to mono and provide that
51  * directly to the listener.
52  *
53  * The caller need not set any constraints as long as the listener is
54  * capable of processing arbitrary formats.
55  *
56  * Constraints may only be set before start() is called.
57  */
58 
59  /* A constraint on the sample rate.
60  *
61  * If the consumer wishes to receive data only at a single, specific
62  * sample rate, it should set this attribute to that value. Otherwise,
63  * it should remain at the default of zero (meaning no constraint).
64  *
65  * The actual rate used will be provided in the sbIMediaFormatAudio
66  * object passed in the EVENT_START event.
67  */
68  attribute unsigned long constraintSampleRate;
69 
70  /* A constraint on the number of channels to use.
71  *
72  * This may be set to 1 (mono) or 2 (stereo), or left at the default
73  * value of 0 to indicate no constraint.
74  *
75  * Currently, only mono or stereo is supported. Media items with more
76  * than two channels will be automatically downmixed to stereo (or mono
77  * if this attribute is set to 1).
78  *
79  * The actual number of channels used will be provided in the
80  * sbIMediaFormatAudio object passed in the EVENT_START event.
81  */
82  attribute unsigned long constraintChannelCount;
83 
84  /* A constraint on the size of each block of data to deliver to the listener.
85  *
86  * If the listener has a preferred block size to process data in, it should
87  * set this attribute to that value. If left at the default value of 0, the
88  * blocks delivered may have any size.
89  *
90  * Note that even if set, SOME blocks may have a different size (due to
91  * corrupt or missing data, or at the end of the stream). See the listener
92  * documentation for more details.
93  */
94  attribute unsigned long constraintBlockSize;
95 
96  /* A constraint on the audio format to deliver to the listener.
97  *
98  * This may be FORMAT_INT16, FORMAT_FLOAT, or FORMAT_ANY.
99  *
100  * If set to FORMAT_INT16, then only the onIntegerAudioDecoded function
101  * on the listener will be called. If set to FORMAT_FLOAT, only
102  * onFloatAudioDecoded will be called. If set to FORMAT_ANY, then
103  * one of these will be selected at runtime depending on the input
104  * format.
105  */
106  attribute unsigned long constraintAudioFormat;
107 
108  const unsigned long FORMAT_ANY = 0;
109  const unsigned long FORMAT_INT16 = 1;
110  const unsigned long FORMAT_FLOAT = 2;
111 
112  /* Start processing the media item that is passed in.
113  *
114  * This call will not block. The listener will be called
115  * with appropriate events and audio data as it becomes
116  * available.
117  *
118  * The caller can suspend or resume processing with the
119  * suspect/resume functions if desired, in order to control
120  * the rate at which decoded audio is provided. Otherwise,
121  * audio is provided as fast as possible.
122  *
123  * This must only be called from the main thread.
124  */
125  void start(in sbIMediaItem aItem);
126 
127  /* Stop processing the media item. This will immediately
128  * terminate processing of the audio. It may be called at any time, but must
129  * be called at some point (e.g. after processing completes), and may only be
130  * called from the main thread.
131  */
132  void stop();
133 
134  /* Temporarily suspend processing of the media item until
135  * resume() is called.
136  *
137  * Must only be called from the main thread.
138  */
139  void suspend();
140 
141  /* Resume processing of the media item after suspend() has
142  * been called.
143  *
144  * Must only be called from the main thread.
145  */
146  void resume();
147 };
148 
attribute unsigned long constraintSampleRate
attribute unsigned long constraintChannelCount
var uuid
void start(in sbIMediaItem aItem)
void init(in sbIMediacoreAudioProcessorListener aListener)
Interface that defines a single item of media in the system.
attribute unsigned long constraintAudioFormat
attribute unsigned long constraintBlockSize