MythTV  master
vaapi2context.h
Go to the documentation of this file.
1 // Copyright (c) 2017 MythTV Developers <mythtv-dev@mythtv.org>
3 //
4 // This is part of MythTV (https://www.mythtv.org)
5 //
6 // This program is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 2 of the License, or
9 // (at your option) any later version.
10 //
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software
18 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 //
20 // You should have received a copy of the GNU General Public License
21 // along with this program. If not, see <http://www.gnu.org/licenses/>.
22 //
24 
25 
26 #ifndef VAAPI2CONTEXT_H
27 #define VAAPI2CONTEXT_H
28 
29 #include "mythtvexp.h"
30 #include "mythcodecid.h"
31 #include "mythcodeccontext.h"
32 
33 extern "C" {
34  #include "libavcodec/avcodec.h"
35 }
36 
38 {
39  public:
40  Vaapi2Context(void) = default;
41  ~Vaapi2Context() override;
42 
43  virtual int FilteredReceiveFrame(AVCodecContext *ctx, AVFrame *frame) override;
44 
45  protected:
46  int InitDeinterlaceFilter(AVCodecContext *ctx, AVFrame *frame) override; // MythCodecContext
47  void CloseFilters();
48 
49 
50  virtual int InitDeinterlaceFilter(AVCodecContext *ctx, AVFrame *frame);
51  AVStream *m_stream {nullptr};
52  AVFilterContext *m_bufferSinkCtx {nullptr};
53  AVFilterContext *m_bufferSrcCtx {nullptr};
54  AVFilterGraph *m_filterGraph {nullptr};
55  bool m_filtersInitialized {false};
56  AVBufferRef *m_hwFramesCtx {nullptr};
57  int64_t m_priorPts[2] {0,0};
58  int64_t m_ptsUsed {0};
59  int m_width {0};
60  int m_height {0};
61  bool m_doubleRate {false};
62 };
63 
64 #endif // VAAPI2CONTEXT_H
struct AVFrame AVFrame
virtual int FilteredReceiveFrame(AVCodecContext *Context, AVFrame *Frame)
Retrieve and process/filter AVFrame.
#define MTV_PUBLIC
Definition: mythtvexp.h:15