CasparCG / client

Client software primarily used with the CasparCG Server software for audio and video playout, to control graphics and recording, but it can also be used for other tasks within television broadcast.
https://casparcg.com
GNU General Public License v3.0
278 stars 97 forks source link

OSC, /control/preview not working #297

Closed autimagic closed 6 months ago

autimagic commented 2 years ago

With reference to this conversation, I believe I found a bug: https://casparcgforum.org/t/osc-preview-call/4374

/control/preview doesn't load the item, but pressing F8 on keyboard does.

Thank you in advance <3

amwtech commented 2 years ago

The same lack of action for the preview command happens in client 2.0.9, and when OSC commands are sent via web sockets.

Julusian commented 7 months ago

Duplicate of https://github.com/CasparCG/client/issues/304 Fix is incoming

amwtech commented 7 months ago

Not a duplicate of #304. The OSC Preview command is still faulty as at December build.

amwtech commented 6 months ago

I have examined the code in RundownTreeWidget header and cpp files that implement the OSC controls, and have a list of modifications that enable OSC control of preview. The codebase is well structured, and makes me think that preview control was deliberately not present. My best guess is that this relates to operation of the client in Auto Step mode.

A client configuration tick enables automatic preview of the next item when using the Auto Step mode. If that preview output is also switched by an operator sat at the client screen pushing the F8 key they know why the preview output has changed. If the preview output is remotely controlled via OSC, the operator at the client screen is not aware why their preview monitor updated.

It is possible to interlock the /control/preview OSC address with the Auto Step control mode, enabling remote switching of preview where a client is not set to use preview with Auto Step. However specific OSC address targets such as /control/headline01/preview always switch the preview output (assuming a preview output has been defined).

So my question is "Should OSC controlled preview be enabled?"

If the answer is yes, I will post the list of modifications and try to create a pull request for client 2.3.0-dev.

Andy

amwtech commented 6 months ago

I have created a pull request that enables OSC control of preview. The code blocks OSC operation of /control/preview if the client is set to operate in preview in auto-step. The pull request comment describes how to set the operational mode to "always enabled".

For people building their own versions of the older clients the code changes are listed below. The line numbers after each version number in the comment line are the line numbers before any edits are made. I tested the code on a version 2.0.9 for Windows.

// Changes needed to enable OSC control of Preview

// File: src\Widgets\Rundown\RundownTreeWidget.h
// Insert a new line after: V2.0.9 => line 119      V2.2.0 => line 119      V2.3.0-dev => line 112
   OscSubscription* previewControlSubscription; // Added

// Add a new line after: V2.0.9 => 232      V2.2.0 => line 232      V2.3.0-dev => line 206
   Q_SLOT void previewControlSubscriptionReceived(const QString&, const QList<QVariant>&); // Added line

// File src\Widgets\Rundown\RundownTreeWidget.cpp
// Append text to end of line. V2.0.9 => line 68     V2.2.0 => line 68      V2.3.0-dev => line 68
   previewControlSubscription(NULL),

// Add code block after line: V2.0.9 => line 1737     V2.2.0 => line 1742      V2.3.0-dev => line 1599
   if (this->previewControlSubscription != NULL)
        this->previewControlSubscription->disconnect(); // Disconnect all events.

// Add new code block after line: V2.0.9 => line 1813     V2.2.0 => line 1818      V2.3.0-dev => line 1680
// Note changes in definitions in Global.h change the first line below to:
// QString previewControlFilter = Osc::RUNDOWN_CONTROL_PREVIEW_FILTER;
   QString previewControlFilter = Osc::DEFAULT_RUNDOWN_CONTROL_PREVIEW_FILTER;
   this->previewControlSubscription = new OscSubscription(previewControlFilter, this);
   QObject::connect(this->previewControlSubscription, SIGNAL(subscriptionReceived(const QString&, const QList<QVariant>&)),
                    this, SLOT(previewControlSubscriptionReceived(const QString&, const QList<QVariant>&)));

// Add a new code block after line: V2.0.9 => line 2060     V2.2.0 => line 2065      V2.3.0-dev => line 1927
void RundownTreeWidget::previewControlSubscriptionReceived(const QString& predicate, const QList<QVariant>& arguments)
{
    Q_UNUSED(predicate);

    if (!this->active)
        return;

    if (this->treeWidgetRundown->currentItem() == NULL)
        return;

    if (this->allowRemoteRundownTriggering && arguments.count() > 0 && arguments[0].toInt() > 0) 
        EventManager::getInstance().fireExecuteRundownItemEvent(ExecuteRundownItemEvent(Playout::PlayoutType::Preview, this->treeWidgetRundown->currentItem()));
}

// To use the Auto Step Preview flag to stop pure control preview operating, but leave targetted osc address working change final if() statemet condition to:
if (this->allowRemoteRundownTriggering && arguments.count() > 0 && arguments[0].toInt() > 0 && !this->previewOnAutoStep) 
amwtech commented 6 months ago

@Julusian - Thanks for catching my error where I had not noticed the changes in Global.h. I tested on an older version of client I still require for work with server 2.1.12_NRK.

I am pleased to report that OSC control of preview works as I expect it to do in V2.3.0 RC1. I therefore think this issue can be closed.

Andy