/usr/include/sipxtapi/mp/MpStreamFeeder.h is in libsipxtapi-dev 3.3.0~test17-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 | //
// Copyright (C) 2006 SIPez LLC.
// Licensed to SIPfoundry under a Contributor Agreement.
//
// Copyright (C) 2004-2006 SIPfoundry Inc.
// Licensed by SIPfoundry under the LGPL license.
//
// Copyright (C) 2004-2006 Pingtel Corp. All rights reserved.
// Licensed to SIPfoundry under a Contributor Agreement.
//
// $$
///////////////////////////////////////////////////////////////////////////////
#ifndef DISABLE_STREAM_PLAYER // [
#ifndef _MpStreamFeeder_h_
#define _MpStreamFeeder_h_
// SYSTEM INCLUDES
// APPLICATION INCLUDES
#include "os/OsDefs.h"
#include "os/OsTask.h"
#include "os/OsCSem.h"
#include "os/OsMsgQ.h"
#include "os/OsMutex.h"
#include "net/Url.h"
#include "mp/StreamDefs.h"
#include "mp/StreamDataSourceListener.h"
#include "mp/StreamDecoderListener.h"
// DEFINES
#define INCL_RAW_DECODER // Include the RAW decoder
#define INCL_WAV_DECODER // Include the WAV decoder
// #define INCL_MP3_DECODER // Include the MP3 decoder
// MACROS
// EXTERNAL FUNCTIONS
// CONSTANTS
// STRUCTS
// TYPEDEFS
//: Feeder states (match player states for the most part, but add a
//: realizing and rendering states)
typedef enum
{
UnrealizedState,
RealizedState,
PrefetchingState,
PrefetchedState,
RendereringState,
StoppedState,
FailedState
} FeederState ;
// FORWARD DECLARATIONS
class StreamFormatDecoder ;
class StreamDataSource ;
class OsNotification ;
/// @brief The MpStreamFeed coordinates with the data source and decoder to ready the
/// input stream and then plugs into the MprFromStream resource to supply
/// audio info the flowgraph.
/**
* ------------------
* +-> | StreamDataSource |
* --------------- ---------------- ------------------
* | MprFromStream | 1..N -> | MpStreamFeeder |
* --------------- ---------------- ---------------------
* +-> | StreamFormatDecoder |
* ---------------------
*
* The MpStreamFeeder has its own state table that mostly matches the generic
* player's state table:
*
* Unrealized -> Realized -> Prefetching -> Prefetched -> Rendering -> Stopped
*
* *->FailedState
*
* Communications:
*
* Events are send to the MpStreamPlayer resource indirectly through a
* settable OsNotifyEvent (setEventHandler).
*
* Events are received from the MprFromStream object by the fromStreamUpdate
* callback function.
*/
class MpStreamFeeder : public StreamDataSourceListener, public StreamDecoderListener
{
/* //////////////////////////// PUBLIC //////////////////////////////////// */
public:
/* ============================ CREATORS ================================== */
///@name Creators
//@{
/// Constructor accepting a url resource, type, and cache all flag
MpStreamFeeder(Url resource, int flags);
/// Constructor accepting a pre-populated buffer, type and cache all flag
MpStreamFeeder(UtlString* pBuffer, int flags);
/// Destructor
virtual ~MpStreamFeeder();
/**<
* As part of destroying the task, flush all messages from the incoming
* OsMsgQ.
*/
/* ============================ MANIPULATORS ============================== */
/// @brief Initiates the connection with the outbound party to validate the
/// connection. Buffers are allocated at this point.
OsStatus realize() ;
/// Begin downloading and decoding data.
OsStatus render() ;
/**<
* The state is not moved to prefetched until a sensible amount of data
* has been received and decoded.
*/
/// Rewind the data source to the prefetched state.
OsStatus rewind() ;
// This may result in re-prefetching data in cases.
OsStatus stop();
/// Stop collecting/rendering data
/// Set the event handler for this renderer.
OsStatus setEventHandler(OsNotification* pEventHandler) ;
/**< All events will be delievered to this handler. */
/// Marks that playing is pauses; however, continues to render and
/// stream.
void markPaused(UtlBoolean bPaused) ;
//@}
/* ============================ ACCESSORS ================================= */
///@name Accessors
//@{
/// Get a frames worth of data (80 samples per frame) ;
OsStatus getFrame(unsigned short *samples) ;
/// Has the rendered been marked as paused?
UtlBoolean isMarkedPaused() ;
/// Get the flags for this renderer
OsStatus getFlags(int &flags) ;
/// Query the state for this renderer
FeederState getState() ;
/// Called by the MprFromStream resource when events changes.
void fromStreamUpdate(FeederEvent event) ;
//@}
/* ============================ INQUIRY =================================== */
///@name Inquiry
//@{
/// Is the transition from state source to target valid?
UtlBoolean isValidStateChange(FeederState source, FeederState target) ;
/* ============================ TESTING =================================== */
#ifdef MP_STREAM_DEBUG /* [ */
static const char* getEventString(FeederEvent event);
#endif /* MP_STREAM_DEBUG ] */
//@}
/* //////////////////////////// PROTECTED ///////////////////////////////// */
protected:
/// Fires renderer event to interested consumers
void fireEvent(FeederEvent eventType) ;
/// Sets the internal renderer state
void setState(FeederState state);
/// Call back for decoder updates
virtual void decoderUpdate(StreamFormatDecoder* pDecoder, StreamDecoderEvent event) ;
/// Call back for data source updates
virtual void dataSourceUpdate(StreamDataSource* pDataSource, StreamDataSourceEvent event) ;
#ifdef MP_STREAM_DEBUG /* [ */
const char* getDataSourceEventString(StreamDataSourceEvent);
const char* getDecoderEventString(StreamDecoderEvent);
const char* getFeederEventString(FeederEvent event);
#endif /* MP_STREAM_DEBUG ] */
/* //////////////////////////// PRIVATE /////////////////////////////////// */
private:
static int s_iInstanceCount ;
FeederState m_state; ///< State of the Feeder
StreamFormatDecoder* m_pFormatDecoder; ///< Decoder
StreamDataSource* m_pDataSource ; ///< Data Source
int mFlags ; ///< Flags given at creation
UtlBoolean m_bMarkedPaused; ///< Is this marked as paused?
OsNotification* m_pEventHandler; ///< Event sink.
int m_iInstanceId ;
OsMutex m_eventGuard; ///< Guards multiple threads from
///< calling fireEvent at same time
/// Construction helper: initialize the decoding source
void initDecodingSource() ;
};
/* ============================ INLINE METHODS ============================ */
#endif // _MpStreamFeeder_h_
#endif // DISABLE_STREAM_PLAYER ]
|