I can record video in movie shooting mode (Sec. 6.4.3 EDSDK API), but I need to record video and take photo step by step. So I have a question: Is it possible to change video and photo mode using sdk? If yes, which mode should we install on our cameras? And how to do it using SDK? The model of our cameras is Canon eos 650D. In sec 6.4.2 EDSDK API I read to use Live View mode before video record, but it solution doesn't work. I try to use the code below.
#include <QCoreApplication>
#include "EDSDK/Header/EDSDK.h"
#include <Windows.h>
#include <QDebug>
EdsError startLiveview(EdsCameraRef camera)
{
EdsError err = EDS_ERR_OK;
// Get the output device for the live view image
EdsUInt32 device;
err = EdsGetPropertyData(camera, kEdsPropID_Evf_OutputDevice, 0 , sizeof(device), &device );
// PC live view starts by setting the PC as the output device for the live view image.
if(err == EDS_ERR_OK)
{
device |= kEdsEvfOutputDevice_PC;
err = EdsSetPropertyData(camera, kEdsPropID_Evf_OutputDevice, 0 , sizeof(device), &device);
}
return err;
// A property change event notification is issued from the camera if property settings are made successfully.
// Start downloading of the live view image once the property change notification arrives.
}
EdsError endLiveview(EdsCameraRef camera)
{
EdsError err = EDS_ERR_OK;
// Get the output device for the live view image
EdsUInt32 device;
err = EdsGetPropertyData(camera, kEdsPropID_Evf_OutputDevice, 0 , sizeof(device), &device );
// PC live view ends if the PC is disconnected from the live view image output device.
if(err == EDS_ERR_OK)
{
device &= ~kEdsEvfOutputDevice_PC;
err = EdsSetPropertyData(camera, kEdsPropID_Evf_OutputDevice, 0 , sizeof(device), &device);
}
return err;
}
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
EdsError err = EDS_ERR_OK;
EdsCameraRef camera = NULL;
EdsCameraListRef cameraList = NULL;
bool isSDKLoaded = false;
EdsUInt32 count = 0;
err = EdsInitializeSDK();
if(err == EDS_ERR_OK)
{
isSDKLoaded=true ;
}
err = EdsGetCameraList(&cameraList);
// Get number of cameras
if(err== EDS_ERR_OK)
{
err = EdsGetChildCount(cameraList, &count);
if(count == 0)
{
err = EDS_ERR_DEVICE_NOT_FOUND;
}
}
// Get first camera retrieved
if(err == EDS_ERR_OK)
{
err = EdsGetChildAtIndex(cameraList , 0 , &camera);
}
if(err == EDS_ERR_OK)
{
err = EdsOpenSession(camera);
}
EdsUInt32 saveTo = kEdsSaveTo_Camera;
err = EdsSetPropertyData(camera, kEdsPropID_SaveTo, 0, sizeof(saveTo) , &saveTo);
startLiveview(camera);
Sleep(1000);
EdsUInt32 record_start = 4; // Begin movie shooting
err = EdsSetPropertyData(camera, kEdsPropID_Record, 0, sizeof(record_start), &record_start);
qDebug() << err;
Sleep(3000);
EdsUInt32 record_stop = 0; // End movie shooting
err = EdsSetPropertyData(camera, kEdsPropID_Record, 0, sizeof(record_stop), &record_stop);
qDebug() << err;
endLiveview(camera);
Sleep(1000);
// Close session with camera
if(err == EDS_ERR_OK)
{
err = EdsCloseSession(camera);
}
// Release camera
if(camera != NULL)
{
EdsRelease(camera);
}
// Terminate SDK
if(isSDKLoaded)
{
EdsTerminateSDK();
}
return a.exec();
}