Commit e239e001 authored by Ghislain MARY's avatar Ghislain MARY
Browse files

Implement FPS getter in the Windows camera capture filter.

parent 2aef0fdd
......@@ -485,6 +485,9 @@ public:
void setFps(float fps){
_fps=fps;
}
float getFps(){
return _fps;
}
MSPixFmt getPixFmt(){
if (!_ready) createDshowGraph(); /* so that _pixfmt is updated*/
return _pixfmt;
......@@ -506,6 +509,7 @@ private:
float _start_time;
int _frame_count;
MSPixFmt _pixfmt;
MSAverageFPS avgfps;
SharedComPtr< IGraphBuilder > _graphBuilder;
SharedComPtr< IBaseFilter > _source;
SharedComPtr< IBaseFilter > _nullRenderer;
......@@ -870,6 +874,7 @@ SharedComPtr< IPin > DSCapture::findPin( SharedComPtr<IBaseFilter> &filter, PIN_
static void dscap_preprocess(MSFilter * obj){
DSCapture *s=(DSCapture*)obj->data;
ms_average_fps_init(&s->avgfps,"msdscap: fps=%f");
s->startDshowGraph();
}
......@@ -894,6 +899,7 @@ static void dscap_process(MSFilter * obj){
timestamp=(uint32_t)(obj->ticker->time*90);/* rtp uses a 90000 Hz clockrate for video*/
mblk_set_timestamp_info(om,timestamp);
ms_queue_put(obj->outputs[0],om);
ms_average_fps_update(&s->avgfps,obj->ticker->time);
}
}
}
......@@ -904,6 +910,16 @@ static int dscap_set_fps(MSFilter *f, void *arg){
return 0;
}
static int dscap_get_fps(MSFilter *f, void *arg){
DSCapture *s=(DSCapture*)f->data;
if (f->ticker){
*((float*)arg)=ms_average_fps_get(&s->avgfps);
} else {
*((float*)arg)=s->getFps();
}
return 0;
}
static int dscap_get_pix_fmt(MSFilter *f,void *arg){
DSCapture *s=(DSCapture*)f->data;
*((MSPixFmt*)arg)=s->getPixFmt();
......
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