FFmpeg
Data Structures | Macros | Enumerations | Functions | Variables
dvdvideodec.c File Reference
#include <inttypes.h>
#include <dvdnav/dvdnav.h>
#include <dvdread/dvd_reader.h>
#include <dvdread/ifo_read.h>
#include <dvdread/ifo_types.h>
#include <dvdread/nav_read.h>
#include "libavcodec/ac3_parser.h"
#include "libavutil/avstring.h"
#include "libavutil/avutil.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/mem.h"
#include "libavutil/opt.h"
#include "libavutil/samplefmt.h"
#include "avformat.h"
#include "avio_internal.h"
#include "avlanguage.h"
#include "demux.h"
#include "dvdclut.h"
#include "internal.h"
#include "url.h"

Go to the source code of this file.

Data Structures

struct  DVDVideoVTSVideoStreamEntry
 
struct  DVDVideoPGCAudioStreamEntry
 
struct  DVDVideoPGCSubtitleStreamEntry
 
struct  DVDVideoPlaybackState
 
struct  DVDVideoDemuxContext
 

Macros

#define DVDVIDEO_MAX_PS_SEARCH_BLOCKS   128
 
#define DVDVIDEO_BLOCK_SIZE   2048
 
#define DVDVIDEO_TIME_BASE_Q   (AVRational) { 1, 90000 }
 
#define DVDVIDEO_PTS_WRAP_BITS   32 /* VOBUs use 32 (PES allows 33) */
 
#define DVDVIDEO_LIBDVDX_LOG_BUFFER_SIZE   1024
 
#define PCI_START_BYTE   45 /* complement dvdread's DSI_START_BYTE */
 
#define OFFSET(x)   offsetof(DVDVideoDemuxContext, x)
 

Enumerations

enum  DVDVideoSubpictureViewport { DVDVIDEO_SUBP_VIEWPORT_FULLSCREEN, DVDVIDEO_SUBP_VIEWPORT_WIDESCREEN, DVDVIDEO_SUBP_VIEWPORT_LETTERBOX, DVDVIDEO_SUBP_VIEWPORT_PANSCAN }
 

Functions

static void dvdvideo_libdvdread_log (void *opaque, dvd_logger_level_t level, const char *msg, va_list msg_va)
 
static void dvdvideo_libdvdnav_log (void *opaque, dvdnav_logger_level_t level, const char *msg, va_list msg_va)
 
static void dvdvideo_ifo_close (AVFormatContext *s)
 
static int dvdvideo_ifo_open (AVFormatContext *s)
 
static int dvdvideo_is_cell_promising (AVFormatContext *s, pgc_t *pgc, int celln)
 
static int dvdvideo_is_pgc_promising (AVFormatContext *s, pgc_t *pgc)
 
static void dvdvideo_menu_close (AVFormatContext *s, DVDVideoPlaybackState *state)
 
static int dvdvideo_menu_open (AVFormatContext *s, DVDVideoPlaybackState *state)
 
static int dvdvideo_menu_next_ps_block (AVFormatContext *s, DVDVideoPlaybackState *state, uint8_t *buf, int buf_size, int *p_is_nav_packet)
 
static void dvdvideo_play_close (AVFormatContext *s, DVDVideoPlaybackState *state)
 
static int dvdvideo_play_open (AVFormatContext *s, DVDVideoPlaybackState *state)
 
static int dvdvideo_play_next_ps_block (AVFormatContext *s, DVDVideoPlaybackState *state, uint8_t *buf, int buf_size, int *p_is_nav_packet)
 
static int dvdvideo_chapters_setup_simple (AVFormatContext *s)
 
static int dvdvideo_chapters_setup_preindex (AVFormatContext *s)
 
static int dvdvideo_video_stream_analyze (AVFormatContext *s, video_attr_t video_attr, DVDVideoVTSVideoStreamEntry *entry)
 
static int dvdvideo_video_stream_add (AVFormatContext *s, DVDVideoVTSVideoStreamEntry *entry)
 
