Index: content/common/gpu/media/vaapi_wrapper.h |
diff --git a/content/common/gpu/media/vaapi_wrapper.h b/content/common/gpu/media/vaapi_wrapper.h |
index fe53552336badfe6bf46a3d3b624506820bf352f..08c1f012a06baee305afb3181286d3a8f2356993 100644 |
--- a/content/common/gpu/media/vaapi_wrapper.h |
+++ b/content/common/gpu/media/vaapi_wrapper.h |
@@ -45,16 +45,28 @@ class CONTENT_EXPORT VaapiWrapper { |
kEncode, |
}; |
- // |report_error_to_uma_cb| will be called independently from reporting |
- // errors to clients via method return values. |
+ struct ProfileConfig { |
+ media::VideoCodecProfile profile; |
wuchengli
2015/02/03 03:17:33
It should be better to store VaProfile in this cla
henryhsu
2015/02/13 04:01:03
Done.
|
+ CodecMode mode; |
+ gfx::Size max_resolution; |
+ }; |
+ |
+ // Return an instance of VaapiWrapper and initialize by |profile| and |
+ // |mode|. |report_error_to_uma_cb| will be called independently from |
+ // reporting errors to clients via method return values. |
static scoped_ptr<VaapiWrapper> Create( |
CodecMode mode, |
media::VideoCodecProfile profile, |
const base::Closure& report_error_to_uma_cb); |
- // Return the supported encode profiles. |
- static std::vector<media::VideoCodecProfile> GetSupportedEncodeProfiles( |
- const base::Closure& report_error_to_uma_cb); |
+ // Return the supported profiles according to mode. |
+ static std::vector<media::VideoCodecProfile> GetSupportedProfiles( |
wuchengli
2015/02/03 03:17:33
Now that we have to return both profile and resolu
henryhsu
2015/02/13 04:01:03
Done.
|
+ CodecMode mode); |
wuchengli
2015/02/03 03:17:33
No need to add CodecMode parameter in this CL. Dec
henryhsu
2015/02/13 04:01:04
Done.
|
+ |
+ // Return the hardware supported maximum resolution. |
+ static gfx::Size GetCodecMaxResolution( |
+ media::VideoCodecProfile profile, |
+ CodecMode mode); |
~VaapiWrapper(); |
@@ -163,8 +175,7 @@ class CONTENT_EXPORT VaapiWrapper { |
VaapiWrapper(); |
bool Initialize(CodecMode mode, |
- media::VideoCodecProfile profile, |
- const base::Closure& report_error__to_uma_cb); |
+ media::VideoCodecProfile profile); |
void Deinitialize(); |
bool VaInitialize(const base::Closure& report_error_to_uma_cb); |
bool GetSupportedVaProfiles(std::vector<VAProfile>* profiles); |
@@ -172,6 +183,7 @@ class CONTENT_EXPORT VaapiWrapper { |
bool AreAttribsSupported(VAProfile va_profile, |
VAEntrypoint entrypoint, |
const std::vector<VAConfigAttrib>& required_attribs); |
+ bool GetVaCodecMaxResolution(VAConfigID config, gfx::Size* resolution); |
// Destroys a |va_surface| created using CreateUnownedSurface. |
void DestroyUnownedSurface(VASurfaceID va_surface_id); |
@@ -191,10 +203,18 @@ class CONTENT_EXPORT VaapiWrapper { |
// Attempt to set render mode to "render to texture.". Failure is non-fatal. |
void TryToSetVADisplayAttributeToLocalGPU(); |
+ // Initialize all supported profiles. |
+ void InitializeSupportedProfiles(); |
+ |
// Lazily initialize static data after sandbox is enabled. Return false on |
// init failure. |
static bool PostSandboxInitialization(); |
+ // Return an instance of VaapiWrapper. |report_error_to_uma_cb| will be called |
+ // independently from reporting errors to clients via method return values. |
+ static scoped_ptr<VaapiWrapper> CreateInstance( |
+ const base::Closure& report_error_to_uma_cb); |
+ |
// Libva is not thread safe, so we have to do locking for it ourselves. |
// This lock is to be taken for the duration of all VA-API calls and for |
// the entire job submission sequence in ExecuteAndDestroyPendingBuffers(). |
@@ -234,6 +254,10 @@ class CONTENT_EXPORT VaapiWrapper { |
VAContextID va_vpp_context_id_; |
VABufferID va_vpp_buffer_id_; |
+ // Initialize supported profiles once. |
+ static bool is_initialize_profile_; |
+ static ProfileConfig supported_profiles_[media::VIDEO_CODEC_PROFILE_MAX * 2]; |
wuchengli
2015/02/02 09:01:07
Chromium way to do this is using base::LazyInstanc
kcwu
2015/02/02 10:11:02
Why not vector? if not vector, the size should be
henryhsu
2015/02/02 10:42:24
Static variables cannot use class object.
henryhsu
2015/02/13 04:01:03
Done.
henryhsu
2015/02/13 04:01:04
Done.
|
+ |
DISALLOW_COPY_AND_ASSIGN(VaapiWrapper); |
}; |