diff mbox series

[FFmpeg-devel,03/18] lavf/dv: always provide avpriv_dv_* symbols

Message ID 20220824084318.333-3-anton@khirnov.net
State Accepted
Commit b6196cb2ef011f1a3278534070205b44c1e0e780
Headers show
Series [FFmpeg-devel,01/18] tests/fate/mov: add a test for dv audio demuxed through dv demuxer | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 fail Make fate failed
andriy/make_x86 success Make finished
andriy/make_fate_x86 fail Make fate failed

Commit Message

Anton Khirnov Aug. 24, 2022, 8:43 a.m. UTC
They are used from libavdevice.
---
 configure            |  1 +
 libavformat/Makefile |  3 +--
 libavformat/dv.c     | 23 +++++++++++++++++++++++
 3 files changed, 25 insertions(+), 2 deletions(-)

Comments

Andreas Rheinhardt Aug. 24, 2022, 4:25 p.m. UTC | #1
Anton Khirnov:
> They are used from libavdevice.
> ---
>  configure            |  1 +
>  libavformat/Makefile |  3 +--
>  libavformat/dv.c     | 23 +++++++++++++++++++++++
>  3 files changed, 25 insertions(+), 2 deletions(-)
> 
> diff --git a/configure b/configure
> index ea50c94002..f4c4ab0484 100755
> --- a/configure
> +++ b/configure
> @@ -3530,6 +3530,7 @@ gdigrab_indev_deps="CreateDIBSection"
>  gdigrab_indev_extralibs="-lgdi32"
>  gdigrab_indev_select="bmp_decoder"
>  iec61883_indev_deps="libiec61883"
> +iec61883_indev_select="dv_demuxer"
>  jack_indev_deps="libjack"
>  jack_indev_deps_any="sem_timedwait dispatch_dispatch_h"
>  kmsgrab_indev_deps="libdrm"
> diff --git a/libavformat/Makefile b/libavformat/Makefile
> index f67a99f839..684bad0eb4 100644
> --- a/libavformat/Makefile
> +++ b/libavformat/Makefile
> @@ -13,6 +13,7 @@ OBJS = allformats.o         \
>         demux.o              \
>         demux_utils.o        \
>         dump.o               \
> +       dv.o                 \
>         format.o             \
>         id3v1.o              \
>         id3v2.o              \
> @@ -184,7 +185,6 @@ OBJS-$(CONFIG_DSS_DEMUXER)               += dss.o
>  OBJS-$(CONFIG_DTSHD_DEMUXER)             += dtshddec.o
>  OBJS-$(CONFIG_DTS_DEMUXER)               += dtsdec.o rawdec.o
>  OBJS-$(CONFIG_DTS_MUXER)                 += rawenc.o
> -OBJS-$(CONFIG_DV_DEMUXER)                += dv.o
>  OBJS-$(CONFIG_DV_MUXER)                  += dvenc.o
>  OBJS-$(CONFIG_DVBSUB_DEMUXER)            += dvbsub.o rawdec.o
>  OBJS-$(CONFIG_DVBTXT_DEMUXER)            += dvbtxt.o rawdec.o
> @@ -711,7 +711,6 @@ SHLIBOBJS-$(CONFIG_RTP_MUXER)            += golomb_tab.o jpegtables.o \
>  SHLIBOBJS-$(CONFIG_SPDIF_MUXER)          += dca_sample_rate_tab.o
>  
>  # libavdevice dependencies
> -OBJS-$(CONFIG_IEC61883_INDEV)            += dv.o
>  
>  # Windows resource file
>  SHLIBOBJS-$(HAVE_GNU_WINDRES)            += avformatres.o
> diff --git a/libavformat/dv.c b/libavformat/dv.c
> index 1dadaf6e62..24bacd5c53 100644
> --- a/libavformat/dv.c
> +++ b/libavformat/dv.c
> @@ -28,6 +28,9 @@
>   * License along with FFmpeg; if not, write to the Free Software
>   * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
>   */
> +
> +#include "config_components.h"
> +
>  #include <time.h>
>  #include "avformat.h"
>  #include "internal.h"
> @@ -40,6 +43,8 @@
>  #include "dv.h"
>  #include "libavutil/avassert.h"
>  
> +#if CONFIG_DV_DEMUXER
> +
>  // Must be kept in sync with AVPacket
>  struct DVPacket {
>      int64_t  pts;
> @@ -647,3 +652,21 @@ const AVInputFormat ff_dv_demuxer = {
>      .read_seek      = dv_read_seek,
>      .extensions     = "dv,dif",
>  };
> +
> +#else // CONFIG_DV_DEMUXER
> +DVDemuxContext *avpriv_dv_init_demux(AVFormatContext *s)
> +{
> +    return NULL;
> +}
> +
> +int avpriv_dv_get_packet(DVDemuxContext *c, AVPacket *pkt)
> +{
> +    return AVERROR(ENOSYS);
> +}
> +
> +int avpriv_dv_produce_packet(DVDemuxContext *c, AVPacket *pkt,
> +                             uint8_t *buf, int buf_size, int64_t pos)
> +{
> +    return AVERROR(ENOSYS);
> +}
> +#endif // CONFIG_DV_DEMUXER

This is unnecessary as the Makefile above ensures that dv.o is built
when iec61883 is built.

- Andreas
Anton Khirnov Aug. 25, 2022, 9:47 a.m. UTC | #2
Quoting Andreas Rheinhardt (2022-08-24 18:25:48)
> 
> This is unnecessary as the Makefile above ensures that dv.o is built
> when iec61883 is built.

For a given build, yes. But it is perfectly legal to swap out SOs with
different sets of enabled components. E.g. Debian has libav* and
libav*-extra packages that can be used interchangeably.
diff mbox series

Patch

diff --git a/configure b/configure
index ea50c94002..f4c4ab0484 100755
--- a/configure
+++ b/configure
@@ -3530,6 +3530,7 @@  gdigrab_indev_deps="CreateDIBSection"
 gdigrab_indev_extralibs="-lgdi32"
 gdigrab_indev_select="bmp_decoder"
 iec61883_indev_deps="libiec61883"
+iec61883_indev_select="dv_demuxer"
 jack_indev_deps="libjack"
 jack_indev_deps_any="sem_timedwait dispatch_dispatch_h"
 kmsgrab_indev_deps="libdrm"
diff --git a/libavformat/Makefile b/libavformat/Makefile
index f67a99f839..684bad0eb4 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -13,6 +13,7 @@  OBJS = allformats.o         \
        demux.o              \
        demux_utils.o        \
        dump.o               \
+       dv.o                 \
        format.o             \
        id3v1.o              \
        id3v2.o              \
@@ -184,7 +185,6 @@  OBJS-$(CONFIG_DSS_DEMUXER)               += dss.o
 OBJS-$(CONFIG_DTSHD_DEMUXER)             += dtshddec.o
 OBJS-$(CONFIG_DTS_DEMUXER)               += dtsdec.o rawdec.o
 OBJS-$(CONFIG_DTS_MUXER)                 += rawenc.o
-OBJS-$(CONFIG_DV_DEMUXER)                += dv.o
 OBJS-$(CONFIG_DV_MUXER)                  += dvenc.o
 OBJS-$(CONFIG_DVBSUB_DEMUXER)            += dvbsub.o rawdec.o
 OBJS-$(CONFIG_DVBTXT_DEMUXER)            += dvbtxt.o rawdec.o
@@ -711,7 +711,6 @@  SHLIBOBJS-$(CONFIG_RTP_MUXER)            += golomb_tab.o jpegtables.o \
 SHLIBOBJS-$(CONFIG_SPDIF_MUXER)          += dca_sample_rate_tab.o
 
 # libavdevice dependencies
-OBJS-$(CONFIG_IEC61883_INDEV)            += dv.o
 
 # Windows resource file
 SHLIBOBJS-$(HAVE_GNU_WINDRES)            += avformatres.o
diff --git a/libavformat/dv.c b/libavformat/dv.c
index 1dadaf6e62..24bacd5c53 100644
--- a/libavformat/dv.c
+++ b/libavformat/dv.c
@@ -28,6 +28,9 @@ 
  * License along with FFmpeg; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
+
+#include "config_components.h"
+
 #include <time.h>
 #include "avformat.h"
 #include "internal.h"
@@ -40,6 +43,8 @@ 
 #include "dv.h"
 #include "libavutil/avassert.h"
 
+#if CONFIG_DV_DEMUXER
+
 // Must be kept in sync with AVPacket
 struct DVPacket {
     int64_t  pts;
@@ -647,3 +652,21 @@  const AVInputFormat ff_dv_demuxer = {
     .read_seek      = dv_read_seek,
     .extensions     = "dv,dif",
 };
+
+#else // CONFIG_DV_DEMUXER
+DVDemuxContext *avpriv_dv_init_demux(AVFormatContext *s)
+{
+    return NULL;
+}
+
+int avpriv_dv_get_packet(DVDemuxContext *c, AVPacket *pkt)
+{
+    return AVERROR(ENOSYS);
+}
+
+int avpriv_dv_produce_packet(DVDemuxContext *c, AVPacket *pkt,
+                             uint8_t *buf, int buf_size, int64_t pos)
+{
+    return AVERROR(ENOSYS);
+}
+#endif // CONFIG_DV_DEMUXER