Blame view

DxDecoder/VideoDecoder.h 2.2 KB
85cc8cb9   Hu Chunming   ๅŽŸ็‰ˆไปฃ็ 
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
  /*
   * Copyright 1993-2015 NVIDIA Corporation.  All rights reserved.
   *
   * Please refer to the NVIDIA end user license agreement (EULA) associated
   * with this source code for terms and conditions that govern your use of
   * this software. Any use, reproduction, disclosure, or distribution of
   * this software and related documentation outside the terms of the EULA
   * is strictly prohibited.
   *
   */
  
  #ifndef NV_VIDEODECODER_H
  #define NV_VIDEODECODER_H
  
  #include <cuda.h>
  #include <cuviddec.h>
  #include <nvcuvid.h>
  
  #define MAX_FRAME_COUNT 2
  
  // Wrapper class around the CUDA Video Decoding API.
  //
  class VideoDecoder
  {
      public:
          explicit
  		VideoDecoder(/*const CUVIDEOFORMAT &rVideoFormat, */CUcontext &rContext,

  			cudaVideoCreateFlags eCreateFlags, CUvideoctxlock &ctx);
  
          ~VideoDecoder();
  
          // Get the code-type currently used.
          cudaVideoCodec
          codec()
          const;
  
          cudaVideoChromaFormat
          chromaFormat()
          const;
  
          // Maximum number of decode surfaces used by decoder.
          unsigned long
          maxDecodeSurfaces()
          const;
  
          unsigned long
          frameWidth()
          const;
  
          unsigned long
          frameHeight()
          const;
  
          unsigned long
          targetWidth()
          const;
  
          unsigned long
          targetHeight()
          const;
  
          void
          decodePicture(CUVIDPICPARAMS *pPictureParameters, CUcontext *pContext = NULL);
  
  		int
          mapFrame(int iPictureIndex, CUdeviceptr *ppDevice, unsigned int *nPitch, CUVIDPROCPARAMS *pVideoProcessingParameters);
  
          void
          unmapFrame(CUdeviceptr pDevice);
  
  		bool InitDecoder(const CUVIDEOFORMAT &rVideoFormat);
      private:
          // Default constructor. Don't implement.
          VideoDecoder();
  
          // Copy constructor. Don't implement.
          VideoDecoder(const VideoDecoder &);
  
          // Assignment operator. Don't implement.
          void
          operator= (const VideoDecoder &);
  
          CUVIDDECODECREATEINFO   oVideoDecodeCreateInfo_;
          CUvideodecoder          oDecoder_;
          cudaVideoCreateFlags    m_VideoCreateFlags;
          CUcontext               m_Context;
          CUvideoctxlock          m_VidCtxLock;
  };
  
  #endif // NV_VIDEODECODER_H