BTRFS: Implement BTree::Path and change _Find.
[haiku.git] / src / add-ons / media / media-add-ons / legacy / LegacyAudioProducer.h
blob174812c84f6ce65e3729dcfa3fa475989957cdac
1 #ifndef _LEGACY_AUDIO_PRODUCER_H
2 #define _LEGACY_AUDIO_PRODUCER_H
4 #include <kernel/OS.h>
5 #include <media/BufferProducer.h>
6 #include <media/Controllable.h>
7 #include <media/MediaAddOn.h>
8 #include <media/MediaDefs.h>
9 #include <media/MediaEventLooper.h>
10 #include <media/MediaNode.h>
11 #include <support/Locker.h>
13 class LegacyAudioProducer : public virtual BMediaEventLooper,
14 public virtual BBufferProducer,
15 public virtual BControllable
17 public:
18 LegacyAudioProducer( BMediaAddOn *addon, const char *name, int32 internal_id );
19 virtual ~LegacyAudioProducer();
20 virtual status_t InitCheck() const { return fInitStatus; }
22 /* BMediaNode */
23 public:
24 virtual port_id ControlPort() const;
25 virtual BMediaAddOn *AddOn( int32 *internal_id ) const;
26 virtual status_t HandleMessage( int32 message, const void *data, size_t size );
28 protected:
29 virtual void Preroll() {}
30 virtual void SetTimeSource( BTimeSource *time_source );
31 virtual status_t RequestCompleted( const media_request_info &info );
33 /* BMediaEventLooper */
34 protected:
35 virtual void NodeRegistered();
36 virtual void Start( bigtime_t performance_time );
37 virtual void Stop( bigtime_t performance_time, bool immediate );
38 virtual void Seek( bigtime_t media_time, bigtime_t performance_time );
39 virtual void TimeWarp( bigtime_t at_real_time, bigtime_t to_performance_time );
40 virtual status_t AddTimer( bigtime_t at_performance_time, int32 cookie );
41 virtual void SetRunMode( run_mode mode );
42 virtual void HandleEvent( const media_timed_event *event, bigtime_t lateness, bool realTimeEvent = false );
43 virtual void CleanUpEvent( const media_timed_event *event );
44 virtual bigtime_t OfflineTime();
45 virtual void ControlLoop();
46 virtual status_t DeleteHook( BMediaNode *node );
48 /* BBufferProducer */
49 protected:
50 virtual status_t FormatSuggestionRequested( media_type type, int32 quality, media_format *format );
51 virtual status_t FormatProposal( const media_source &output, media_format *format );
52 virtual status_t FormatChangeRequested( const media_source &source, const media_destination &destination,
53 media_format *io_format, int32 *_deprecated_ );
54 virtual status_t GetNextOutput( int32 *cookie, media_output *out_output );
55 virtual status_t DisposeOutputCookie( int32 cookie );
56 virtual status_t SetBufferGroup( const media_source &for_source, BBufferGroup *group );
57 virtual status_t VideoClippingChanged( const media_source &for_source, int16 num_shorts, int16 *clip_data,
58 const media_video_display_info &display, int32 *_deprecated_ )
59 { return B_ERROR; }
60 virtual status_t GetLatency( bigtime_t *out_latency );
61 virtual status_t PrepareToConnect( const media_source &what, const media_destination &where, media_format *format,
62 media_source *out_source, char *out_name);
63 virtual void Connect( status_t error, const media_source &source, const media_destination &destination,
64 const media_format &format, char *io_name );
65 virtual void Disconnect( const media_source &what, const media_destination &where );
66 virtual void LateNoticeReceived( const media_source &what, bigtime_t how_much, bigtime_t performance_time );
67 virtual void EnableOutput( const media_source &what, bool enabled, int32 *_deprecated_ );
68 virtual status_t SetPlayRate( int32 numer,int32 denom );
69 virtual void AdditionalBufferRequested( const media_source & source, media_buffer_id prev_buffer,
70 bigtime_t prev_time, const media_seek_tag *prev_tag );
71 virtual void LatencyChanged( const media_source &source, const media_destination &destination,
72 bigtime_t new_latency, uint32 flags );
74 /* BControllable */
75 protected:
76 virtual status_t GetParameterValue( int32 id, bigtime_t *last_change, void *value, size_t *size );
77 virtual void SetParameterValue( int32 id, bigtime_t when, const void *value, size_t size );
78 virtual status_t StartControlPanel( BMessenger *out_messenger )
79 { return B_ERROR; }
81 /* state */
82 private:
83 void HandleStart( bigtime_t performance_time );
84 void HandleStop();
85 void HandleTimeWarp( bigtime_t performance_time );
86 void HandleSeek( bigtime_t performance_time );
88 status_t fInitStatus;
90 int32 fInternalID;
91 BMediaAddOn *fAddOn;
93 BLocker fLock;
94 BBufferGroup *fBufferGroup;
96 thread_id fThread;
97 sem_id fFrameSync;
99 static int32 _run_thread_( void *data );
100 int32 RunThread();
102 #if 0
103 /* The remaining variables should be declared volatile, but they
104 * are not here to improve the legibility of the sample code. */
105 uint32 fFrame;
106 uint32 fFrameBase;
107 bigtime_t fPerformanceTimeBase;
108 bigtime_t fProcessingLatency;
109 media_output fOutput;
110 media_raw_video_format fConnectedFormat;
111 bool fRunning;
112 bool fConnected;
113 bool fEnabled;
115 enum { P_COLOR };
116 uint32 fColor;
117 bigtime_t fLastColorChange;
118 #endif
121 #endif