MythTV  master
Macros | Enumerations | Functions | Variables
avformatdecoder.cpp File Reference
#include "avformatdecoder.h"
#include <unistd.h>
#include <algorithm>
#include <array>
#include <cmath>
#include <cstdint>
#include <iostream>
#include <set>
#include "libavutil/avutil.h"
#include "libavutil/error.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/log.h"
#include "libavutil/opt.h"
#include "libavcodec/avcodec.h"
#include "libavformat/avformat.h"
#include "libavformat/avio.h"
#include "libswscale/swscale.h"
#include "libavutil/stereo3d.h"
#include "libavutil/imgutils.h"
#include "libavutil/display.h"
#include <QFileInfo>
#include <QStringDecoder>
#include "libmyth/audio/audiooutput.h"
#include "libmyth/audio/audiooutpututil.h"
#include "libmythbase/iso639.h"
#include "libmythbase/lcddevice.h"
#include "libmythbase/mythchrono.h"
#include "libmythbase/mythconfig.h"
#include "libmythbase/mythcorecontext.h"
#include "libmythbase/mythdate.h"
#include "libmythbase/mythdbcon.h"
#include "libmythbase/stringutil.h"
#include "libmythui/mythuihelper.h"
#include "mythtvexp.h"
#include "Bluray/mythbdbuffer.h"
#include "DVD/mythdvdbuffer.h"
#include "captions/cc608decoder.h"
#include "captions/cc708decoder.h"
#include "captions/subtitlereader.h"
#include "captions/teletextdecoder.h"
#include "io/mythmediabuffer.h"
#include "mheg/interactivetv.h"
#include "mpeg/atscdescriptors.h"
#include "mpeg/dvbdescriptors.h"
#include "mpeg/mpegtables.h"
#include "bytereader.h"
#include "mythavutil.h"
#include "mythframe.h"
#include "mythhdrvideometadata.h"
#include "mythvideoprofile.h"
#include "remoteencoder.h"
Include dependency graph for avformatdecoder.cpp:

Go to the source code of this file.

Macros

#define LOC   QString("AFD: ")
 
#define FAIL(errmsg)
 

Enumerations

enum  V4L2_MPEG_LINE_TYPES : std::uint8_t { V4L2_MPEG_VBI_IVTV_TELETEXT_B = 1, V4L2_MPEG_VBI_IVTV_CAPTION_525 = 4, V4L2_MPEG_VBI_IVTV_WSS_625 = 5, V4L2_MPEG_VBI_IVTV_VPS = 7 }
 

Functions

static QSize get_video_dim (const AVCodecContext &ctx)
 
static float get_aspect (const AVCodecContext &ctx)
 
static float get_aspect (AVCParser &p)
 
int get_avf_buffer (struct AVCodecContext *c, AVFrame *pic, int flags)
 
static bool StreamHasRequiredParameters (AVCodecContext *Context, AVStream *Stream)
 Determine if we have enough live TV data to initialize hardware decoders. More...
 
static void myth_av_log (void *ptr, int level, const char *fmt, va_list vl)
 
static int get_canonical_lang (const char *lang_cstr)
 
static const char * AVMediaTypeToString (enum AVMediaType codec_type)
 returns a human readable string for the AVMediaType enum. More...
 
static int64_t lsb3full (int64_t lsb, int64_t base_ts, int lsb_bits)
 
void HandleStreamChange (void *data)
 
static bool cc608_good_parity (uint16_t data)
 
int get_avf_buffer_dxva2 (struct AVCodecContext *c, AVFrame *pic, int)
 
static std::vector< int > filter_lang (const sinfo_vec_t &tracks, int lang_key, const std::vector< int > &ftype)
 
static std::vector< int > filter_type (const sinfo_vec_t &tracks, AudioTrackType type)
 
static void extract_mono_channel (uint channel, AudioInfo *audioInfo, char *buffer, int bufsize)
 

Variables

static constexpr int SEQ_PKT_ERR_MAX { 50 }
 
static constexpr ssize_t kMaxVideoQueueSize = 220
 
static bool silence_ffmpeg_logging = false
 
static constexpr uint32_t SEQ_START { 0x000001b3 }
 
static constexpr uint32_t GOP_START { 0x000001b8 }
 
static constexpr uint32_t SLICE_MIN { 0x00000101 }
 
static constexpr uint32_t SLICE_MAX { 0x000001af }
 

Macro Definition Documentation

◆ LOC

#define LOC   QString("AFD: ")

Definition at line 121 of file avformatdecoder.cpp.

◆ FAIL

#define FAIL (   errmsg)
Value:
do { \
LOG(VB_PLAYBACK, LOG_INFO, LOC + (errmsg)); \
return false; \
} while (false)

Definition at line 208 of file avformatdecoder.cpp.

Enumeration Type Documentation

◆ V4L2_MPEG_LINE_TYPES

enum V4L2_MPEG_LINE_TYPES : std::uint8_t
Enumerator
V4L2_MPEG_VBI_IVTV_TELETEXT_B 

Teletext (uses lines 6-22 for PAL, 10-21 for NTSC)

V4L2_MPEG_VBI_IVTV_CAPTION_525 

Closed Captions (line 21 NTSC, line 22 PAL)

V4L2_MPEG_VBI_IVTV_WSS_625 

