[vlc-commits] Revert "Port to new libmpcdec API"
Jean-Baptiste Kempf
git at videolan.org
Wed Jul 11 19:36:51 CEST 2018
vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Wed Jul 11 19:32:20 2018 +0200| [e20677966fb7729f9be5732fbc847868d7bb4a0d] | committer: Jean-Baptiste Kempf
Revert "Port to new libmpcdec API"
This reverts commit 87cb4e591ac075c7fabc395cf997e0b261296007.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e20677966fb7729f9be5732fbc847868d7bb4a0d
---
configure.ac | 7 +---
modules/demux/mpc.c | 119 ++++------------------------------------------------
2 files changed, 10 insertions(+), 116 deletions(-)
diff --git a/configure.ac b/configure.ac
index 6ec557bc14..36252aaff8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2164,12 +2164,9 @@ 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_HEADERS([mpcdec/mpcdec.h], [
VLC_ADD_PLUGIN([mpc])
- VLC_ADD_LIBS([mpc],[-lmpcdec])],
- [AC_CHECK_HEADERS([mpcdec/mpcdec.h], [
- VLC_ADD_PLUGIN([mpc])
- VLC_ADD_LIBS([mpc],[-lmpcdec])])])
+ VLC_ADD_LIBS([mpc],[-lmpcdec])])
fi
dnl
diff --git a/modules/demux/mpc.c b/modules/demux/mpc.c
index b665ea078a..9a31e2098a 100644
--- a/modules/demux/mpc.c
+++ b/modules/demux/mpc.c
@@ -36,11 +36,7 @@
#include <vlc_codec.h>
#include <math.h>
-#ifdef HAVE_MPC_MPCDEC_H
-#include <mpc/mpcdec.h>
-#else
#include <mpcdec/mpcdec.h>
-#endif
/* TODO:
* - test stream version 4..6
@@ -79,11 +75,7 @@ typedef struct
es_out_id_t *p_es;
/* */
-#ifndef HAVE_MPC_MPCDEC_H
mpc_decoder decoder;
-#else
- mpc_demux *decoder;
-#endif
mpc_reader reader;
mpc_streaminfo info;
@@ -91,19 +83,11 @@ typedef struct
int64_t i_position;
} demux_sys_t;
-#ifndef HAVE_MPC_MPCDEC_H
static mpc_int32_t ReaderRead( void *p_private, void *dst, mpc_int32_t i_size );
static mpc_bool_t ReaderSeek( void *p_private, mpc_int32_t i_offset );
static mpc_int32_t ReaderTell( void *p_private);
static mpc_int32_t ReaderGetSize( void *p_private );
static mpc_bool_t ReaderCanSeek( void *p_private );
-#else
-static mpc_int32_t ReaderRead( mpc_reader *p_private, void *dst, mpc_int32_t i_size );
-static mpc_bool_t ReaderSeek( mpc_reader *p_private, mpc_int32_t i_offset );
-static mpc_int32_t ReaderTell( mpc_reader *p_private);
-static mpc_int32_t ReaderGetSize( mpc_reader *p_private );
-static mpc_bool_t ReaderCanSeek( mpc_reader *p_private );
-#endif
/*****************************************************************************
* Open: initializes ES structures
@@ -118,15 +102,11 @@ static int Open( vlc_object_t * p_this )
if( vlc_stream_Peek( p_demux->s, &p_peek, 4 ) < 4 )
return VLC_EGENERIC;
- if( memcmp( p_peek, "MP+", 3 )
-#ifdef HAVE_MPC_MPCDEC_H
- /* SV8 format */
- && memcmp( p_peek, "MPCK", 4 )
-#endif
- )
+ 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;
@@ -154,7 +134,6 @@ static int Open( vlc_object_t * p_this )
p_sys->reader.canseek = ReaderCanSeek;
p_sys->reader.data = p_demux;
-#ifndef HAVE_MPC_MPCDEC_H
/* Load info */
mpc_streaminfo_init( &p_sys->info );
if( mpc_streaminfo_read( &p_sys->info, &p_sys->reader ) != ERROR_CODE_OK )
@@ -164,13 +143,6 @@ static int Open( vlc_object_t * p_this )
mpc_decoder_setup( &p_sys->decoder, &p_sys->reader );
if( !mpc_decoder_initialize( &p_sys->decoder, &p_sys->info ) )
goto error;
-#else
- p_sys->decoder = mpc_demux_init( &p_sys->reader );
- if( !p_sys->decoder )
- goto error;
-
- mpc_demux_get_info( p_sys->decoder, &p_sys->info );
-#endif
/* Fill p_demux fields */
p_demux->pf_demux = Demux;
@@ -239,10 +211,6 @@ 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;
-#ifdef HAVE_MPC_MPCDEC_H
- if( p_sys->decoder )
- mpc_demux_exit( p_sys->decoder );
-#endif
free( p_sys );
}
@@ -256,15 +224,12 @@ static int Demux( demux_t *p_demux )
demux_sys_t *p_sys = p_demux->p_sys;
block_t *p_data;
int i_ret;
-#ifdef HAVE_MPC_MPCDEC_H
- mpc_frame_info frame;
- mpc_status err;
-#endif
- p_data = block_Alloc( MPC_DECODER_BUFFER_LENGTH*sizeof(MPC_SAMPLE_FORMAT) );
+
+ p_data = block_New( p_demux,
+ MPC_DECODER_BUFFER_LENGTH*sizeof(MPC_SAMPLE_FORMAT) );
if( !p_data )
return VLC_DEMUXER_EGENERIC;
-#ifndef HAVE_MPC_MPCDEC_H
i_ret = mpc_decoder_decode( &p_sys->decoder,
(MPC_SAMPLE_FORMAT*)p_data->p_buffer,
NULL, NULL );
@@ -273,22 +238,6 @@ static int Demux( demux_t *p_demux )
block_Release( p_data );
return i_ret < 0 ? VLC_DEMUXER_EGENERIC : VLC_DEMUXER_EOF;
}
-#else
- 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 )
- {
- block_Release( p_data );
- return VLC_DEMUXER_EOF;
- }
-
- i_ret = frame.samples;
-#endif
/* */
p_data->i_buffer = i_ret * sizeof(MPC_SAMPLE_FORMAT) * p_sys->info.channels;
@@ -327,27 +276,15 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
case DEMUX_GET_LENGTH:
pi64 = va_arg( args, int64_t * );
-#ifndef HAVE_MPC_MPCDEC_H
*pi64 = CLOCK_FREQ * p_sys->info.pcm_samples /
p_sys->info.sample_freq;
-#else
- *pi64 = CLOCK_FREQ * (p_sys->info.samples -
- p_sys->info.beg_silence) /
- p_sys->info.sample_freq;
-#endif
return VLC_SUCCESS;
case DEMUX_GET_POSITION:
pf = va_arg( args, double * );
-#ifndef HAVE_MPC_MPCDEC_H
- if( p_sys->info.pcm_samples > 0 )
- *pf = (double) p_sys->i_position /
- (double)p_sys->info.pcm_samples;
-#else
- if( p_sys->info.samples - p_sys->info.beg_silence > 0)
- *pf = (double) p_sys->i_position /
- (double)(p_sys->info.samples - p_sys->info.beg_silence);
-#endif
+ pi64 = (int64_t*)va_arg( args, int64_t * );
+ *pi64 = INT64_C(1000000) * p_sys->info.pcm_samples /
+ p_sys->info.sample_freq;
else
*pf = 0.0;
return VLC_SUCCESS;
@@ -360,14 +297,8 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
case DEMUX_SET_POSITION:
f = va_arg( args, double );
-#ifndef HAVE_MPC_MPCDEC_H
i64 = (int64_t)(f * p_sys->info.pcm_samples);
if( mpc_decoder_seek_sample( &p_sys->decoder, i64 ) )
-#else
- i64 = (int64_t)(f * (p_sys->info.samples -
- p_sys->info.beg_silence));
- if( mpc_demux_seek_sample( p_sys->decoder, i64 ) == MPC_STATUS_OK )
-#endif
{
p_sys->i_position = i64;
return VLC_SUCCESS;
@@ -376,11 +307,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
case DEMUX_SET_TIME:
i64 = va_arg( args, int64_t );
-#ifndef HAVE_MPC_MPCDEC_H
if( mpc_decoder_seek_sample( &p_sys->decoder, i64 ) )
-#else
- if( mpc_demux_seek_sample( p_sys->decoder, i64 ) == MPC_STATUS_OK )
-#endif
{
p_sys->i_position = i64;
return VLC_SUCCESS;
@@ -398,63 +325,33 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
}
}
-#ifndef HAVE_MPC_MPCDEC_H
static mpc_int32_t ReaderRead( void *p_private, void *dst, mpc_int32_t i_size )
{
demux_t *p_demux = (demux_t*)p_private;
-#else
-static mpc_int32_t ReaderRead( mpc_reader *p_private, void *dst, mpc_int32_t i_size )
-{
- demux_t *p_demux = (demux_t*)p_private->data;
-#endif
return vlc_stream_Read( p_demux->s, dst, i_size );
}
-#ifndef HAVE_MPC_MPCDEC_H
static mpc_bool_t ReaderSeek( void *p_private, mpc_int32_t i_offset )
{
demux_t *p_demux = (demux_t*)p_private;
-#else
-static mpc_bool_t ReaderSeek( mpc_reader *p_private, mpc_int32_t i_offset )
-{
- demux_t *p_demux = (demux_t*)p_private->data;
-#endif
return !vlc_stream_Seek( p_demux->s, i_offset );
}
-#ifndef HAVE_MPC_MPCDEC_H
static mpc_int32_t ReaderTell( void *p_private)
{
demux_t *p_demux = (demux_t*)p_private;
-#else
-static mpc_int32_t ReaderTell( mpc_reader *p_private)
-{
- demux_t *p_demux = (demux_t*)p_private->data;
-#endif
return vlc_stream_Tell( p_demux->s );
}
-#ifndef HAVE_MPC_MPCDEC_H
static mpc_int32_t ReaderGetSize( void *p_private )
{
demux_t *p_demux = (demux_t*)p_private;
-#else
-static mpc_int32_t ReaderGetSize( mpc_reader *p_private )
-{
- demux_t *p_demux = (demux_t*)p_private->data;
-#endif
return stream_Size( p_demux->s );
}
-#ifndef HAVE_MPC_MPCDEC_H
static mpc_bool_t ReaderCanSeek( void *p_private )
{
demux_t *p_demux = (demux_t*)p_private;
-#else
-static mpc_bool_t ReaderCanSeek( mpc_reader *p_private )
-{
- demux_t *p_demux = (demux_t*)p_private->data;
-#endif
bool b_canseek;
vlc_stream_Control( p_demux->s, STREAM_CAN_SEEK, &b_canseek );
More information about the vlc-commits
mailing list