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

media / gpu / vaapi / test / scoped_va_config.h [blame]

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

#ifndef MEDIA_GPU_VAAPI_TEST_SCOPED_VA_CONFIG_H_
#define MEDIA_GPU_VAAPI_TEST_SCOPED_VA_CONFIG_H_

#include <va/va.h>

#include "base/memory/raw_ref.h"

namespace media {
namespace vaapi_test {

class VaapiDevice;

// This class holds configuration information for a VaapiDevice. The VaapiDevice
// must be externally guaranteed to outlive the ScopedVAConfig.
class ScopedVAConfig {
 public:
  // Initializes the VA handles for a VAConfig with |profile| and
  // |va_rt_format|. Requires an initialized |device|. Success is ASSERTed.
  ScopedVAConfig(const VaapiDevice& device,
                 VAProfile profile,
                 unsigned int va_rt_format);

  ScopedVAConfig(const ScopedVAConfig&) = delete;
  ScopedVAConfig& operator=(const ScopedVAConfig&) = delete;
  ~ScopedVAConfig();

  VAConfigID id() const { return config_id_; }
  VAProfile profile() const { return profile_; }
  unsigned int va_rt_format() const { return va_rt_format_; }

 private:
  // Non-owned.
  const raw_ref<const VaapiDevice> device_;

  VAConfigID config_id_;
  const VAProfile profile_;
  const unsigned int va_rt_format_;
};

}  // namespace vaapi_test
}  // namespace media

#endif  // MEDIA_GPU_VAAPI_TEST_SCOPED_VA_CONFIG_H_