Skip to content

Commit

Permalink
Merge svn changes up to r30732
Browse files Browse the repository at this point in the history
  • Loading branch information
Uoti Urpala committed Mar 9, 2010
2 parents ef3ef5e + 5a22891 commit acdce01
Show file tree
Hide file tree
Showing 26 changed files with 180 additions and 81 deletions.
5 changes: 4 additions & 1 deletion AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -768,8 +768,11 @@ Syrjälä, Ville <syrjala@sci.fi>
Szecsi, Gabor <deje@miki.hu>
* directsound AO driver

Tackaberry, Jason <tack@sault.org>
Tackaberry, Jason <tack@urandom.ca>
* second DVD ripping guide
* multichannel audio fixes
* support for 8 channel audio
* various minor features and bug fixes

Tam, Howell (Pigeon) <pigeon@pigeond.net>
* native libcaca driver (-vo caca)
Expand Down
3 changes: 2 additions & 1 deletion DOCS/xml/en/usage.xml
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,8 @@ DVDs usually have surround audio encoded in AC-3 (Dolby Digital) or DTS
(Digital Theater System) format. Some modern audio equipment is capable of
decoding these formats internally. <application>MPlayer</application> can be
configured to relay the audio data without decoding it. This will only work if
you have a S/PDIF (Sony/Philips Digital Interface) jack in your sound card.
you have a S/PDIF (Sony/Philips Digital Interface) jack in your sound card, or
if you are passing audio over HDMI.
</para>

<para>
Expand Down
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

include config.mak

.SUFFIXES:

###### variable declarations #######

Expand Down Expand Up @@ -752,6 +753,9 @@ all: $(ALL_PRG-yes)
%.ho: %.h
$(CC) $(CFLAGS) -Wno-unused -c -o $@ -x c $<

%.o: %.S
$(CC) $(ASFLAGS) -c -o $@ $<

%-rc.o: %.rc
$(WINDRES) -I. $< $@

Expand Down
1 change: 1 addition & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -2429,6 +2429,7 @@ if test "$cc_vendor" = "gnu" ; then
cc_check -Wno-pointer-sign && CFLAGS="-Wno-pointer-sign $CFLAGS"
cc_check -Wdisabled-optimization && CFLAGS="-Wdisabled-optimization $CFLAGS"
cc_check -Wundef && CFLAGS="-Wundef $CFLAGS"
cc_check -Wmissing-prototypes && CFLAGS="-Wmissing-prototypes $CFLAGS"
else
CFLAGS="-D_ISOC99_SOURCE -D_BSD_SOURCE $CFLAGS"
fi
Expand Down
11 changes: 11 additions & 0 deletions etc/codecs.conf
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ videocodec ffbinkvideo
driver ffmpeg
dll binkvideo
out YV12
out 420A

videocodec ffcdgraphics
info "FFmpeg CD-Graphics"
Expand Down Expand Up @@ -4537,6 +4538,16 @@ audiocodec lhacm
driver acm
dll "lhacm.acm"

audiocodec lhacm2
info "Voxware AC aka Lernout & Hauspie CELP and CBS codecs"
status working
format 0x70
format 0x71
format 0x72
format 0x73
driver acm
dll "lhacm2.acm" ; aka lhacm.acm md5sum 4585780a8eb71d86df64553b34ba8f79

audiocodec pscelp
info "Philips Speech Processing CELP"
status working
Expand Down
6 changes: 5 additions & 1 deletion libao2/ao_coreaudio.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,11 @@ static int read_buffer(unsigned char* data,int len){
return len;
}

