Commit 1264a7ab authored by Ghislain MARY's avatar Ghislain MARY

Reorganization of sources to introduce video rendering.

parent cde267fa
mswp8cap - Windows Phone 8 Video Capture plugin for mediastreamer2.
mswp8vid - Windows Phone 8 Video plugin for mediastreamer2.
Compile on Windows using Visual Studio 2012.
This diff is collapsed.
/*
mswp8cap_reader.h
mswp8cap.h
mediastreamer2 library - modular sound and video processing and streaming
Windows Audio Session API sound card plugin for mediastreamer2
......@@ -37,10 +37,10 @@ namespace mediastreamer2
{
class MSWP8CapSampleSink;
class MSWP8CapReader {
class MSWP8Cap {
public:
MSWP8CapReader();
virtual ~MSWP8CapReader();
MSWP8Cap();
virtual ~MSWP8Cap();
int activate();
int deactivate();
......@@ -59,7 +59,7 @@ namespace mediastreamer2
static void detectCameras(MSWebCamManager *manager, MSWebCamDesc *desc);
private:
void MSWP8CapReader::bitstreamToMsgb(uint8_t *encoded_buf, size_t size, MSQueue *nalus);
void bitstreamToMsgb(uint8_t *encoded_buf, size_t size, MSQueue *nalus);
bool selectBestVideoSize();
void configure();
......@@ -89,7 +89,7 @@ namespace mediastreamer2
: public Microsoft::WRL::RuntimeClass<Microsoft::WRL::RuntimeClassFlags<Microsoft::WRL::RuntimeClassType::ClassicCom>, ICameraCaptureSampleSink>
{
public:
STDMETHODIMP RuntimeClassInitialize(MSWP8CapReader *reader) {
STDMETHODIMP RuntimeClassInitialize(MSWP8Cap *reader) {
m_dwSampleCount = 0;
m_reader = reader;
return S_OK;
......@@ -108,7 +108,7 @@ namespace mediastreamer2
private:
DWORD m_dwSampleCount;
MSWP8CapReader *m_reader;
MSWP8Cap *m_reader;
};
}
This diff is collapsed.
/*
mswp8vid.cpp
mediastreamer2 library - modular sound and video processing and streaming
Windows Audio Session API sound card plugin for mediastreamer2
Copyright (C) 2010-2013 Belledonne Communications, Grenoble, France
This program 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 2
of the License, or (at your option) any later version.
This program 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 this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "mediastreamer2/msfilter.h"
#include "mediastreamer2/msvideo.h"
#include "mediastreamer2/mswebcam.h"
#include "mswp8cap.h"
using namespace mediastreamer2;
/******************************************************************************
* Methods to (de)initialize and run the WP8 Video capture filter *
*****************************************************************************/
static void ms_wp8cap_read_init(MSFilter *f) {
MSWP8Cap *r = new MSWP8Cap();
f->data = r;
}
static void ms_wp8cap_read_preprocess(MSFilter *f) {
MSWP8Cap *r = static_cast<MSWP8Cap *>(f->data);
r->activate();
}
static void ms_wp8cap_read_process(MSFilter *f) {
MSWP8Cap *r = static_cast<MSWP8Cap *>(f->data);
if (!r->isStarted()) {
r->start();
}
r->feed(f);
}
static void ms_wp8cap_read_postprocess(MSFilter *f) {
MSWP8Cap *r = static_cast<MSWP8Cap *>(f->data);
r->stop();
r->deactivate();
}
static void ms_wp8cap_read_uninit(MSFilter *f) {
MSWP8Cap *r = static_cast<MSWP8Cap *>(f->data);
delete r;
}
/******************************************************************************
* Methods to configure the Windows Phone 8 Video capture filter *
*****************************************************************************/
static int ms_wp8cap_set_fps(MSFilter *f, void *arg) {
MSWP8Cap *r = static_cast<MSWP8Cap *>(f->data);
r->setFps(*((int*)arg));
return 0;
}
static int ms_wp8cap_get_pix_fmt(MSFilter *f, void *arg) {
MS_UNUSED(f);
MSPixFmt *fmt = static_cast<MSPixFmt *>(arg);
*fmt = MS_PIX_FMT_UNKNOWN;
return 0;
}
static int ms_wp8cap_set_vsize(MSFilter *f, void *arg) {
MSWP8Cap *r = static_cast<MSWP8Cap *>(f->data);
MSVideoSize *vs = static_cast<MSVideoSize *>(arg);
r->setVideoSize(*vs);
return 0;
}
static int ms_wp8cap_get_vsize(MSFilter *f, void *arg) {
MSWP8Cap *r = static_cast<MSWP8Cap *>(f->data);
MSVideoSize *vs = static_cast<MSVideoSize *>(arg);
*vs = r->getVideoSize();
return 0;
}
static MSFilterMethod ms_wp8cap_read_methods[] = {
{ MS_FILTER_SET_FPS, ms_wp8cap_set_fps },
{ MS_FILTER_GET_PIX_FMT, ms_wp8cap_get_pix_fmt },
{ MS_FILTER_SET_VIDEO_SIZE, ms_wp8cap_set_vsize },
{ MS_FILTER_GET_VIDEO_SIZE, ms_wp8cap_get_vsize },
{ 0, NULL }
};
/******************************************************************************
* Definition of the Windows Phone 8 Video Capture filter *
*****************************************************************************/
#define MS_WP8CAP_READ_ID MS_FILTER_PLUGIN_ID
#define MS_WP8CAP_READ_NAME "MSWP8CapRead"
#define MS_WP8CAP_READ_DESCRIPTION "Windows Phone 8 Video capture"
#define MS_WP8CAP_READ_CATEGORY MS_FILTER_OTHER
#define MS_WP8CAP_READ_ENC_FMT NULL
#define MS_WP8CAP_READ_NINPUTS 0
#define MS_WP8CAP_READ_NOUTPUTS 1
#define MS_WP8CAP_READ_FLAGS 0
#ifndef _MSC_VER
MSFilterDesc ms_wp8cap_read_desc = {
.id = MS_WP8CAP_READ_ID,
.name = MS_WP8CAP_READ_NAME,
.text = MS_WP8CAP_READ_DESCRIPTION,
.category = MS_WP8CAP_READ_CATEGORY,
.enc_fmt = MS_WP8CAP_READ_ENC_FMT,
.ninputs = MS_WP8CAP_READ_NINPUTS,
.noutputs = MS_WP8CAP_READ_NOUTPUTS,
.init = ms_wp8cap_read_init,
.preprocess = ms_wp8cap_read_preprocess,
.process = ms_wp8cap_read_process,
.postprocess = ms_wp8cap_read_postprocess,
.uninit = ms_wp8cap_read_uninit,
.methods = ms_wp8cap_read_methods,
.flags = MS_WP8CAP_READ_FLAGS
};
#else
MSFilterDesc ms_wp8cap_read_desc = {
MS_WP8CAP_READ_ID,
MS_WP8CAP_READ_NAME,
MS_WP8CAP_READ_DESCRIPTION,
MS_WP8CAP_READ_CATEGORY,
MS_WP8CAP_READ_ENC_FMT,
MS_WP8CAP_READ_NINPUTS,
MS_WP8CAP_READ_NOUTPUTS,
ms_wp8cap_read_init,
ms_wp8cap_read_preprocess,
ms_wp8cap_read_process,
ms_wp8cap_read_postprocess,
ms_wp8cap_read_uninit,
ms_wp8cap_read_methods,
MS_WP8CAP_READ_FLAGS
};
#endif
MS_FILTER_DESC_EXPORT(ms_wp8cap_read_desc)
static void ms_wp8cap_detect(MSWebCamManager *m);
static MSFilter *ms_wp8cap_create_reader(MSWebCam *cam);
static MSWebCamDesc ms_wp8cap_desc = {
"MSWP8Cap",
ms_wp8cap_detect,
NULL,
ms_wp8cap_create_reader,
NULL
};
static void ms_wp8cap_detect(MSWebCamManager *m) {
MSWP8Cap::detectCameras(m, &ms_wp8cap_desc);
}
static MSFilter *ms_wp8cap_create_reader(MSWebCam *cam) {
MSFilter *f = ms_filter_new_from_desc(&ms_wp8cap_read_desc);
MSWP8Cap *r = static_cast<MSWP8Cap *>(f->data);
r->setCameraLocation((uint32)cam->data);
return f;
}
#ifdef _MSC_VER
#define MS_PLUGIN_DECLARE(type) extern "C" __declspec(dllexport) type
#else
#define MS_PLUGIN_DECLARE(type) extern "C" type
#endif
MS_PLUGIN_DECLARE(void) libmswp8vid_init(void) {
MSWebCamManager *manager = ms_web_cam_manager_get();
ms_web_cam_manager_register_desc(manager, &ms_wp8cap_desc);
ms_message("libmswp8vid plugin loaded");
}

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Express 2012 for Windows Phone
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mswp8cap", "mswp8cap\mswp8cap.vcxproj", "{0565952A-EA62-46A2-8261-F5B4B490DA42}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mswp8vid", "mswp8vid\mswp8vid.vcxproj", "{0565952A-EA62-46A2-8261-F5B4B490DA42}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mediastreamer2", "..\..\mediastreamer2\build\vsx\mediastreamer2\mediastreamer2\mediastreamer2.vcxproj", "{027BAD0E-9179-48C1-9733-7AA7E2C2EC70}"
ProjectSection(ProjectDependencies) = postProject
......
......@@ -20,10 +20,10 @@
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{0565952a-ea62-46a2-8261-f5b4b490da42}</ProjectGuid>
<RootNamespace>mswp8cap</RootNamespace>
<RootNamespace>mswp8vid</RootNamespace>
<DefaultLanguage>en-US</DefaultLanguage>
<MinimumVisualStudioVersion>11.0</MinimumVisualStudioVersion>
<ProjectName>libmswp8cap</ProjectName>
<ProjectName>libmswp8vid</ProjectName>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
......@@ -178,14 +178,14 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\mswp8vid.cpp" />
<ClCompile Include="..\..\mswp8cap.cpp" />
<ClCompile Include="..\..\mswp8cap_reader.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\mswp8cap_reader.h" />
<ClInclude Include="..\..\mswp8cap.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsPhone\v$(TargetPlatformVersion)\Microsoft.Cpp.WindowsPhone.$(TargetPlatformVersion).targets" Condition="'$(Platform)'=='ARM'" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
\ No newline at end of file
</Project>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment