00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 #include <be/media/MediaRoster.h>
00035 #include <be/media/MediaEventLooper.h>
00036 #include <be/media/BufferProducer.h>
00037
00038 #include "portaudio.h"
00039
00040 class PaPlaybackNode :
00041 public BBufferProducer,
00042 public BMediaEventLooper
00043 {
00044
00045 public:
00046 PaPlaybackNode( uint32 channels, float frame_rate, uint32 frames_per_buffer,
00047 PortAudioCallback *callback, void *user_data );
00048 ~PaPlaybackNode();
00049
00050
00051
00052
00053 BBuffer *FillNextBuffer(bigtime_t time);
00054 void SetSampleFormat(PaSampleFormat inFormat, PaSampleFormat outFormat);
00055 bool IsRunning();
00056 PaTimestamp GetStreamTime();
00057
00058
00059
00060 BMediaAddOn* AddOn( int32 * ) const;
00061 status_t HandleMessage( int32 message, const void *data, size_t size );
00062
00063
00064
00065 void HandleEvent( const media_timed_event *event, bigtime_t lateness,
00066 bool realTimeEvent );
00067 void NodeRegistered();
00068
00069
00070
00071 status_t FormatSuggestionRequested( media_type type, int32 quality,
00072 media_format* format );
00073 status_t FormatProposal( const media_source& output, media_format* format );
00074 status_t FormatChangeRequested( const media_source& source,
00075 const media_destination& destination, media_format* io_format, int32* );
00076
00077 status_t GetNextOutput( int32* cookie, media_output* out_output );
00078 status_t DisposeOutputCookie( int32 cookie );
00079
00080 void LateNoticeReceived( const media_source& what, bigtime_t how_much,
00081 bigtime_t performance_time );
00082 void EnableOutput( const media_source& what, bool enabled, int32* _deprecated_ );
00083
00084 status_t PrepareToConnect( const media_source& what,
00085 const media_destination& where, media_format* format,
00086 media_source* out_source, char* out_name );
00087 void Connect(status_t error, const media_source& source,
00088 const media_destination& destination, const media_format& format,
00089 char* io_name);
00090 void Disconnect(const media_source& what, const media_destination& where);
00091
00092 status_t SetBufferGroup(const media_source& for_source, BBufferGroup* newGroup);
00093
00094 bool mAborted;
00095
00096 private:
00097 media_output mOutput;
00098 media_format mPreferredFormat;
00099 uint32 mOutputSampleWidth, mFramesPerBuffer;
00100 BBufferGroup *mBufferGroup;
00101 bigtime_t mDownstreamLatency, mInternalLatency, mStartTime;
00102 uint64 mSamplesSent;
00103 PortAudioCallback *mCallback;
00104 void *mUserData;
00105 bool mRunning;
00106
00107 };
00108