1
0
mirror of https://github.com/mpv-player/mpv synced 2025-03-21 18:57:35 +00:00

Speex support. Seeking and pts generation does not work.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@16916 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
reimar 2005-11-05 11:58:25 +00:00
parent eeaa5eb45f
commit 4e76145381
8 changed files with 84 additions and 1 deletions

View File

@ -216,6 +216,7 @@ D
* made MMS over HTTP stream selection work and modified ASF header parsing
* reimplemented ao_jack without bio2jack dependency
* musepack demuxer and decoder, based on Reza's patch
* speex decoder via libspeex
* MPEG-2 in GXF demuxer
* vo_gl ported to windows
* gl_commmon.[ch] to decrease code duplication

View File

@ -34,6 +34,7 @@ MPlayer (1.0)
* support for dmb1 MJPEG files with ffmjpeg
* support for musepack audio (WARNING: when muxing into e.g. AVI you will
be able to seek, but you might get ear- and speaker-breaking noises)
* experimental speex support via libspeex
* On2 VP7 video decoder via binary DLL
* Duck/On2 TrueMotion2 (TM20) support via lavc
* support FLX and DTA extensions for flic files

View File

@ -104,6 +104,7 @@ CODEC_LIBS = $(AV_LIB) \
$(XMMS_LIB) \
$(X264_LIB) \
$(MUSEPACK_LIB) \
$(SPEEX_LIB) \
COMMON_LIBS = libmpcodecs/libmpcodecs.a \
$(W32_LIB) \

32
configure vendored
View File

@ -243,6 +243,7 @@ Codecs:
--enable-tremor-low build with lower accuracy internal tremor [disabled]
--enable-external-tremor build with external tremor [disabled]
--disable-vorbis disable OggVorbis support entirely [autodetect]
--disable-speex disable Speex support [autodetect]
--enable-theora build with OggTheora support [autodetect]
--disable-internal-matroska disable internal Matroska support [enabled]
--enable-external-faad build with external FAAD2 (AAC) support [autodetect]
@ -1486,6 +1487,7 @@ _twolame=auto
_tremor_internal=yes
_tremor_low=no
_vorbis=auto
_speex=auto
_theora=auto
_mp3lib=yes
_liba52=yes
@ -1679,6 +1681,8 @@ for ac_option do
--disable-liblzo) _liblzo=no ;;
--enable-vorbis) _vorbis=yes ;;
--disable-vorbis) _vorbis=no ;;
--enable-speex) _speex=yes ;;
--disable-speex) _speex=no ;;
--enable-internal-tremor) _tremor_internal=yes ;;
--disable-internal-tremor) _tremor_internal=no ;;
--enable-tremor-low) _tremor_low=yes ;;
@ -5389,6 +5393,29 @@ elif test "$_vorbis" = yes -a "$_tremor" = yes ; then
fi
echores "$_vorbis"
echocheck "libspeex (version >= 1.1 required)"
if test "$_speex" = auto ; then
_speex=no
cat > $TMPC << EOF
#include <speex/speex.h>
int main(void) {
SpeexBits bits;
void *dec;
speex_decode_int(dec, &bits, dec);
}
EOF
cc_check -lspeex $_ld_lm && _speex=yes
fi
if test "$_speex" = yes ; then
_def_speex='#define HAVE_SPEEX 1'
_ld_speex='-lspeex'
_codecmodules="speex $_codecmodules"
else
_def_speex='#undef HAVE_SPEEX'
_nocodecmodules="speex $_nocodecmodules"
fi
echores "$_speex"
echocheck "OggTheora support"
if test "$_theora" = auto ; then
_theora=no
@ -6982,6 +7009,7 @@ LIBMPEG2 = $_libmpeg2
TREMOR = $_tremor_internal
TREMOR_FLAGS = $_tremor_flags
SPEEX = $_speex
MUSEPACK = $_musepack
UNRARLIB = $_unrarlib
@ -7091,6 +7119,7 @@ FRIBIDI_LIB = $_ld_fribidi
LIBLZO_LIB= $_ld_liblzo
MAD_LIB = $_ld_mad
VORBIS_LIB = $_ld_vorbis $_ld_libdv
SPEEX_LIB = $_ld_speex
THEORA_LIB = $_ld_theora
FAAD_LIB = $_ld_faad
INTERNAL_FAAD = $_faad_internal
@ -7669,6 +7698,9 @@ $_def_vorbis
/* enable Tremor as vorbis decoder */
$_def_tremor
/* enable Speex support */
$_def_speex
/* enable musepack support */
$_def_musepack

View File

@ -2628,6 +2628,14 @@ audiocodec vorbis
; driver acm
; dll "vorbis.acm"
audiocodec speex
info "Speex Audio Decoder"
status working
comment "Speex driver using libspeex"
fourcc 'spx '
driver speex
dll "speex"
audiocodec vivoaudio
info "Vivo G.723/Siren Audio Codec"
status working

View File

