Re: [FFmpeg-devel] [PATCH v7 1/2] libavformat/dvdvideo: add DVD-Video demuxer powered by libdvdnav and libdvdread

2024-02-07 Thread Andreas Rheinhardt
Marth64:
> Sorry for the quick follow-up to v6, I wanted to get this update out now 
> hopefully
> before v6 is actually reviewed. v7 fixes a few documentation typos, options 
> descriptions,
> and log messages: nothing major. I also flattened this out to be a 2-patch set
> with subtitle palette support.
> 
> This is the result of >1yr of research and I am now very satisfied with it's 
> result.
> I will not make any more changes at this point unless it is outcome from a 
> review.
> If the community decides to merge it, I am happy to continue to improve it 
> with support for
> seeking, probing, and tests.
> 
> Thank you so much,
> 
> 
> Signed-off-by: Marth64 
> ---
>  Changelog |2 +
>  configure |8 +
>  doc/demuxers.texi |  129 
>  libavformat/Makefile  |1 +
>  libavformat/allformats.c  |1 +
>  libavformat/dvdvideodec.c | 1410 +
>  6 files changed, 1551 insertions(+)
>  create mode 100644 libavformat/dvdvideodec.c
> 
> diff --git a/Changelog b/Changelog
> index c5fb21d198..88653bc6d3 100644
> --- a/Changelog
> +++ b/Changelog
> @@ -24,6 +24,8 @@ version :
>  - ffmpeg CLI options may now be used as -/opt , which is equivalent
>to -opt >
>  - showinfo bitstream filter
> +- DVD-Video demuxer, powered by libdvdnav and libdvdread
> +
>  
>  version 6.1:
>  - libaribcaption decoder
> diff --git a/configure b/configure
> index 68f675a4bc..70c33ec96d 100755
> --- a/configure
> +++ b/configure
> @@ -227,6 +227,8 @@ External library support:
>--enable-libdavs2enable AVS2 decoding via libdavs2 [no]
>--enable-libdc1394   enable IIDC-1394 grabbing using libdc1394
> and libraw1394 [no]
> +  --enable-libdvdnav   enable libdvdnav, needed for DVD demuxing [no]
> +  --enable-libdvdread  enable libdvdread, needed for DVD demuxing [no]
>--enable-libfdk-aac  enable AAC de/encoding via libfdk-aac [no]
>--enable-libfliteenable flite (voice synthesis) support via 
> libflite [no]
>--enable-libfontconfig   enable libfontconfig, useful for drawtext filter 
> [no]
> @@ -1806,6 +1808,8 @@ EXTERNAL_LIBRARY_GPL_LIST="
>  frei0r
>  libcdio
>  libdavs2
> +libdvdnav
> +libdvdread
>  librubberband
>  libvidstab
>  libx264
> @@ -3520,6 +3524,8 @@ dts_demuxer_select="dca_parser"
>  dtshd_demuxer_select="dca_parser"
>  dv_demuxer_select="dvprofile"
>  dv_muxer_select="dvprofile"
> +dvdvideo_demuxer_select="mpegps_demuxer"
> +dvdvideo_demuxer_deps="libdvdnav libdvdread"
>  dxa_demuxer_select="riffdec"
>  eac3_demuxer_select="ac3_parser"
>  evc_demuxer_select="evc_frame_merge_bsf evc_parser"
> @@ -6761,6 +6767,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&& check_pkg_config libdrm libdrm xf86drm.h 
> drmGetVersion
> +enabled libdvdnav && require_pkg_config libdvdnav "dvdnav >= 6.1.1" 
> dvdnav/dvdnav.h dvdnav_open2
> +enabled libdvdread&& require_pkg_config libdvdread "dvdread >= 
> 6.1.2" dvdread/dvd_reader.h DVDOpen2 -ldvdread
>  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/doc/demuxers.texi b/doc/demuxers.texi
> index e4c5b560a6..ad0906f6ec 100644
> --- a/doc/demuxers.texi
> +++ b/doc/demuxers.texi
> @@ -285,6 +285,135 @@ This demuxer accepts the following option:
>  
>  @end table
>  
> +@section dvdvideo
> +
> +DVD-Video demuxer, powered by libdvdnav and libdvdread.
> +
> +Can directly ingest DVD titles, specifically sequential PGCs,
> +into a conversion pipeline. Menus and seeking are not supported at this time.
> +
> +Block devices (DVD drives), ISO files, and directory structures are accepted.
> +Activate with @code{-f dvdvideo} in front of one of these inputs.
> +
> +Underlying playback is fully handled by libdvdnav, and structure parsing by 
> libdvdread.
> +ffmpeg must be built with GPL library support available as well as the 
> switches
> +@code{--enable-libdvdnav} and @code{--enable-libdvdread}.
> +
> +You will need to provide either the desired "title number" or exact PGC/PG 
> coordinates.
> +Many open-source DVD players and tools can aid in providing this information.
> +If not specified, the demuxer will default to title 1 which works for many 
> discs.
> +However, due to the flexibility of DVD-Video, it is recommended to check 
> manually.
> +There are many discs that are authored strangely or with invalid headers.
> +
> +If the input is a real DVD drive, please 

