Repository: xbmc/xbmc
File: xbmc/cores/VideoPlayer/MediaPipelineWebOS.cpp (C++)

Code before:

  if (!videoHint.width || !videoHint.height)
  {
    CLog::LogF(LOGERROR, "{}", "null size, cannot handle");
    return false;
  }

  CLog::LogF(LOGDEBUG,
             "hints: Width {} x Height {}, Fpsrate {} / Fpsscale {}, "
             "CodecID {}, Level {}, Profile {}, PTS_invalid {}, Tag {}, Extradata-Size: {}",
             videoHint.width, videoHint.height, videoHint.fpsrate, videoHint.fpsscale,
             videoHint.codec, videoHint.level, videoHint.profile, videoHint.ptsinvalid,
             videoHint.codec_tag, videoHint.extradata.GetSize());

  if (!ms_codecMap.contains(videoHint.codec))
  {
    CLog::LogF(LOGDEBUG, "Unsupported video hints.codec({})", videoHint.codec);
    return false;
  }

  SetupBitstreamConverter(videoHint);
  CVariant& contents = p["option"]["externalStreamingInfo"]["contents"];
  if (videoHint.hdrType == StreamHdrType::HDR_TYPE_DOLBYVISION)
  {
    contents["DolbyHdrInfo"]["encryptionType"] =
        videoHint.cryptoSession ? "all" : "clear"; //"bl", "el", "all"
    contents["DolbyHdrInfo"]["profileId"] = videoHint.dovi.dv_profile;
    contents["DolbyHdrInfo"]["trackType"] = videoHint.dovi.el_present_flag ? "dual" : "single";
  }

  using namespace KODI::WINDOWING::WAYLAND;
  const auto winSystem = dynamic_cast<CWinSystemWaylandWebOS*>(CServiceBroker::GetWinSystem());
  if (winSystem->SupportsExportedWindow())
  {
    p["option"]["windowId"] = winSystem->GetExportedWindowName();
  }
  else
  {
    auto buffer = static_cast<CStarfishVideoBuffer*>(m_picture.videoBuffer);
    const std::unique_ptr<AcbHandle>& acb = buffer->CreateAcbHandle();
    if (acb->Id())
    {
      if (!AcbAPI_initialize(acb->Id(), PLAYER_TYPE_MSE, getenv("APPID"), &AcbCallback))
      {
        buffer->ResetAcbHandle();
      }
    }
  }

  p["option"]["appId"] = CCompileInfo::GetPackage();
  contents["codec"]["video"] = ms_codecMap.at(videoHint.codec).name.data();

Review comment (suggestion):
```suggestion
    contents["DolbyHdrInfo"]["encryptionType"] = videoHint.cryptoSession ? "all" : "clear";
```

Code after:
  }
  else
  {
    auto buffer = static_cast<CStarfishVideoBuffer*>(m_picture.videoBuffer);
    const std::unique_ptr<AcbHandle>& acb = buffer->CreateAcbHandle();
    if (acb->Id())
    {
      if (!AcbAPI_initialize(acb->Id(), PLAYER_TYPE_MSE, getenv("APPID"), &AcbCallback))
      {
        buffer->ResetAcbHandle();
      }
    }
  }

  p["option"]["appId"] = CCompileInfo::GetPackage();
  contents["codec"]["video"] = std::string(ms_codecMap.at(videoHint.codec).name);

  if (audioHint.codec == AV_CODEC_ID_NONE)
  {
    m_audioCodec = nullptr;
    m_audioEncoder = nullptr;
    m_audioResample = nullptr;
    m_encoderBuffers = nullptr;
    p["option"]["needAudio"] = false;
  }
  else
  {
    contents["codec"]["audio"] = SetupAudio(audioHint, contents);
  }

  if (audioHint.codec == AV_CODEC_ID_EAC3 && audioHint.profile == AV_PROFILE_EAC3_DDP_ATMOS)
    contents["immersive"] = "ATMOS";

  contents["format"] = "RAW";
  p["mediaTransportType"] = "BUFFERSTREAM";
  contents["provider"] = CCompileInfo::GetPackage();
  p["option"]["transmission"]["contentsType"] = "LIVE";
  p["option"]["transmission"]["trickType"] = "client-side";
  p["option"]["seekMode"] = "keep-rate";
  p["option"]["useDroppedFrameEvent"] = true;
  p["option"]["externalStreamingInfo"]["streamQualityInfo"] = true;
  p["option"]["externalStreamingInfo"]["streamQualityInfoNonFlushable"] = true;
  p["option"]["externalStreamingInfo"]["streamQualityInfoCorruptedFrame"] = true;

  CVariant& esInfo = contents["esInfo"];
  esInfo["pauseAtDecodeTime"] = true;
  esInfo["seperatedPTS"] = true;
  esInfo["ptsToDecode"] = m_pts.load().count();
  esInfo["videoWidth"] = videoHint.width;
  esInfo["videoHeight"] = videoHint.height;
  if (videoHint.fpsrate && videoHint.fpsscale)