@ -209,6 +209,10 @@ ifeq ($(MUSEPACK),yes)
AUDIO_SRCS += ad_mpc.c
endif
ifeq ($(SPEEX),yes)
AUDIO_SRCS += ad_speex.c
endif
ifeq ($(FAAC),yes)
ENCODER_SRCS += ae_faac.c
endif

View File

@ -33,6 +33,7 @@ extern ad_functions_t mpcodecs_ad_acm;
extern ad_functions_t mpcodecs_ad_msgsm;
extern ad_functions_t mpcodecs_ad_faad;
extern ad_functions_t mpcodecs_ad_libvorbis;
extern ad_functions_t mpcodecs_ad_speex;
extern ad_functions_t mpcodecs_ad_libmad;
extern ad_functions_t mpcodecs_ad_realaud;
extern ad_functions_t mpcodecs_ad_libdv;
@ -78,6 +79,9 @@ ad_functions_t* mpcodecs_ad_drivers[] =
#ifdef HAVE_OGGVORBIS
&mpcodecs_ad_libvorbis,
#endif
#ifdef HAVE_SPEEX
&mpcodecs_ad_speex,
#endif
#ifdef USE_LIBMAD
&mpcodecs_ad_libmad,
#endif

View File

@ -16,6 +16,7 @@
#include "stheader.h"
#define FOURCC_VORBIS mmioFOURCC('v', 'r', 'b', 's')
#define FOURCC_SPEEX mmioFOURCC('s', 'p', 'x', ' ')
#define FOURCC_THEORA mmioFOURCC('t', 'h', 'e', 'o')
#ifdef TREMOR
@ -116,6 +117,7 @@ typedef struct ogg_stream {
ogg_stream_state stream;
int hdr_packets;
int vorbis;
int speex;
int theora;
int flac;
int text;
@ -352,6 +354,8 @@ static unsigned char* demux_ogg_read_packet(ogg_stream_t* os,ogg_packet* pack,vo
os->lastsize = blocksize;
os->lastpos = pack->granulepos;
}
} else if (os->speex) {
data = pack->packet;
# ifdef HAVE_OGGTHEORA
} else if (os->theora) {
/* we pass complete packets to theora, mustn't strip the header! */
@ -536,6 +540,13 @@ static int demux_ogg_add_packet(demux_stream_t* ds,ogg_stream_t* os,int id,ogg_p
demux_ogg_add_sub(os,pack);
return 0;
}
if (os->speex) {
// discard first two packets, they contain the header and comment
if (os->hdr_packets < 2) {
os->hdr_packets++;
return 0;
}
} else
// If packet is an header we jump it except for vorbis and theora
// (PACKET_TYPE_HEADER bit doesn't even exist for theora ?!)
// We jump nothing for FLAC. Ain't this great? Packet contents have to be
@ -916,6 +927,27 @@ int demux_ogg_open(demuxer_t* demuxer) {
ogg_d->subs[ogg_d->num_sub].id = n_audio;
n_audio++;
mp_msg(MSGT_DEMUX,MSGL_INFO,"[Ogg] stream %d: audio (Vorbis), -aid %d\n",ogg_d->num_sub,n_audio-1);
} else if (pack.bytes >= 80 && !strncmp(pack.packet,"Speex", 5)) {
sh_a = new_sh_audio(demuxer, ogg_d->num_sub);
sh_a->wf = (WAVEFORMATEX*)calloc(1, sizeof(WAVEFORMATEX) + pack.bytes);
sh_a->format = FOURCC_SPEEX;
sh_a->samplerate = sh_a->wf->nSamplesPerSec = get_uint32(&pack.packet[36]);
sh_a->channels = sh_a->wf->nChannels = get_uint32(&pack.packet[48]);
sh_a->wf->wFormatTag = sh_a->format;
sh_a->wf->nAvgBytesPerSec = get_uint32(&pack.packet[52]);
sh_a->wf->nBlockAlign = 0;
sh_a->wf->wBitsPerSample = 16;
sh_a->samplesize = 2;
sh_a->wf->cbSize = pack.bytes;
memcpy(&sh_a->wf[1], pack.packet, pack.bytes);
ogg_d->subs[ogg_d->num_sub].samplerate = sh_a->samplerate;
ogg_d->subs[ogg_d->num_sub].speex = 1;
if (identify)
mp_msg(MSGT_GLOBAL, MSGL_INFO, "ID_AUDIO_ID=%d\n", n_audio);
ogg_d->subs[ogg_d->num_sub].id = n_audio;
n_audio++;
mp_msg(MSGT_DEMUX,MSGL_INFO,"[Ogg] stream %d: audio (Speex), -aid %d\n",ogg_d->num_sub,n_audio-1);
// check for Theora
# ifdef HAVE_OGGTHEORA
@ -1549,7 +1581,7 @@ static void demux_ogg_seek(demuxer_t *demuxer,float rel_seek_secs,int flags) {
break;
}
}
if(!precision && (is_keyframe || os->vorbis) ) {
if(!precision && (is_keyframe || os->vorbis || os->speex) ) {
ogg_sub.lines = 0;
vo_sub = &ogg_sub;
vo_osd_changed(OSDTYPE_SUBTITLE);