AVFormatContextPtr dt_av_create_output_format_context(const char * _FormatName, const char * _Filename)
{
    AVOutputFormat * outputFormat = dt_av_guess_format(_FormatName, NULL);
    
    AVFormatContext * outputCtx = NULL;
    int dt_err = avformat_alloc_output_context2(&outputCtx, outputFormat, NULL, _Filename);
    FF_CHECK_ERR(dt_err);

    if (FF_ERR(dt_err))
    {
        //// TODO!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1 Error
        DT_THROW_AVERROR( errors::create_file() , dt_err, "avformat_alloc_output_context2");
        return AVFormatContextPtr((AVFormatContext*)NULL);
    }

    AVFormatContextPtr outputCtxPtr( outputCtx, details::_AVOutputFormatContextDestruct() );

    if (!(outputCtx->oformat->flags & AVFMT_NOFILE)) 
    {
        dt_err = avio_open(&outputCtx->pb, _Filename, AVIO_FLAG_WRITE);
        if (FF_ERR(dt_err))
        {
            //// TODO!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1 Error
            DT_THROW_AVERROR( errors::create_file() , dt_err, "avformat_alloc_output_context2");
            return AVFormatContextPtr((AVFormatContext*)NULL);
        }
    }

    return outputCtxPtr;
}
Exemple #2
0
bool joypad::config_force_feedback(io_service_t p_service) {

	HRESULT ret = FFCreateDevice(p_service, &ff_device);
	ERR_FAIL_COND_V(ret != FF_OK, false);

	ret = FFDeviceSendForceFeedbackCommand(ff_device, FFSFFC_RESET);
	FF_ERR();

	ret = FFDeviceSendForceFeedbackCommand(ff_device, FFSFFC_SETACTUATORSON);
	FF_ERR();

	if (check_ff_features()) {
		ret = FFDeviceCreateEffect(ff_device, kFFEffectType_ConstantForce_ID, &ff_effect, &ff_object);
		FF_ERR();
		return true;
	}
	FFReleaseDevice(ff_device);
	return false;
}