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 <cstring>
#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 "libmyth/mythaverror.h"
#include "libmyth/mythavframe.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/mythlogging.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 "mythavbufferref.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)
 
static void HandleStreamChange (void *data, int avprogram_id)
 
static bool cc608_good_parity (uint16_t data)
 
static AVBufferRef * get_pmt_section_from_AVProgram (const AVProgram *program)
 
static AVBufferRef * get_pmt_section_for_AVStream_index (AVFormatContext *context, int stream_index)
 
static bool is_dual_mono (const AVChannelLayout &ch_layout)
 
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 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

◆ FAIL

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

Definition at line 199 of file avformatdecoder.cpp.

◆ LOC

#define LOC   QString("AFD: ")

Definition at line 114 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 56 of file avformatdecoder.cpp.

Function Documentation

◆ 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 348 of file avformatdecoder.cpp.

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

◆ cc608_good_parity()

static bool cc608_good_parity ( uint16_t  data)
static

◆ extract_mono_channel()

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

Definition at line 4326 of file avformatdecoder.cpp.

Referenced by AvFormatDecoder::ProcessAudioPacket().

◆ 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 4025 of file avformatdecoder.cpp.

Referenced by AvFormatDecoder::selectBestAudioTrack().

◆ filter_type()

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

Definition at line 4039 of file avformatdecoder.cpp.

Referenced by AvFormatDecoder::AutoSelectAudioTrack().

◆ get_aspect() [1/2]

static float get_aspect ( AVCParser p)
static

Definition at line 155 of file avformatdecoder.cpp.

◆ get_aspect() [2/2]

static float get_aspect ( const AVCodecContext &  ctx)
static

◆ get_avf_buffer()

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

Definition at line 2663 of file avformatdecoder.cpp.

◆ get_canonical_lang()

static int get_canonical_lang ( const char *  lang_cstr)
static

◆ get_pmt_section_for_AVStream_index()

static AVBufferRef * get_pmt_section_for_AVStream_index ( AVFormatContext *  context,
int  stream_index 
)
static

◆ get_pmt_section_from_AVProgram()

static AVBufferRef * get_pmt_section_from_AVProgram ( const AVProgram *  program)
static

◆ get_video_dim()

static QSize get_video_dim ( const AVCodecContext &  ctx)
static

◆ HandleStreamChange()

static void HandleStreamChange ( void *  data,
int  avprogram_id 
)
static

Definition at line 872 of file avformatdecoder.cpp.

Referenced by AvFormatDecoder::OpenFile().

◆ is_dual_mono()

static bool is_dual_mono ( const AVChannelLayout &  ch_layout)
static

◆ lsb3full()

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

Definition at line 457 of file avformatdecoder.cpp.

Referenced by AvFormatDecoder::NormalizeVideoTimecode().

◆ myth_av_log()

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

Definition at line 265 of file avformatdecoder.cpp.

Referenced by AvFormatDecoder::AvFormatDecoder().

◆ 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 209 of file avformatdecoder.cpp.

Referenced by AvFormatDecoder::OpenFile().

Variable Documentation

◆ GOP_START

constexpr uint32_t GOP_START { 0x000001b8 }
staticconstexpr

Definition at line 2980 of file avformatdecoder.cpp.

Referenced by AvFormatDecoder::MpegPreProcessPkt().

◆ kMaxVideoQueueSize

constexpr ssize_t kMaxVideoQueueSize = 220
staticconstexpr

Definition at line 127 of file avformatdecoder.cpp.

Referenced by AvFormatDecoder::GetFrame().

◆ SEQ_PKT_ERR_MAX

constexpr int SEQ_PKT_ERR_MAX { 50 }
staticconstexpr

◆ SEQ_START

constexpr uint32_t SEQ_START { 0x000001b3 }
staticconstexpr

Definition at line 2979 of file avformatdecoder.cpp.

Referenced by AvFormatDecoder::MpegPreProcessPkt().

◆ SLICE_MAX

constexpr uint32_t SLICE_MAX { 0x000001af }
staticconstexpr

Definition at line 2983 of file avformatdecoder.cpp.

Referenced by AvFormatDecoder::MpegPreProcessPkt().

◆ SLICE_MIN

constexpr uint32_t SLICE_MIN { 0x00000101 }
staticconstexpr

Definition at line 2982 of file avformatdecoder.cpp.

Referenced by AvFormatDecoder::MpegPreProcessPkt().