static int Demux ( demux_t * );
static int Control( demux_t *, int, va_list );
+class DeckLinkCaptureDelegate;
+
struct demux_sys_t
{
IDeckLink *p_card;
IDeckLinkInput *p_input;
+ DeckLinkCaptureDelegate *p_delegate;
es_out_id_t *p_es;
};
+class DeckLinkCaptureDelegate : public IDeckLinkInputCallback
+{
+public:
+ DeckLinkCaptureDelegate( demux_t *p_demux ) : p_demux_(p_demux) {}
+
+ // FIXME: These leak.
+ virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, LPVOID *ppv) { return E_NOINTERFACE; }
+ virtual ULONG STDMETHODCALLTYPE AddRef(void) { return 1; }
+ virtual ULONG STDMETHODCALLTYPE Release(void) { return 1; }
+
+ virtual HRESULT STDMETHODCALLTYPE VideoInputFormatChanged(BMDVideoInputFormatChangedEvents, IDeckLinkDisplayMode*, BMDDetectedVideoInputFormatFlags);
+ virtual HRESULT STDMETHODCALLTYPE VideoInputFrameArrived(IDeckLinkVideoInputFrame*, IDeckLinkAudioInputPacket*);
+
+private:
+ demux_t *p_demux_;
+};
+
+HRESULT DeckLinkCaptureDelegate::VideoInputFormatChanged(BMDVideoInputFormatChangedEvents events, IDeckLinkDisplayMode *mode, BMDDetectedVideoInputFormatFlags)
+{
+ msg_Dbg( p_demux_, "Video input format changed" );
+ return S_OK;
+}
+
+HRESULT DeckLinkCaptureDelegate::VideoInputFrameArrived(IDeckLinkVideoInputFrame* videoFrame, IDeckLinkAudioInputPacket* audioFrame)
+{
+ msg_Dbg( p_demux_, "Received a frame" );
+ return S_OK;
+}
+
static int Open( vlc_object_t *p_this )
{
demux_t *p_demux = (demux_t*)p_this;
result = decklink_iterator->Next( &p_sys->p_card );
if ( result != S_OK ) {
- msg_Err( p_demux, "No DeckLink PCI cards found." );
+ msg_Err( p_demux, "No DeckLink PCI cards found" );
return VLC_EGENERIC;
}
return VLC_EGENERIC;
}
+ p_sys->p_delegate = new DeckLinkCaptureDelegate( p_demux );
+ p_sys->p_input->SetCallback( p_sys->p_delegate );
+
+ result = p_sys->p_input->EnableVideoInput(bmdModePAL, bmdFormat8BitYUV, 0);
+ if ( result != S_OK ) {
+ msg_Err( p_demux, "Failed to enable video input" );
+ return VLC_EGENERIC;
+ }
+
+ // FIXME: add audio
+ result = p_sys->p_input->StartStreams();
+ if ( result != S_OK ) {
+ msg_Err( p_demux, "Failed to start streams" );
+ return VLC_EGENERIC;
+ }
+
/*eDeclare elementary streams */
es_format_t fmt;
es_format_Init( &fmt, VIDEO_ES, VLC_CODEC_YUYV );