static int dvdvideo_video_stream_setup (AVFormatContext *s)
 
static int dvdvideo_audio_stream_analyze (AVFormatContext *s, audio_attr_t audio_attr, uint16_t audio_control, DVDVideoPGCAudioStreamEntry *entry)
 
static int dvdvideo_audio_stream_add (AVFormatContext *s, DVDVideoPGCAudioStreamEntry *entry)
 
static int dvdvideo_audio_stream_add_all (AVFormatContext *s)
 
static int dvdvideo_subp_stream_analyze (AVFormatContext *s, uint32_t offset, subp_attr_t subp_attr, DVDVideoPGCSubtitleStreamEntry *entry)
 
static int dvdvideo_subp_stream_add (AVFormatContext *s, DVDVideoPGCSubtitleStreamEntry *entry)
 
static int dvdvideo_subp_stream_add_internal (AVFormatContext *s, uint32_t offset, subp_attr_t subp_attr, enum DVDVideoSubpictureViewport viewport)
 
static int dvdvideo_subp_stream_add_all (AVFormatContext *s)
 
static int dvdvideo_subdemux_read_data (void *opaque, uint8_t *buf, int buf_size)
 
static void dvdvideo_subdemux_close (AVFormatContext *s)
 
static int dvdvideo_subdemux_open (AVFormatContext *s)
 
static int dvdvideo_subdemux_reset (AVFormatContext *s)
 
static int dvdvideo_read_header (AVFormatContext *s)
 
static int dvdvideo_read_packet (AVFormatContext *s, AVPacket *pkt)
 
static int dvdvideo_close (AVFormatContext *s)
 
static int dvdvideo_read_seek (AVFormatContext *s, int stream_index, int64_t timestamp, int flags)
 

Variables

static const uint8_t dvdvideo_nav_header [4] = { 0x00, 0x00, 0x01, 0xBF }
 
static const char dvdvideo_subp_viewport_labels [4][13]
 
static const AVOption dvdvideo_options []
 
static const AVClass dvdvideo_class
 
const FFInputFormat ff_dvdvideo_demuxer
 

Macro Definition Documentation

◆ DVDVIDEO_MAX_PS_SEARCH_BLOCKS

#define DVDVIDEO_MAX_PS_SEARCH_BLOCKS   128

Definition at line 57 of file dvdvideodec.c.

◆ DVDVIDEO_BLOCK_SIZE

#define DVDVIDEO_BLOCK_SIZE   2048

Definition at line 58 of file dvdvideodec.c.

◆ DVDVIDEO_TIME_BASE_Q

#define DVDVIDEO_TIME_BASE_Q   (AVRational) { 1, 90000 }

Definition at line 59 of file dvdvideodec.c.

◆ DVDVIDEO_PTS_WRAP_BITS

#define DVDVIDEO_PTS_WRAP_BITS   32 /* VOBUs use 32 (PES allows 33) */

Definition at line 60 of file dvdvideodec.c.

◆ DVDVIDEO_LIBDVDX_LOG_BUFFER_SIZE

#define DVDVIDEO_LIBDVDX_LOG_BUFFER_SIZE   1024

Definition at line 61 of file dvdvideodec.c.

◆ PCI_START_BYTE

#define PCI_START_BYTE   45 /* complement dvdread's DSI_START_BYTE */

Definition at line 63 of file dvdvideodec.c.

◆ OFFSET

#define OFFSET (   x)    offsetof(DVDVideoDemuxContext, x)

Definition at line 1798 of file dvdvideodec.c.

Enumeration Type Documentation

◆ DVDVideoSubpictureViewport

Enumerator
DVDVIDEO_SUBP_VIEWPORT_FULLSCREEN 
DVDVIDEO_SUBP_VIEWPORT_WIDESCREEN 
DVDVIDEO_SUBP_VIEWPORT_LETTERBOX 
DVDVIDEO_SUBP_VIEWPORT_PANSCAN 

Definition at line 66 of file dvdvideodec.c.

