MythTV  master
mythcodeccontext.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 MYTHCODECONTEXT_H
27 #define MYTHCODECONTEXT_H
28 
29 struct AVCodecContext;
30 struct AVFrame;
31 struct AVStream;
32 struct AVFilterContext;
33 struct AVFilterGraph;
34 struct AVBufferRef;
35 class MythPlayer;
36 
37 #include "mythtvexp.h"
38 #include "mythcodecid.h"
39 
41 {
42  public:
43  MythCodecContext(void);
44  virtual ~MythCodecContext() = default;
45  static MythCodecContext* createMythCodecContext(MythCodecID codec);
46  virtual int HwDecoderInit(AVCodecContext * /*ctx*/) { return 0; }
47  void setStream(AVStream *initStream) { stream = initStream; }
48  virtual int FilteredReceiveFrame(AVCodecContext *ctx, AVFrame *frame);
49  static QStringList GetDeinterlacers(const QString& decodername);
50  static bool isCodecDeinterlacer(const QString& decodername);
51  virtual QStringList GetDeinterlacers(void) { return QStringList(); }
52  virtual QString GetDeinterlaceFilter() { return QString(); }
53  void setPlayer(MythPlayer *tPlayer) { player = tPlayer; }
54  bool setDeinterlacer(bool enable, QString name = QString());
55  bool isDeinterlacing(void) { return filter_graph != nullptr;}
56  QString getDeinterlacerName(void) { return deinterlacername; }
57  bool BestDeint(void);
58  bool FallbackDeint(void);
59  bool getDoubleRate(void) { return doublerate; }
60  QString GetFallbackDeint(void);
61 
62  protected:
63  virtual bool isValidDeinterlacer(QString /*name*/) { return false; }
64  virtual int InitDeinterlaceFilter(AVCodecContext *ctx, AVFrame *frame);
65  AVStream* stream;
66  AVFilterContext *buffersink_ctx;
67  AVFilterContext *buffersrc_ctx;
68  AVFilterGraph *filter_graph;
70  AVBufferRef *hw_frames_ctx;
72  int64_t priorPts[2];
73  int64_t ptsUsed;
74  int width;
75  int height;
77  QMutex contextLock;
78  bool doublerate;
79 };
80 
81 #endif // MYTHCODECCONTEXT_H
AVFilterContext * buffersink_ctx
MythCodecID
Definition: mythcodecid.h:10
struct AVFrame AVFrame
QString getDeinterlacerName(void)
AVFilterGraph * filter_graph
MythPlayer * player
#define MTV_PUBLIC
Definition: mythtvexp.h:15
bool getDoubleRate(void)
virtual bool isValidDeinterlacer(QString)
void setPlayer(MythPlayer *tPlayer)
const char * name
Definition: ParseText.cpp:328
virtual QStringList GetDeinterlacers(void)
AVFilterContext * buffersrc_ctx
virtual QString GetDeinterlaceFilter()
virtual int HwDecoderInit(AVCodecContext *)
AVBufferRef * hw_frames_ctx
void setStream(AVStream *initStream)
bool isDeinterlacing(void)