From patchwork Sat Jan 7 19:21:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanislav Ionascu X-Patchwork-Id: 39915 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:bc95:b0:ad:ade2:bfd2 with SMTP id fx21csp2027289pzb; Sat, 7 Jan 2023 11:21:23 -0800 (PST) X-Google-Smtp-Source: AMrXdXttjZROLz5EWPhZCnAOxqpsQyNo89o4RFJ00cFK/L7KjWYBV0eSmAzghuMCJDwZrWxNPFYL X-Received: by 2002:a17:906:7f99:b0:84d:2f2a:b158 with SMTP id f25-20020a1709067f9900b0084d2f2ab158mr2906827ejr.11.1673119283255; Sat, 07 Jan 2023 11:21:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673119283; cv=none; d=google.com; s=arc-20160816; b=q3rKa6XvXuUOt8/m15FhMx3KSFc65ShFRCcZmi2hTvtdv+OkDnl+PndsECtFp2C/3J hoYA7jmhcz1hSzp1bSCmvq6lSujuV7RTsa3ogsh/5CP9KIpktvsimEMqaKBc7pr7f3jP RTW+ywQrm23yC+RDWPV+kmimnojjkxK1pJ/52BgeTKDRigeTOnRwmL6yOsJZ7crJdlia ziXWFuInpbVpZl2WonTkx8zGZN1KovmZhnNsCaAW2Cxh8iSsMwtkMFvWW+XGOaF/44jT gklgVo/VM2Eaq6nkvhyLPEDSTCQ1zXORdvED0ZRDP8VcnO5GJCYTeRG/aUqYEZYXCc/H Gdow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:message-id:date:to:from :dkim-signature:delivered-to; bh=LOsVFQSI4rfVQvFPozQAJ47oHOF4F2UOB/E9IIgXMRA=; b=fHezomFa3+5PXrypyngoYQyoXcHoQY9fHg5N/ZSBoShpBtBacuybsjKL8sSQgQZcoA 9NZ267wWTsndia29p6/NeOd45QvlZzdQFSMZnErherucQjXZEZvnmNxnJUko/N7plhyQ 05J8Dt2Yzl9lwVHHno7YX2q1olW6juIpf3ZnUH6Apoc9GB2IMYXn1Dbv5wuXJjNkj0nW /06ii2IlUcoRosxNeFb7rjP1JEnzNHl7NiamFwJM1fpG5jiZKjiIADLlV3ccYhbJVru2 qtmRaZexG9GtxhRcOC1OZD/vUk8cR2i/x2Bydj1d7vYzazEVIGx5KT8DISMRk/9cKjQM TGng== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=DgKVpMEo; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id hs42-20020a1709073eaa00b00813b319af0esi4962900ejc.110.2023.01.07.11.21.22; Sat, 07 Jan 2023 11:21:23 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=DgKVpMEo; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id A9C9368BB5A; Sat, 7 Jan 2023 21:21:18 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7E4DB68B265 for ; Sat, 7 Jan 2023 21:21:11 +0200 (EET) Received: by mail-wm1-f48.google.com with SMTP id p1-20020a05600c1d8100b003d8c9b191e0so3372596wms.4 for ; Sat, 07 Jan 2023 11:21:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=hhdi2E6HSaOoAhEE7AHrVlVzWTy7zsMmzqTzZcCZLPY=; b=DgKVpMEoViXuUcVTuH3+RsAXB+vPFggkz/NP+BTwk5TsQ/OXpSZ7brXsr6caHwGRVi LyzKCdlcW2M/MSMzArTSgAf2NO992jmGr4HlGUHSmcPTc7A1JrinbICqkS7o9PcsGJDs oT7c2I+5ZV7mvMdxOE3S46Ld5gfv4hG77hWSzemD50TKrtoTZQkfqFoYFjUecgZr0iqx wzBQbr/PXSroaUwTZ6iXJ/EihRAceCOXxRzqEN8iuGgqqw6jo4bqDdrdOzE0VrImEe+g bhwu563mv4GNgW0RXkYOt0ErfKo0gxta4PfYMq2vPI6V6XaZOaen6Dk0gdGD0C7EkW1J bnMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=hhdi2E6HSaOoAhEE7AHrVlVzWTy7zsMmzqTzZcCZLPY=; b=FvvCkimCwcK43ATs7zYV7anA5m90i/W2MwFEgZ5RyFMd53koGoXA14jRUa2QIZZJtN bJBwm01P3+SLAPAjJb9t4BhuTXo2p2Jv+dZFnlMSfZGcWE0h/j1pKyG6pkGC9Zkn4TcU XRvKD18Z9wvBCCh7ETU5U2DZAZ9Dwd2hRGBqzuhdSCOZKMrjRCpPQ0OUCF7v1sOS1MZv +cYhgBHnpmlaDhELsnUSTZMuxR48HtUs9atDSR0zifvbEksEIQ7PbcXSs5skDyvqufdC ndy1nru8tHbr2cmgtCAveOmJI2mFN/gs5ufZdfeawXhZRyRkjGcBX9f7O66WAj9lzB3+ LX1w== X-Gm-Message-State: AFqh2kq//eoCCp9uMaR/DEkQAExSNC9+mwsudvxTGTnY9rHTPUDd79We 12nIiHZshUXgp3cME1+6Ks1mHlcUYkoWdQ== X-Received: by 2002:a05:600c:250:b0:3d2:2830:b8bb with SMTP id 16-20020a05600c025000b003d22830b8bbmr46249673wmj.34.1673119270484; Sat, 07 Jan 2023 11:21:10 -0800 (PST) Received: from localhost.localdomain (host109-147-184-255.range109-147.btcentralplus.com. [109.147.184.255]) by smtp.gmail.com with ESMTPSA id j18-20020a05600c191200b003d9dee823a3sm5700004wmq.5.2023.01.07.11.21.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 Jan 2023 11:21:09 -0800 (PST) From: Stanislav Ionascu To: ffmpeg-devel@ffmpeg.org Date: Sat, 7 Jan 2023 19:21:00 +0000 Message-Id: <20230107192100.16005-1-stanislav.ionascu@gmail.com> X-Mailer: git-send-email 2.37.2 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2] avformat/dvd: new dvd:// protocol for reading dvd folder/images X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Stanislav Ionascu Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: v7EU1RNi8WnZ dvd:// protocol uses libdvdread for opening folders and/or disc-images, it then either identifies the longest title-set, or uses the title-set parameter. After opening the dvd, it will read and output all VOBs, in sequence defined by the program-chain. Signed-off-by: Stanislav Ionascu --- configure | 5 + libavformat/Makefile | 1 + libavformat/dvd.c | 307 ++++++++++++++++++++++++++++++++++++++++ libavformat/protocols.c | 1 + 4 files changed, 314 insertions(+) create mode 100644 libavformat/dvd.c diff --git a/configure b/configure index 870d426b0e..312144c105 100755 --- a/configure +++ b/configure @@ -230,6 +230,7 @@ External library support: --enable-libdavs2 enable AVS2 decoding via libdavs2 [no] --enable-libdc1394 enable IIDC-1394 grabbing using libdc1394 and libraw1394 [no] + --enable-libdvdread enable DVD reading using libdvdread [no] --enable-libfdk-aac enable AAC de/encoding via libfdk-aac [no] --enable-libflite enable flite (voice synthesis) support via libflite [no] --enable-libfontconfig enable libfontconfig, useful for drawtext filter [no] @@ -1814,6 +1815,7 @@ EXTERNAL_LIBRARY_LIST=" libdav1d libdc1394 libdrm + libdvdread libflite libfontconfig libfreetype @@ -3557,6 +3559,7 @@ xv_outdev_deps="xlib_xv xlib_x11 xlib_xext" # protocols async_protocol_deps="threads" bluray_protocol_deps="libbluray" +dvd_protocol_deps="libdvdread" ffrtmpcrypt_protocol_conflict="librtmp_protocol" ffrtmpcrypt_protocol_deps_any="gcrypt gmp openssl mbedtls" ffrtmpcrypt_protocol_select="tcp_protocol" @@ -6568,6 +6571,8 @@ enabled libdav1d && require_pkg_config libdav1d "dav1d >= 0.5.0" "dav1d enabled libdavs2 && require_pkg_config libdavs2 "davs2 >= 1.6.0" davs2.h davs2_decoder_open enabled libdc1394 && require_pkg_config libdc1394 libdc1394-2 dc1394/dc1394.h dc1394_new enabled libdrm && require_pkg_config libdrm libdrm xf86drm.h drmGetVersion +enabled libdvdread && enable dvdread +enabled dvdread && require_pkg_config libdvdread dvdread "dvdread/dvd_reader.h" DVDOpen2 enabled libfdk_aac && { check_pkg_config libfdk_aac fdk-aac "fdk-aac/aacenc_lib.h" aacEncOpen || { require libfdk_aac fdk-aac/aacenc_lib.h aacEncOpen -lfdk-aac && warn "using libfdk without pkg-config"; } } diff --git a/libavformat/Makefile b/libavformat/Makefile index d7f198bf39..a31fafcadb 100644 --- a/libavformat/Makefile +++ b/libavformat/Makefile @@ -644,6 +644,7 @@ OBJS-$(CONFIG_CONCAT_PROTOCOL) += concat.o OBJS-$(CONFIG_CONCATF_PROTOCOL) += concat.o OBJS-$(CONFIG_CRYPTO_PROTOCOL) += crypto.o OBJS-$(CONFIG_DATA_PROTOCOL) += data_uri.o +OBJS-$(CONFIG_DVD_PROTOCOL) += dvd.o OBJS-$(CONFIG_FFRTMPCRYPT_PROTOCOL) += rtmpcrypt.o rtmpdigest.o rtmpdh.o OBJS-$(CONFIG_FFRTMPHTTP_PROTOCOL) += rtmphttp.o OBJS-$(CONFIG_FILE_PROTOCOL) += file.o diff --git a/libavformat/dvd.c b/libavformat/dvd.c new file mode 100644 index 0000000000..8d7780f760 --- /dev/null +++ b/libavformat/dvd.c @@ -0,0 +1,307 @@ +/* + * DVD (libdvdread) protocol + * Copyright (c) 2023 Stan Ionascu + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include +#include +#include + +#include "libavformat/avformat.h" +#include "libavformat/url.h" +#include "libavutil/avstring.h" +#include "libavutil/opt.h" + +#define DVD_PROTO_PREFIX "dvd:" +#define DVD_SECTOR_SIZE 2048 + +typedef struct { + const AVClass *class; + + dvd_reader_t *dvd; + dvd_logger_cb dvd_logger; + + int title_set_nr; + int angle_nr; + dvd_file_t *dvd_title_file; + ifo_handle_t *vmg_ifo; + ifo_handle_t *vts_ifo; + pgc_t *current_pgc; + int current_cell; + + int start_sector; + int current_sector; + int end_sector; + +} DvdProtocolContext; + +static int bcd2int(int bcd) +{ + return (((bcd & 0xf0) >> 4) * 10 + (bcd & 0x0f)); +} + +static void dvd_logger_ff(void *opaque, dvd_logger_level_t dvd_level, const char *fmt, va_list args) +{ + int level = AV_LOG_TRACE; + if (dvd_level == DVD_LOGGER_LEVEL_ERROR) { + level = AV_LOG_ERROR; + } else if (dvd_level == DVD_LOGGER_LEVEL_WARN) { + level = AV_LOG_WARNING; + } else if (dvd_level == DVD_LOGGER_LEVEL_INFO) { + level = AV_LOG_INFO; + } else if (dvd_level == DVD_LOGGER_LEVEL_DEBUG) { + level = AV_LOG_DEBUG; + } + av_vlog(opaque, level, fmt, args); + /* add new line */ + av_log(opaque, level, "\n"); +} + +static int ff_dvd_get_title_set_length(ifo_handle_t *vts_ifo, tt_srpt_t *tt_srpt, int title_nr) +{ + /* NOTE: below 1 vs 0 indexing */ + int vts_title_number = tt_srpt->title[title_nr].vts_ttn; + int pgc_number = vts_ifo->vts_ptt_srpt->title[vts_title_number - 1].ptt[0].pgcn; + dvd_time_t *playback_time = &vts_ifo->vts_pgcit->pgci_srp[pgc_number - 1].pgc->playback_time; + + return (bcd2int(playback_time->hour) * 3600 + + bcd2int(playback_time->minute) * 60 + + bcd2int(playback_time->second)) * 1000; +} + +static void ff_dvd_set_program_chain_info(DvdProtocolContext *ctx, int title_nr, int ptt_nr) +{ + int vts_title_number = ctx->vmg_ifo->tt_srpt->title[title_nr].vts_ttn; + int pgc_id = ctx->vts_ifo->vts_ptt_srpt->title[vts_title_number].ptt[ptt_nr].pgcn; + int pgn = ctx->vts_ifo->vts_ptt_srpt->title[vts_title_number].ptt[ptt_nr].pgn; + + ctx->current_pgc = ctx->vts_ifo->vts_pgcit->pgci_srp[pgc_id - 1].pgc; + ctx->current_cell = ctx->current_pgc->program_map[pgn - 1] - 1; + + /* change angle */ + if(ctx->current_pgc->cell_playback[ctx->current_cell].block_type == BLOCK_TYPE_ANGLE_BLOCK ) { + ctx->current_cell += ctx->angle_nr; + } + + ctx->start_sector = ctx->current_pgc->cell_playback[ctx->current_cell].first_sector; + ctx->end_sector = ctx->current_pgc->cell_playback[ctx->current_cell].last_sector; + ctx->current_sector = ctx->start_sector; +} + +static int ff_dvd_get_next_cell(DvdProtocolContext *ctx) +{ + int next_cell = ctx->current_cell; + + /* fast-forward until last-cell */ + if (ctx->current_pgc->cell_playback[next_cell].block_type == BLOCK_TYPE_ANGLE_BLOCK) { + ctx->current_cell += ctx->angle_nr; + while (next_cell < ctx->current_pgc->nr_of_cells && + ctx->current_pgc->cell_playback[next_cell].block_type != BLOCK_MODE_LAST_CELL) { + next_cell++; + } + } + + /* take next cell */ + next_cell++; + if (next_cell >= ctx->current_pgc->nr_of_cells) { + return -1; + } + + return next_cell; +} + +static int dvd_url_close(URLContext *h) +{ + DvdProtocolContext *ctx = h->priv_data; + ifoClose(ctx->vts_ifo); + ifoClose(ctx->vmg_ifo); + DVDCloseFile(ctx->dvd_title_file); + DVDClose(ctx->dvd); + return 0; +} + +static int dvd_url_open(URLContext *h, const char *path, int flags) +{ + DvdProtocolContext *ctx = h->priv_data; + const char *dvd_path = path; + ifo_handle_t *vmg_ifo, *vts_ifo; + tt_srpt_t *tt_srpt; + int num_vts; + int longest_title_set_nr; + int64_t longest_title_set_time = 0; + int vts_nr; + int title_set_nr; + char disc_volume_id[32]; + + ctx->vmg_ifo = ctx->vts_ifo = NULL; + ctx->dvd_logger.pf_log = &dvd_logger_ff; + + /* strip protocol from path */ + av_strstart(path, DVD_PROTO_PREFIX, &dvd_path); + + /* open dvd folder or disc */ + if ((ctx->dvd = DVDOpen2(h, &ctx->dvd_logger, dvd_path)) == NULL) { + av_log(h, AV_LOG_ERROR, "DVDOpen(%s) failed\n", dvd_path); + return AVERROR(EIO); + } + + if (DVDUDFVolumeInfo(ctx->dvd, &disc_volume_id[0], 32, NULL, 0) == 0) { + av_log(h, AV_LOG_INFO, "opened disc-volume-id: %s\n", disc_volume_id); + } + + /* read toc */ + if ((vmg_ifo = ifoOpen(ctx->dvd, 0)) == NULL) { + av_log(h, AV_LOG_ERROR, "ifoOpen(0) failed\n"); + return AVERROR(EIO); + } + + /* read titles */ + num_vts = vmg_ifo->vts_atrt->nr_of_vtss; + av_log(h, AV_LOG_INFO, "there are %d usable titles\n", num_vts); + + /* get title-set info(s) */ + tt_srpt = vmg_ifo->tt_srpt; + if (ctx->title_set_nr >= tt_srpt->nr_of_srpts) { + av_log(h, AV_LOG_ERROR, "invalid title id %d\n", ctx->title_set_nr); + return AVERROR(EINVAL); + } + + for (vts_nr = 1; vts_nr <= num_vts; vts_nr++) { + int title_nr; + for (title_nr = 0; title_nr < tt_srpt->nr_of_srpts; title_nr++) { + int title_length_ms; + + if (tt_srpt->title[title_nr].title_set_nr != vts_nr) { + continue; + } + + /* describe the title(s) info */ + if ((vts_ifo = ifoOpen(ctx->dvd, vts_nr)) == NULL) { + av_log(h, AV_LOG_ERROR, "ifoOpen(%d) failed\n", title_nr); + return AVERROR(ENOMEM); + } + + /* skip if video title set or program chain info is missing */ + if (vts_ifo->vtsi_mat == NULL || vts_ifo->vts_pgcit == NULL) { + ifoClose(vts_ifo); + av_log(h, AV_LOG_TRACE, "skip title %d as no vts or pgc info is present\n", + title_nr); + continue; + } + + title_length_ms = ff_dvd_get_title_set_length(vts_ifo, tt_srpt, title_nr); + + av_log(h, AV_LOG_INFO, "title %03d : (%d:%02d:%02d) and %d chapter(s)\n", + title_nr, + (title_length_ms / 3600000), + (title_length_ms % 3600000) / 60000, + (title_length_ms % 60000) / 1000, + tt_srpt->title[title_nr].nr_of_ptts); + + if (longest_title_set_time < title_length_ms) { + longest_title_set_nr = title_nr; + longest_title_set_time = title_length_ms; + } + + ifoClose(vts_ifo); + } + } + + if (ctx->title_set_nr < 0) { + ctx->title_set_nr = longest_title_set_nr; + } + av_log(h, AV_LOG_INFO, "selected main title-set %d\n", ctx->title_set_nr); + + if (ctx->angle_nr > 0 && ctx->angle_nr >= tt_srpt->title[ctx->title_set_nr].nr_of_angles) { + av_log(h, AV_LOG_ERROR, "incorrect angle selected %d out of %d angle(s)\n", + ctx->angle_nr, + tt_srpt->title[ctx->title_set_nr].nr_of_angles); + } + + /* open request title_set info */ + title_set_nr = tt_srpt->title[ctx->title_set_nr].title_set_nr; + if ((vts_ifo = ifoOpen(ctx->dvd, title_set_nr)) == NULL) { + av_log(h, AV_LOG_INFO, "ifoOpen(%d) failed\n", title_set_nr); + return AVERROR(ENOMEM); + } + + /* open file */ + if ((ctx->dvd_title_file = DVDOpenFile(ctx->dvd, title_set_nr, DVD_READ_TITLE_VOBS)) == NULL) { + av_log(h, AV_LOG_ERROR, "DVDOpenFile(%d) failed\n", title_set_nr); + return AVERROR(EIO); + } + + ctx->vmg_ifo = vmg_ifo; + ctx->vts_ifo = vts_ifo; + + ff_dvd_set_program_chain_info(ctx, title_set_nr, 0); + + return 0; +} + +static int dvd_url_read(URLContext *h, unsigned char *buf, int size) +{ + DvdProtocolContext *ctx = h->priv_data; + ssize_t blocks_got; + int num_blocks = size / DVD_SECTOR_SIZE; + + if (ctx->current_sector > ctx->end_sector) { + int next_cell = ff_dvd_get_next_cell(ctx); + if (next_cell < 0) { + return AVERROR_EOF; + } + + ctx->current_cell = next_cell; + ctx->start_sector = ctx->current_pgc->cell_playback[ctx->current_cell].first_sector; + ctx->end_sector = ctx->current_pgc->cell_playback[ctx->current_cell].last_sector; + ctx->current_sector = ctx->start_sector; + } + + /* read all sectors that fit into buf */ + blocks_got = DVDReadBlocks(ctx->dvd_title_file, ctx->current_sector, num_blocks, buf); + if (blocks_got <= 0) { + av_log(h, AV_LOG_ERROR, "failed to DVDReadBlocks() %d blocks at offset %d\n", + num_blocks, ctx->current_cell); + return AVERROR(EIO); + } + ctx->current_sector += blocks_got; + return blocks_got <= 0 ? AVERROR_EOF : blocks_got * DVD_SECTOR_SIZE; +} + +#define OFFSET(x) offsetof(DvdProtocolContext, x) +static const AVOption options[] = { + {"title-set", "", OFFSET(title_set_nr), AV_OPT_TYPE_INT, { .i64=-1 }, -1, 9999, AV_OPT_FLAG_DECODING_PARAM }, + {"angle", "", OFFSET(angle_nr), AV_OPT_TYPE_INT, { .i64=0 }, 0, 256, AV_OPT_FLAG_DECODING_PARAM }, + { NULL }, +}; +static const AVClass dvd_context_class = { + .class_name = "dvd", + .item_name = av_default_item_name, + .option = options, + .version = LIBAVUTIL_VERSION_INT, +}; + +const URLProtocol ff_dvd_protocol = { + .name = "dvd", + .url_close = dvd_url_close, + .url_open = dvd_url_open, + .url_read = dvd_url_read, + .priv_data_size = sizeof(DvdProtocolContext), + .priv_data_class = &dvd_context_class, +}; diff --git a/libavformat/protocols.c b/libavformat/protocols.c index 8b7d1b940f..69f015c532 100644 --- a/libavformat/protocols.c +++ b/libavformat/protocols.c @@ -29,6 +29,7 @@ extern const URLProtocol ff_concat_protocol; extern const URLProtocol ff_concatf_protocol; extern const URLProtocol ff_crypto_protocol; extern const URLProtocol ff_data_protocol; +extern const URLProtocol ff_dvd_protocol; extern const URLProtocol ff_ffrtmpcrypt_protocol; extern const URLProtocol ff_ffrtmphttp_protocol; extern const URLProtocol ff_file_protocol;