Function Documentation

◆ dvdvideo_libdvdread_log()

static void dvdvideo_libdvdread_log ( void *  opaque,
dvd_logger_level_t  level,
const char *  msg,
va_list  msg_va 
)
static

Definition at line 176 of file dvdvideodec.c.

Referenced by dvdvideo_ifo_open().

◆ dvdvideo_libdvdnav_log()

static void dvdvideo_libdvdnav_log ( void *  opaque,
dvdnav_logger_level_t  level,
const char *  msg,
va_list  msg_va 
)
static

Definition at line 193 of file dvdvideodec.c.

Referenced by dvdvideo_play_open().

◆ dvdvideo_ifo_close()

static void dvdvideo_ifo_close ( AVFormatContext s)
static

Definition at line 211 of file dvdvideodec.c.

Referenced by dvdvideo_close().

◆ dvdvideo_ifo_open()

static int dvdvideo_ifo_open ( AVFormatContext s)
static

Definition at line 225 of file dvdvideodec.c.

Referenced by dvdvideo_read_header().

◆ dvdvideo_is_cell_promising()

static int dvdvideo_is_cell_promising ( AVFormatContext s,
pgc_t *  pgc,
int  celln 
)
static

Definition at line 304 of file dvdvideodec.c.

Referenced by dvdvideo_is_pgc_promising(), and dvdvideo_play_next_ps_block().

◆ dvdvideo_is_pgc_promising()

static int dvdvideo_is_pgc_promising ( AVFormatContext s,
pgc_t *  pgc 
)
static

Definition at line 311 of file dvdvideodec.c.

Referenced by dvdvideo_play_open().

◆ dvdvideo_menu_close()

static void dvdvideo_menu_close ( AVFormatContext s,
DVDVideoPlaybackState state 
)
static

Definition at line 320 of file dvdvideodec.c.

Referenced by dvdvideo_chapters_setup_preindex(), and dvdvideo_close().

◆ dvdvideo_menu_open()

static int dvdvideo_menu_open ( AVFormatContext s,
DVDVideoPlaybackState state 
)
static

Definition at line 326 of file dvdvideodec.c.

Referenced by dvdvideo_chapters_setup_preindex(), and dvdvideo_read_header().

◆ dvdvideo_menu_next_ps_block()

static int dvdvideo_menu_next_ps_block ( AVFormatContext s,
DVDVideoPlaybackState state,
uint8_t *  buf,
int  buf_size,
int *  p_is_nav_packet 
)
static

Definition at line 395 of file dvdvideodec.c.

Referenced by dvdvideo_chapters_setup_preindex(), and dvdvideo_subdemux_read_data().

◆ dvdvideo_play_close()

static void dvdvideo_play_close ( AVFormatContext s,
DVDVideoPlaybackState state 
)
static

Definition at line 501 of file dvdvideodec.c.

Referenced by dvdvideo_chapters_setup_preindex(), and dvdvideo_close().

◆ dvdvideo_play_open()

static int dvdvideo_play_open ( AVFormatContext s,
DVDVideoPlaybackState state 
)
static

Definition at line 515 of file dvdvideodec.c.

Referenced by dvdvideo_chapters_setup_preindex(), and dvdvideo_read_header().

◆ dvdvideo_play_next_ps_block()

static int dvdvideo_play_next_ps_block ( AVFormatContext s,
DVDVideoPlaybackState state,
uint8_t *  buf,
int  buf_size,
int *  p_is_nav_packet 
)
static

Definition at line 619 of file dvdvideodec.c.

Referenced by dvdvideo_chapters_setup_preindex(), and dvdvideo_subdemux_read_data().

◆ dvdvideo_chapters_setup_simple()

static int dvdvideo_chapters_setup_simple ( AVFormatContext s)
static

Definition at line 869 of file dvdvideodec.c.

Referenced by dvdvideo_read_header().

◆ dvdvideo_chapters_setup_preindex()

static int dvdvideo_chapters_setup_preindex ( AVFormatContext s)
static