Re: [FFmpeg-devel] [PATCH v7 1/2] libavformat/dvdvideo: add DVD-Video demuxer powered by libdvdnav and libdvdread

2024-02-06 Thread Marth64
Thank you for your time and detailed review. I will clean all this up and
send v9

On Tue, Feb 6, 2024 at 6:53 PM Stefano Sabatini  wrote:

> On date Sunday 2024-02-04 23:48:25 -0600, Marth64 wrote:
> > Sorry for the quick follow-up to v6, I wanted to get this update out now
> hopefully
> > before v6 is actually reviewed. v7 fixes a few documentation typos,
> options descriptions,
> > and log messages: nothing major. I also flattened this out to be a
> 2-patch set
> > with subtitle palette support.
> >
> > This is the result of >1yr of research and I am now very satisfied with
> it's result.
> > I will not make any more changes at this point unless it is outcome from
> a review.
> > If the community decides to merge it, I am happy to continue to improve
> it with support for
> > seeking, probing, and tests.
> >
> > Thank you so much,
> >
> >
> > Signed-off-by: Marth64 
> > ---
> >  Changelog |2 +
> >  configure |8 +
> >  doc/demuxers.texi |  129 
> >  libavformat/Makefile  |1 +
> >  libavformat/allformats.c  |1 +
> >  libavformat/dvdvideodec.c | 1410 +
> >  6 files changed, 1551 insertions(+)
> >  create mode 100644 libavformat/dvdvideodec.c
> >
> > diff --git a/Changelog b/Changelog
> > index c5fb21d198..88653bc6d3 100644
> > --- a/Changelog
> > +++ b/Changelog
> > @@ -24,6 +24,8 @@ version :
> >  - ffmpeg CLI options may now be used as -/opt , which is
> equivalent
> >to -opt >
> >  - showinfo bitstream filter
> > +- DVD-Video demuxer, powered by libdvdnav and libdvdread
> > +
> >
> >  version 6.1:
> >  - libaribcaption decoder
> > diff --git a/configure b/configure
> > index 68f675a4bc..70c33ec96d 100755
> > --- a/configure
> > +++ b/configure
> > @@ -227,6 +227,8 @@ External library support:
> >--enable-libdavs2enable AVS2 decoding via libdavs2 [no]
> >--enable-libdc1394   enable IIDC-1394 grabbing using libdc1394
> > and libraw1394 [no]
> > +  --enable-libdvdnav   enable libdvdnav, needed for DVD demuxing
> [no]
> > +  --enable-libdvdread  enable libdvdread, needed for DVD demuxing
> [no]
> >--enable-libfdk-aac  enable AAC de/encoding via libfdk-aac [no]
> >--enable-libfliteenable flite (voice synthesis) support via
> libflite [no]
> >--enable-libfontconfig   enable libfontconfig, useful for drawtext
> filter [no]
> > @@ -1806,6 +1808,8 @@ EXTERNAL_LIBRARY_GPL_LIST="
> >  frei0r
> >  libcdio
> >  libdavs2
> > +libdvdnav
> > +libdvdread
> >  librubberband
> >  libvidstab
> >  libx264
> > @@ -3520,6 +3524,8 @@ dts_demuxer_select="dca_parser"
> >  dtshd_demuxer_select="dca_parser"
> >  dv_demuxer_select="dvprofile"
> >  dv_muxer_select="dvprofile"
> > +dvdvideo_demuxer_select="mpegps_demuxer"
> > +dvdvideo_demuxer_deps="libdvdnav libdvdread"
> >  dxa_demuxer_select="riffdec"
> >  eac3_demuxer_select="ac3_parser"
> >  evc_demuxer_select="evc_frame_merge_bsf evc_parser"
> > @@ -6761,6 +6767,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&& check_pkg_config libdrm libdrm xf86drm.h
> drmGetVersion
> > +enabled libdvdnav && require_pkg_config libdvdnav "dvdnav >=
> 6.1.1" dvdnav/dvdnav.h dvdnav_open2
> > +enabled libdvdread&& require_pkg_config libdvdread "dvdread >=
> 6.1.2" dvdread/dvd_reader.h DVDOpen2 -ldvdread
> >  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/doc/demuxers.texi b/doc/demuxers.texi
> > index e4c5b560a6..ad0906f6ec 100644
> > --- a/doc/demuxers.texi
> > +++ b/doc/demuxers.texi
> > @@ -285,6 +285,135 @@ This demuxer accepts the following option:
> >
> >  @end table
> >
> > +@section dvdvideo
> > +
> > +DVD-Video demuxer, powered by libdvdnav and libdvdread.
> > +
> > +Can directly ingest DVD titles, specifically sequential PGCs,
> > +into a conversion pipeline. Menus and seeking are not supported at this
> time.
> > +
> > +Block devices (DVD drives), ISO files, and directory structures are
> accepted.
> > +Activate with @code{-f dvdvideo} in front of one of these inputs.
> > +
> > +Underlying playback is fully handled by libdvdnav, and structure
> parsing by libdvdread.
>
> > +ffmpeg must be built with GPL library support available as well as the
> switches
> > +@code{--enable-libdvdnav} and @code{--enable-libdvdread}.
>
> FFmpeg must be built with GPL library support available as well as the
> configure switches 

