Hi Nigel,
yes. EnableSampleGrabber is set to true.
After switching to Videocapture with codec the OnDShowEvent is fired once.
Here is my code sequence:
//---------------------------------------------------------------------------
this->bVideoMode = !this->bVideoMode;
if(this->bVideoMode)
{
imgView->IO->DShowParams->Disconnect();
btToggleVideoMode->ImageIndex = 7;
//imgView->IO->DShowParams->RenderAudio = false;
imgView->IO->DShowParams->SetVideoCodec(cbVideoCodecs->ItemIndex); <-- XVid
//imgView->IO->DShowParams->VideoCodecQuality = 1;
imgView->IO->DShowParams->FileOutput = "C:\\temp\\testavi1.avi";
this->RunVideo();
}
else
{
imgView->IO->DShowParams->Disconnect();
btToggleVideoMode->ImageIndex = 6;
imgView->IO->DShowParams->SetVideoCodec(-1);
imgView->IO->DShowParams->FileOutput = "";
this->RunVideo();
}
//---------------------------------------------------------------------------
void __fastcall TfmDXCaptureMain::RunVideo(void)
{
this->DisconnectVideo();
this->ConnectVideo();
TIEDSRunResult ret = imgView->IO->DShowParams->Run();
if(ret == iedsSuccess)
{
//Show devicename in caption
}
else if(ret == iedsBusy)
{
//Busy Msg
}
else
{
//Error Msg
}
}
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
void __fastcall TfmDXCaptureMain::ConnectVideo(void)
{
if(!imgView->IO->DShowParams->Connected)
{
//preset videodevice
imgView->IO->DShowParams->SetVideoInput(iSelectedDevice);
imgView->IO->DShowParams->Connect();
//get n set resolution
this->FillResolution();
//reconnect with resolution
imgView->IO->DShowParams->Disconnect();
imgView->IO->DShowParams->SetVideoInput(iSelectedDevice, 0, Video_format_struct[this->iStreamSizeIndex].BitmapWidth, Video_format_struct[this->iStreamSizeIndex].BitmapHeight,
Video_format_struct[this->iStreamSizeIndex].Format, Video_format_struct[this->iStreamSizeIndex].BitRate);
imgView->IO->DShowParams->EnableSampleGrabber = true;
imgView->IO->DShowParams->Connect();
imgView->IO->DShowParams->GetCurrentVideoFormat(this->iCurrentStreamWidth, this->iCurrentStreamHeight, this->asCurrentFormat);
}
}
//---------------------------------------------------------------------------
Thanks for your help.
Best regards
Alex