<commit_before>/****************************************************************************
 *
 *   (c) 2009-2019 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
 *
 * QGroundControl is licensed according to the terms in the file
 * COPYING.md in the root of the source code directory.
 *
 ****************************************************************************/

#include "CustomVideoManager.h"
#include "MultiVehicleManager.h"
#include "CustomCameraManager.h"
#include "CustomCameraControl.h"

//-----------------------------------------------------------------------------
CustomVideoManager::CustomVideoManager(QGCApplication* app, QGCToolbox* toolbox)
    : VideoManager(app, toolbox)
{
}

//-----------------------------------------------------------------------------
void
CustomVideoManager::_updateSettings()
{
    if(!_videoSettings || !_videoReceiver)
        return;
    //-- Check encoding
    if(_activeVehicle && _activeVehicle->dynamicCameras()) {
        CustomCameraControl* pCamera = dynamic_cast<CustomCameraControl*>(_activeVehicle->dynamicCameras()->currentCameraInstance());
        if(pCamera) {
            Fact *fact = pCamera->videoEncoding();
            if (fact) {
                _videoReceiver->setVideoDecoder(static_cast<VideoReceiver::VideoEncoding>(fact->rawValue().toInt()));
            }
        }
    }
    VideoManager::_updateSettings();
}
<commit_msg>CustomVideoManager: Use qobject_cast<commit_after>/****************************************************************************
 *
 *   (c) 2009-2019 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
 *
 * QGroundControl is licensed according to the terms in the file
 * COPYING.md in the root of the source code directory.
 *
 ****************************************************************************/

#include "CustomVideoManager.h"
#include "MultiVehicleManager.h"
#include "CustomCameraManager.h"
#include "CustomCameraControl.h"

//-----------------------------------------------------------------------------
CustomVideoManager::CustomVideoManager(QGCApplication* app, QGCToolbox* toolbox)
    : VideoManager(app, toolbox)
{
}

//-----------------------------------------------------------------------------
void
CustomVideoManager::_updateSettings()
{
    if(!_videoSettings || !_videoReceiver)
        return;
    //-- Check encoding
    if(_activeVehicle && _activeVehicle->dynamicCameras()) {
        auto* pCamera = qobject_cast<CustomCameraControl*>(_activeVehicle->dynamicCameras()->currentCameraInstance());
        if(pCamera) {
            Fact *fact = pCamera->videoEncoding();
            if (fact) {
                _videoReceiver->setVideoDecoder(static_cast<VideoReceiver::VideoEncoding>(fact->rawValue().toInt()));
            }
        }
    }
    VideoManager::_updateSettings();
}

{'fraction_non_alphanumeric': 0.3143160878809355, 'fraction_numerical': 0.005669737774627924, 'mean_word_length': 2.6425806451612903, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5512891', 'n_tokens_mistral': 690, 'n_tokens_neox': 659, 'n_words': 120}