Re: [FFmpeg-devel] [PATCH v7 1/2] libavformat/dvdvideo: add DVD-Video demuxer powered by libdvdnav and libdvdread

2024-02-06 Thread Stefano Sabatini
On date Sunday 2024-02-04 23:48:25 -0600, Marth64 wrote:
> Sorry for the quick follow-up to v6, I wanted to get this update out now 
> hopefully
> before v6 is actually reviewed. v7 fixes a few documentation typos, options 
> descriptions,
> and log messages: nothing major. I also flattened this out to be a 2-patch set
> with subtitle palette support.
> 
> This is the result of >1yr of research and I am now very satisfied with it's 
> result.
> I will not make any more changes at this point unless it is outcome from a 
> review.
> If the community decides to merge it, I am happy to continue to improve it 
> with support for
> seeking, probing, and tests.
> 
> Thank you so much,
> 
> 
> Signed-off-by: Marth64 
> ---
>  Changelog |2 +
>  configure |8 +
>  doc/demuxers.texi |  129 
>  libavformat/Makefile  |1 +
>  libavformat/allformats.c  |1 +
>  libavformat/dvdvideodec.c | 1410 +
>  6 files changed, 1551 insertions(+)
>  create mode 100644 libavformat/dvdvideodec.c
> 
> diff --git a/Changelog b/Changelog
> index c5fb21d198..88653bc6d3 100644
> --- a/Changelog
> +++ b/Changelog
> @@ -24,6 +24,8 @@ version :
>  - ffmpeg CLI options may now be used as -/opt , which is equivalent
>to -opt >
>  - showinfo bitstream filter
> +- DVD-Video demuxer, powered by libdvdnav and libdvdread
> +
>  
>  version 6.1:
>  - libaribcaption decoder
> diff --git a/configure b/configure
> index 68f675a4bc..70c33ec96d 100755
> --- a/configure
> +++ b/configure
> @@ -227,6 +227,8 @@ External library support:
>--enable-libdavs2enable AVS2 decoding via libdavs2 [no]
>--enable-libdc1394   enable IIDC-1394 grabbing using libdc1394
> and libraw1394 [no]
> +  --enable-libdvdnav   enable libdvdnav, needed for DVD demuxing [no]
> +  --enable-libdvdread  enable libdvdread, needed for DVD demuxing [no]
>--enable-libfdk-aac  enable AAC de/encoding via libfdk-aac [no]
>--enable-libfliteenable flite (voice synthesis) support via 
> libflite [no]
>--enable-libfontconfig   enable libfontconfig, useful for drawtext filter 
> [no]
> @@ -1806,6 +1808,8 @@ EXTERNAL_LIBRARY_GPL_LIST="
>  frei0r
>  libcdio
>  libdavs2
> +libdvdnav
> +libdvdread
>  librubberband
>  libvidstab
>  libx264
> @@ -3520,6 +3524,8 @@ dts_demuxer_select="dca_parser"
>  dtshd_demuxer_select="dca_parser"
>  dv_demuxer_select="dvprofile"
>  dv_muxer_select="dvprofile"
> +dvdvideo_demuxer_select="mpegps_demuxer"
> +dvdvideo_demuxer_deps="libdvdnav libdvdread"
>  dxa_demuxer_select="riffdec"
>  eac3_demuxer_select="ac3_parser"
>  evc_demuxer_select="evc_frame_merge_bsf evc_parser"
> @@ -6761,6 +6767,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&& check_pkg_config libdrm libdrm xf86drm.h 
> drmGetVersion
> +enabled libdvdnav && require_pkg_config libdvdnav "dvdnav >= 6.1.1" 
> dvdnav/dvdnav.h dvdnav_open2
> +enabled libdvdread&& require_pkg_config libdvdread "dvdread >= 
> 6.1.2" dvdread/dvd_reader.h DVDOpen2 -ldvdread
>  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/doc/demuxers.texi b/doc/demuxers.texi
> index e4c5b560a6..ad0906f6ec 100644
> --- a/doc/demuxers.texi
> +++ b/doc/demuxers.texi
> @@ -285,6 +285,135 @@ This demuxer accepts the following option:
>  
>  @end table
>  
> +@section dvdvideo
> +
> +DVD-Video demuxer, powered by libdvdnav and libdvdread.
> +
> +Can directly ingest DVD titles, specifically sequential PGCs,
> +into a conversion pipeline. Menus and seeking are not supported at this time.
> +
> +Block devices (DVD drives), ISO files, and directory structures are accepted.
> +Activate with @code{-f dvdvideo} in front of one of these inputs.
> +
> +Underlying playback is fully handled by libdvdnav, and structure parsing by 
> libdvdread.

