1 // Copyright (c) 2017 Intel Corporation
2 //
3 // Permission is hereby granted, free of charge, to any person obtaining a copy
4 // of this software and associated documentation files (the "Software"), to deal
5 // in the Software without restriction, including without limitation the rights
6 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 // copies of the Software, and to permit persons to whom the Software is
8 // furnished to do so, subject to the following conditions:
9 //
10 // The above copyright notice and this permission notice shall be included in all
11 // copies or substantial portions of the Software.
12 //
13 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 // SOFTWARE.
20 
21 #ifndef __UMC_VIDEO_DECODER_H__
22 #define __UMC_VIDEO_DECODER_H__
23 
24 #include "umc_structures.h"
25 #include "umc_video_data.h"
26 #include "umc_base_codec.h"
27 #include "umc_base_color_space_converter.h"
28 
29 namespace UMC
30 {
31 
32 class VideoAccelerator;
33 
34 class VideoDecoderParams : public BaseCodecParams
35 {
36     DYNAMIC_CAST_DECL(VideoDecoderParams, BaseCodecParams)
37 
38 public:
39     // Default constructor
40     VideoDecoderParams();
41     // Destructor
42     virtual ~VideoDecoderParams();
43 
44     VideoStreamInfo         info;                           // (VideoStreamInfo) compressed video info
45     uint32_t                  lFlags;                         // (uint32_t) decoding flag(s)
46 
47     BaseCodec               *pPostProcessing;               // (BaseCodec*) pointer to post processing
48 
49     VideoAccelerator        *pVideoAccelerator;             // pointer to video accelerator
50 };
51 
52 /******************************************************************************/
53 
54 class VideoDecoder : public BaseCodec
55 {
DYNAMIC_CAST_DECL(VideoDecoder,BaseCodec)56     DYNAMIC_CAST_DECL(VideoDecoder, BaseCodec)
57 
58 public:
59     VideoDecoder(void) :
60         m_PostProcessing(NULL),
61         m_allocatedPostProcessing(NULL)
62     {}
63 
64     // Destructor
65     virtual ~VideoDecoder(void);
66 
67     // BaseCodec methods
68     // Get codec working (initialization) parameter(s)
69     virtual Status GetInfo(BaseCodecParams *info);
70     // Set new working parameter(s)
71     virtual Status SetParams(BaseCodecParams *params);
72 
73     // Additional methods
74     // Reset skip frame counter
75     virtual Status ResetSkipCount() = 0;
76     // Increment skip frame counter
77     virtual Status SkipVideoFrame(int32_t) = 0;
78     // Get skip frame counter statistic
79     virtual uint32_t GetNumOfSkippedFrames() = 0;
80 
81     // returns closed capture data
GetUserData(MediaData *)82     virtual Status GetUserData(MediaData* /*pCC*/)
83     {
84         return UMC_ERR_NOT_IMPLEMENTED;
85     }
86 
87 protected:
88 
89     VideoStreamInfo         m_ClipInfo;                         // (VideoStreamInfo) clip info
90     BaseCodec               *m_PostProcessing;                  // (BaseCodec*) pointer to post processing
91     BaseCodec               *m_allocatedPostProcessing;         // (BaseCodec*) pointer to default post processing allocated by decoder
92 
93 private:
94     // Declare private copy constructor to avoid accidental assignment
95     // and klocwork complaining.
96     VideoDecoder(const VideoDecoder &);
97     VideoDecoder & operator = (const VideoDecoder &);
98 };
99 
100 } // end namespace UMC
101 
102 #endif // __UMC_VIDEO_DECODER_H__
103