Definition at line 915 of file dvdvideodec.c.

Referenced by dvdvideo_read_header().

◆ dvdvideo_video_stream_analyze()

static int dvdvideo_video_stream_analyze ( AVFormatContext s,
video_attr_t  video_attr,
DVDVideoVTSVideoStreamEntry entry 
)
static

Definition at line 1007 of file dvdvideodec.c.

Referenced by dvdvideo_video_stream_setup().

◆ dvdvideo_video_stream_add()

static int dvdvideo_video_stream_add ( AVFormatContext s,
DVDVideoVTSVideoStreamEntry entry 
)
static

Definition at line 1056 of file dvdvideodec.c.

Referenced by dvdvideo_video_stream_setup().

◆ dvdvideo_video_stream_setup()

static int dvdvideo_video_stream_setup ( AVFormatContext s)
static

Definition at line 1089 of file dvdvideodec.c.

Referenced by dvdvideo_read_header().

◆ dvdvideo_audio_stream_analyze()

static int dvdvideo_audio_stream_analyze ( AVFormatContext s,
audio_attr_t  audio_attr,
uint16_t  audio_control,
DVDVideoPGCAudioStreamEntry entry 
)
static

Definition at line 1113 of file dvdvideodec.c.

Referenced by dvdvideo_audio_stream_add_all().

◆ dvdvideo_audio_stream_add()

static int dvdvideo_audio_stream_add ( AVFormatContext s,
DVDVideoPGCAudioStreamEntry entry 
)
static

Definition at line 1216 of file dvdvideodec.c.

Referenced by dvdvideo_audio_stream_add_all().

◆ dvdvideo_audio_stream_add_all()

static int dvdvideo_audio_stream_add_all ( AVFormatContext s)
static

Definition at line 1249 of file dvdvideodec.c.

Referenced by dvdvideo_read_header().

◆ dvdvideo_subp_stream_analyze()

static int dvdvideo_subp_stream_analyze ( AVFormatContext s,
uint32_t  offset,
subp_attr_t  subp_attr,
DVDVideoPGCSubtitleStreamEntry entry 
)
static

Definition at line 1297 of file dvdvideodec.c.

Referenced by dvdvideo_subp_stream_add_internal().

◆ dvdvideo_subp_stream_add()

static int dvdvideo_subp_stream_add ( AVFormatContext s,
DVDVideoPGCSubtitleStreamEntry entry 
)
static

Definition at line 1324 of file dvdvideodec.c.

Referenced by dvdvideo_subp_stream_add_internal().

◆ dvdvideo_subp_stream_add_internal()

static int dvdvideo_subp_stream_add_internal ( AVFormatContext s,
uint32_t  offset,
subp_attr_t  subp_attr,
enum DVDVideoSubpictureViewport  viewport 
)
static

Definition at line 1358 of file dvdvideodec.c.

Referenced by dvdvideo_subp_stream_add_all().

◆ dvdvideo_subp_stream_add_all()

static int dvdvideo_subp_stream_add_all ( AVFormatContext s)
static

Definition at line 1385 of file dvdvideodec.c.

Referenced by dvdvideo_read_header().

◆ dvdvideo_subdemux_read_data()

static int dvdvideo_subdemux_read_data ( void *  opaque,
uint8_t *  buf,
int  buf_size 
)
static

Definition at line 1451 of file dvdvideodec.c.

Referenced by dvdvideo_subdemux_open().

◆ dvdvideo_subdemux_close()

static void dvdvideo_subdemux_close ( AVFormatContext s)
static

Definition at line 1489 of file dvdvideodec.c.

Referenced by dvdvideo_close(), and dvdvideo_subdemux_reset().

◆ dvdvideo_subdemux_open()

static int dvdvideo_subdemux_open ( AVFormatContext s)
static

Definition at line 1497 of file dvdvideodec.c.

Referenced by dvdvideo_read_header(), and dvdvideo_subdemux_reset().

◆ dvdvideo_subdemux_reset()

