Home | History | Annotate | Download | only in vda
      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 // Note: ported from Chromium commit head: 85fdf90
      5 
      6 #include "base/logging.h"
      7 
      8 #include "video_decode_accelerator.h"
      9 
     10 namespace media {
     11 
     12 VideoDecodeAccelerator::Config::Config() = default;
     13 VideoDecodeAccelerator::Config::Config(const Config& config) = default;
     14 
     15 VideoDecodeAccelerator::Config::Config(VideoCodecProfile video_codec_profile)
     16     : profile(video_codec_profile) {}
     17 
     18 VideoDecodeAccelerator::Config::~Config() = default;
     19 
     20 std::string VideoDecodeAccelerator::Config::AsHumanReadableString() const {
     21   std::ostringstream s;
     22   s << "profile: " << GetProfileName(profile);
     23   return s.str();
     24 }
     25 
     26 void VideoDecodeAccelerator::Client::NotifyInitializationComplete(
     27     bool success) {
     28   NOTREACHED() << "By default deferred initialization is not supported.";
     29 }
     30 
     31 VideoDecodeAccelerator::~VideoDecodeAccelerator() = default;
     32 
     33 bool VideoDecodeAccelerator::TryToSetupDecodeOnSeparateThread(
     34     const base::WeakPtr<Client>& decode_client,
     35     const scoped_refptr<base::SingleThreadTaskRunner>& decode_task_runner) {
     36   // Implementations in the process that VDA runs in must override this.
     37   LOG(FATAL) << "This may only be called in the same process as VDA impl.";
     38   return false;
     39 }
     40 
     41 void VideoDecodeAccelerator::ImportBufferForPicture(
     42     int32_t picture_buffer_id,
     43     VideoPixelFormat pixel_format,
     44     const NativePixmapHandle& native_pixmap_handle) {
     45   NOTREACHED() << "Buffer import not supported.";
     46 }
     47 
     48 VideoDecodeAccelerator::SupportedProfile::SupportedProfile()
     49     : profile(VIDEO_CODEC_PROFILE_UNKNOWN), encrypted_only(false) {}
     50 
     51 VideoDecodeAccelerator::SupportedProfile::~SupportedProfile() = default;
     52 
     53 VideoDecodeAccelerator::Capabilities::Capabilities() : flags(NO_FLAGS) {}
     54 
     55 VideoDecodeAccelerator::Capabilities::Capabilities(const Capabilities& other) =
     56     default;
     57 
     58 VideoDecodeAccelerator::Capabilities::~Capabilities() = default;
     59 
     60 std::string VideoDecodeAccelerator::Capabilities::AsHumanReadableString()
     61     const {
     62   std::ostringstream s;
     63   s << "[";
     64   for (const SupportedProfile& sp : supported_profiles) {
     65     s << " " << GetProfileName(sp.profile) << ": " << sp.min_resolution.width()
     66       << "x" << sp.min_resolution.height() << "->" << sp.max_resolution.width()
     67       << "x" << sp.max_resolution.height();
     68   }
     69   s << "]";
     70   return s.str();
     71 }
     72 
     73 } // namespace media
     74 
     75 namespace std {
     76 
     77 void default_delete<media::VideoDecodeAccelerator>::operator()(
     78     media::VideoDecodeAccelerator* vda) const {
     79   vda->Destroy();
     80 }
     81 
     82 } // namespace std
     83