> +ffmpeg must be built with GPL library support available as well as the 
> switches
> +@code{--enable-libdvdnav} and @code{--enable-libdvdread}.

FFmpeg must be built with GPL library support available as well as the
configure switches @code{--enable-libdvdnav} and @code{--enable-libdvdread}.

> +
> +You will need to provide either the desired "title number" or exact PGC/PG 
> coordinates.

> +Many open-source DVD players and tools can aid in providing this information.

unrelated, but it might be useful to have a -list-titles option to
show this information

> +If not 

[FFmpeg-devel] [PATCH v7 1/2] libavformat/dvdvideo: add DVD-Video demuxer powered by libdvdnav and libdvdread

2024-02-04 Thread Marth64
Sorry for the quick follow-up to v6, I wanted to get this update out now 
hopefully
before v6 is actually reviewed. v7 fixes a few documentation typos, options 
descriptions,
and log messages: nothing major. I also flattened this out to be a 2-patch set
with subtitle palette support.

This is the result of >1yr of research and I am now very satisfied with it's 
result.
I will not make any more changes at this point unless it is outcome from a 
review.
If the community decides to merge it, I am happy to continue to improve it with 
support for
seeking, probing, and tests.

Thank you so much,


Signed-off-by: Marth64 
---
 Changelog |2 +
 configure |8 +
 doc/demuxers.texi |  129 
 libavformat/Makefile  |1 +
 libavformat/allformats.c  |1 +
 libavformat/dvdvideodec.c | 1410 +
 6 files changed, 1551 insertions(+)
 create mode 100644 libavformat/dvdvideodec.c