Wide Screen Signal (line 20 NTSC, line 23 PAL)

V4L2_MPEG_VBI_IVTV_VPS 

Video Programming System (PAL) (line 16)

Definition at line 55 of file avformatdecoder.cpp.

Function Documentation

◆ get_video_dim()

static QSize get_video_dim ( const AVCodecContext &  ctx)
static

◆ get_aspect() [1/2]

static float get_aspect ( const AVCodecContext &  ctx)
static

◆ get_aspect() [2/2]

static float get_aspect ( AVCParser p)
static

Definition at line 164 of file avformatdecoder.cpp.

◆ get_avf_buffer()

int get_avf_buffer ( struct AVCodecContext *  c,
AVFrame pic,
int  flags 
)

Definition at line 2678 of file avformatdecoder.cpp.

◆ StreamHasRequiredParameters()

static bool StreamHasRequiredParameters ( AVCodecContext *  Context,
AVStream *  Stream 
)
static

Determine if we have enough live TV data to initialize hardware decoders.

This was based on what is now the static int has_codec_parameters() from libavformat/demux.c

Definition at line 218 of file avformatdecoder.cpp.

Referenced by AvFormatDecoder::OpenFile().

◆ myth_av_log()

static void myth_av_log ( void *  ptr,
int  level,
const char *  fmt,
va_list  vl 
)
static

Definition at line 274 of file avformatdecoder.cpp.

Referenced by AvFormatDecoder::AvFormatDecoder().

◆ get_canonical_lang()

static int get_canonical_lang ( const char *  lang_cstr)
static

◆ AVMediaTypeToString()

static const char* AVMediaTypeToString ( enum AVMediaType  codec_type)
static

returns a human readable string for the AVMediaType enum.

av_get_media_type_string() from <libavutil/avutil.h> returns NULL for unknown or invalid codec_type, so use this instead.

Definition at line 358 of file avformatdecoder.cpp.

Referenced by AvFormatDecoder::GetFrame(), AvFormatDecoder::InitVideoCodec(), AvFormatDecoder::OpenAVCodec(), and AvFormatDecoder::ScanStreams().

◆ lsb3full()

static int64_t lsb3full ( int64_t  lsb,
int64_t  base_ts,
int  lsb_bits 
)
static

Definition at line 466 of file avformatdecoder.cpp.

Referenced by AvFormatDecoder::NormalizeVideoTimecode().

◆ HandleStreamChange()

void HandleStreamChange ( void *  data)

Definition at line 886 of file avformatdecoder.cpp.

◆ cc608_good_parity()

static bool cc608_good_parity ( uint16_t  data)
static

◆ get_avf_buffer_dxva2()

int get_avf_buffer_dxva2 ( struct AVCodecContext *  c,
AVFrame pic,
int   
)

Definition at line 2742 of file avformatdecoder.cpp.

◆ filter_lang()

static std::vector<int> filter_lang ( const sinfo_vec_t tracks,
int  lang_key,
const std::vector< int > &  ftype 
)
static

Definition at line 4219 of file avformatdecoder.cpp.

Referenced by AvFormatDecoder::AutoSelectAudioTrack().

◆ filter_type()

static std::vector<int> filter_type ( const sinfo_vec_t tracks,
AudioTrackType  type 
)
static

Definition at line 4233 of file avformatdecoder.cpp.

Referenced by AvFormatDecoder::AutoSelectAudioTrack().

◆ extract_mono_channel()

static void extract_mono_channel ( uint  channel,
AudioInfo audioInfo,
char *  buffer,
int  bufsize 
)
static

Definition at line 4537 of file avformatdecoder.cpp.

Referenced by AvFormatDecoder::ProcessAudioPacket().

Variable Documentation

◆ SEQ_PKT_ERR_MAX

constexpr int SEQ_PKT_ERR_MAX { 50 }
staticconstexpr

◆ kMaxVideoQueueSize

constexpr ssize_t kMaxVideoQueueSize = 220
staticconstexpr

Definition at line 134 of file avformatdecoder.cpp.

Referenced by AvFormatDecoder::GetFrame().

◆ silence_ffmpeg_logging

bool silence_ffmpeg_logging = false
static

Definition at line 137 of file avformatdecoder.cpp.

Referenced by AvFormatDecoder::FindStreamInfo(), and myth_av_log().

◆ SEQ_START

constexpr uint32_t SEQ_START { 0x000001b3 }
staticconstexpr

Definition at line 3051 of file avformatdecoder.cpp.

Referenced by AvFormatDecoder::MpegPreProcessPkt().

◆ GOP_START

constexpr uint32_t GOP_START { 0x000001b8 }
staticconstexpr

Definition at line 3052 of file avformatdecoder.cpp.

Referenced by AvFormatDecoder::MpegPreProcessPkt().

◆ SLICE_MIN

constexpr uint32_t SLICE_MIN { 0x00000101 }
staticconstexpr

Definition at line 3054 of file avformatdecoder.cpp.

Referenced by AvFormatDecoder::MpegPreProcessPkt().

◆ SLICE_MAX

constexpr uint32_t SLICE_MAX { 0x000001af }
staticconstexpr

Definition at line 3055 of file avformatdecoder.cpp.

Referenced by AvFormatDecoder::MpegPreProcessPkt().

LOC
#define LOC
Definition: avformatdecoder.cpp:121