1 /* Copyright (c) 1998-99, Be Incorporated, All Rights Reserved.
2 * Distributed under the terms of the Be Sample Code license.
4 * Copyright (c) 2000-2008, Ingo Weinhold <ingo_weinhold@gmx.de>,
5 * Copyright (c) 2000-2008, Stephan Aßmus <superstippi@gmx.de>,
6 * All Rights Reserved. Distributed under the terms of the MIT license.
8 #ifndef _VIDEO_PRODUCER_H
9 #define _VIDEO_PRODUCER_H
12 #include <BufferProducer.h>
13 #include <Controllable.h>
15 #include <MediaDefs.h>
16 #include <MediaEventLooper.h>
17 #include <MediaNode.h>
26 class VideoProducer
: public virtual BMediaEventLooper
,
27 public virtual BBufferProducer
{
29 VideoProducer(BMediaAddOn
* addon
, const char* name
,
30 int32 internalId
, NodeManager
* manager
,
31 VideoSupplier
* supplier
);
32 virtual ~VideoProducer();
34 virtual status_t
InitCheck() const
35 { return fInitStatus
; }
37 // BMediaNode interface
39 virtual BMediaAddOn
* AddOn(int32
* _internalId
) const;
40 virtual status_t
HandleMessage(int32 message
, const void* data
,
43 virtual void SetTimeSource(BTimeSource
* timeSource
);
45 // BMediaEventLooper interface
47 virtual void NodeRegistered();
48 virtual void Start(bigtime_t performanceTime
);
49 virtual void Stop(bigtime_t performanceTime
, bool immediate
);
50 virtual void Seek(bigtime_t mediaTime
,
51 bigtime_t performanceTime
);
52 virtual void HandleEvent(const media_timed_event
* event
,
54 bool realTimeEvent
= false);
55 virtual status_t
DeleteHook(BMediaNode
* node
);
57 // BBufferProducer interface
59 virtual status_t
FormatSuggestionRequested(media_type type
,
60 int32 quality
, media_format
* format
);
61 virtual status_t
FormatProposal(const media_source
&output
,
62 media_format
* format
);
63 virtual status_t
FormatChangeRequested(const media_source
& source
,
64 const media_destination
& destination
,
65 media_format
* ioFormat
, int32
* _deprecated_
);
66 virtual status_t
GetNextOutput(int32
* cookie
,
67 media_output
* outOutput
);
68 virtual status_t
DisposeOutputCookie(int32 cookie
);
69 virtual status_t
SetBufferGroup(const media_source
& forSource
,
71 virtual status_t
VideoClippingChanged(const media_source
& forSource
,
72 int16 numShorts
, int16
* clipData
,
73 const media_video_display_info
& display
,
75 virtual status_t
GetLatency(bigtime_t
* out_latency
);
76 virtual status_t
PrepareToConnect(const media_source
& what
,
77 const media_destination
& where
,
78 media_format
* format
, media_source
* outSource
,
80 virtual void Connect(status_t error
, const media_source
& source
,
81 const media_destination
& destination
,
82 const media_format
& format
, char* ioName
);
83 virtual void Disconnect(const media_source
& what
,
84 const media_destination
& where
);
85 virtual void LateNoticeReceived(const media_source
& what
,
86 bigtime_t howMuch
, bigtime_t performanceTime
);
87 virtual void EnableOutput(const media_source
& what
, bool enabled
,
89 virtual status_t
SetPlayRate(int32 numer
, int32 denom
);
90 virtual void AdditionalBufferRequested(
91 const media_source
& source
,
92 media_buffer_id prevBuffer
,
94 const media_seek_tag
* prevTag
);
95 virtual void LatencyChanged(const media_source
& source
,
96 const media_destination
& destination
,
97 bigtime_t newLatency
, uint32 flags
);
100 void _HandleStart(bigtime_t performance_time
);
102 void _HandleTimeWarp(bigtime_t performance_time
);
103 void _HandleSeek(bigtime_t performance_time
);
105 static int32
_FrameGeneratorThreadEntry(void* data
);
106 int32
_FrameGeneratorThread();
108 status_t fInitStatus
;
114 BBufferGroup
* fBufferGroup
;
115 BBufferGroup
* fUsedBufferGroup
;
120 // The remaining variables should be declared volatile, but they
121 // are not here to improve the legibility of the sample code.
124 bigtime_t fPerformanceTimeBase
;
125 bigtime_t fBufferDuration
;
126 bigtime_t fBufferLatency
;
127 media_output fOutput
;
128 media_raw_video_format fConnectedFormat
;
133 NodeManager
* fManager
;
134 VideoSupplier
* fSupplier
;
137 #endif // VIDEO_PRODUCER_H