OSStatus theRenderProc(void *inRefCon, AudioUnitRenderActionFlags *inActionFlags, const AudioTimeStamp *inTimeStamp, UInt32 inBusNumber, UInt32 inNumFrames, AudioBufferList *ioData)
static OSStatus theRenderProc(void *inRefCon,
AudioUnitRenderActionFlags *inActionFlags,
const AudioTimeStamp *inTimeStamp,
UInt32 inBusNumber, UInt32 inNumFrames,
AudioBufferList *ioData)
{
int amt=av_fifo_size(ao->buffer);
int req=(inNumFrames)*ao->packetSize;
Expand Down
112 changes: 68 additions & 44 deletions libao2/ao_pcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,30 +61,75 @@ static int fast = 0;
#define WAV_ID_DATA 0x61746164 /* "data" */
#define WAV_ID_PCM 0x0001
#define WAV_ID_FLOAT_PCM 0x0003

struct WaveHeader
{
uint32_t riff;
uint32_t file_length;
uint32_t wave;
uint32_t fmt;
uint32_t fmt_length;
uint16_t fmt_tag;
uint16_t channels;
uint32_t sample_rate;
uint32_t bytes_per_second;
uint16_t block_align;
uint16_t bits;
uint32_t data;
uint32_t data_length;
};
#define WAV_ID_FORMAT_EXTENSIBLE 0xfffe

/* init with default values */
static struct WaveHeader wavhdr;
static uint64_t data_length;

static FILE *fp = NULL;


static void fput16le(uint16_t val, FILE *fp) {
uint8_t bytes[2] = {val, val >> 8};
fwrite(bytes, 1, 2, fp);
}

static void fput32le(uint32_t val, FILE *fp) {
uint8_t bytes[4] = {val, val >> 8, val >> 16, val >> 24};
fwrite(bytes, 1, 4, fp);
}

static void write_wave_header(FILE *fp, uint64_t data_length) {
int use_waveex = (ao_data.channels >= 5 && ao_data.channels <= 8);
uint16_t fmt = (ao_data.format == AF_FORMAT_FLOAT_LE) ? WAV_ID_FLOAT_PCM : WAV_ID_PCM;
uint32_t fmt_chunk_size = use_waveex ? 40 : 16;
int bits = af_fmt2bits(ao_data.format);

// Master RIFF chunk
fput32le(WAV_ID_RIFF, fp);
// RIFF chunk size: 'WAVE' + 'fmt ' + 4 + fmt_chunk_size + data chunk hdr (8) + data length
fput32le(12 + fmt_chunk_size + 8 + data_length, fp);
fput32le(WAV_ID_WAVE, fp);

// Format chunk
fput32le(WAV_ID_FMT, fp);
fput32le(fmt_chunk_size, fp);
fput16le(use_waveex ? WAV_ID_FORMAT_EXTENSIBLE : fmt, fp);
fput16le(ao_data.channels, fp);
fput32le(ao_data.samplerate, fp);
fput32le(ao_data.bps, fp);
fput16le(ao_data.channels * (bits / 8), fp);
fput16le(bits, fp);

if (use_waveex) {
// Extension chunk
fput16le(22, fp);
fput16le(bits, fp);
switch (ao_data.channels) {
case 5:
fput32le(0x0607, fp); // L R C Lb Rb
break;
case 6:
fput32le(0x060f, fp); // L R C Lb Rb LFE
break;
case 7:
fput32le(0x0727, fp); // L R C Cb Ls Rs LFE
break;
case 8:
fput32le(0x063f, fp); // L R C Lb Rb Ls Rs LFE
break;
}
// 2 bytes format + 14 bytes guid
fput32le(fmt, fp);
fput32le(0x00100000, fp);
fput32le(0xAA000080, fp);
fput32le(0x719B3800, fp);
}

// Data chunk
fput32le(WAV_ID_DATA, fp);
fput32le(data_length, fp);
}

// to set/get/query special features/parameters
static int control(int cmd,void *arg){
return -1;
Expand All @@ -93,7 +138,6 @@ static int control(int cmd,void *arg){
// open & setup audio device
// return: 1=success 0=fail
static int init(int rate,int channels,int format,int flags){
int bits;
const opt_t subopts[] = {
{"waveheader", OPT_ARG_BOOL, &ao_pcm_waveheader, NULL},
{"file", OPT_ARG_MSTRZ, &ao_outputfilename, NULL},
Expand Down Expand Up @@ -130,29 +174,12 @@ static int init(int rate,int channels,int format,int flags){
}
}

bits = af_fmt2bits(format);

ao_data.outburst = 65536;
ao_data.buffersize= 2*65536;
ao_data.channels=channels;
ao_data.samplerate=rate;
ao_data.format=format;
ao_data.bps=channels*rate*(bits/8);

wavhdr.riff = le2me_32(WAV_ID_RIFF);
wavhdr.wave = le2me_32(WAV_ID_WAVE);
wavhdr.fmt = le2me_32(WAV_ID_FMT);
wavhdr.fmt_length = le2me_32(16);
wavhdr.fmt_tag = le2me_16(format == AF_FORMAT_FLOAT_LE ? WAV_ID_FLOAT_PCM : WAV_ID_PCM);
wavhdr.channels = le2me_16(ao_data.channels);
wavhdr.sample_rate = le2me_32(ao_data.samplerate);
wavhdr.bytes_per_second = le2me_32(ao_data.bps);
wavhdr.bits = le2me_16(bits);
wavhdr.block_align = le2me_16(ao_data.channels * (bits / 8));

wavhdr.data = le2me_32(WAV_ID_DATA);
wavhdr.data_length=le2me_32(0x7ffff000);
wavhdr.file_length = wavhdr.data_length + sizeof(wavhdr) - 8;
ao_data.bps=channels*rate*(af_fmt2bits(format)/8);

mp_tmsg(MSGT_AO, MSGL_INFO, "[AO PCM] File: %s (%s)\nPCM: Samplerate: %iHz Channels: %s Format %s\n", ao_outputfilename,
(ao_pcm_waveheader?"WAVE":"RAW PCM"), rate,
Expand All @@ -162,7 +189,7 @@ static int init(int rate,int channels,int format,int flags){
fp = fopen(ao_outputfilename, "wb");
if(fp) {
if(ao_pcm_waveheader){ /* Reserve space for wave header */
fwrite(&wavhdr,sizeof(wavhdr),1,fp);
write_wave_header(fp, 0x7ffff000);
}
return 1;
}
Expand All @@ -186,10 +213,7 @@ static void uninit(int immed){
else if (data_length > 0x7ffff000)
mp_msg(MSGT_AO, MSGL_ERR, "File larger than allowed for WAV files, may play truncated!\n");
else {
wavhdr.file_length = data_length + sizeof(wavhdr) - 8;
wavhdr.file_length = le2me_32(wavhdr.file_length);
wavhdr.data_length = le2me_32(data_length);
fwrite(&wavhdr,sizeof(wavhdr),1,fp);
write_wave_header(fp, data_length);
}
}
fclose(fp);
Expand Down Expand Up @@ -241,7 +265,7 @@ static int play(void* data,int len,int flags){
#endif

if (ao_data.channels == 5 || ao_data.channels == 6 || ao_data.channels == 8) {
int frame_size = le2me_16(wavhdr.bits) / 8;
int frame_size = af_fmt2bits(ao_data.format) / 8;
len -= len % (frame_size * ao_data.channels);
reorder_channel_nch(data, AF_CHANNEL_LAYOUT_MPLAYER_DEFAULT,
AF_CHANNEL_LAYOUT_WAVEEX_DEFAULT,
Expand Down
2 changes: 1 addition & 1 deletion libmpcodecs/ad_hwmpa.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ static int control(sh_audio_t *sh,int cmd,void* arg, ...)
return CONTROL_FALSE;
case ADCTRL_SKIP_FRAME:
start = mpa_sync(sh, 2, &len, NULL, NULL, NULL, NULL, NULL);
if(len < 0)
if(start < 0)
return CONTROL_FALSE;

sh->a_in_buffer_len -= start;
Expand Down
6 changes: 6 additions & 0 deletions libmpdemux/aviprint.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,12 @@ void print_wave_header(WAVEFORMATEX *h, int verbose_level){
mp_msg(MSGT_HEADER, verbose_level, "mp3.nFramesPerBlock=%d\n",h2->nFramesPerBlock);
mp_msg(MSGT_HEADER, verbose_level, "mp3.nCodecDelay=%d\n",h2->nCodecDelay);
}
else if (h->wFormatTag == 0xfffe && h->cbSize >= 22) {
WAVEFORMATEXTENSIBLE *h2 = (WAVEFORMATEXTENSIBLE *)h;
mp_msg(MSGT_HEADER, verbose_level, "ex.wValidBitsPerSample=%d\n", h2->wValidBitsPerSample);
mp_msg(MSGT_HEADER, verbose_level, "ex.dwChannelMask=0x%X\n", h2->dwChannelMask);
mp_msg(MSGT_HEADER, verbose_level, "ex.SubFormat=%d (0x%X)\n", h2->SubFormat, h2->SubFormat);
}
else if (h->cbSize > 0)
{
int i;
Expand Down
2 changes: 2 additions & 0 deletions libmpdemux/demux_audio.c
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,8 @@ static int demux_audio_open(demuxer_t* demuxer) {
}
stream_read(s,(char*)((char*)(w)+sizeof(WAVEFORMATEX)),w->cbSize);
l -= w->cbSize;
if (w->wFormatTag & 0xfffe && w->cbSize >= 22)
sh_audio->format = ((WAVEFORMATEXTENSIBLE *)w)->SubFormat;
}

if( mp_msg_test(MSGT_DEMUX,MSGL_V) ) print_wave_header(w, MSGL_V);
Expand Down
11 changes: 11 additions & 0 deletions libmpdemux/ms_hdr.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,17 @@ typedef struct __attribute__((__packed__)) _WAVEFORMATEX {
} WAVEFORMATEX, *PWAVEFORMATEX, *NPWAVEFORMATEX, *LPWAVEFORMATEX;
#endif /* _WAVEFORMATEX_ */

#ifndef _WAVEFORMATEXTENSIBLE_
#define _WAVEFORMATEXTENSIBLE_
typedef struct __attribute__((__packed__)) _WAVEFORMATEXTENSIBLE {
WAVEFORMATEX wf;
unsigned short wValidBitsPerSample;
unsigned int dwChannelMask;
unsigned int SubFormat; // Only interested in first 32 bits of guid
unsigned int _guid_remainder[3];
} WAVEFORMATEXTENSIBLE;
#endif /* _WAVEFORMATEXTENSIBLE_ */

#ifndef _MPEGLAYER3WAVEFORMAT_
#define _MPEGLAYER3WAVEFORMAT_
typedef struct __attribute__((__packed__)) mpeglayer3waveformat_tag {
Expand Down
4 changes: 1 addition & 3 deletions libvo/fastmemcpy.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,12 @@
#include "config.h"
#include <inttypes.h>
#include <string.h>

#if defined(CONFIG_FASTMEMCPY) && (HAVE_MMX || HAVE_MMX2 || HAVE_AMD3DNOW /* || HAVE_SSE || HAVE_SSE2 */)
#include <stddef.h>

void * fast_memcpy(void * to, const void * from, size_t len);
void * mem2agpcpy(void * to, const void * from, size_t len);

#else
#if ! defined(CONFIG_FASTMEMCPY) && ! (HAVE_MMX || HAVE_MMX2 || HAVE_AMD3DNOW /* || HAVE_SSE || HAVE_SSE2 */)
#define mem2agpcpy(a,b,c) memcpy(a,b,c)
#define fast_memcpy(a,b,c) memcpy(a,b,c)
#endif
Expand Down
4 changes: 2 additions & 2 deletions mencoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
#include "m_config.h"
#include "parser-mecmd.h"
#include "parser-cfg.h"

#include "mp_fifo.h"
#include "get_path.h"

#include "stream/stream.h"
Expand All @@ -73,7 +73,7 @@
#include "libmpdemux/mp3_hdr.h"
#include "libmpdemux/muxer.h"


#include "input/input.h"
#include "libvo/video_out.h"

#include "libaf/af_format.h"
Expand Down
2 changes: 1 addition & 1 deletion mp3lib/mpg123.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ void dct64_MMX_3dnow(short *, short *, real *);
void dct64_MMX_3dnowex(short *, short *, real *);
void dct64_sse(short *, short *, real *);
void dct64_altivec(real *, real *, real *);
void (*dct64_MMX_func)(short *, short *, real *);
extern void (*dct64_MMX_func)(short *, short *, real *);

void mp3lib_dct64(real *, real *, real *);

Expand Down
2 changes: 2 additions & 0 deletions mp3lib/sr1.c
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,8 @@ static int _has_mmx = 0; // used by layer2.c, layer3.c to pre-scale coeffs
/* PUBLIC FUNCTIONS */
/******************************************************************************/

void (*dct64_MMX_func)(short *, short *, real *);

#include "layer2.c"
#include "layer3.c"
#include "layer1.c"
Expand Down
11 changes: 3 additions & 8 deletions mp_msg.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <string.h>

#include "config.h"
#include "osdep/getch2.h"

#ifdef CONFIG_TRANSLATION
#include <locale.h>
Expand All @@ -31,14 +32,6 @@
#ifdef CONFIG_ICONV
#include <iconv.h>
#include <errno.h>
/**
* \brief gets the name of the system's terminal character set
* \return a malloced string indicating the system charset
*
* Be warned that this function on many systems is in no way thread-safe
* since it modifies global data
*/
char* get_term_charset(void);
#endif

#include "mp_msg.h"
Expand Down Expand Up @@ -244,6 +237,8 @@ void mp_msg_va(int mod, int lev, const char *format, va_list va)
header = tmp[strlen(tmp)-1] == '\n' || tmp[strlen(tmp)-1] == '\r';

fprintf(stream, "%s", tmp);
if (mp_msg_color)
fprintf(stream, "\033[0m");
fflush(stream);
}

Expand Down
Loading

0 comments on commit acdce01

Please sign in to comment.