[vlc-commits] [Git][videolan/vlc][master] 2 commits: remove Musepack demuxer

Steve Lhomme (@robUx4) gitlab at videolan.org
Tue Apr 28 10:41:44 UTC 2026



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
cb36c8fe by Steve Lhomme at 2026-04-28T09:39:48+02:00
remove Musepack demuxer

The underlying library is old, unmaintained and full of issues.
libavformat+libavcodec can play all the samples from https://streams.videolan.org/streams/mpc

- - - - -
1b97942b by Steve Lhomme at 2026-04-28T09:39:48+02:00
contrib: mpcdec: remove unused contrib

We no longer build the access+demuxer+decoder module.

- - - - -


16 changed files:

- NEWS
- configure.ac
- − contrib/src/mpcdec/0004-libmpcdec-added-install-and-soversion.patch
- − contrib/src/mpcdec/0005-If-BUILD_SHARED_LIBS-is-set-and-SHARED-undefined-the.patch
- − contrib/src/mpcdec/0006-adapted-patch-0001-shared.patch-from-buildroot.patch
- − contrib/src/mpcdec/0007-only-build-libmpcdec.patch
- − contrib/src/mpcdec/SHA512SUMS
- − contrib/src/mpcdec/musepack-asinh-msvc.patch
- − contrib/src/mpcdec/musepack-no-binaries.patch
- − contrib/src/mpcdec/musepack-no-cflags-clobber.patch
- − contrib/src/mpcdec/rules.mak
- meson_options.txt
- modules/demux/Makefile.am
- modules/demux/meson.build
- − modules/demux/mpc.c
- po/POTFILES.in


Changes:

=====================================
NEWS
=====================================
@@ -47,6 +47,7 @@ Demuxer:
  * Improved Bluray menus, clips and stream selection
  * Support chapters in mp3 files
  * Support for DMX audio music (MUS) files
+ * Removed Musepack demuxer in favor of libavformat+libavcodec
 
 Codecs:
  * Remove schroedinger support for dirac in favor of avcodec


=====================================
configure.ac
=====================================
@@ -2594,21 +2594,6 @@ if test "${enable_mod}" != "no" ; then
     ])
 fi
 
-dnl
-dnl  mpc demux plugin
-dnl
-AC_ARG_ENABLE([mpc],
-  AS_HELP_STRING([--disable-mpc], [do not use libmpcdec (default auto)]))
-if test "${enable_mpc}" != "no"
-then
-    AC_CHECK_HEADERS([mpc/mpcdec.h], [
-      AC_CHECK_LIB([mpcdec], [mpc_demux_init], [
-        VLC_ADD_PLUGIN([mpc])
-        VLC_ADD_LIBS([mpc],[-lmpcdec])
-      ],, [$LIBM])
-    ])
-fi
-
 dnl
 dnl  Codec plugins
 dnl


