Commit 8ab2dbe4 authored by Ghislain MARY's avatar Ghislain MARY

Add missing methods to the Windows Phone 8 video capture filter.

parent d10420a0
......@@ -33,6 +33,7 @@ using namespace mswp8vid;
static const int defaultFps = 15;
static const int defaultBitrate = 384000;
bool MSWP8Cap::smInstantiated = false;
......@@ -40,7 +41,7 @@ bool MSWP8Cap::smInstantiated = false;
MSWP8Cap::MSWP8Cap()
: mIsInitialized(false), mIsActivated(false), mIsStarted(false),
mRfc3984Packer(nullptr), mPackerMode(1), mStartTime(0), mSampleCount(-1), mFps(defaultFps),
mRfc3984Packer(nullptr), mPackerMode(1), mStartTime(0), mSampleCount(-1), mFps(defaultFps), mBitrate(defaultBitrate),
mCameraLocation(CameraSensorLocation::Front),
mDimensions(MS_VIDEO_SIZE_CIF_W, MS_VIDEO_SIZE_CIF_H),
mVideoDevice(nullptr)
......@@ -272,6 +273,11 @@ void MSWP8Cap::setFps(int fps)
}
}
void MSWP8Cap::setBitrate(int bitrate)
{
// TODO
}
MSVideoSize MSWP8Cap::getVideoSize()
{
MSVideoSize vs;
......@@ -304,6 +310,14 @@ void MSWP8Cap::setVideoSize(MSVideoSize vs)
}
}
void MSWP8Cap::requestIdrFrame()
{
if (mIsStarted) {
Platform::Boolean value = true;
mVideoDevice->SetProperty(KnownCameraAudioVideoProperties::H264RequestIdrFrame, value);
}
}
void MSWP8Cap::bitstreamToMsgb(uint8_t *encoded_buf, size_t size, MSQueue *nalus) {
size_t idx = 0;
......
......@@ -52,9 +52,13 @@ namespace mswp8vid
void OnSampleAvailable(ULONGLONG hnsPresentationTime, ULONGLONG hnsSampleDuration, DWORD cbSample, BYTE* pSample);
void setCameraLocation(uint32 location);
int getFps() { return mFps; }
void setFps(int fps);
int getBitrate() { return mBitrate; }
void setBitrate(int bitrate);
MSVideoSize getVideoSize();
void setVideoSize(MSVideoSize vs);
void requestIdrFrame();
static void detectCameras(MSWebCamManager *manager, MSWebCamDesc *desc);
......@@ -75,6 +79,7 @@ namespace mswp8vid
uint64_t mStartTime;
int mSampleCount;
int mFps;
int mBitrate;
HANDLE mStartCompleted;
HANDLE mStopCompleted;
Windows::Phone::Media::Capture::CameraSensorLocation mCameraLocation;
......
......@@ -69,6 +69,12 @@ static void ms_wp8cap_read_uninit(MSFilter *f) {
* Methods to configure the Windows Phone 8 video capture filter *
*****************************************************************************/
static int ms_wp8cap_get_fps(MSFilter *f, void *arg) {
MSWP8Cap *r = static_cast<MSWP8Cap *>(f->data);
*((int *)arg) = r->getFps();
return 0;
}
static int ms_wp8cap_set_fps(MSFilter *f, void *arg) {
MSWP8Cap *r = static_cast<MSWP8Cap *>(f->data);
r->setFps(*((int*)arg));
......@@ -82,6 +88,13 @@ static int ms_wp8cap_get_pix_fmt(MSFilter *f, void *arg) {
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 int ms_wp8cap_set_vsize(MSFilter *f, void *arg) {
MSWP8Cap *r = static_cast<MSWP8Cap *>(f->data);
MSVideoSize *vs = static_cast<MSVideoSize *>(arg);
......@@ -89,18 +102,35 @@ static int ms_wp8cap_set_vsize(MSFilter *f, void *arg) {
return 0;
}
static int ms_wp8cap_get_vsize(MSFilter *f, void *arg) {
static int ms_wp8cap_get_bitrate(MSFilter *f, void *arg) {
MSWP8Cap *r = static_cast<MSWP8Cap *>(f->data);
MSVideoSize *vs = static_cast<MSVideoSize *>(arg);
*vs = r->getVideoSize();
*((int *)arg) = r->getBitrate();
return 0;
}
static int ms_wp8cap_set_bitrate(MSFilter *f, void *arg) {
MSWP8Cap *r = static_cast<MSWP8Cap *>(f->data);
r->setBitrate(*((int *)arg));
return 0;
}
static int ms_wp8cap_req_vfu(MSFilter *f, void *arg) {
MS_UNUSED(arg);
MSWP8Cap *r = static_cast<MSWP8Cap *>(f->data);
r->requestIdrFrame();
return 0;
}
static MSFilterMethod ms_wp8cap_read_methods[] = {
{ MS_FILTER_GET_FPS, ms_wp8cap_get_fps },
{ 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 },
{ MS_FILTER_SET_VIDEO_SIZE, ms_wp8cap_set_vsize },
{ MS_FILTER_GET_BITRATE, ms_wp8cap_get_bitrate },
{ MS_FILTER_SET_BITRATE, ms_wp8cap_set_bitrate },
{ MS_FILTER_REQ_VFU, ms_wp8cap_req_vfu },
{ MS_VIDEO_ENCODER_REQ_VFU, ms_wp8cap_req_vfu },
{ 0, NULL }
};
......
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