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 "libavutil/avstring.h"
#include "libavutil/avutil.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/mem.h"
#include "libavutil/opt.h"
#include "libavutil/samplefmt.h"
#include "libavutil/time.h"
#include "libavutil/timestamp.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   64 /* 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, void(*flush_cb)(AVFormatContext *s))
 
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_nav_event, void(*flush_cb)(AVFormatContext *s))
 
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, enum AVStreamParseType need_parsing)
 
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, enum AVStreamParseType need_parsing)
 
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, enum AVStreamParseType need_parsing)
 
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 void dvdvideo_subdemux_flush (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_read_header (AVFormatContext *s)
 
static int dvdvideo_read_packet (AVFormatContext *s, AVPacket *pkt)
 
static int dvdvideo_close (AVFormatContext *s)
 

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 58 of file dvdvideodec.c.

◆ DVDVIDEO_BLOCK_SIZE

#define DVDVIDEO_BLOCK_SIZE   2048

Definition at line 59 of file dvdvideodec.c.

◆ DVDVIDEO_TIME_BASE_Q

#define DVDVIDEO_TIME_BASE_Q   (AVRational) { 1, 90000 }

Definition at line 60 of file dvdvideodec.c.

◆ DVDVIDEO_PTS_WRAP_BITS

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

Definition at line 61 of file dvdvideodec.c.

◆ DVDVIDEO_LIBDVDX_LOG_BUFFER_SIZE

#define DVDVIDEO_LIBDVDX_LOG_BUFFER_SIZE   1024

Definition at line 62 of file dvdvideodec.c.

◆ PCI_START_BYTE

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

Definition at line 64 of file dvdvideodec.c.

◆ OFFSET

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

Definition at line 1679 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 67 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 174 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 191 of file dvdvideodec.c.

Referenced by dvdvideo_play_open().

◆ dvdvideo_ifo_close()

static void dvdvideo_ifo_close ( AVFormatContext s)
static

Definition at line 209 of file dvdvideodec.c.

Referenced by dvdvideo_close().

◆ dvdvideo_ifo_open()

static int dvdvideo_ifo_open ( AVFormatContext s)
static

Definition at line 223 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 302 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 309 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 318 of file dvdvideodec.c.

Referenced by dvdvideo_close().

◆ dvdvideo_menu_open()

static int dvdvideo_menu_open ( AVFormatContext s,
DVDVideoPlaybackState state 
)
static

Definition at line 324 of file dvdvideodec.c.

Referenced by 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,
void(*)(AVFormatContext *s flush_cb 
)
static

Definition at line 393 of file dvdvideodec.c.

Referenced by dvdvideo_subdemux_read_data().

◆ dvdvideo_play_close()

static void dvdvideo_play_close ( AVFormatContext s,
DVDVideoPlaybackState state 
)
static

Definition at line 495 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 509 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_nav_event,
void(*)(AVFormatContext *s flush_cb 
)
static

Definition at line 613 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 858 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 899 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 973 of file dvdvideodec.c.

Referenced by dvdvideo_video_stream_setup().

◆ dvdvideo_video_stream_add()

static int dvdvideo_video_stream_add ( AVFormatContext s,
DVDVideoVTSVideoStreamEntry entry,
enum AVStreamParseType  need_parsing 
)
static

Definition at line 1022 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 1057 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 1081 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,
enum AVStreamParseType  need_parsing 
)
static

Definition at line 1184 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 1218 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 1266 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,
enum AVStreamParseType  need_parsing 
)
static

Definition at line 1290 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 1325 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 1352 of file dvdvideodec.c.

Referenced by dvdvideo_read_header().

◆ dvdvideo_subdemux_flush()

static void dvdvideo_subdemux_flush ( AVFormatContext s)
static

Definition at line 1418 of file dvdvideodec.c.

Referenced by dvdvideo_subdemux_read_data().

◆ dvdvideo_subdemux_read_data()

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

Definition at line 1431 of file dvdvideodec.c.

Referenced by dvdvideo_subdemux_open().

◆ dvdvideo_subdemux_close()

static void dvdvideo_subdemux_close ( AVFormatContext s)
static

Definition at line 1462 of file dvdvideodec.c.

Referenced by dvdvideo_close().

◆ dvdvideo_subdemux_open()

static int dvdvideo_subdemux_open ( AVFormatContext s)
static

Definition at line 1470 of file dvdvideodec.c.

Referenced by dvdvideo_read_header().

◆ dvdvideo_read_header()

static int dvdvideo_read_header ( AVFormatContext s)
static

Definition at line 1505 of file dvdvideodec.c.

◆ dvdvideo_read_packet()

static int dvdvideo_read_packet ( AVFormatContext s,
AVPacket pkt 
)
static

Definition at line 1590 of file dvdvideodec.c.

◆ dvdvideo_close()

static int dvdvideo_close ( AVFormatContext s)
static

Definition at line 1663 of file dvdvideodec.c.

Variable Documentation

◆ dvdvideo_nav_header

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

Definition at line 65 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 73 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 (0=auto)", OFFSET(opt_menu_lu), AV_OPT_TYPE_INT, { .i64=0 }, 0, 99, AV_OPT_FLAG_DECODING_PARAM },
{"menu_vts", "menu VTS (0=VMG main menu)", OFFSET(opt_menu_vts), AV_OPT_TYPE_INT, { .i64=0 }, 0, 99, AV_OPT_FLAG_DECODING_PARAM },
{"pg", "entry PG number (0=auto)", OFFSET(opt_pg), AV_OPT_TYPE_INT, { .i64=0 }, 0, 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 1680 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 1696 of file dvdvideodec.c.

◆ ff_dvdvideo_demuxer

const FFInputFormat ff_dvdvideo_demuxer
Initial value:

Definition at line 1703 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:1679
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
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:1505
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:550
NULL
#define NULL
Definition: coverity.c:32
dvdvideo_class
static const AVClass dvdvideo_class
Definition: dvdvideodec.c:1696
dvdvideo_read_packet
static int dvdvideo_read_packet(AVFormatContext *s, AVPacket *pkt)
Definition: dvdvideodec.c:1590
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:1663
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:1680
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:235
AVFMT_NOGENSEARCH
#define AVFMT_NOGENSEARCH
Format does not allow to fall back on generic search.
Definition: avformat.h:486
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:273
AVFMT_TS_DISCONT
#define AVFMT_TS_DISCONT
Format allows timestamp discontinuities.
Definition: avformat.h:481
AV_OPT_TYPE_BOOL
@ AV_OPT_TYPE_BOOL
Definition: opt.h:251