=====================================
contrib/src/mpcdec/0004-libmpcdec-added-install-and-soversion.patch deleted
=====================================
@@ -1,72 +0,0 @@
-From 1db3ae6dd941c1f68e0d447bb70a18679fccea2f Mon Sep 17 00:00:00 2001
-From: r2d <r2d at c51c8d5e-032a-db11-a0f2-0002b3467eef>
-Date: Mon, 21 Oct 2013 20:34:18 +0000
-Subject: [PATCH 4/6] libmpcdec : added install and soversion
-
-git-svn-id: http://svn.musepack.net/libmpc/trunk@482 c51c8d5e-032a-db11-a0f2-0002b3467eef
-
----
- CMakeLists.txt           |  1 -
- include/CMakeLists.txt   |  1 -
- libmpcdec/CMakeLists.txt | 16 ++++++++++++++++
- libmpcdec/Makefile.am    |  1 +
- 4 files changed, 17 insertions(+), 2 deletions(-)
- delete mode 100644 include/CMakeLists.txt
-
-diff --git a/CMakeLists.txt b/CMakeLists.txt
-index 06d4363..e958296 100644
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -23,4 +23,3 @@ add_subdirectory(libmpcdec)
- add_subdirectory(libmpcpsy)
- add_subdirectory(libmpcenc)
- add_subdirectory(libwavformat)
--add_subdirectory(include)
-diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt
-deleted file mode 100644
-index 074461d..0000000
---- a/include/CMakeLists.txt
-+++ /dev/null
-@@ -1 +0,0 @@
--INSTALL(DIRECTORY mpc DESTINATION include)
-diff --git a/libmpcdec/CMakeLists.txt b/libmpcdec/CMakeLists.txt
-index 0bc5b62..fb18968 100644
---- a/libmpcdec/CMakeLists.txt
-+++ b/libmpcdec/CMakeLists.txt
-@@ -1,7 +1,23 @@
-+SET(mpcdec_VERSION_MAJOR 7)
-+SET(mpcdec_VERSION_MINOR 0)
-+SET(mpcdec_VERSION_PATCH 1)
-+
-+set(mpcdec_VERSION ${mpcdec_VERSION_MAJOR}.${mpcdec_VERSION_MINOR}.${mpcdec_VERSION_PATCH})
-+
- include_directories(${libmpc_SOURCE_DIR}/include)
-+install(FILES
-+	${libmpc_SOURCE_DIR}/include/mpc/mpcdec.h
-+	${libmpc_SOURCE_DIR}/include/mpc/reader.h
-+	${libmpc_SOURCE_DIR}/include/mpc/streaminfo.h
-+	${libmpc_SOURCE_DIR}/include/mpc/mpc_types.h
-+	DESTINATION include/mpc COMPONENT headers)
-+
- if(SHARED)
-   add_library(mpcdec SHARED huffman mpc_decoder mpc_reader streaminfo mpc_bits_reader mpc_demux requant synth_filter ${libmpc_SOURCE_DIR}/common/crc32)
-+  set_target_properties(mpcdec PROPERTIES VERSION ${mpcdec_VERSION} SOVERSION ${mpcdec_VERSION_MAJOR})
-+  install(TARGETS mpcdec LIBRARY DESTINATION "lib" COMPONENT libraries)
- else(SHARED)
-   add_library(mpcdec_static STATIC huffman mpc_decoder mpc_reader streaminfo mpc_bits_reader mpc_demux requant synth_filter ${libmpc_SOURCE_DIR}/common/crc32)
-+  install(TARGETS mpcdec_static ARCHIVE DESTINATION "lib/static" COMPONENT libraries)
- endif(SHARED)
- 
-diff --git a/libmpcdec/Makefile.am b/libmpcdec/Makefile.am
-index 48f3835..048217a 100644
---- a/libmpcdec/Makefile.am
-+++ b/libmpcdec/Makefile.am
-@@ -16,4 +16,5 @@ libmpcdec_la_SOURCES = huffman.c mpc_decoder.c mpc_reader.c \
- 	mpc_bits_reader.h huffman.h decoder.h internal.h requant.h mpcdec_math.h \
- 	$(common_sources)
- 
-+# version info shoud match the one in CMakeLists.txt
- libmpcdec_la_LDFLAGS = -no-undefined -version-info 7:0:1
--- 
-2.37.3.windows.1
-


=====================================
contrib/src/mpcdec/0005-If-BUILD_SHARED_LIBS-is-set-and-SHARED-undefined-the.patch deleted
=====================================
@@ -1,41 +0,0 @@
-From bab8308ca1ae6b96f4e1c2929608e02971d24009 Mon Sep 17 00:00:00 2001
-From: r2d <r2d at c51c8d5e-032a-db11-a0f2-0002b3467eef>
-Date: Sun, 5 Oct 2014 18:31:05 +0000
-Subject: [PATCH 5/6] If BUILD_SHARED_LIBS is set and SHARED undefined, then
- drive SHARED with the BUILD_SHARED_LIBS value. patch by Samuel Martin
- <s.martin49 at gmail.com>
-
-git-svn-id: http://svn.musepack.net/libmpc/trunk@485 c51c8d5e-032a-db11-a0f2-0002b3467eef
----
- CMakeLists.txt | 15 ++++++++++-----
- 1 file changed, 10 insertions(+), 5 deletions(-)
-
-diff --git a/CMakeLists.txt b/CMakeLists.txt
-index e958296..50666fe 100644
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -7,11 +7,16 @@ project(libmpc C)
- set(CMAKE_VERBOSE_MAKEFILE false)
- TEST_BIG_ENDIAN(MPC_ENDIANNESS)
- 
--if(WIN32)
--  option(SHARED "Use shared libmpcdec" OFF)
--else(WIN32)
--  option(SHARED "Use shared libmpcdec" ON)
--endif(WIN32)
-+# Use the standard CMake flag to drive the shared object build.
-+if(DEFINED BUILD_SHARED_LIBS AND NOT DEFINED SHARED)
-+  set(SHARED ${BUILD_SHARED_LIBS})
-+else()
-+  if(WIN32)
-+    option(SHARED "Use shared libmpcdec" OFF)
-+  else(WIN32)
-+    option(SHARED "Use shared libmpcdec" ON)
-+  endif(WIN32)
-+endif()
- 
- add_definitions(-DFAST_MATH -DCVD_FASTLOG)
- 
--- 
-2.37.3.windows.1
-