static int dvdvideo_subdemux_reset ( AVFormatContext s)
static

Definition at line 1531 of file dvdvideodec.c.

Referenced by dvdvideo_read_packet(), and dvdvideo_read_seek().

◆ dvdvideo_read_header()

static int dvdvideo_read_header ( AVFormatContext s)
static

Definition at line 1544 of file dvdvideodec.c.

◆ dvdvideo_read_packet()

static int dvdvideo_read_packet ( AVFormatContext s,
AVPacket pkt 
)
static

Definition at line 1622 of file dvdvideodec.c.

◆ dvdvideo_close()

static int dvdvideo_close ( AVFormatContext s)
static

Definition at line 1713 of file dvdvideodec.c.

◆ dvdvideo_read_seek()

static int dvdvideo_read_seek ( AVFormatContext s,
int  stream_index,
int64_t  timestamp,
int  flags 
)
static

Definition at line 1732 of file dvdvideodec.c.

Variable Documentation

◆ dvdvideo_nav_header

const uint8_t dvdvideo_nav_header[4] = { 0x00, 0x00, 0x01, 0xBF }
static

Definition at line 64 of file dvdvideodec.c.

Referenced by dvdvideo_menu_next_ps_block().

◆ dvdvideo_subp_viewport_labels

const char dvdvideo_subp_viewport_labels[4][13]
static
Initial value:
= {
"Fullscreen", "Widescreen", "Letterbox", "Pan and Scan"
}

Definition at line 72 of file dvdvideodec.c.

Referenced by dvdvideo_subp_stream_add().

◆ dvdvideo_options

const AVOption dvdvideo_options[]
static
Initial value:
= {
{"angle", "playback angle number", OFFSET(opt_angle), AV_OPT_TYPE_INT, { .i64=1 }, 1, 9, AV_OPT_FLAG_DECODING_PARAM },
{"chapter_end", "exit chapter (PTT) number (0=end)", OFFSET(opt_chapter_end), AV_OPT_TYPE_INT, { .i64=0 }, 0, 99, AV_OPT_FLAG_DECODING_PARAM },
{"chapter_start", "entry chapter (PTT) number", OFFSET(opt_chapter_start), AV_OPT_TYPE_INT, { .i64=1 }, 1, 99, AV_OPT_FLAG_DECODING_PARAM },
{"menu", "demux menu domain", OFFSET(opt_menu), AV_OPT_TYPE_BOOL, { .i64=0 }, 0, 1, AV_OPT_FLAG_DECODING_PARAM },
{"menu_lu", "menu language unit", OFFSET(opt_menu_lu), AV_OPT_TYPE_INT, { .i64=1 }, 1, 99, AV_OPT_FLAG_DECODING_PARAM },
{"menu_vts", "menu VTS (0=VMG root menu)", OFFSET(opt_menu_vts), AV_OPT_TYPE_INT, { .i64=1 }, 0, 99, AV_OPT_FLAG_DECODING_PARAM },
{"pg", "entry PG number (when paired with PGC number)", OFFSET(opt_pg), AV_OPT_TYPE_INT, { .i64=1 }, 1, 255, AV_OPT_FLAG_DECODING_PARAM },
{"pgc", "entry PGC number (0=auto)", OFFSET(opt_pgc), AV_OPT_TYPE_INT, { .i64=0 }, 0, 999, AV_OPT_FLAG_DECODING_PARAM },
{"preindex", "enable for accurate chapter markers, slow (2-pass read)", OFFSET(opt_preindex), AV_OPT_TYPE_BOOL, { .i64=0 }, 0, 1, AV_OPT_FLAG_DECODING_PARAM },
{"region", "playback region number (0=free)", OFFSET(opt_region), AV_OPT_TYPE_INT, { .i64=0 }, 0, 8, AV_OPT_FLAG_DECODING_PARAM },
{"title", "title number (0=auto)", OFFSET(opt_title), AV_OPT_TYPE_INT, { .i64=0 }, 0, 99, AV_OPT_FLAG_DECODING_PARAM },
{"trim", "trim padding cells from start", OFFSET(opt_trim), AV_OPT_TYPE_BOOL, { .i64=1 }, 0, 1, AV_OPT_FLAG_DECODING_PARAM },
{NULL}
}

