Mercurial > mplayer.hg
changeset 10261:05a50c0ce239
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
author | rtognimp |
---|---|
date | Sun, 08 Jun 2003 20:29:04 +0000 |
parents | 597ad4eb02fc |
children | e6f5487b2042 |
files | etc/codecs.conf libmpcodecs/Makefile libmpcodecs/ad.c libmpcodecs/ad_ra1428.c |
diffstat | 4 files changed, 158 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/etc/codecs.conf Sun Jun 08 20:25:28 2003 +0000 +++ b/etc/codecs.conf Sun Jun 08 20:29:04 2003 +0000 @@ -1558,6 +1558,13 @@ driver realaud dll "28_83260.dll" +audiocodec mpra1428 + info "RealAudio 1.0 and 2.0 native decoder" + status working + format 0x345F3431 ; "14_4" + format 0x385F3832 ; "28_8" + driver ra1428 + audiocodec racook info "RealAudio COOK" status working
--- a/libmpcodecs/Makefile Sun Jun 08 20:25:28 2003 +0000 +++ b/libmpcodecs/Makefile Sun Jun 08 20:29:04 2003 +0000 @@ -5,7 +5,7 @@ LIBNAME2 = libmpencoders.a AUDIO_SRCS_LIB=ad_liba52.c ad_hwac3.c ad_mp3lib.c -AUDIO_SRCS_NAT=ad_alaw.c ad_dk3adpcm.c ad_pcm.c ad_dvdpcm.c ad_imaadpcm.c ad_msadpcm.c ad_msgsm.c ad_roqaudio.c +AUDIO_SRCS_NAT=ad_alaw.c ad_dk3adpcm.c ad_pcm.c ad_dvdpcm.c ad_imaadpcm.c ad_msadpcm.c ad_msgsm.c ad_roqaudio.c ad_ra1428.c AUDIO_SRCS_OPT=ad_acm.c ad_dshow.c ad_dmo.c ad_qtaudio.c ad_ffmpeg.c ad_faad.c ad_libvorbis.c ad_libmad.c ad_realaud.c ad_libdv.c AUDIO_SRCS=dec_audio.c ad.c $(AUDIO_SRCS_LIB) $(AUDIO_SRCS_NAT) $(AUDIO_SRCS_OPT) @@ -17,7 +17,7 @@ VFILTER_SRCS=vf.c vf_vo.c vf_crop.c vf_expand.c vf_pp.c vf_scale.c vf_format.c vf_yuy2.c vf_flip.c vf_rgb2bgr.c vf_rotate.c vf_mirror.c vf_palette.c vf_lavc.c vf_dvbscale.c vf_cropdetect.c vf_test.c vf_noise.c vf_yvu9.c vf_rectangle.c vf_lavcdeint.c vf_eq.c vf_eq2.c vf_halfpack.c vf_dint.c vf_1bpp.c vf_bmovl.c vf_2xsai.c vf_unsharp.c vf_swapuv.c vf_il.c vf_boxblur.c vf_sab.c vf_smartblur.c vf_perspective.c vf_down3dright.c vf_field.c vf_denoise3d.c vf_hqdn3d.c vf_detc.c vf_telecine.c vf_tfields.c vf_ivtc.c vf_ilpack.c vf_dsize.c vf_decimate.c ENCODER_SRCS=ve.c ve_divx4.c ve_lavc.c ve_vfw.c ve_rawrgb.c ve_libdv.c ve_xvid.c ve_qtvideo.c ve_nuv.c -NATIVE_SRCS=native/RTjpegN.c native/cinepak.c native/fli.c native/minilzo.c native/msvidc.c native/nuppelvideo.c native/qtrle.c native/qtrpza.c native/qtsmc.c native/roqav.c native/xa_gsm.c native/svq1.c +NATIVE_SRCS=native/RTjpegN.c native/cinepak.c native/fli.c native/minilzo.c native/msvidc.c native/nuppelvideo.c native/qtrle.c native/qtrpza.c native/qtsmc.c native/roqav.c native/xa_gsm.c native/svq1.c native/decode144.c native/decode288.c ifeq ($(FAME),yes) VFILTER_SRCS += vf_fame.c
--- a/libmpcodecs/ad.c Sun Jun 08 20:25:28 2003 +0000 +++ b/libmpcodecs/ad.c Sun Jun 08 20:29:04 2003 +0000 @@ -38,6 +38,7 @@ extern ad_functions_t mpcodecs_ad_realaud; extern ad_functions_t mpcodecs_ad_libdv; extern ad_functions_t mpcodecs_ad_qtaudio; +extern ad_functions_t mpcodecs_ad_ra1428; ad_functions_t* mpcodecs_ad_drivers[] = { @@ -85,5 +86,6 @@ #ifdef HAVE_LIBDV095 &mpcodecs_ad_libdv, #endif + &mpcodecs_ad_ra1428, NULL };
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libmpcodecs/ad_ra1428.c Sun Jun 08 20:29:04 2003 +0000 @@ -0,0 +1,147 @@ +// SAMPLE audio decoder - you can use this file as template when creating new codec! + +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> + +#include "config.h" +#include "ad_internal.h" + +static ad_info_t info = { + "RealAudio 1.0 and 2.0 native decoder", + "ra1428", + "Roberto Togni", + "http://www.honeypot.net/audio", + "Decoders taken from a public domain Amiga player" +}; + +LIBAD_EXTERN(ra1428) + +#include "native/common1428.h" + + + +static int preinit(sh_audio_t *sh) { + sh->samplerate=sh->wf->nSamplesPerSec; + sh->samplesize=sh->wf->wBitsPerSample/8; + sh->channels=sh->wf->nChannels; + sh->sample_format=AFMT_S16_LE; + + switch (sh->format) { + case mmioFOURCC('1','4','_','4'): + mp_msg(MSGT_DECAUDIO,MSGL_INFO,"[ra1428] RealAudio 1.0 (14_4)\n"); + sh->i_bps=1800; + break; + case mmioFOURCC('2','8','_','8'): + mp_msg(MSGT_DECAUDIO,MSGL_INFO,"[ra1428] RealAudio 2.0 (28_8)\n"); + sh->i_bps=1200; + break; + default: + mp_msg(MSGT_DECAUDIO,MSGL_ERR,"[ra1428] Unhandled format in preinit: %x\n", sh->format); + return 0; + } + + sh->audio_out_minsize=128000; // no idea how to get... :( + sh->audio_in_minsize=((short*)(sh->wf+1))[1]*sh->wf->nBlockAlign; + + return 1; // return values: 1=OK 0=ERROR +} + + + +static int init(sh_audio_t *sh) { + switch (sh->format) { + case mmioFOURCC('1','4','_','4'): + (Real_144*)sh->context = init_144(); + break; + case mmioFOURCC('2','8','_','8'): + (Real_288*)sh->context = init_288(); + break; + default: + mp_msg(MSGT_DECAUDIO,MSGL_ERR,"[ra1428] Unhandled format in init: %x\n", sh->format); + return 0; + } + + return 1; // return values: 1=OK 0=ERROR +} + + + +static void uninit(sh_audio_t *sh) { + switch (sh->format) { + case mmioFOURCC('1','4','_','4'): + free_144((Real_144*)sh->context); + break; + case mmioFOURCC('2','8','_','8'): + free_288((Real_288*)sh->context); + break; + default: + mp_msg(MSGT_DECAUDIO,MSGL_ERR,"[ra1428] Unhandled format in uninit: %x\n", sh->format); + return; + } +} + + + +static int decode_audio(sh_audio_t *sh,unsigned char *buf,int minlen,int maxlen) { + int w=sh->wf->nBlockAlign; + int h=((short*)(sh->wf+1))[1]; + int cfs=((short*)(sh->wf+1))[3]; + int i,j; + + if(sh->a_in_buffer_len<=0){ + switch (sh->format) { + case mmioFOURCC('1','4','_','4'): + demux_read_data(sh->ds, sh->a_in_buffer, sh->wf->nBlockAlign); + sh->a_in_buffer_size= + sh->a_in_buffer_len=sh->wf->nBlockAlign; + break; + case mmioFOURCC('2','8','_','8'): + for (j = 0; j < h; j++) + for (i = 0; i < h/2; i++) + demux_read_data(sh->ds, sh->a_in_buffer+i*2*w+j*cfs, cfs); + sh->a_in_buffer_size= + sh->a_in_buffer_len=sh->wf->nBlockAlign*h; + break; + default: + mp_msg(MSGT_DECAUDIO,MSGL_ERR,"[ra1428] Unhandled format in decode_audio: %x\n", sh->format); + return 0; + } + } + + switch (sh->format) { + case mmioFOURCC('1','4','_','4'): + decode_144((Real_144*)sh->context,sh->a_in_buffer+sh->a_in_buffer_size-sh->a_in_buffer_len,(signed short*)buf); + break; + case mmioFOURCC('2','8','_','8'): + decode_288((Real_288*)sh->context,sh->a_in_buffer+sh->a_in_buffer_size-sh->a_in_buffer_len,(signed short*)buf); + break; + default: + mp_msg(MSGT_DECAUDIO,MSGL_ERR,"[ra1428] Unhandled format in init: %x\n", sh->format); + return 0; + } + + sh->a_in_buffer_len-=cfs; + + return AUDIOBLOCK*2; // return value: number of _bytes_ written to output buffer, + // or -1 for EOF (or uncorrectable error) +} + +static int control(sh_audio_t *sh,int cmd,void* arg, ...){ + // various optional functions you MAY implement: + switch(cmd){ + case ADCTRL_RESYNC_STREAM: + // it is called once after seeking, to resync. + // Note: sh_audio->a_in_buffer_len=0; is done _before_ this call! +// ... + return CONTROL_TRUE; + case ADCTRL_SKIP_FRAME: + // it is called to skip (jump over) small amount (1/10 sec or 1 frame) + // of audio data - used to sync audio to video after seeking + // if you don't return CONTROL_TRUE, it will defaults to: + // ds_fill_buffer(sh_audio->ds); // skip 1 demux packet +// ... + return CONTROL_TRUE; + } + return CONTROL_UNKNOWN; +}