MythTV  master
transcode.h
Go to the documentation of this file.
1 #include "recordingprofile.h"
2 #include "fifowriter.h"
3 #include "transcodedefs.h"
4 #include "programtypes.h"
5 #include "playercontext.h"
6 
7 class ProgramInfo;
9 class MythPlayer;
10 class RingBuffer;
11 
12 using KFATable = vector<struct kfatable_entry>;
13 
14 class Transcode : public QObject
15 {
16  public:
17  explicit Transcode(ProgramInfo *pginfo);
18  ~Transcode() override;
19  int TranscodeFile(
20  const QString &inputname,
21  const QString &outputname,
22  const QString &profileName,
23  bool honorCutList, bool framecontrol, int jobID,
24  const QString& fifodir, bool fifo_info, bool cleanCut, frm_dir_map_t &deleteMap,
25  int AudioTrackNo, bool passthru = false);
26  void ShowProgress(bool val) { m_showProgress = val; }
28  void SetAVFMode(void) { m_avfMode = true; }
29  void SetHLSMode(void) { m_hlsMode = true; }
30  void SetHLSStreamID(int streamid) { m_hlsStreamID = streamid; }
31  void SetHLSMaxSegments(int segments) { m_hlsMaxSegments = segments; }
32  void SetCMDContainer(const QString& container) { m_cmdContainer = container; }
33  void SetCMDAudioCodec(const QString& codec) { m_cmdAudioCodec = codec; }
34  void SetCMDVideoCodec(const QString& codec) { m_cmdVideoCodec = codec; }
35  void SetCMDHeight(int height) { m_cmdHeight = height; }
36  void SetCMDWidth(int width) { m_cmdWidth = width; }
37  void SetCMDBitrate(int bitrate) { m_cmdBitrate = bitrate; }
38  void SetCMDAudioBitrate(int bitrate) { m_cmdAudioBitrate = bitrate; }
40 
41  private:
42  bool GetProfile(const QString& profileName, const QString& encodingType, int height,
43  int frameRate);
44  void ReencoderAddKFA(long curframe, long lastkey, long num_keyframes);
45  void SetPlayerContext(PlayerContext* player_ctx);
47  MythPlayer *GetPlayer(void) { return (m_ctx) ? m_ctx->m_player : nullptr; }
48 
49  private:
50  ProgramInfo *m_proginfo { nullptr };
52  int m_keyframeDist { 30 };
53 #if CONFIG_LIBMP3LAME
54  NuppelVideoRecorder *m_nvr { nullptr };
55 #endif
56  PlayerContext *m_ctx { nullptr };
58  FIFOWriter *m_fifow { nullptr };
59  KFATable *m_kfaTable { nullptr };
60  bool m_showProgress { false };
62  bool m_avfMode { false };
63  bool m_hlsMode { false };
64  int m_hlsStreamID { -1 };
65  bool m_hlsDisableAudioOnly { false };
66  int m_hlsMaxSegments { 0 };
67  QString m_cmdContainer { "mpegts" };
68  QString m_cmdAudioCodec { "aac" };
69  QString m_cmdVideoCodec { "libx264" };
70  int m_cmdWidth { 480 };
71  int m_cmdHeight { 0 };
72  int m_cmdBitrate { 600000 };
73  int m_cmdAudioBitrate { 64000 };
74 };
75 
76 /* vim: set expandtab tabstop=4 shiftwidth=4: */
void SetCMDWidth(int width)
Definition: transcode.h:36
bool m_showProgress
Definition: transcode.h:60
void SetCMDAudioCodec(const QString &codec)
Definition: transcode.h:33
MythPlayer * m_player
PlayerContext * GetPlayerContext(void)
Definition: transcode.h:46
void ReencoderAddKFA(long curframe, long lastkey, long num_keyframes)
Definition: transcode.cpp:68
void SetAVFMode(void)
Definition: transcode.h:28
void SetCMDBitrate(int bitrate)
Definition: transcode.h:37
PlayerContext * m_ctx
Definition: transcode.h:56
int m_cmdWidth
Definition: transcode.h:70
void SetHLSMaxSegments(int segments)
Definition: transcode.h:31
int m_hlsMaxSegments
Definition: transcode.h:66
bool m_avfMode
Definition: transcode.h:62
int m_keyframeDist
Definition: transcode.h:52
ProgramInfo * m_proginfo
Definition: transcode.h:50
void DisableAudioOnlyHLS(void)
Definition: transcode.h:39
void SetHLSStreamID(int streamid)
Definition: transcode.h:30
QString m_recorderOptions
Definition: transcode.h:61
void ShowProgress(bool val)
Definition: transcode.h:26
void SetCMDContainer(const QString &container)
Definition: transcode.h:32
Holds information on recordings and videos.
Definition: programinfo.h:67
~Transcode() override
Definition: transcode.cpp:57
void SetCMDHeight(int height)
Definition: transcode.h:35
QString m_cmdAudioCodec
Definition: transcode.h:68
QString m_cmdContainer
Definition: transcode.h:67
RecordingProfile * m_recProfile
Definition: transcode.h:51
int m_hlsStreamID
Definition: transcode.h:64
bool GetProfile(const QString &profileName, const QString &encodingType, int height, int frameRate)
Definition: transcode.cpp:80
RingBuffer * m_outRingBuffer
Definition: transcode.h:57
int m_cmdHeight
Definition: transcode.h:71
void SetRecorderOptions(const QString &options)
Definition: transcode.h:27
MythPlayer * GetPlayer(void)
Definition: transcode.h:47
int m_cmdAudioBitrate
Definition: transcode.h:73
void SetPlayerContext(PlayerContext *player_ctx)
Definition: transcode.cpp:141
FIFOWriter * m_fifow
Definition: transcode.h:58
bool m_hlsDisableAudioOnly
Definition: transcode.h:65
KFATable * m_kfaTable
Definition: transcode.h:59
void SetHLSMode(void)
Definition: transcode.h:29
vector< struct kfatable_entry > KFATable
Definition: transcode.h:12
int TranscodeFile(const QString &inputname, const QString &outputname, const QString &profileName, bool honorCutList, bool framecontrol, int jobID, const QString &fifodir, bool fifo_info, bool cleanCut, frm_dir_map_t &deleteMap, int AudioTrackNo, bool passthru=false)
Definition: transcode.cpp:194
Transcode(ProgramInfo *pginfo)
Definition: transcode.cpp:51
int m_cmdBitrate
Definition: transcode.h:72
void SetCMDVideoCodec(const QString &codec)
Definition: transcode.h:34
QMap< uint64_t, MarkTypes > frm_dir_map_t
Frame # -> Mark map.
Definition: programtypes.h:81
Implements a file/stream reader/writer.
void SetCMDAudioBitrate(int bitrate)
Definition: transcode.h:38
bool m_hlsMode
Definition: transcode.h:63
QString m_cmdVideoCodec
Definition: transcode.h:69