Definition at line 1799 of file dvdvideodec.c.

◆ dvdvideo_class

const AVClass dvdvideo_class
static
Initial value:
= {
.class_name = "DVD-Video demuxer",
.item_name = av_default_item_name,
.option = dvdvideo_options,
}

Definition at line 1815 of file dvdvideodec.c.

◆ ff_dvdvideo_demuxer

const FFInputFormat ff_dvdvideo_demuxer
Initial value:

Definition at line 1822 of file dvdvideodec.c.

AVFMT_NO_BYTE_SEEK
#define AVFMT_NO_BYTE_SEEK
Format does not allow seeking by bytes.
Definition: avformat.h:487
AVFMT_SHOW_IDS
#define AVFMT_SHOW_IDS
Show format stream IDs numbers.
Definition: avformat.h:477
OFFSET
#define OFFSET(x)
Definition: dvdvideodec.c:1798
AVFMT_NOBINSEARCH
#define AVFMT_NOBINSEARCH
Format does not allow to fall back on binary search via read_timestamp.
Definition: avformat.h:485
DVDVideoDemuxContext
Definition: dvdvideodec.c:139
AVFMT_SEEK_TO_PTS
#define AVFMT_SEEK_TO_PTS
Seeking is based on PTS.
Definition: avformat.h:503
read_seek
static int read_seek(AVFormatContext *ctx, int stream_index, int64_t timestamp, int flags)
Definition: libcdio.c:151
read_close
static av_cold int read_close(AVFormatContext *ctx)
Definition: libcdio.c:143
read_packet
static int read_packet(void *opaque, uint8_t *buf, int buf_size)
Definition: avio_read_callback.c:42
dvdvideo_read_header
static int dvdvideo_read_header(AVFormatContext *s)
Definition: dvdvideodec.c:1544
FF_INFMT_FLAG_INIT_CLEANUP
#define FF_INFMT_FLAG_INIT_CLEANUP
For an FFInputFormat with this flag set read_close() needs to be called by the caller upon read_heade...
Definition: demux.h:35
LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
read_header
static int read_header(FFV1Context *f)
Definition: ffv1dec.c:540
NULL
#define NULL
Definition: coverity.c:32
dvdvideo_class
static const AVClass dvdvideo_class
Definition: dvdvideodec.c:1815
dvdvideo_read_packet
static int dvdvideo_read_packet(AVFormatContext *s, AVPacket *pkt)
Definition: dvdvideodec.c:1622
av_default_item_name
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:237
dvdvideo_close
static int dvdvideo_close(AVFormatContext *s)
Definition: dvdvideodec.c:1713
NULL_IF_CONFIG_SMALL
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:94
AVFMT_NOFILE
#define AVFMT_NOFILE
Demuxer will use avio_open, no opened file should be provided by the caller.
Definition: avformat.h:468
dvdvideo_options
static const AVOption dvdvideo_options[]
Definition: dvdvideodec.c:1799
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition: opt.h:259
AVFMT_NOGENSEARCH
#define AVFMT_NOGENSEARCH
Format does not allow to fall back on generic search.
Definition: avformat.h:486
dvdvideo_read_seek
static int dvdvideo_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags)
Definition: dvdvideodec.c:1732
AV_OPT_FLAG_DECODING_PARAM
#define AV_OPT_FLAG_DECODING_PARAM
A generic parameter which can be set by the user for demuxing or decoding.
Definition: opt.h:356
AVFMT_TS_DISCONT
#define AVFMT_TS_DISCONT
Format allows timestamp discontinuities.
Definition: avformat.h:481
AV_OPT_TYPE_BOOL
@ AV_OPT_TYPE_BOOL
Underlying C type is int.
Definition: opt.h:327