1 #ifndef _LEGACY_AUDIO_PRODUCER_H
2 #define _LEGACY_AUDIO_PRODUCER_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
18 LegacyAudioProducer( BMediaAddOn
*addon
, const char *name
, int32 internal_id
);
19 virtual ~LegacyAudioProducer();
20 virtual status_t
InitCheck() const { return fInitStatus
; }
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
);
29 virtual void Preroll() {}
30 virtual void SetTimeSource( BTimeSource
*time_source
);
31 virtual status_t
RequestCompleted( const media_request_info
&info
);
33 /* BMediaEventLooper */
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
);
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_
)
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
);
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
)
83 void HandleStart( bigtime_t performance_time
);
85 void HandleTimeWarp( bigtime_t performance_time
);
86 void HandleSeek( bigtime_t performance_time
);
94 BBufferGroup
*fBufferGroup
;
99 static int32
_run_thread_( void *data
);
103 /* The remaining variables should be declared volatile, but they
104 * are not here to improve the legibility of the sample code. */
107 bigtime_t fPerformanceTimeBase
;
108 bigtime_t fProcessingLatency
;
109 media_output fOutput
;
110 media_raw_video_format fConnectedFormat
;
117 bigtime_t fLastColorChange
;