2 * FireWire DV media addon for Haiku
4 * Copyright (c) 2008, JiSheng Zhang (jszhang3@mail.ustc.edu.cn)
5 * Distributed under the terms of the MIT License.
7 * Based on DVB media addon
8 * Copyright (c) 2004-2007 Marcus Overhagen <marcus@overhagen.de>
11 #ifndef __FIREWIRE_DV_NODE_H
12 #define __FIREWIRE_DV_NODE_H
16 #include <media/BufferProducer.h>
17 //#include <media/BufferConsumer.h>
18 #include <media/Controllable.h>
19 #include <media/MediaDefs.h>
20 #include <media/MediaEventLooper.h>
21 #include <media/MediaNode.h>
22 #include <support/Locker.h>
26 class BParameterGroup
;
29 class FireWireDVNode
: public virtual BBufferProducer
,
30 public virtual BControllable
, public virtual BMediaEventLooper
{
32 FireWireDVNode(BMediaAddOn
*addon
,
33 const char *name
, int32 internal_id
,
35 virtual ~FireWireDVNode();
37 virtual status_t
InitCheck() const { return fInitStatus
; }
41 virtual BMediaAddOn
*AddOn(int32
* internal_id
) const;
42 virtual status_t
HandleMessage(int32 message
, const void *data
,
45 virtual void Preroll();
46 virtual void SetTimeSource(BTimeSource
* time_source
);
47 virtual void SetRunMode(run_mode mode
);
49 /* BMediaEventLooper */
51 virtual void NodeRegistered();
52 virtual void HandleEvent(const media_timed_event
*event
,
54 bool realTimeEvent
= false);
58 virtual status_t
FormatSuggestionRequested(media_type type
,
59 int32 quality
, media_format
* format
);
60 virtual status_t
FormatProposal(const media_source
&source
,
61 media_format
* format
);
62 virtual status_t
FormatChangeRequested(
63 const media_source
&source
,
64 const media_destination
&destination
,
65 media_format
* io_format
,
67 virtual status_t
GetNextOutput(int32
* cookie
,
68 media_output
* out_output
);
69 virtual status_t
DisposeOutputCookie(int32 cookie
);
70 virtual status_t
SetBufferGroup(const media_source
& for_source
,
72 virtual status_t
VideoClippingChanged(
73 const media_source
& for_source
,
74 int16 num_shorts
, int16
* clip_data
,
75 const media_video_display_info
&display
,
77 virtual status_t
GetLatency(bigtime_t
* out_latency
);
78 virtual status_t
PrepareToConnect(const media_source
& what
,
79 const media_destination
& where
,
81 media_source
* out_source
,
83 virtual void Connect(status_t error
,
84 const media_source
& source
,
85 const media_destination
& destination
,
86 const media_format
& format
,
88 virtual void Disconnect(const media_source
& what
,
89 const media_destination
& where
);
90 virtual void LateNoticeReceived(const media_source
& what
,
92 bigtime_t performance_time
);
93 virtual void EnableOutput(const media_source
& what
,
94 bool enabled
, int32
* _deprecated_
);
95 virtual void AdditionalBufferRequested(
96 const media_source
& source
,
97 media_buffer_id prev_buffer
,
99 const media_seek_tag
* prev_tag
);
103 virtual status_t
GetParameterValue(int32 id
,
104 bigtime_t
* last_change
, void* value
,
106 virtual void SetParameterValue(int32 id
, bigtime_t when
,
107 const void* value
, size_t size
);
111 void HandleStart(bigtime_t performance_time
);
113 void HandleTimeWarp(bigtime_t performance_time
);
114 void HandleSeek(bigtime_t performance_time
);
117 BParameterWeb
* CreateParameterWeb();
118 void SetAboutInfo(BParameterGroup
*about
);
120 void RefreshParameterWeb();
122 status_t
StartCapture();
123 status_t
StopCapture();
124 status_t
StartCaptureThreads();
125 status_t
StopCaptureThreads();
127 static int32
_card_reader_thread_(void *arg
);
129 void card_reader_thread();
131 status_t fInitStatus
;
134 bool fOutputEnabledEncVideo
;
135 media_output fOutputEncVideo
;
136 media_format fDefaultFormatEncVideo
;
138 bool fCaptureThreadsActive
;
139 thread_id fThreadIdCardReader
;
140 volatile bool fTerminateThreads
;
141 BBufferGroup
* fBufferGroupEncVideo
;
148 #endif // __FIREWIRE_DV_NODE_H