summaryrefslogtreecommitdiffstats
path: root/tinyDSHOW/include/tinydshow
diff options
context:
space:
mode:
Diffstat (limited to 'tinyDSHOW/include/tinydshow')
-rw-r--r--tinyDSHOW/include/tinydshow/DSBufferWriter.h52
-rw-r--r--tinyDSHOW/include/tinydshow/DSCaptureFormat.h51
-rw-r--r--tinyDSHOW/include/tinydshow/DSCaptureGraph.h108
-rw-r--r--tinyDSHOW/include/tinydshow/DSCaptureUtils.h64
-rw-r--r--tinyDSHOW/include/tinydshow/DSDisplay.h80
-rw-r--r--tinyDSHOW/include/tinydshow/DSDisplayGraph.h107
-rw-r--r--tinyDSHOW/include/tinydshow/DSDisplayOverlay.h72
-rw-r--r--tinyDSHOW/include/tinydshow/DSFrameRateFilter.h83
-rw-r--r--tinyDSHOW/include/tinydshow/DSGrabber.h91
-rw-r--r--tinyDSHOW/include/tinydshow/DSOutputFilter.h127
-rw-r--r--tinyDSHOW/include/tinydshow/DSOutputStream.h95
-rw-r--r--tinyDSHOW/include/tinydshow/DSUtils.h78
-rw-r--r--tinyDSHOW/include/tinydshow/Resizer.h174
-rw-r--r--tinyDSHOW/include/tinydshow/VideoDisplayName.h47
-rw-r--r--tinyDSHOW/include/tinydshow/VideoFrame.h108
-rw-r--r--tinyDSHOW/include/tinydshow/VideoGrabberName.h47
-rw-r--r--tinyDSHOW/include/tinydshow/plugin/DSConsumer.h35
-rw-r--r--tinyDSHOW/include/tinydshow/plugin/DSProducer.h35
18 files changed, 1454 insertions, 0 deletions
diff --git a/tinyDSHOW/include/tinydshow/DSBufferWriter.h b/tinyDSHOW/include/tinydshow/DSBufferWriter.h
new file mode 100644
index 0000000..156471f
--- /dev/null
+++ b/tinyDSHOW/include/tinydshow/DSBufferWriter.h
@@ -0,0 +1,52 @@
+/*
+* Copyright (C) 2009-2010 Mamadou Diop.
+*
+* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
+*
+* This file is part of Open Source Doubango Framework.
+*
+* DOUBANGO is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* DOUBANGO is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with DOUBANGO.
+*
+*/
+#ifndef DSBUFFERWRITTER_H
+#define DSBUFFERWRITTER_H
+/*
+// TODO: do it only once
+#if !defined(TDSHOW_DEFINE_GUID) && !defined(_WIN32_WCE)
+#define TDSHOW_DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
+ EXTERN_C const GUID DECLSPEC_SELECTANY name \
+ = { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }
+#elif !defined(TDSHOW_DEFINE_GUID) && defined(_WIN32_WCE)
+#define TDSHOW_DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
+ EXTERN_C const GUID __declspec(selectany) name \
+ = { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }
+#endif
+
+// {27AD9929-E4E7-423b-8BDD-8AF5AC894DE0}
+TDSHOW_DEFINE_GUID(IID_DSBufferWriter,
+ 0x27ad9929, 0xe4e7, 0x423b, 0x8b, 0xdd, 0x8a, 0xf5, 0xac, 0x89, 0x4d, 0xe0);
+ */
+
+
+class DSBufferWriter
+#ifndef _WIN32_WCE
+ : public IUnknown
+#endif
+{
+public:
+ virtual void setBuffer (void* pBuffer, int size) = 0;
+ virtual HRESULT setImageFormat(UINT width, UINT height/*, GUID subType, UINT fps*/) = 0;
+};
+
+#endif
diff --git a/tinyDSHOW/include/tinydshow/DSCaptureFormat.h b/tinyDSHOW/include/tinydshow/DSCaptureFormat.h
new file mode 100644
index 0000000..5eb372d
--- /dev/null
+++ b/tinyDSHOW/include/tinydshow/DSCaptureFormat.h
@@ -0,0 +1,51 @@
+/*
+* Copyright (C) 2009-2010 Mamadou Diop.
+*
+* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
+*
+* This file is part of Open Source Doubango Framework.
+*
+* DOUBANGO is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* DOUBANGO is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with DOUBANGO.
+*
+*/
+#ifndef DSCAPTUREFORMAT_H
+#define DSCAPTUREFORMAT_H
+
+#include <tinydshow_config.h>
+#include <strmif.h>
+
+
+class DSCaptureFormat
+{
+public:
+ DSCaptureFormat(int w, int h, int f, GUID c) : width(w), height(h), fps(f), chroma(c) {};
+ virtual ~DSCaptureFormat() {};
+
+ int getWidth() { return this->width; };
+ int getHeight() { return this->height; };
+ int getFramerate() { return this->fps; };
+ GUID getChroma() { return this->chroma; };
+
+ int getMatchScore(int w, int h);
+ bool isRGB();
+
+private:
+ int width;
+ int height;
+ int fps;
+ GUID chroma;
+};
+
+
+#endif
diff --git a/tinyDSHOW/include/tinydshow/DSCaptureGraph.h b/tinyDSHOW/include/tinydshow/DSCaptureGraph.h
new file mode 100644
index 0000000..b3eac91
--- /dev/null
+++ b/tinyDSHOW/include/tinydshow/DSCaptureGraph.h
@@ -0,0 +1,108 @@
+/*
+* Copyright (C) 2009-2010 Mamadou Diop.
+*
+* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
+*
+* This file is part of Open Source Doubango Framework.
+*
+* DOUBANGO is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* DOUBANGO is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with DOUBANGO.
+*
+*/
+#ifndef DSCAPTUREGRAPH_H
+#define DSCAPTUREGRAPH_H
+
+#include <tinydshow_config.h>
+#include <vector>
+#include <control.h>
+#include <tinydshow/DSCaptureFormat.h>
+#include <tinydshow/DSFrameRateFilter.h>
+
+#ifdef _WIN32_WCE
+# include <tinydshow/wce/DSSampleGrabber.h>
+# include <tinydshow/wce/DSInxbNullFilter.h>
+# include <tinydshow/wce/InxbISampleGrabberCB.h>
+#else
+# include <qedit.h>
+#endif
+
+
+class DSCaptureGraph
+{
+public:
+#ifdef _WIN32_WCE
+ DSCaptureGraph(InxbISampleGrabberCB* callback, HRESULT *hr);
+#else
+ DSCaptureGraph(ISampleGrabberCB* callback, HRESULT *hr);
+#endif
+ virtual ~DSCaptureGraph();
+
+ std::vector<DSCaptureFormat> *getFormats() { return &this->supportedFormats; };
+
+ HRESULT setSource(const std::string &devicePath);
+ HRESULT setParameters(DSCaptureFormat *format, int framerate);
+
+ HRESULT connect();
+ HRESULT disconnect();
+
+ HRESULT start();
+ HRESULT stop();
+ bool isRunning();
+
+ std::string getDeviceId() const { return this->deviceId; };
+
+ HRESULT getConnectedMediaType(AM_MEDIA_TYPE *mediaType);
+
+private:
+ HRESULT createCaptureGraph();
+
+private:
+#ifdef _WIN32_WCE
+ InxbISampleGrabberCB *grabberCallback;
+#else
+ ISampleGrabberCB *grabberCallback;
+#endif
+
+ ICaptureGraphBuilder2 *captureGraphBuilder;
+ IGraphBuilder *graphBuilder;
+
+ IBaseFilter *sourceFilter;
+ IBaseFilter *nullRendererFilter;
+ IBaseFilter *sampleGrabberFilter;
+
+#ifdef _WIN32_WCE
+ IBaseFilter *colorConvertor565; //http://msdn.microsoft.com/en-us/library/aa926076.aspx
+#else
+ IBaseFilter *decompressorFilter;
+ DSFrameRateFilter *frameRateFilter;
+#endif
+
+#ifdef _WIN32_WCE
+ DSSampleGrabber *grabberController;
+#else
+ ISampleGrabber *grabberController;
+#endif
+
+ IMediaControl *mediaController;
+ IMediaEventEx *mediaEventController;
+
+ IAMStreamConfig *streamConfiguration;
+
+ std::vector<DSCaptureFormat> supportedFormats;
+ DSCaptureFormat *captureFormat;
+
+ bool running;
+ std::string deviceId;
+};
+
+#endif
diff --git a/tinyDSHOW/include/tinydshow/DSCaptureUtils.h b/tinyDSHOW/include/tinydshow/DSCaptureUtils.h
new file mode 100644
index 0000000..33f0640
--- /dev/null
+++ b/tinyDSHOW/include/tinydshow/DSCaptureUtils.h
@@ -0,0 +1,64 @@
+/*
+* Copyright (C) 2009-2010 Mamadou Diop.
+*
+* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
+*
+* This file is part of Open Source Doubango Framework.
+*
+* DOUBANGO is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* DOUBANGO is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with DOUBANGO.
+*
+*/
+#ifndef DSCAPTUREUTILS_H
+#define DSCAPTUREUTILS_H
+
+#include <tinydshow_config.h>
+#include <tinydshow/DSCaptureFormat.h>
+#include <tinydshow/VideoGrabberName.h>
+
+#include <vector>
+
+// --------------------------------------------------------------------------------
+
+#ifdef INCLUDE_VFW_DEVICES
+#define INCLUDE_CATEGORY_FLAG 0
+#else
+#define INCLUDE_CATEGORY_FLAG CDEF_DEVMON_FILTER | CDEF_DEVMON_PNP_DEVICE
+#endif
+
+// --------------------------------------------------------------------------------
+
+/**
+* \brief Fills in a vector with VideoGrabberName instances constructed from the video capture devices.
+* \param A pointer to the device vector to append
+* \return An HRESULT value
+*/
+HRESULT enumerateCaptureDevices(const std::string &prefix, std::vector<VideoGrabberName> *names);
+
+/**
+* \brief Fills in a vector with VideoGrabberName instances constructed from the video capture devices.
+* \param A constant string containing a device path
+* \param A pointer to the filter that will contains the filter created or NULL if not the device is not found
+* \return An HRESULT value
+*/
+HRESULT createSourceFilter(std::string *devicePath, IBaseFilter **sourceFilter);
+
+/**
+* \brief Fills in a vector with DSCaptureFormat instances constructed from the given video capture device.
+* \param An instance of a capture device
+* \param A pointer to the format vector to append
+* \return An HRESULT value
+*/
+HRESULT getSupportedFormats(IBaseFilter *sourceFilter, std::vector<DSCaptureFormat> *formats);
+
+#endif
diff --git a/tinyDSHOW/include/tinydshow/DSDisplay.h b/tinyDSHOW/include/tinydshow/DSDisplay.h
new file mode 100644
index 0000000..aaf8258
--- /dev/null
+++ b/tinyDSHOW/include/tinydshow/DSDisplay.h
@@ -0,0 +1,80 @@
+/*
+* Copyright (C) 2009-2010 Mamadou Diop.
+*
+* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
+*
+* This file is part of Open Source Doubango Framework.
+*
+* DOUBANGO is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* DOUBANGO is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with DOUBANGO.
+*
+*/
+#ifndef DIRECTSHOW_DISPLAY_H
+#define DIRECTSHOW_DISPLAY_H
+
+#include <tinydshow_config.h>
+
+#include <tinydshow/DSDisplayGraph.h>
+#include <tinydshow/DSDisplayOverlay.h>
+
+
+class DSDisplay
+{
+public:
+ DSDisplay(HRESULT *hr);
+ virtual ~DSDisplay();
+
+ virtual void attach(INT64 parent);
+ virtual void attach(void *parent);
+ virtual void detach(void *parent);
+ virtual void detach();
+ virtual bool isAttached();
+
+ virtual void start();
+ virtual void stop();
+
+ virtual int getWidth();
+ virtual int getHeight();
+ virtual void setSize(int w, int h);
+
+ virtual bool isFullscreen();
+ virtual void setFullscreen(bool value);
+
+ virtual bool canFullscreen();
+
+ virtual void setFps(int fps_);
+
+ virtual void handleVideoFrame(const void* data, int w, int h);
+
+ LRESULT handleEvents(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
+
+private:
+ void hook();
+ void unhook();
+ void applyRatio(RECT rect);
+
+private:
+ DSDisplayGraph *graph;
+ DSDisplayOverlay *overlay;
+
+ int fps;
+ int width, height;
+
+ bool fullscreen;
+ HWND window;
+ WNDPROC parentWindowProc;
+
+ bool hooked;
+};
+
+#endif
diff --git a/tinyDSHOW/include/tinydshow/DSDisplayGraph.h b/tinyDSHOW/include/tinydshow/DSDisplayGraph.h
new file mode 100644
index 0000000..32942be
--- /dev/null
+++ b/tinyDSHOW/include/tinydshow/DSDisplayGraph.h
@@ -0,0 +1,107 @@
+/*
+* Copyright (C) 2009-2010 Mamadou Diop.
+*
+* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
+*
+* This file is part of Open Source Doubango Framework.
+*
+* DOUBANGO is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* DOUBANGO is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with DOUBANGO.
+*
+*/
+#ifndef DSDISPLAYGRAPH_H
+#define DSDISPLAYGRAPH_H
+
+#include <tinydshow_config.h>
+
+#include <control.h>
+
+#include <tinydshow/VideoFrame.h>
+#include <tinydshow/DSOutputFilter.h>
+#include <tinydshow/DSDisplayOverlay.h>
+
+#if defined(VMR9) || defined(VMR9_WINDOWLESS)
+#include <D3D9.h>
+#include <vmr9.h>
+#endif
+
+
+class DSDisplayGraph
+{
+public:
+ DSDisplayGraph(HRESULT *hr);
+ virtual ~DSDisplayGraph();
+
+ int getDisplayFps() { return this->fps; };
+ void setDisplayFps(int fps_);
+
+ bool getImageFormat(UINT &width, UINT &height);
+ bool setImageFormat(UINT width, UINT height);
+
+ HRESULT connect();
+ HRESULT disconnect();
+
+ HRESULT start();
+ HRESULT stop();
+ bool isRunning();
+
+ IMediaEventEx *getMediaEvent() { return this->mediaEvent; };
+ IVideoWindow *getVideoWindow() { return this->videoWindow; };
+ DSOutputFilter *getSourceFilter() { return this->sourceFilter; };
+
+#if defined(VMR)
+ IVMRMixerBitmap *getMixerBitmap() { return this->mixerBitmap; };
+#elif defined(VMR9)
+ IVMRMixerBitmap9 *getMixerBitmap() { return this->mixerBitmap; };
+#elif defined(VMR9_WINDOWLESS)
+ IVMRMixerBitmap9 *getMixerBitmap() { return this->mixerBitmap; };
+ IVMRMixerControl9 *getMixerControl() { return this->mixerControl; };
+ IVMRWindowlessControl9 *getWindowlessControl() { return this->windowlessControl; };
+#endif
+
+ void handleFrame(const void* data, int w, int h);
+
+private:
+ HRESULT createDisplayGraph();
+
+private:
+ IGraphBuilder *graphBuilder;
+
+ DSOutputFilter *sourceFilter;
+ IBaseFilter *colorspaceConverterFilter;
+ IBaseFilter *videoRendererFilter;
+
+ IMediaControl *mediaController;
+ IMediaEventEx *mediaEvent;
+ IVideoWindow *videoWindow;
+
+#if defined(VMR)
+ IVMRMixerBitmap *mixerBitmap;
+ IVMRFilterConfig *filterConfig;
+#elif defined(VMR9)
+ IVMRMixerBitmap9 *mixerBitmap;
+ IVMRMixerControl9 *mixerControl;
+ IVMRFilterConfig9 *filterConfig;
+#elif defined(VMR9_WINDOWLESS)
+ IVMRMixerBitmap9 *mixerBitmap;
+ IVMRMixerControl9 *mixerControl;
+ IVMRFilterConfig9 *filterConfig;
+ IVMRWindowlessControl9 *windowlessControl;
+#endif
+
+ bool connected;
+ bool running;
+ int fps;
+};
+
+#endif
diff --git a/tinyDSHOW/include/tinydshow/DSDisplayOverlay.h b/tinyDSHOW/include/tinydshow/DSDisplayOverlay.h
new file mode 100644
index 0000000..539a5bc
--- /dev/null
+++ b/tinyDSHOW/include/tinydshow/DSDisplayOverlay.h
@@ -0,0 +1,72 @@
+/*
+* Copyright (C) 2009-2010 Mamadou Diop.
+*
+* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
+*
+* This file is part of Open Source Doubango Framework.
+*
+* DOUBANGO is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* DOUBANGO is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with DOUBANGO.
+*
+*/
+#ifndef DSDISPLAYOVERLAY_H
+#define DSDISPLAYOVERLAY_H
+
+#include <tinydshow_config.h>
+#include <strmif.h>
+
+#if defined(VMR9) || defined(VMR9_WINDOWLESS)
+#include <D3D9.h>
+#include <D3Dx9.h>
+#include <vmr9.h>
+#endif
+
+class DSDisplayGraph;
+
+class DSDisplayOverlay
+{
+public:
+ DSDisplayOverlay();
+ virtual ~DSDisplayOverlay();
+
+ void attach(HWND parent, DSDisplayGraph *graph);
+ void detach();
+
+ void show(int value);
+ void update();
+
+private:
+ void internalUpdate();
+
+private:
+ HWND window;
+
+ DSDisplayGraph *displayGraph;
+ int ticks;
+
+#if defined(VMR)
+ HDC hdcBmp;
+ HBITMAP hbmOld;
+ VMRALPHABITMAP alphaBitmap;
+ float alphaStep;
+#elif defined(VMR9) || defined(VMR9_WINDOWLESS)
+ IDirect3D9 *direct3D;
+ IDirect3DDevice9 *direct3DDevice;
+ IDirect3DSurface9 *direct3DSurface;
+ D3DXIMAGE_INFO overlayInfo;
+ VMR9AlphaBitmap alphaBitmap;
+ float alphaStep;
+#endif
+};
+
+#endif
diff --git a/tinyDSHOW/include/tinydshow/DSFrameRateFilter.h b/tinyDSHOW/include/tinydshow/DSFrameRateFilter.h
new file mode 100644
index 0000000..78aa88e
--- /dev/null
+++ b/tinyDSHOW/include/tinydshow/DSFrameRateFilter.h
@@ -0,0 +1,83 @@
+/*
+* Copyright (C) 2009-2010 Mamadou Diop.
+*
+* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
+*
+* This file is part of Open Source Doubango Framework.
+*
+* DOUBANGO is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* DOUBANGO is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with DOUBANGO.
+*
+*/
+#ifndef DSFrameRateFilter_H
+#define DSFrameRateFilter_H
+
+#include <tinydshow_config.h>
+
+#include <streams.h>
+#include <math.h>
+
+// TODO: do it only once
+#if !defined(TDSHOW_DEFINE_GUID) && !defined(_WIN32_WCE)
+#define TDSHOW_DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
+ EXTERN_C const GUID DECLSPEC_SELECTANY name \
+ = { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }
+#elif !defined(TDSHOW_DEFINE_GUID) && defined(_WIN32_WCE)
+#define TDSHOW_DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
+ EXTERN_C const GUID __declspec(selectany) name \
+ = { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }
+#endif
+
+// {7F9F08CF-139F-40b2-A283-01C4EC26A452}
+TDSHOW_DEFINE_GUID(CLSID_DSFrameRateFilter,
+0x7f9f08cf, 0x139f, 0x40b2, 0xa2, 0x83, 0x1, 0xc4, 0xec, 0x26, 0xa4, 0x52);
+
+class DSFrameRateFilter : public CTransInPlaceFilter
+{
+public:
+ DSFrameRateFilter(TCHAR *tszName, LPUNKNOWN punk, HRESULT *phr);
+ ~DSFrameRateFilter(void);
+
+public:
+ HRESULT Transform(IMediaSample *pSample);
+ HRESULT CheckInputType(const CMediaType* mtIn);
+
+public:
+ /**
+ * \def SetFps
+ * \brief fps1 define source .
+ */
+ HRESULT SetFps(int inputFps, int outputFps);
+
+ static CUnknown *WINAPI CreateInstance(LPUNKNOWN punk, HRESULT *phr);
+ DECLARE_IUNKNOWN;
+
+ /*STDMETHODIMP_(ULONG) NonDelegatingRelease()
+ {
+ if(InterlockedDecrement(&m_cRef) == 0)
+ {
+ delete this;
+ return 0;
+ }
+ return m_cRef;
+ }*/
+
+private:
+ int m_progress;
+ int m_inputFps, m_outputFps;
+ bool m_bProcessFrame;
+ REFERENCE_TIME m_rtFrameLength; // UNITS/fps
+ LONGLONG m_iFrameNumber;
+};
+
+#endif ////DSFrameRateFilter_H \ No newline at end of file
diff --git a/tinyDSHOW/include/tinydshow/DSGrabber.h b/tinyDSHOW/include/tinydshow/DSGrabber.h
new file mode 100644
index 0000000..4c66716
--- /dev/null
+++ b/tinyDSHOW/include/tinydshow/DSGrabber.h
@@ -0,0 +1,91 @@
+/*
+* Copyright (C) 2009-2010 Mamadou Diop.
+*
+* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
+*
+* This file is part of Open Source Doubango Framework.
+*
+* DOUBANGO is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* DOUBANGO is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with DOUBANGO.
+*
+*/
+#if !defined(DIRECTSHOW_GRABBER_H)/* && !defined(_WIN32_WCE)*/
+#define DIRECTSHOW_GRABBER_H
+
+#include <tinydshow_config.h>
+
+#include <tinydshow/DSCaptureGraph.h>
+#include <tinydshow/VideoFrame.h>
+
+#include "tinymedia/tmedia_producer.h"
+
+#include "tsk_mutex.h"
+
+class DSDisplay;
+
+#ifdef _WIN32_WCE
+# include <tinydshow/wce/InxbISampleGrabberCB.h>
+#endif
+
+
+class DSGrabber : public
+#ifdef _WIN32_WCE
+ InxbISampleGrabberCB
+#else
+ ISampleGrabberCB
+#endif
+{
+public:
+ DSGrabber(HRESULT *hr);
+ virtual ~DSGrabber();
+
+ void setCallback(tmedia_producer_enc_cb_f callback, const void* callback_data);
+ void setCaptureDevice(const std::string &devicePath);
+
+ virtual void start();
+ virtual void stop();
+
+ virtual bool setCaptureParameters(int format, int f);
+
+ virtual VIDEOFORMAT getCaptureFormat();
+ virtual int getFramerate();
+
+ virtual HRESULT STDMETHODCALLTYPE SampleCB(double SampleTime, IMediaSample *pSample);
+ virtual HRESULT STDMETHODCALLTYPE BufferCB(double SampleTime, BYTE *pBuffer, long BufferLen);
+
+ virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void __RPC_FAR *__RPC_FAR *ppvObject);
+ virtual ULONG STDMETHODCALLTYPE AddRef();
+ virtual ULONG STDMETHODCALLTYPE Release();
+
+ DSDisplay *preview;
+
+private:
+ int width;
+ int height;
+ int fps;
+
+ DSCaptureGraph *graph;
+
+ //VideoFrame *currentFrame;
+ BITMAPINFOHEADER bitmapInfo;
+ BYTE *buffer;
+
+ tsk_mutex_handle_t *mutex_buffer;
+
+ bool first_buffer;
+
+ const void* plugin_cb_data;
+ tmedia_producer_enc_cb_f plugin_cb;
+};
+
+#endif
diff --git a/tinyDSHOW/include/tinydshow/DSOutputFilter.h b/tinyDSHOW/include/tinydshow/DSOutputFilter.h
new file mode 100644
index 0000000..1e141b3
--- /dev/null
+++ b/tinyDSHOW/include/tinydshow/DSOutputFilter.h
@@ -0,0 +1,127 @@
+/*
+* Copyright (C) 2009-2010 Mamadou Diop.
+*
+* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
+*
+* This file is part of Open Source Doubango Framework.
+*
+* DOUBANGO is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* DOUBANGO is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with DOUBANGO.
+*
+*/
+#ifndef DSOUTPUTFILTER_H
+#define DSOUTPUTFILTER_H
+
+#include <tinydshow_config.h>
+
+#include <tinydshow/DSBufferWriter.h>
+#include <streams.h>
+
+// TODO: do it only once
+#if !defined(TDSHOW_DEFINE_GUID) && !defined(_WIN32_WCE)
+#define TDSHOW_DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
+ EXTERN_C const GUID DECLSPEC_SELECTANY name \
+ = { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }
+#elif !defined(TDSHOW_DEFINE_GUID) && defined(_WIN32_WCE)
+#define TDSHOW_DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
+ EXTERN_C const GUID __declspec(selectany) name \
+ = { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }
+#endif
+
+class DSOutputStream;
+
+// {17D9D5CB-850D-4339-B72A-F72D084D8D64}
+TDSHOW_DEFINE_GUID(CLSID_TdshowOutputFilter,
+0x17d9d5cb, 0x850d, 0x4339, 0xb7, 0x2a, 0xf7, 0x2d, 0x8, 0x4d, 0x8d, 0x64);
+
+class DSOutputFilter : public CSource, public DSBufferWriter
+{
+public:
+ DSOutputFilter(LPUNKNOWN pUnk, HRESULT *phr);
+ virtual ~DSOutputFilter();
+
+ //static CUnknown * WINAPI CreateInstance(LPUNKNOWN pUnk, HRESULT *phr);
+ DECLARE_IUNKNOWN;
+
+ virtual void setBuffer(void *pointer, int size);
+ virtual inline HRESULT setImageFormat(UINT width, UINT height);
+ virtual bool getImageFormat(UINT &width, UINT &height);
+
+ virtual void setFps(int fps_);
+ virtual void showOverlay(int value);
+
+ virtual void getMediaType(AM_MEDIA_TYPE* &pmt);
+ virtual HRESULT setMediaType(const AM_MEDIA_TYPE* pmt);
+
+ void reset();
+
+#ifdef _WIN32_WCE
+ STDMETHODIMP_(ULONG) NonDelegatingRelease();
+#endif
+
+//protected:
+#ifdef _WIN32_WCE
+ /*STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
+ {
+ CheckPointer(ppv, E_POINTER);
+
+ if (riid == IID_IBaseFilter
+ || riid == IID_IBaseFilter
+ || riid == IID_IUnknown
+ || riid == IID_IMediaFilter
+ )
+ {
+ return GetInterface((IBaseFilter *) this, ppv);
+ }
+ else
+ {
+ *ppv = NULL;
+ return E_NOINTERFACE;
+ }
+ };
+
+ STDMETHODIMP_(ULONG) AddRef() {
+ //return GetOwner()->AddRef();
+ //return 1;
+ return (ULONG)InterlockedIncrement(&m_cRef);
+ };
+
+ STDMETHODIMP_(ULONG) Release() {
+ LONG lRefCount = InterlockedDecrement(&m_cRef);
+ if(m_cRef < 1) delete this;
+ return (ULONG)m_cRef;
+ };
+
+ STDMETHODIMP_(ULONG) NonDelegatingAddRef()
+ {
+ return InterlockedIncrement(&m_cRef);
+ }*/
+#endif
+/*
+ STDMETHODIMP_(ULONG) NonDelegatingRelease()
+ {
+ if(InterlockedDecrement(&m_cRef) == 0)
+ {
+ delete this;
+ return 0;
+ }
+ return m_cRef;
+ }*/
+
+private:
+ DSOutputStream *outputStream;
+
+ friend class DSOutputStream;
+};
+
+#endif
diff --git a/tinyDSHOW/include/tinydshow/DSOutputStream.h b/tinyDSHOW/include/tinydshow/DSOutputStream.h
new file mode 100644
index 0000000..d786922
--- /dev/null
+++ b/tinyDSHOW/include/tinydshow/DSOutputStream.h
@@ -0,0 +1,95 @@
+/*
+* Copyright (C) 2009-2010 Mamadou Diop.
+*
+* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
+*
+* This file is part of Open Source Doubango Framework.
+*
+* DOUBANGO is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* DOUBANGO is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with DOUBANGO.
+*
+*/
+#ifndef DSOUTPUTSTREAM_H
+#define DSOUTPUTSTREAM_H
+
+#include <tinydshow_config.h>
+
+#include <streams.h>
+
+#include "tsk_mutex.h"
+
+class DSOutputFilter;
+
+class DSOutputStream : public CSourceStream
+{
+public:
+ DSOutputStream(HRESULT *phr, DSOutputFilter *pParent, LPCWSTR pPinName);
+ virtual ~DSOutputStream();
+
+ void setFps(int fps_);
+ void showOverlay(int value);
+
+ HRESULT setImageFormat(UINT width, UINT height);
+ bool getImageFormat(UINT &width, UINT &height);
+ STDMETHODIMP Notify(IBaseFilter *pSelf, Quality q) { return E_NOTIMPL; };
+ inline bool lockBuffer(){
+ if(this->mutex){
+ return tsk_mutex_lock(this->mutex) == 0;
+ }
+ return false;
+ }
+ inline bool unlockBuffer(){
+ if(this->mutex){
+ return tsk_mutex_unlock(this->mutex) == 0;
+ }
+ return false;
+ }
+
+public:
+ void *buffer;
+ int buffer_size;
+ LONGLONG frameNumber;
+
+protected: // Overrides
+ HRESULT GetMediaType(CMediaType *pMediaType);
+ HRESULT DecideBufferSize(IMemAllocator *pMemAlloc, ALLOCATOR_PROPERTIES *pProperties);
+ HRESULT OnThreadCreate();
+ HRESULT OnThreadDestroy();
+ HRESULT FillBuffer(IMediaSample *pSample);
+
+private:
+ /*inline */void TransfertBuffer(void* src, void* dest, long lSize);
+ inline HRESULT DrawOverLay(void *pBuffer, long lSize);
+
+private:
+ // TIMING
+ REFERENCE_TIME frameLength;
+ int fps;
+
+ // sizing
+ UINT width;
+ UINT height;
+
+ // overlaying
+ bool overlay;
+ BITMAPINFO bitmapInfo;
+ void *paintBuffer;
+ HDC paintDC;
+ HBITMAP hDibSection;
+ HGDIOBJ hObject;
+
+ tsk_mutex_handle_t* mutex;
+};
+
+
+#endif
diff --git a/tinyDSHOW/include/tinydshow/DSUtils.h b/tinyDSHOW/include/tinydshow/DSUtils.h
new file mode 100644
index 0000000..957954b
--- /dev/null
+++ b/tinyDSHOW/include/tinydshow/DSUtils.h
@@ -0,0 +1,78 @@
+/*
+* Copyright (C) 2009-2010 Mamadou Diop.
+*
+* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
+*
+* This file is part of Open Source Doubango Framework.
+*
+* DOUBANGO is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* DOUBANGO is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with DOUBANGO.
+*
+*/
+#ifndef TINYDSHOW_DUTILS_H
+#define TINYDSHOW_DUTILS_H
+
+#include <tinydshow_config.h>
+
+#include <strmif.h>
+
+// --------------------------------------------------------------------------------
+
+#define SAFE_RELEASE(x) if (x) { x->Release(); x = NULL; }
+#define SAFE_DELETE_PTR(x) if (x) { delete x; x = NULL; }
+#define SAFE_DELETE_ARRAY(x) if (x) { delete[] x; x = NULL; }
+
+#define DS_NANOS_TO_100NS(NANOS) (((LONGLONG)(NANOS)) / 100ui64)
+#define DS_MICROS_TO_100NS(MICROS) (((LONGLONG)(MICROS)) * 10ui64)
+#define DS_MILLIS_TO_100NS(MILLIS) (((LONGLONG)(MILLIS)) * 10000ui64)
+#define DS_SECONDS_TO_100NS(SEC) (((LONGLONG)(SEC)) * 10000000ui64)
+//#define DS_100NS_TO_SECONDS(NANOS) (((LONGLONG)(NANOS)) / 10000000ui64)
+
+//#define SECONDS_TO_100NS(s) (LONGLONG)(10000000/(s))
+//#define SECONDS_FROM_100NS(ns) (10000000/(ns))
+
+#define COCREATE(cls, iid, target) \
+ CoCreateInstance(cls, NULL, CLSCTX_INPROC_SERVER, iid, reinterpret_cast<void**>(&target))
+#define QUERY(source, iid, target) \
+ source->QueryInterface(iid, reinterpret_cast<void**>(&target))
+
+// --------------------------------------------------------------------------------
+
+
+#define FILTER_WEBCAM _T("WEBCAM")
+#define FILTER_FRAMERATE _T("TDSHOW_FRAMERATE")
+#define FILTER_OUTPUT _T("TDSHOW_OUTPUT")
+#define FITLER_SAMPLE_GRABBER _T("SAMPLE_GRABBER")
+#define FILTER_AVI_DECOMPRESSOR _T("AVI_DECOMPRESSOR")
+
+#define FILTER_COLORSPACE_CONVERTOR _T("COLORSPACE_CONVERTOR")
+#define FILTER_NULL_RENDERER _T("NULL_RENDERER")
+#define FILTER_VIDEO_RENDERER _T("VIDEO_RENDERER")
+#define FILTER_VIDEO_MIXING_RENDERER _T("VIDEO_MIXING_RENDERER")
+#define FILTER_COLOR_CONVERTOR_565 _T("COLOR_CONVERTOR_565")
+
+// --------------------------------------------------------------------------------
+
+bool IsMainThread();
+
+IPin *GetPin(IBaseFilter *pFilter, PIN_DIRECTION dir);
+
+HRESULT ConnectFilters(IGraphBuilder *graphBuilder, IBaseFilter *source, IBaseFilter *destination, AM_MEDIA_TYPE *mediaType = NULL);
+
+HRESULT DisconnectFilters(IGraphBuilder *graphBuilder, IBaseFilter *source, IBaseFilter *destination);
+
+bool DisconnectAllFilters(IGraphBuilder *graphBuilder);
+
+bool RemoveAllFilters(IGraphBuilder *graphBuilder);
+
+#endif /* TINYDSHOW_DUTILS_H */
diff --git a/tinyDSHOW/include/tinydshow/Resizer.h b/tinyDSHOW/include/tinydshow/Resizer.h
new file mode 100644
index 0000000..d5ef36e
--- /dev/null
+++ b/tinyDSHOW/include/tinydshow/Resizer.h
@@ -0,0 +1,174 @@
+/*
+* Copyright (C) 2009-2010 Mamadou Diop.
+*
+* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
+*
+* This file is part of Open Source Doubango Framework.
+*
+* DOUBANGO is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* DOUBANGO is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with DOUBANGO.
+*
+*/
+/*
+ * Copyright (c) Microsoft Corporation. All rights reserved.
+ */
+#ifndef RESIZER_H
+#define RESIZER_H
+
+#include <tinydshow_config.h>
+
+/*
+* StretchC.C
+*
+* StretchBlt for DIBs
+*
+* C version of stretch.asm: StretchDIB optimised for AVI.
+*
+* NOTES
+* - does not handle mirroring in x or y
+* - does not handle pixel translation
+* - will not work in place.
+*/
+
+
+/* Outline:
+*
+* we select a y-stretching function depending on the ratio (eg 1:N or N:1).
+* it copies scanlines from source to destination, duplicating or omitting
+* scanlines as necessary to fit the destination. It copies each scanline
+* via the X_FUNC function we passed as an argument: this copies one scanline
+* duplicating or omitting pixels to fit the destination: we select an X_FUNC
+* depending on the bit-depth as well as the x-stretching ratio.
+*
+* both x and y stretching functions use the following basic model for deciding
+* when to insert/omit elements:
+*
+* delta = <larger extent> -1;
+*
+* for (number of destination elements) {
+*
+* copy one element
+* advance pointer to larger region
+* delta -= <smaller extent>
+* if (delta < 0) {
+* delta += <larger extent>;
+* advance pointer to smaller region
+* }
+* }
+*/
+
+#include <streams.h>
+
+/* stretch proportions */
+#define STRETCH_1_1 1
+#define STRETCH_1_2 2
+#define STRETCH_1_4 3
+#define STRETCH_1_N 4
+#define STRETCH_N_1 5
+#define STRETCH_4_1 6
+#define STRETCH_2_1 7
+
+void __stdcall StretchDIB(
+ LPBITMAPINFOHEADER biDst, // --> BITMAPINFO of destination
+ LPVOID lpvDst, // --> to destination bits
+ int DstX, // Destination origin - x coordinate
+ int DstY, // Destination origin - y coordinate
+ int DstXE, // x extent of the BLT
+ int DstYE, // y extent of the BLT
+ LPBITMAPINFOHEADER biSrc, // --> BITMAPINFO of source
+ LPVOID lpvSrc, // --> to source bits
+ int SrcX, // Source origin - x coordinate
+ int SrcY, // Source origin - y coordinate
+ int SrcXE, // x extent of the BLT
+ int SrcYE // y extent of the BLT
+ );
+
+void ResizeRGB( BITMAPINFOHEADER *pbiIn, //Src's BitMapInFoHeader
+ const unsigned char * dibBits, //Src bits
+ BITMAPINFOHEADER *pbiOut,
+ unsigned char *pFrame, //Dst bits
+ int iNewWidth, //new W in pixel
+ int iNewHeight); //new H in pixel
+
+/*
+* an X_FUNC is a function that copies one scanline, stretching or shrinking it
+* to fit a destination scanline. Pick an X_FUNC depending on
+* bitdepth and stretch ratio (1:1, 1:2, 1:4, 1:N, N:1, 4:1, 2:1)
+*
+* the x_fract argument is the delta fraction: it is a representation
+* of the smaller extent (whichever that is) as a fraction of the larger,
+* and is used when stretching or shrinking to advance the pointer to the
+* smaller scanline every (fract) pixels of the larger.
+* Thus if we are expanding 1:8, x_fract will be 1/8, we will advance the
+* source pointer once every 8 pixels, and thus copy each source pixel to
+* 8 dest pixels. Note that if shrinking 8:1, x_fract will still be 1/8
+* and we will use it to control advancement of the dest pointer.
+* the fraction is multiplied by 65536.
+*/
+typedef void (*X_FUNC) (LPBYTE lpSrc,
+ LPBYTE lpDst,
+ int SrcXE,
+ int DstXE,
+ int x_fract);
+
+
+void X_Stretch_1_1_8Bits(LPBYTE lpSrc, LPBYTE lpDst, int SrcXE, int DstXE, int x_fract);
+void X_Stretch_1_2_8Bits(LPBYTE lpSrc, LPBYTE lpDst, int SrcXE, int DstXE, int x_fract);
+void X_Stretch_1_4_8Bits(LPBYTE lpSrc, LPBYTE lpDst, int SrcXE, int DstXE, int x_fract);
+void X_Stretch_1_N_8Bits(LPBYTE lpSrc, LPBYTE lpDst, int SrcXE, int DstXE, int x_fract);
+void X_Stretch_N_1_8Bits(LPBYTE lpSrc, LPBYTE lpDst, int SrcXE, int DstXE, int x_fract);
+
+void X_Stretch_1_1_16Bits(LPBYTE lpSrc, LPBYTE lpDst, int SrcXE, int DstXE, int x_fract);
+void X_Stretch_1_2_16Bits(LPBYTE lpSrc, LPBYTE lpDst, int SrcXE, int DstXE, int x_fract);
+void X_Stretch_1_N_16Bits(LPBYTE lpSrc, LPBYTE lpDst, int SrcXE, int DstXE, int x_fract);
+void X_Stretch_N_1_16Bits(LPBYTE lpSrc, LPBYTE lpDst, int SrcXE, int DstXE, int x_fract);
+
+void X_Stretch_1_1_24Bits(LPBYTE lpSrc, LPBYTE lpDst, int SrcXE, int DstXE, int x_fract);
+void X_Stretch_1_N_24Bits(LPBYTE lpSrc, LPBYTE lpDst, int SrcXE, int DstXE, int x_fract);
+void X_Stretch_N_1_24Bits(LPBYTE lpSrc, LPBYTE lpDst, int SrcXE, int DstXE, int x_fract);
+
+void X_Stretch_1_1_32Bits(LPBYTE lpSrc, LPBYTE lpDst, int SrcXE, int DstXE, int x_fract);
+void X_Stretch_1_N_32Bits(LPBYTE lpSrc, LPBYTE lpDst, int SrcXE, int DstXE, int x_fract);
+void X_Stretch_N_1_32Bits(LPBYTE lpSrc, LPBYTE lpDst, int SrcXE, int DstXE, int x_fract);
+
+
+/*
+* Y_Stretch_* functions copy DstYE scanlines (using
+* an X_FUNC to copy each scanline) omitting or duplicating scanlines to
+* fit the destination extent. Pick a Y_ depending on the ratio
+* (1:N, N:1...)
+*/
+
+void Y_Stretch_1_N(LPBYTE lpSrc, LPBYTE lpDst, int SrcXE,int SrcYE, int DstXE,
+ int DstYE, int SrcWidth, int DstWidth, int x_fract,
+ X_FUNC x_func, int nBits);
+
+void Y_Stretch_N_1(LPBYTE lpSrc, LPBYTE lpDst, int SrcXE,int SrcYE, int DstXE,
+ int DstYE, int SrcWidth, int DstWidth, int x_fract,
+ X_FUNC x_func);
+
+/*
+* special case y-stretch functions for 1:2 in both dimensions for 8 and 16 bits
+* takes no X_FUNC arg. Will do entire stretch.
+*/
+void Stretch_1_2_8Bits(LPBYTE lpSrc, LPBYTE lpDst, int SrcXE,int SrcYE, int DstXE,
+ int DstYE, int SrcWidth, int DstWidth, int x_fract);
+
+
+void Stretch_1_2_16Bits(LPBYTE lpSrc, LPBYTE lpDst, int SrcXE,int SrcYE, int DstXE,
+ int DstYE, int SrcWidth, int DstWidth, int x_fract);
+
+/* straight copy of one scanline of count bytes */
+void X_CopyScanline(LPBYTE lpSrc, LPBYTE lpDst, int count);
+
+#endif //RESIZER_H
diff --git a/tinyDSHOW/include/tinydshow/VideoDisplayName.h b/tinyDSHOW/include/tinydshow/VideoDisplayName.h
new file mode 100644
index 0000000..65044db
--- /dev/null
+++ b/tinyDSHOW/include/tinydshow/VideoDisplayName.h
@@ -0,0 +1,47 @@
+/*
+* Copyright (C) 2009-2010 Mamadou Diop.
+*
+* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
+*
+* This file is part of Open Source Doubango Framework.
+*
+* DOUBANGO is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* DOUBANGO is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with DOUBANGO.
+*
+*/
+#ifndef TINYDSHOW_VIDEODISPLAYNAME_H
+#define TINYDSHOW_VIDEODISPLAYNAME_H
+
+#include "tinydshow_config.h"
+
+#include <string>
+
+class VideoDisplayName
+{
+public:
+ VideoDisplayName() {}
+
+ VideoDisplayName(std::string name, std::string description);
+
+ std::string getName() const;
+
+ std::string getDescription() const;
+
+ int operator==( const VideoDisplayName &dev ) const;
+
+private:
+ std::string name;
+ std::string description;
+};
+
+#endif /* TINYDSHOW_VIDEODISPLAYNAME_H */
diff --git a/tinyDSHOW/include/tinydshow/VideoFrame.h b/tinyDSHOW/include/tinydshow/VideoFrame.h
new file mode 100644
index 0000000..8722083
--- /dev/null
+++ b/tinyDSHOW/include/tinydshow/VideoFrame.h
@@ -0,0 +1,108 @@
+/*
+* Copyright (C) 2009-2010 Mamadou Diop.
+*
+* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
+*
+* This file is part of Open Source Doubango Framework.
+*
+* DOUBANGO is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* DOUBANGO is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with DOUBANGO.
+*
+*/
+#ifndef VIDEOFRAME_H
+#define VIDEOFRAME_H
+
+// Define supported video formats
+typedef enum _VIDEOFORMAT
+{
+ VIDEOFORMAT_NULL = 0, // 0 x 0 : Null
+ VIDEOFORMAT_SQCIF, // 128 x 96 : SQCIF
+ VIDEOFORMAT_QCIF, // 176 x 144 : QCIF
+ VIDEOFORMAT_QVGA, // 320 x 240 : QVGA
+ VIDEOFORMAT_CIF, // 352 x 288 : CIF
+ VIDEOFORMAT_VGA, // 640 x 480 : VGA
+ VIDEOFORMAT_4CIF, // 704 x 576 : 4CIF
+ VIDEOFORMAT_SVGA, // 800 x 600 : SVGA
+ VIDEOFORMAT_XGA, // 1024 x 768 : XGA
+ VIDEOFORMAT_SXGA, // 1280 x 1024 : SXGA
+ VIDEOFORMAT_16CIF, // 1408 x 1152 : 16CIF
+} VIDEOFORMAT;
+
+
+// Macro to convert a video format to its size
+#define VIDEOFORMAT_TO_SIZE(format, width, height) \
+ switch(format) \
+ { \
+ case VIDEOFORMAT_SQCIF: width = 128; height = 96; break; \
+ case VIDEOFORMAT_QCIF: width = 176; height = 144; break; \
+ case VIDEOFORMAT_QVGA: width = 320; height = 240; break; \
+ case VIDEOFORMAT_CIF: width = 352; height = 288; break; \
+ case VIDEOFORMAT_VGA: width = 640; height = 480; break; \
+ case VIDEOFORMAT_4CIF: width = 704; height = 576; break; \
+ case VIDEOFORMAT_SVGA: width = 800; height = 600; break; \
+ case VIDEOFORMAT_XGA: width = 1024; height = 768; break; \
+ case VIDEOFORMAT_SXGA: width = 1280; height = 1024; break; \
+ case VIDEOFORMAT_16CIF: width = 1408; height = 1152; break; \
+ case VIDEOFORMAT_NULL: \
+ default: width = 0; height = 0; break; \
+ } \
+
+
+// Macro to get a video format from its size
+#define SIZE_TO_VIDEOFORMAT(width, height, format) \
+ if ((width == 128) && (height = 96)) format = VIDEOFORMAT_SQCIF; \
+ else if ((width == 176) && (height = 144)) format = VIDEOFORMAT_QCIF; \
+ else if ((width == 320) && (height = 240)) format = VIDEOFORMAT_QVGA; \
+ else if ((width == 352) && (height = 288)) format = VIDEOFORMAT_CIF; \
+ else if ((width == 640) && (height = 480)) format = VIDEOFORMAT_VGA; \
+ else if ((width == 704) && (height = 576)) format = VIDEOFORMAT_4CIF; \
+ else if ((width == 800) && (height = 600)) format = VIDEOFORMAT_SVGA; \
+ else if ((width == 1024) && (height = 768)) format = VIDEOFORMAT_XGA; \
+ else if ((width == 1280) && (height = 1024)) format = VIDEOFORMAT_SXGA; \
+ else if ((width == 1408) && (height = 1152)) format = VIDEOFORMAT_16CIF; \
+ else format = VIDEOFORMAT_NULL; \
+
+
+// Constants for consumer and producer Ids
+#define GRABBER_VIDEO_ID 0x1FFFFFFF
+#define REMOTE_VIDEO_ID 0x2FFFFFFF
+
+
+class VideoFrame
+{
+public:
+ VideoFrame() { this->data = NULL; };
+ virtual ~VideoFrame() { if(this->data) { this->data = NULL;} };
+
+ int getWidth() { return this->width; };
+ int getHeight() { return this->height; };
+ int getBitsPerPixel() { return this->bpp; };
+ int getTotalBits () { return this->width * this->height * (this->bpp/8); };
+ void* getData() { return this->data; };
+
+ void setWidth(int width_) { this->width = width_; };
+ void setHeight(int height_) { this->height = height_; };
+ void setBitsPerPixel( int bpp_) { this->bpp = bpp_; };
+ void setData( void* data_) { this->data = data_; };
+
+ VIDEOFORMAT getSize();
+ void setSize(VIDEOFORMAT format);
+
+private:
+ void *data;
+ int width;
+ int height;
+ int bpp;
+};
+
+#endif /* VIDEOFRAME_H */
diff --git a/tinyDSHOW/include/tinydshow/VideoGrabberName.h b/tinyDSHOW/include/tinydshow/VideoGrabberName.h
new file mode 100644
index 0000000..5a2344c
--- /dev/null
+++ b/tinyDSHOW/include/tinydshow/VideoGrabberName.h
@@ -0,0 +1,47 @@
+/*
+* Copyright (C) 2009-2010 Mamadou Diop.
+*
+* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
+*
+* This file is part of Open Source Doubango Framework.
+*
+* DOUBANGO is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* DOUBANGO is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with DOUBANGO.
+*
+*/
+#ifndef TINYDSHOW_VIDEOGRABBERNAME_H
+#define TINYDSHOW_VIDEOGRABBERNAME_H
+
+#include "tinydshow_config.h"
+
+#include<string>
+
+class VideoGrabberName
+{
+public:
+ VideoGrabberName() {}
+
+ VideoGrabberName(std::string name, std::string description);
+
+ std::string getName() const;
+
+ std::string getDescription() const;
+
+ int operator==( const VideoGrabberName &dev ) const;
+
+private:
+ std::string name;
+ std::string description;
+};
+
+#endif /* TINYDSHOW_VIDEOGRABBERNAME_H */
diff --git a/tinyDSHOW/include/tinydshow/plugin/DSConsumer.h b/tinyDSHOW/include/tinydshow/plugin/DSConsumer.h
new file mode 100644
index 0000000..36fb413
--- /dev/null
+++ b/tinyDSHOW/include/tinydshow/plugin/DSConsumer.h
@@ -0,0 +1,35 @@
+/*
+* Copyright (C) 2009-2010 Mamadou Diop.
+*
+* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
+*
+* This file is part of Open Source Doubango Framework.
+*
+* DOUBANGO is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* DOUBANGO is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with DOUBANGO.
+*
+*/
+#ifndef DSCONSUMER_H
+#define DSCONSUMER_H
+
+#include <tinydshow_config.h>
+
+#include "tinymedia/tmedia_consumer.h"
+
+TDSHOW_BEGIN_DECLS
+
+TINYDSHOW_GEXTERN const tmedia_consumer_plugin_def_t *tdshow_consumer_plugin_def_t;
+
+TDSHOW_END_DECLS
+
+#endif /* DSCONSUMER_H */
diff --git a/tinyDSHOW/include/tinydshow/plugin/DSProducer.h b/tinyDSHOW/include/tinydshow/plugin/DSProducer.h
new file mode 100644
index 0000000..6af7e79
--- /dev/null
+++ b/tinyDSHOW/include/tinydshow/plugin/DSProducer.h
@@ -0,0 +1,35 @@
+/*
+* Copyright (C) 2009-2010 Mamadou Diop.
+*
+* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
+*
+* This file is part of Open Source Doubango Framework.
+*
+* DOUBANGO is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* DOUBANGO is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with DOUBANGO.
+*
+*/
+#ifndef DSPRODUCER_H
+#define DSPRODUCER_H
+
+#include <tinydshow_config.h>
+
+#include "tinymedia/tmedia_producer.h"
+
+TDSHOW_BEGIN_DECLS
+
+TINYDSHOW_GEXTERN const tmedia_producer_plugin_def_t *tdshow_producer_plugin_def_t;
+
+TDSHOW_END_DECLS
+
+#endif /* DSPRODUCER_H */
OpenPOWER on IntegriCloud