1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43
   44
   45
   46
   47
   48
   49
   50
   51
   52
   53
   54
   55
   56
   57
   58
   59
   60
   61
   62
   63
   64
   65
   66
   67
   68
   69
   70
   71
   72
   73
   74
   75
   76
   77
   78
   79
   80
   81
   82
   83
   84
   85
   86
   87
   88
   89
   90
   91
   92
   93

media / cdm / win / test / media_foundation_clear_key_content_enabler.cc [blame]

// Copyright 2023 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "media/cdm/win/test/media_foundation_clear_key_content_enabler.h"

#include <mferror.h>

#include "base/notreached.h"
#include "media/base/win/mf_helpers.h"
#include "media/cdm/win/test/media_foundation_clear_key_guids.h"

namespace media {

MediaFoundationClearKeyContentEnabler::MediaFoundationClearKeyContentEnabler() =
    default;

MediaFoundationClearKeyContentEnabler::
    ~MediaFoundationClearKeyContentEnabler() {
  DVLOG_FUNC(1);
}

HRESULT MediaFoundationClearKeyContentEnabler::RuntimeClassInitialize() {
  DVLOG_FUNC(1);
  return S_OK;
}

STDMETHODIMP MediaFoundationClearKeyContentEnabler::AutomaticEnable() {
  DVLOG_FUNC(3);

  // API not used.
  NOTIMPLEMENTED();
  return E_NOTIMPL;
}

STDMETHODIMP MediaFoundationClearKeyContentEnabler::Cancel() {
  DVLOG_FUNC(3);

  // API not used.
  NOTIMPLEMENTED();
  return E_NOTIMPL;
}

STDMETHODIMP MediaFoundationClearKeyContentEnabler::GetEnableData(
    _Outptr_result_bytebuffer_(*data_size) BYTE** data,
    _Out_ DWORD* data_size) {
  DVLOG_FUNC(3);

  // Does not support this method of content enabling with EME.
  return MF_E_NOT_AVAILABLE;
}

STDMETHODIMP MediaFoundationClearKeyContentEnabler::GetEnableURL(
    _Out_writes_bytes_(*url_size) LPWSTR* url,
    _Out_ DWORD* url_size,
    _Inout_ MF_URL_TRUST_STATUS* trust_status) {
  DVLOG_FUNC(3);

  // Does not support this method of content enabling with EME.
  return MF_E_NOT_AVAILABLE;
}

STDMETHODIMP MediaFoundationClearKeyContentEnabler::IsAutomaticSupported(
    _Out_ BOOL* automatic) {
  if (!automatic) {
    return E_INVALIDARG;
  }

  *automatic = FALSE;
  return S_OK;
}

STDMETHODIMP MediaFoundationClearKeyContentEnabler::MonitorEnable() {
  DVLOG_FUNC(3);

  // API not used.
  NOTIMPLEMENTED();
  return E_NOTIMPL;
}

STDMETHODIMP MediaFoundationClearKeyContentEnabler::GetEnableType(
    _Out_ GUID* type) {
  DVLOG_FUNC(1);

  if (!type) {
    return E_INVALIDARG;
  }

  *type = MEDIA_FOUNDATION_CLEARKEY_GUID_CONTENT_ENABLER_TYPE;
  return S_OK;
}

}  // namespace media