• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #include "base/logging.h"
6 
7 #include "video_decode_accelerator.h"
8 
9 namespace media {
10 
11 VideoDecodeAccelerator::Config::Config() = default;
12 VideoDecodeAccelerator::Config::Config(const Config& config) = default;
13 
Config(VideoCodecProfile video_codec_profile)14 VideoDecodeAccelerator::Config::Config(VideoCodecProfile video_codec_profile)
15     : profile(video_codec_profile) {}
16 
17 VideoDecodeAccelerator::Config::~Config() = default;
18 
AsHumanReadableString() const19 std::string VideoDecodeAccelerator::Config::AsHumanReadableString() const {
20   std::ostringstream s;
21   s << "profile: " << GetProfileName(profile);
22   return s.str();
23 }
24 
NotifyInitializationComplete(bool success)25 void VideoDecodeAccelerator::Client::NotifyInitializationComplete(
26     bool success) {
27   NOTREACHED() << "By default deferred initialization is not supported.";
28 }
29 
~VideoDecodeAccelerator()30 VideoDecodeAccelerator::~VideoDecodeAccelerator() {}
31 
TryToSetupDecodeOnSeparateThread(const base::WeakPtr<Client> & decode_client,const scoped_refptr<base::SingleThreadTaskRunner> & decode_task_runner)32 bool VideoDecodeAccelerator::TryToSetupDecodeOnSeparateThread(
33     const base::WeakPtr<Client>& decode_client,
34     const scoped_refptr<base::SingleThreadTaskRunner>& decode_task_runner) {
35   // Implementations in the process that VDA runs in must override this.
36   LOG(FATAL) << "This may only be called in the same process as VDA impl.";
37   return false;
38 }
39 
ImportBufferForPicture(int32_t picture_buffer_id,const std::vector<base::FileDescriptor> & dmabuf_fds)40 void VideoDecodeAccelerator::ImportBufferForPicture(
41     int32_t picture_buffer_id,
42     const std::vector<base::FileDescriptor>& dmabuf_fds) {
43   NOTREACHED() << "Buffer import not supported.";
44 }
45 
SupportedProfile()46 VideoDecodeAccelerator::SupportedProfile::SupportedProfile()
47     : profile(VIDEO_CODEC_PROFILE_UNKNOWN), encrypted_only(false) {}
48 
~SupportedProfile()49 VideoDecodeAccelerator::SupportedProfile::~SupportedProfile() {}
50 
Capabilities()51 VideoDecodeAccelerator::Capabilities::Capabilities() : flags(NO_FLAGS) {}
52 
53 VideoDecodeAccelerator::Capabilities::Capabilities(const Capabilities& other) =
54     default;
55 
~Capabilities()56 VideoDecodeAccelerator::Capabilities::~Capabilities() {}
57 
AsHumanReadableString() const58 std::string VideoDecodeAccelerator::Capabilities::AsHumanReadableString()
59     const {
60   std::ostringstream s;
61   s << "[";
62   for (const SupportedProfile& sp : supported_profiles) {
63     s << " " << GetProfileName(sp.profile) << ": " << sp.min_resolution.width()
64       << "x" << sp.min_resolution.height() << "->" << sp.max_resolution.width()
65       << "x" << sp.max_resolution.height();
66   }
67   s << "]";
68   return s.str();
69 }
70 
71 } // namespace media
72 
73 namespace std {
74 
operator ()(media::VideoDecodeAccelerator * vda) const75 void default_delete<media::VideoDecodeAccelerator>::operator()(
76     media::VideoDecodeAccelerator* vda) const {
77   vda->Destroy();
78 }
79 
80 } // namespace std
81