diff --git a/Changelog b/Changelog
index c5fb21d198..88653bc6d3 100644
--- a/Changelog
+++ b/Changelog
@@ -24,6 +24,8 @@ version :
 - ffmpeg CLI options may now be used as -/opt , which is equivalent
   to -opt >
 - showinfo bitstream filter
+- DVD-Video demuxer, powered by libdvdnav and libdvdread
+
 
 version 6.1:
 - libaribcaption decoder
diff --git a/configure b/configure
index 68f675a4bc..70c33ec96d 100755
--- a/configure
+++ b/configure
@@ -227,6 +227,8 @@ External library support:
   --enable-libdavs2enable AVS2 decoding via libdavs2 [no]
   --enable-libdc1394   enable IIDC-1394 grabbing using libdc1394
and libraw1394 [no]
+  --enable-libdvdnav   enable libdvdnav, needed for DVD demuxing [no]
+  --enable-libdvdread  enable libdvdread, needed for DVD demuxing [no]
   --enable-libfdk-aac  enable AAC de/encoding via libfdk-aac [no]
   --enable-libfliteenable flite (voice synthesis) support via libflite 
[no]
   --enable-libfontconfig   enable libfontconfig, useful for drawtext filter 
[no]
@@ -1806,6 +1808,8 @@ EXTERNAL_LIBRARY_GPL_LIST="
 frei0r
 libcdio
 libdavs2
+libdvdnav
+libdvdread
 librubberband
 libvidstab
 libx264
@@ -3520,6 +3524,8 @@ dts_demuxer_select="dca_parser"
 dtshd_demuxer_select="dca_parser"
 dv_demuxer_select="dvprofile"
 dv_muxer_select="dvprofile"
+dvdvideo_demuxer_select="mpegps_demuxer"
+dvdvideo_demuxer_deps="libdvdnav libdvdread"
 dxa_demuxer_select="riffdec"
 eac3_demuxer_select="ac3_parser"
 evc_demuxer_select="evc_frame_merge_bsf evc_parser"
@@ -6761,6 +6767,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&& check_pkg_config libdrm libdrm xf86drm.h 
drmGetVersion
+enabled libdvdnav && require_pkg_config libdvdnav "dvdnav >= 6.1.1" 
dvdnav/dvdnav.h dvdnav_open2
+enabled libdvdread&& require_pkg_config libdvdread "dvdread >= 6.1.2" 
dvdread/dvd_reader.h DVDOpen2 -ldvdread
 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/doc/demuxers.texi b/doc/demuxers.texi
index e4c5b560a6..ad0906f6ec 100644
--- a/doc/demuxers.texi
+++ b/doc/demuxers.texi
@@ -285,6 +285,135 @@ This demuxer accepts the following option:
 
 @end table
 
+@section dvdvideo
+
+DVD-Video demuxer, powered by libdvdnav and libdvdread.
+
+Can directly ingest DVD titles, specifically sequential PGCs,
+into a conversion pipeline. Menus and seeking are not supported at this time.
+
+Block devices (DVD drives), ISO files, and directory structures are accepted.
+Activate with @code{-f dvdvideo} in front of one of these inputs.
+
+Underlying playback is fully handled by libdvdnav, and structure parsing by 
libdvdread.
+ffmpeg must be built with GPL library support available as well as the switches
+@code{--enable-libdvdnav} and @code{--enable-libdvdread}.
+
+You will need to provide either the desired "title number" or exact PGC/PG 
coordinates.
+Many open-source DVD players and tools can aid in providing this information.
+If not specified, the demuxer will default to title 1 which works for many 
discs.
+However, due to the flexibility of DVD-Video, it is recommended to check 
manually.
+There are many discs that are authored strangely or with invalid headers.
+
+If the input is a real DVD drive, please note that there are some drives which 
may
+silently fail on reading bad sectors from the disc, returning random bits 
instead
+which is effectively corrupt data. This is especially prominent on aging or 
rotting discs.
+A second pass and integrity checks would