=====================================
contrib/src/mpcdec/0006-adapted-patch-0001-shared.patch-from-buildroot.patch deleted
=====================================
@@ -1,53 +0,0 @@
-From 714e0e572ea7746831b5fa5434ea2669180e702f Mon Sep 17 00:00:00 2001
-From: r2d <r2d at c51c8d5e-032a-db11-a0f2-0002b3467eef>
-Date: Sun, 14 Feb 2016 22:07:10 +0000
-Subject: [PATCH 6/7] adapted patch 0001-shared.patch from buildroot:
- https://git.busybox.net/buildroot/tree/package/musepack/0001-shared.patch
- original changelog :
-
-Fixup installation of shared mpcdec library.
-Based on gentoo patch.
-
-Signed-off-by: Gustavo Zacarias <gustavo at zacarias.com.ar>
-
-git-svn-id: http://svn.musepack.net/libmpc/trunk@491 c51c8d5e-032a-db11-a0f2-0002b3467eef
----
- libmpcdec/CMakeLists.txt | 13 ++++++++-----
- 1 file changed, 8 insertions(+), 5 deletions(-)
-
-diff --git a/libmpcdec/CMakeLists.txt b/libmpcdec/CMakeLists.txt
-index 5579d55..7ce5e94 100644
---- a/libmpcdec/CMakeLists.txt
-+++ b/libmpcdec/CMakeLists.txt
-@@ -4,7 +4,6 @@ SET(mpcdec_VERSION_PATCH 1)
- 
- set(mpcdec_VERSION ${mpcdec_VERSION_MAJOR}.${mpcdec_VERSION_MINOR}.${mpcdec_VERSION_PATCH})
- 
--include_directories(${libmpc_SOURCE_DIR}/include)
- install(FILES
- 	${libmpc_SOURCE_DIR}/include/mpc/mpcdec.h
- 	${libmpc_SOURCE_DIR}/include/mpc/reader.h
-@@ -12,12 +11,16 @@ install(FILES
- 	${libmpc_SOURCE_DIR}/include/mpc/mpc_types.h
- 	DESTINATION include/mpc COMPONENT headers)
- 
-+include_directories(${libmpc_SOURCE_DIR}/include)
- if(SHARED)
--  add_library(mpcdec SHARED huffman mpc_decoder mpc_reader streaminfo mpc_bits_reader mpc_demux requant synth_filter ${libmpc_SOURCE_DIR}/common/crc32)
--  set_target_properties(mpcdec PROPERTIES VERSION ${mpcdec_VERSION} SOVERSION ${mpcdec_VERSION_MAJOR})
--  install(TARGETS mpcdec LIBRARY DESTINATION "lib" COMPONENT libraries)
-+  add_library(mpcdec_shared SHARED huffman mpc_decoder mpc_reader streaminfo mpc_bits_reader mpc_demux requant synth_filter ${libmpc_SOURCE_DIR}/common/crc32)
-+  set_target_properties(mpcdec_shared PROPERTIES OUTPUT_NAME mpcdec CLEAN_DIRECT_OUTPUT 1 VERSION ${mpcdec_VERSION} SOVERSION ${mpcdec_VERSION_MAJOR})
-+  install(TARGETS mpcdec_shared LIBRARY DESTINATION "lib${LIB_SUFFIX}" ARCHIVE DESTINATION "lib${LIB_SUFFIX}" COMPONENT libraries)
-+  target_link_libraries(mpcdec_shared m)
- else(SHARED)
-   add_library(mpcdec_static STATIC huffman mpc_decoder mpc_reader streaminfo mpc_bits_reader mpc_demux requant synth_filter ${libmpc_SOURCE_DIR}/common/crc32)
--  install(TARGETS mpcdec_static ARCHIVE DESTINATION "lib/static" COMPONENT libraries)
-+  set_target_properties(mpcdec_static PROPERTIES OUTPUT_NAME mpcdec CLEAN_DIRECT_OUTPUT 1)
-+  install(TARGETS mpcdec_static LIBRARY DESTINATION "lib${LIB_SUFFIX}" ARCHIVE DESTINATION "lib${LIB_SUFFIX}" COMPONENT libraries)
-+  target_link_libraries(mpcdec_static m)
- endif(SHARED)
- 
--- 
-2.45.0.windows.1
-


=====================================
contrib/src/mpcdec/0007-only-build-libmpcdec.patch deleted
=====================================
@@ -1,24 +0,0 @@
-From 0b5a35b4a87952465717a76d5dcdadf52b930ba9 Mon Sep 17 00:00:00 2001
-From: Steve Lhomme <robux4 at ycbcr.xyz>
-Date: Wed, 13 Nov 2024 14:25:36 +0100
-Subject: [PATCH 7/7] only build libmpcdec
-
-We don't need anything else for VLC
----
- CMakeLists.txt | 3 ---
- 1 file changed, 3 deletions(-)
-
-diff --git a/CMakeLists.txt b/CMakeLists.txt
-index 50666fe..237daf1 100644
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -25,6 +25,3 @@ if(NOT MSVC)
- endif(NOT MSVC)
- 
- add_subdirectory(libmpcdec)
--add_subdirectory(libmpcpsy)
--add_subdirectory(libmpcenc)
--add_subdirectory(libwavformat)
--- 
-2.45.0.windows.1
-


=====================================
contrib/src/mpcdec/SHA512SUMS deleted
=====================================
@@ -1 +0,0 @@
-89a8eab35e88d5ec1ef7c8fae897b23a5e31e1c99c8430f43a960c8543acd15cbb6b78e3d9da750a7d2649ebd86479c9136f9d370e0911675bfed8feff8de1d1  musepack_src_r481.tar.gz


=====================================
contrib/src/mpcdec/musepack-asinh-msvc.patch deleted
=====================================
@@ -1,25 +0,0 @@
-From db238381db9763ca1a7fc066a613a087b37d87e2 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Hugo=20Beauz=C3=A9e-Luyssen?= <hugo at beauzee.fr>
-Date: Wed, 3 Dec 2014 15:47:33 +0100
-Subject: [PATCH 3/7] contribs: Fix mpcdec build with MSVC
-
----
- libmpcpsy/psy_tab.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/libmpcpsy/psy_tab.c b/libmpcpsy/psy_tab.c
-index 35c56ac..698601c 100644
---- a/libmpcpsy/psy_tab.c
-+++ b/libmpcpsy/psy_tab.c
-@@ -187,7 +187,7 @@ Ruhehoerschwelle ( PsyModel* m,
-     }
- }
- 
--#ifdef _MSC_VER
-+#if defined(_MSC_VER) && _MSC_VER < 1800
- static double
- asinh ( double x )
- {
--- 
-2.45.0.windows.1
-


=====================================
contrib/src/mpcdec/musepack-no-binaries.patch deleted
=====================================
@@ -1,28 +0,0 @@
-From 22bfcda42e120ffe18b727a53b346fb489ebd88f Mon Sep 17 00:00:00 2001
-From: Pavlov Konstantin <thresh at videolan.org>
-Date: Tue, 17 Apr 2012 13:18:34 +0200
-Subject: [PATCH 2/7] don't build binaries
-
----
- CMakeLists.txt | 7 -------
- 1 file changed, 7 deletions(-)
-
-diff --git a/CMakeLists.txt b/CMakeLists.txt
-index a6478c5..06d4363 100644
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -23,11 +23,4 @@ add_subdirectory(libmpcdec)
- add_subdirectory(libmpcpsy)
- add_subdirectory(libmpcenc)
- add_subdirectory(libwavformat)
--add_subdirectory(mpcgain)
--add_subdirectory(mpcdec)
--add_subdirectory(mpcenc)
--add_subdirectory(mpc2sv8)
--add_subdirectory(mpccut)
--add_subdirectory(mpcchap)
--add_subdirectory(wavcmp)
- add_subdirectory(include)
--- 
-2.45.0.windows.1
-


=====================================
contrib/src/mpcdec/musepack-no-cflags-clobber.patch deleted
=====================================
@@ -1,25 +0,0 @@
-From 1f177a63ae04331f07be40b6cbfda312c51ac0c8 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?R=C3=A9mi=20Denis-Courmont?= <remi at remlab.net>
-Date: Mon, 8 Aug 2011 17:31:04 +0200
-Subject: [PATCH 1/7] do not clobber our precious CFLAGS
-
----
- CMakeLists.txt | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/CMakeLists.txt b/CMakeLists.txt
-index b13f78c..a6478c5 100644
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -16,7 +16,7 @@ endif(WIN32)
- add_definitions(-DFAST_MATH -DCVD_FASTLOG)
- 
- if(NOT MSVC)
--  set(CMAKE_C_FLAGS "-O3 -Wall -fomit-frame-pointer -pipe")
-+  add_definitions(-O3 -Wall -fomit-frame-pointer -pipe)
- endif(NOT MSVC)
- 
- add_subdirectory(libmpcdec)
--- 
-2.45.0.windows.1
-


=====================================
contrib/src/mpcdec/rules.mak deleted
=====================================
@@ -1,36 +0,0 @@
-# Musepack decoder
-
-PKGS += mpcdec
-
-#MUSE_VERSION := 1.2.6
-#MUSE_URL := http://files.musepack.net/source/libmpcdec-$(MUSE_VERSION).tar.bz2
-#MUSE_URL := http://files2.musepack.net/source/libmpcdec-$(MUSE_VERSION).tar.bz2
-
-MUSE_REV := 481
-MUSE_URL := $(CONTRIB_VIDEOLAN)/mpcdec/musepack_src_r$(MUSE_REV).tar.gz
-
-$(TARBALLS)/musepack_src_r$(MUSE_REV).tar.gz:
-	$(call download_pkg,$(MUSE_URL),mpcdec)
-
-#MUSE_REV := 481
-#MUSE_SVN := http://svn.musepack.net/libmpc/trunk/
-
-.sum-mpcdec: musepack_src_r$(MUSE_REV).tar.gz
-
-musepack: musepack_src_r$(MUSE_REV).tar.gz .sum-mpcdec
-	$(UNPACK)
-	$(APPLY) $(SRC)/mpcdec/musepack-no-cflags-clobber.patch
-	$(APPLY) $(SRC)/mpcdec/musepack-no-binaries.patch
-	$(APPLY) $(SRC)/mpcdec/musepack-asinh-msvc.patch
-	$(APPLY) $(SRC)/mpcdec/0004-libmpcdec-added-install-and-soversion.patch
-	$(APPLY) $(SRC)/mpcdec/0005-If-BUILD_SHARED_LIBS-is-set-and-SHARED-undefined-the.patch
-	$(APPLY) $(SRC)/mpcdec/0006-adapted-patch-0001-shared.patch-from-buildroot.patch
-	$(APPLY) $(SRC)/mpcdec/0007-only-build-libmpcdec.patch
-	$(MOVE)
-
-.mpcdec: musepack toolchain.cmake
-	$(CMAKECLEAN)
-	$(HOSTVARS_CMAKE) $(CMAKE) -DCMAKE_POLICY_VERSION_MINIMUM=3.5
-	+$(CMAKEBUILD)
-	$(CMAKEINSTALL)
-	touch $@


=====================================
meson_options.txt
=====================================
@@ -764,11 +764,6 @@ option('gme',
     value: 'auto',
     description: 'Game Music Emu support')
 
-option('mpc',
-    type: 'feature',
-    value: 'auto',
-    description: 'libmpcdec support')
-
 option('sid',
     type: 'feature',
     value: 'auto',


=====================================
modules/demux/Makefile.am
=====================================
@@ -108,12 +108,6 @@ libnuv_plugin_la_SOURCES = demux/nuv.c
 libnuv_plugin_la_LIBADD = $(LIBM)
 demux_PLUGINS += libnuv_plugin.la
 
-libmpc_plugin_la_SOURCES = demux/mpc.c
-libmpc_plugin_la_LDFLAGS = $(AM_LDFLAGS) $(demux_RPATH)
-libmpc_plugin_la_LIBADD = $(LIBS_mpc) $(LIBM)
-EXTRA_LTLIBRARIES += libmpc_plugin.la
-demux_PLUGINS += $(LTLIBmpc)
-
 libtta_plugin_la_SOURCES = demux/tta.c
 demux_PLUGINS += libtta_plugin.la
 


=====================================
modules/demux/meson.build
=====================================
@@ -410,27 +410,6 @@ vlc_modules += {
     'enabled': gme_dep.found(),
 }
 
-# mpc
-mpc_dep = disabler()
-if get_option('mpc').allowed()
-if cc.check_header('mpc/mpcdec.h')
-    mpc_dep = cc.find_library('mpcdec')
-    cdata.set('HAVE_MPC_MPCDEC_H', 1)
-elif cc.check_header('mpc/mpcdec.h', dependencies: contrib_dep )
-    if cc.find_library('mpcdec', dirs: contrib_libdir).found()
-        mpc_dep = declare_dependency(
-            dependencies: [cc.find_library('mpcdec', dirs: contrib_libdir), contrib_dep])
-        cdata.set('HAVE_MPC_MPCDEC_H', 1)
-    endif
-endif
-endif
-vlc_modules += {
-    'name' : 'mpc',
-    'sources' : files('mpc.c'),
-    'dependencies' : [mpc_dep, m_lib],
-    'enabled' : mpc_dep.found(),
-}
-
 # sid
 sid_dep = dependency('libsidplay2', required: get_option('sid'))
 if cpp.check_header('sidplay/builders/resid.h', dependencies: sid_dep)


=====================================
modules/demux/mpc.c deleted
=====================================
@@ -1,344 +0,0 @@
-/*****************************************************************************
- * mpc.c : MPC stream input module for vlc
- *****************************************************************************
- * Copyright (C) 2001 the VideoLAN team
- *
- * Authors: Laurent Aimar <fenrir at via.ecp.fr.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-
-/*****************************************************************************
- * Preamble
- *****************************************************************************/
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include <vlc_common.h>
-#include <vlc_plugin.h>
-#include <vlc_demux.h>
-#include <vlc_codec.h>
-#include <math.h>
-
-#include <mpc/mpcdec.h>
-
-/* TODO:
- *  - test stream version 4..6
- *  - test fixed float version
- *  - ...
- *
- *  XXX:
- *  It is done the ugly way (the demux does the decode stage... but it works
- */
-
-/*****************************************************************************
- * Module descriptor
- *****************************************************************************/
-static int  Open  ( vlc_object_t * );
-static void Close ( vlc_object_t * );
-
-vlc_module_begin ()
-    set_subcategory( SUBCAT_INPUT_DEMUX )
-    set_description( N_("MusePack demuxer") )
-    set_capability( "demux", 145 )
-
-    set_callbacks( Open, Close )
-    add_shortcut( "mpc" )
-    add_file_extension("mpc")
-    add_file_extension("mp+")
-    add_file_extension("mpp")
-vlc_module_end ()
-
-/*****************************************************************************
- * Local prototypes
- *****************************************************************************/
-static int Demux  ( demux_t * );
-static int Control( demux_t *, int, va_list );
-
-typedef struct
-{
-    /* */
-    es_out_id_t   *p_es;
-
-    /* */
-    mpc_demux      *decoder;
-    mpc_reader     reader;
-    mpc_streaminfo info;
-
-    /* */
-    mpc_uint64_t   i_position;
-} demux_sys_t;
-
-static mpc_int32_t ReaderRead(mpc_reader *, void *dst, mpc_int32_t i_size);
-static mpc_bool_t  ReaderSeek(mpc_reader *, mpc_int32_t i_offset);
-static mpc_int32_t ReaderTell(mpc_reader *);
-static mpc_int32_t ReaderGetSize(mpc_reader *);
-static mpc_bool_t  ReaderCanSeek(mpc_reader *);
-
-/*****************************************************************************
- * Open: initializes ES structures
- *****************************************************************************/
-static int Open( vlc_object_t * p_this )
-{
-    demux_t     *p_demux = (demux_t*)p_this;
-    demux_sys_t *p_sys;
-    es_format_t fmt;
-    const uint8_t *p_peek;
-
-    if( vlc_stream_Peek( p_demux->s, &p_peek, 4 ) < 4 )
-        return VLC_EGENERIC;
-
-    if( memcmp( p_peek, "MP+", 3 ) )
-    {
-        /* for v4..6 we check extension file */
-        const int i_version = (GetDWLE( p_peek ) >> 11)&0x3ff;
-
-        if( i_version  < 4 || i_version > 6 )
-            return VLC_EGENERIC;
-
-        if( !p_demux->obj.force )
-            return VLC_EGENERIC;
-    }
-
-    /* */
-    p_sys = vlc_obj_calloc( p_this, 1, sizeof( *p_sys ) );
-    if( !p_sys )
-        return VLC_ENOMEM;
-
-    p_sys->i_position = 0;
-
-    p_sys->reader.read = ReaderRead;
-    p_sys->reader.seek = ReaderSeek;
-    p_sys->reader.tell = ReaderTell;
-    p_sys->reader.get_size = ReaderGetSize;
-    p_sys->reader.canseek = ReaderCanSeek;
-    p_sys->reader.data = p_demux->s;
-
-    /* */
-    p_sys->decoder = mpc_demux_init( &p_sys->reader );
-    if( !p_sys->decoder )
-        return VLC_EGENERIC;
-
-    /* Load info */
-    mpc_demux_get_info( p_sys->decoder, &p_sys->info );
-
-    /* Fill p_demux fields */
-    p_demux->pf_demux = Demux;
-    p_demux->pf_control = Control;
-    p_demux->p_sys = p_sys;
-
-    /* */
-#ifndef MPC_FIXED_POINT
-    es_format_Init( &fmt, AUDIO_ES, VLC_CODEC_FL32 );
-#else
-#   ifdef WORDS_BIGENDIAN
-    es_format_Init( &fmt, AUDIO_ES, VLC_CODEC_S32B );
-#   else
-    es_format_Init( &fmt, AUDIO_ES, VLC_CODEC_S32L );
-#   endif
-#endif
-    fmt.audio.i_channels = p_sys->info.channels;
-    fmt.audio.i_rate = p_sys->info.sample_freq;
-    fmt.audio.i_blockalign = 4*fmt.audio.i_channels;
-    fmt.audio.i_bitspersample = 32;
-    fmt.i_bitrate = fmt.i_bitrate * fmt.audio.i_channels *
-                    fmt.audio.i_bitspersample;
-
-#ifdef HAVE_MPC_MPCDEC_H
-#   define CONVERT_PEAK( mpc_peak ) (pow( 10, (mpc_peak) / 256.0 / 20.0 ) / 32767.0)
-#   define CONVERT_GAIN( mpc_gain ) (MPC_OLD_GAIN_REF - (mpc_gain) / 256.0)
-#else
-#   define CONVERT_PEAK( mpc_peak ) ((mpc_peak) / 32767.0)
-#   define CONVERT_GAIN( mpc_gain ) ((mpc_gain) / 100.0)
-#endif
-
-    if( p_sys->info.peak_title > 0 )
-    {
-        fmt.audio_replay_gain.pb_peak[AUDIO_REPLAY_GAIN_TRACK] = true;
-        fmt.audio_replay_gain.pf_peak[AUDIO_REPLAY_GAIN_TRACK] = (float) CONVERT_PEAK( p_sys->info.peak_title );
-        fmt.audio_replay_gain.pb_gain[AUDIO_REPLAY_GAIN_TRACK] = true;
-        fmt.audio_replay_gain.pf_gain[AUDIO_REPLAY_GAIN_TRACK] = (float) CONVERT_GAIN( p_sys->info.gain_title );
-    }
-    if( p_sys->info.peak_album > 0 )
-    {
-        fmt.audio_replay_gain.pb_peak[AUDIO_REPLAY_GAIN_ALBUM] = true;
-        fmt.audio_replay_gain.pf_peak[AUDIO_REPLAY_GAIN_ALBUM] = (float) CONVERT_PEAK( p_sys->info.peak_album );
-        fmt.audio_replay_gain.pb_gain[AUDIO_REPLAY_GAIN_ALBUM] = true;
-        fmt.audio_replay_gain.pf_gain[AUDIO_REPLAY_GAIN_ALBUM] = (float) CONVERT_GAIN( p_sys->info.gain_album );
-    }
-
-#undef CONVERT_GAIN
-#undef CONVERT_PEAK
-
-    fmt.i_id = 0;
-    p_sys->p_es = es_out_Add( p_demux->out, &fmt );
-    if( !p_sys->p_es )
-        return VLC_EGENERIC;
-
-    return VLC_SUCCESS;
-}
-
-/*****************************************************************************
- * Close: frees unused data
- *****************************************************************************/
-static void Close( vlc_object_t * p_this )
-{
-    demux_t        *p_demux = (demux_t*)p_this;
-    demux_sys_t    *p_sys = p_demux->p_sys;
-
-    mpc_demux_exit( p_sys->decoder );
-}
-
-/*****************************************************************************
- * Demux:
- *****************************************************************************
- * Returns -1 in case of error, 0 in case of EOF, 1 otherwise
- *****************************************************************************/
-static int Demux( demux_t *p_demux )
-{
-    demux_sys_t *p_sys = p_demux->p_sys;
-    block_t     *p_data;
-    mpc_frame_info frame;
-    mpc_status err;
-
-    p_data = block_Alloc( MPC_DECODER_BUFFER_LENGTH*sizeof(MPC_SAMPLE_FORMAT) );
-    if( unlikely(!p_data) )
-        return VLC_DEMUXER_EGENERIC;
-
-    frame.buffer = (MPC_SAMPLE_FORMAT*)p_data->p_buffer;
-    err = mpc_demux_decode( p_sys->decoder, &frame );
-    if( err != MPC_STATUS_OK )
-    {
-        block_Release( p_data );
-        return VLC_DEMUXER_EGENERIC;
-    }
-    else if( frame.bits == -1 || frame.samples == 0 )
-    {
-        block_Release( p_data );
-        return VLC_DEMUXER_EOF;
-    }
-
-    /* */
-    p_data->i_buffer = frame.samples * sizeof(MPC_SAMPLE_FORMAT) * p_sys->info.channels;
-    p_data->i_dts = p_data->i_pts =
-            VLC_TICK_0 + vlc_tick_from_samples(p_sys->i_position, p_sys->info.sample_freq);
-
-    es_out_SetPCR( p_demux->out, p_data->i_dts );
-
-    es_out_Send( p_demux->out, p_sys->p_es, p_data );
-
-    /* */
-    p_sys->i_position += frame.samples;
-
-    return VLC_DEMUXER_SUCCESS;
-}
-
-/*****************************************************************************
- * Control:
- *****************************************************************************/
-static int Control( demux_t *p_demux, int i_query, va_list args )
-{
-    demux_sys_t *p_sys = p_demux->p_sys;
-
-    switch( i_query )
-    {
-        case DEMUX_CAN_SEEK:
-            return vlc_stream_vaControl( p_demux->s, i_query, args );
-
-        case DEMUX_HAS_UNSUPPORTED_META:
-            *va_arg( args, bool* ) = true;
-            return VLC_SUCCESS;
-
-        case DEMUX_GET_LENGTH:
-            *va_arg( args, vlc_tick_t * ) =
-                vlc_tick_from_samples(p_sys->info.samples, p_sys->info.sample_freq);
-            return VLC_SUCCESS;
-
-        case DEMUX_GET_POSITION:
-            *va_arg( args, double * ) = (double)p_sys->i_position /
-                                                p_sys->info.samples;
-            return VLC_SUCCESS;
-
-        case DEMUX_GET_TIME:
-            *va_arg( args, vlc_tick_t * ) =
-                vlc_tick_from_samples(p_sys->i_position, p_sys->info.sample_freq);
-            return VLC_SUCCESS;
-
-        case DEMUX_SET_POSITION:
-        {
-            mpc_uint64_t i64 = va_arg( args, double ) * p_sys->info.samples;
-            if( mpc_demux_seek_sample( p_sys->decoder, i64 ) )
-            {
-                p_sys->i_position = i64;
-                return VLC_SUCCESS;
-            }
-            return VLC_EGENERIC;
-        }
-
-        case DEMUX_SET_TIME:
-        {
-            vlc_tick_t i64 = va_arg( args, vlc_tick_t );
-            if( mpc_demux_seek_sample( p_sys->decoder, i64 ) )
-            {
-                p_sys->i_position = i64;
-                return VLC_SUCCESS;
-            }
-            return VLC_EGENERIC;
-        }
-
-        case DEMUX_CAN_PAUSE:
-        case DEMUX_SET_PAUSE_STATE:
-        case DEMUX_CAN_CONTROL_PACE:
-        case DEMUX_GET_PTS_DELAY:
-            return demux_vaControlHelper( p_demux->s, 0, -1, 0, 1, i_query, args );
-
-        default:
-            return VLC_EGENERIC;
-    }
-}
-
-mpc_int32_t ReaderRead(mpc_reader *p_private, void *dst, mpc_int32_t i_size)
-{
-    stream_t *stream = p_private->data;
-    return vlc_stream_Read( stream, dst, i_size );
-}
-
-mpc_bool_t ReaderSeek(mpc_reader *p_private, mpc_int32_t i_offset)
-{
-    stream_t *stream = p_private->data;
-    return !vlc_stream_Seek( stream, i_offset );
-}
-
-mpc_int32_t ReaderTell(mpc_reader *p_private)
-{
-    stream_t *stream = p_private->data;
-    return vlc_stream_Tell( stream );
-}
-
-mpc_int32_t ReaderGetSize(mpc_reader *p_private)
-{
-    stream_t *stream = p_private->data;
-    return stream_Size( stream );
-}
-
-mpc_bool_t ReaderCanSeek(mpc_reader *p_private)
-{
-    stream_t *stream = p_private->data;
-    bool b_canseek;
-
-    vlc_stream_Control( stream, STREAM_CAN_SEEK, &b_canseek );
-    return b_canseek;
-}


=====================================
po/POTFILES.in
=====================================
@@ -381,7 +381,6 @@ modules/demux/mp4/libmp4.c
 modules/demux/mp4/libmp4.h
 modules/demux/mp4/meta.c
 modules/demux/mp4/mp4.c
-modules/demux/mpc.c
 modules/demux/mpeg/es.c
 modules/demux/mpeg/h26x.c
 modules/demux/mpeg/mpgv.c



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/7d73d0a102a345625c9709df60c109703b2dc31d...1b97942bcbb80754c6a884e51758d0875d3930a5

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/7d73d0a102a345625c9709df60c109703b2dc31d...1b97942bcbb80754c6a884e51758d0875d3930a5
You're receiving this email because of your account on code.videolan.org.




More information about the vlc-commits mailing list