| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 // | 4 // |
| 5 // This file contains an implementation of VaapiWrapper, used by | 5 // This file contains an implementation of VaapiWrapper, used by |
| 6 // VaapiVideoDecodeAccelerator and VaapiH264Decoder for decode, | 6 // VaapiVideoDecodeAccelerator and VaapiH264Decoder for decode, |
| 7 // and VaapiVideoEncodeAccelerator for encode, to interface | 7 // and VaapiVideoEncodeAccelerator for encode, to interface |
| 8 // with libva (VA-API library for hardware video codec). | 8 // with libva (VA-API library for hardware video codec). |
| 9 | 9 |
| 10 #ifndef CONTENT_COMMON_GPU_MEDIA_VAAPI_WRAPPER_H_ | 10 #ifndef CONTENT_COMMON_GPU_MEDIA_VAAPI_WRAPPER_H_ |
| 11 #define CONTENT_COMMON_GPU_MEDIA_VAAPI_WRAPPER_H_ | 11 #define CONTENT_COMMON_GPU_MEDIA_VAAPI_WRAPPER_H_ |
| 12 | 12 |
| 13 #include <set> | 13 #include <set> |
| 14 #include <vector> | 14 #include <vector> |
| 15 | 15 |
| 16 #include "base/lazy_instance.h" | 16 #include "base/lazy_instance.h" |
| 17 #include "base/memory/ref_counted.h" | 17 #include "base/memory/ref_counted.h" |
| 18 #include "base/synchronization/lock.h" | 18 #include "base/synchronization/lock.h" |
| 19 #include "content/common/content_export.h" | 19 #include "content/common/content_export.h" |
| 20 #include "content/common/gpu/media/va_surface.h" | 20 #include "content/common/gpu/media/va_surface.h" |
| 21 #include "media/base/video_decoder_config.h" | 21 #include "media/base/video_decoder_config.h" |
| 22 #include "media/base/video_frame.h" | 22 #include "media/base/video_frame.h" |
| 23 #include "media/video/video_decode_accelerator.h" |
| 23 #include "media/video/video_encode_accelerator.h" | 24 #include "media/video/video_encode_accelerator.h" |
| 24 #include "third_party/libva/va/va.h" | 25 #include "third_party/libva/va/va.h" |
| 25 #include "third_party/libva/va/va_vpp.h" | 26 #include "third_party/libva/va/va_vpp.h" |
| 26 #include "ui/gfx/geometry/size.h" | 27 #include "ui/gfx/geometry/size.h" |
| 27 #if defined(USE_X11) | 28 #if defined(USE_X11) |
| 28 #include "third_party/libva/va/va_x11.h" | 29 #include "third_party/libva/va/va_x11.h" |
| 29 #endif // USE_X11 | 30 #endif // USE_X11 |
| 30 | 31 |
| 31 namespace content { | 32 namespace content { |
| 32 | 33 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 62 // errors to clients via method return values. | 63 // errors to clients via method return values. |
| 63 static scoped_ptr<VaapiWrapper> CreateForVideoCodec( | 64 static scoped_ptr<VaapiWrapper> CreateForVideoCodec( |
| 64 CodecMode mode, | 65 CodecMode mode, |
| 65 media::VideoCodecProfile profile, | 66 media::VideoCodecProfile profile, |
| 66 const base::Closure& report_error_to_uma_cb); | 67 const base::Closure& report_error_to_uma_cb); |
| 67 | 68 |
| 68 // Return the supported encode profiles. | 69 // Return the supported encode profiles. |
| 69 static std::vector<media::VideoEncodeAccelerator::SupportedProfile> | 70 static std::vector<media::VideoEncodeAccelerator::SupportedProfile> |
| 70 GetSupportedEncodeProfiles(); | 71 GetSupportedEncodeProfiles(); |
| 71 | 72 |
| 73 // Return the supported decode profiles. |
| 74 static std::vector<media::VideoDecodeAccelerator::SupportedProfile> |
| 75 GetSupportedDecodeProfiles(); |
| 76 |
| 72 ~VaapiWrapper(); | 77 ~VaapiWrapper(); |
| 73 | 78 |
| 74 // Create |num_surfaces| backing surfaces in driver for VASurfaces, each | 79 // Create |num_surfaces| backing surfaces in driver for VASurfaces, each |
| 75 // of size |size|. Returns true when successful, with the created IDs in | 80 // of size |size|. Returns true when successful, with the created IDs in |
| 76 // |va_surfaces| to be managed and later wrapped in VASurfaces. | 81 // |va_surfaces| to be managed and later wrapped in VASurfaces. |
| 77 // The client must DestroySurfaces() each time before calling this method | 82 // The client must DestroySurfaces() each time before calling this method |
| 78 // again to free the allocated surfaces first, but is not required to do so | 83 // again to free the allocated surfaces first, but is not required to do so |
| 79 // at destruction time, as this will be done automatically from | 84 // at destruction time, as this will be done automatically from |
| 80 // the destructor. | 85 // the destructor. |
| 81 bool CreateSurfaces(const gfx::Size& size, | 86 bool CreateSurfaces(const gfx::Size& size, |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 // Singleton variable to store supported profile information for encode and | 310 // Singleton variable to store supported profile information for encode and |
| 306 // decode. | 311 // decode. |
| 307 static base::LazyInstance<LazyProfileInfos> profile_infos_; | 312 static base::LazyInstance<LazyProfileInfos> profile_infos_; |
| 308 | 313 |
| 309 DISALLOW_COPY_AND_ASSIGN(VaapiWrapper); | 314 DISALLOW_COPY_AND_ASSIGN(VaapiWrapper); |
| 310 }; | 315 }; |
| 311 | 316 |
| 312 } // namespace content | 317 } // namespace content |
| 313 | 318 |
| 314 #endif // CONTENT_COMMON_GPU_MEDIA_VAAPI_WRAPPER_H_ | 319 #endif // CONTENT_COMMON_GPU_MEDIA_VAAPI_WRAPPER_H_ |
| OLD | NEW |