Blame view

3rdparty/opencv-4.5.4/modules/gapi/src/api/media.cpp 1.33 KB
f4334277   Hu Chunming   提交3rdparty
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
  // This file is part of OpenCV project.
  // It is subject to the license terms in the LICENSE file found in the top-level directory
  // of this distribution and at http://opencv.org/license.html.
  //
  // Copyright (C) 2020 Intel Corporation
  
  #include "precomp.hpp"
  #include <opencv2/gapi/media.hpp>
  
  struct cv::MediaFrame::Priv {
      std::unique_ptr<IAdapter> adapter;
  };
  
  cv::MediaFrame::MediaFrame() {
  }
  
  cv::MediaFrame::MediaFrame(AdapterPtr &&ptr)
      : m(new Priv{std::move(ptr)}) {
  }
  
  cv::GFrameDesc cv::MediaFrame::desc() const {
      return m->adapter->meta();
  }
  
  cv::MediaFrame::View cv::MediaFrame::access(Access code) const {
      return m->adapter->access(code);
  }
  
  cv::util::any cv::MediaFrame::blobParams() const
  {
      return m->adapter->blobParams();
  }
  
  cv::MediaFrame::IAdapter* cv::MediaFrame::getAdapter() const {
      return m->adapter.get();
  }
  
  void cv::MediaFrame::serialize(cv::gapi::s11n::IOStream& os) const {
      return m->adapter->serialize(os);
  }
  
  cv::MediaFrame::View::View(Ptrs&& ptrs, Strides&& strs, Callback &&cb)
      : ptr   (std::move(ptrs))
      , stride(std::move(strs))
      , m_cb  (std::move(cb)) {
  }
  
  cv::MediaFrame::View::~View() {
      if (m_cb) {
          m_cb();
      }
  }
  
  cv::util::any cv::MediaFrame::IAdapter::blobParams() const
  {
      // Does nothing by default
      return {};
  }
  
  cv::MediaFrame::IAdapter::~IAdapter() {
  }