Merge svn changes up to r30732

This commit is contained in:
Uoti Urpala 2010-03-10 01:25:15 +02:00
commit acdce0176a
26 changed files with 180 additions and 81 deletions

View File

@ -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)

View File

@ -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>

View File

@ -21,6 +21,7 @@
include config.mak
.SUFFIXES:
###### variable declarations #######
@ -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. $< $@

1
configure vendored
View File

@ -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

View File

@ -19,6 +19,7 @@ videocodec ffbinkvideo
driver ffmpeg
dll binkvideo
out YV12
out 420A
videocodec ffcdgraphics
info "FFmpeg CD-Graphics"
@ -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

View File

@ -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;

View File

@ -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;
@ -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},
@ -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,
@ -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;
}
@ -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);
@ -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,

View File

@ -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;

View File

@ -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;

View File

@ -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);

View File

@ -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 {

View File

@ -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

View File

@ -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"
@ -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"

View File

@ -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 *);

View File

@ -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"

View File

@ -22,6 +22,7 @@
#include <string.h>
#include "config.h"
#include "osdep/getch2.h"
#ifdef CONFIG_TRANSLATION
#include <locale.h>
@ -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"
@ -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);
}

View File

@ -24,6 +24,8 @@
#ifndef MPLAYER_GETCH2_H
#define MPLAYER_GETCH2_H
#include "config.h"
/* Screen size. Initialized by load_termcap() and get_screen_size() */
extern int screen_width;
extern int screen_height;
@ -45,10 +47,20 @@ void getch2_disable(void);
struct mp_fifo;
void getch2(struct mp_fifo *fifo);
/* slave cmd function for Windows and OS/2 */
int mp_input_slave_cmd_func(int fd,char* dest,int size);
#ifdef CONFIG_ICONV
/**
* \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
#if defined(__MINGW32__) || defined(__OS2__)
/* slave cmd function for Windows and OS/2 */
int mp_input_slave_cmd_func(int fd,char* dest,int size);
#define USE_SELECT 0
#define MP_INPUT_SLAVE_CMD_FUNC mp_input_slave_cmd_func
#else

View File

@ -23,6 +23,7 @@
#include "m_option.h"
#include "m_config.h"
#include "playtree.h"
#include "macosx_finder_args.h"
static play_tree_t *files=NULL;

View File

@ -0,0 +1,26 @@
/*
* This file is part of MPlayer.
*
* MPlayer 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.
*
* MPlayer 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 MPlayer; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef MPLAYER_MACOSX_FINDER_ARGS_H
#define MPLAYER_MACOSX_FINDER_ARGS_H
#include "playtree.h"
play_tree_t *macosx_finder_args(m_config_t *config, int argc, char **argv);
#endif /* MPLAYER_MACOSX_FINDER_ARGS_H */

View File

@ -34,7 +34,7 @@ const char timer_name[] = "Darwin accurate";
/* the core sleep function, uses floats and is used in MPlayer G2 */
float sleep_accurate(float time_frame)
static float sleep_accurate(float time_frame)
{
uint64_t deadline = time_frame / timebase_ratio + mach_absolute_time();

View File

@ -36,6 +36,7 @@
#include "m_config.h"
#include "playtree.h"
#include "parser-mpcmd.h"
#include "osdep/macosx_finder_args.h"
static int recursion_depth = 0;
static int mode = 0;
@ -93,9 +94,6 @@ m_config_parse_mp_command_line(m_config_t *config, int argc, char **argv)
int no_more_opts = 0;
int opt_exit = 0; // flag indicating whether mplayer should exit without playing anything
play_tree_t *last_parent, *last_entry = NULL, *root;
#ifdef CONFIG_MACOSX_FINDER
play_tree_t *macosx_finder_args(m_config_t *, int , char **);
#endif
#ifdef MP_DEBUG
assert(config != NULL);

View File

@ -74,6 +74,10 @@
#include "network.h"
#include "libavutil/common.h"
#ifndef O_BINARY
#define O_BINARY 0
#endif
#define DEFAULT_FREEDB_SERVER "freedb.freedb.org"
#define DEFAULT_CACHE_DIR "/.cddb/"
@ -346,11 +350,7 @@ int cddb_read_cache(cddb_data_t *cddb_data)
sprintf(file_name, "%s%08lx", cddb_data->cache_dir, cddb_data->disc_id);
file_fd = open(file_name, O_RDONLY
#if defined(__MINGW32__) || defined(__CYGWIN__)
| O_BINARY
#endif
);
file_fd = open(file_name, O_RDONLY | O_BINARY);
if (file_fd < 0) {
mp_tmsg(MSGT_DEMUX, MSGL_ERR, "No cache found.\n");
return -1;

View File

@ -72,7 +72,7 @@ int vcd_seek_to_track(mp_vcd_priv_t* vcd,int track){
return VCD_SECTOR_DATA*vcd_get_msf(vcd);
}
int vcd_get_track_end(mp_vcd_priv_t* vcd,int track){
static int vcd_get_track_end(mp_vcd_priv_t* vcd,int track){
vcd->entry.cdte_format = CDROM_MSF;
vcd->entry.cdte_track = track<vcd->tochdr.cdth_trk1?(track+1):CDROM_LEADOUT;
if (ioctl(vcd->fd, CDROMREADTOCENTRY, &vcd->entry)) {
@ -82,7 +82,7 @@ int vcd_get_track_end(mp_vcd_priv_t* vcd,int track){
return VCD_SECTOR_DATA*vcd_get_msf(vcd);
}
mp_vcd_priv_t* vcd_read_toc(int fd){
static mp_vcd_priv_t* vcd_read_toc(int fd){
struct cdrom_tochdr tochdr;
mp_vcd_priv_t* vcd;
int i, min = 0, sec = 0, frame = 0;

View File

@ -86,7 +86,7 @@ int vcd_seek_to_track(mp_vcd_priv_t* vcd, int track)
return VCD_SECTOR_DATA*vcd_get_msf(vcd);
}
int vcd_get_track_end(mp_vcd_priv_t* vcd, int track)
static int vcd_get_track_end(mp_vcd_priv_t* vcd, int track)
{
struct CDTrackInfo entry;
@ -117,7 +117,7 @@ int vcd_get_track_end(mp_vcd_priv_t* vcd, int track)
return VCD_SECTOR_DATA*vcd_get_msf(vcd);
}
mp_vcd_priv_t* vcd_read_toc(int fd)
static mp_vcd_priv_t* vcd_read_toc(int fd)
{
dk_cd_read_disc_info_t tochdr;
struct CDDiscInfo hdr;

View File

@ -144,7 +144,7 @@ vcd_seek_to_track(mp_vcd_priv_t* vcd, int track)
return VCD_SECTOR_DATA * vcd_get_msf(vcd);
}
int
static int
vcd_get_track_end(mp_vcd_priv_t* vcd, int track)
{
if (!read_toc_entry(vcd,
@ -153,7 +153,7 @@ vcd_get_track_end(mp_vcd_priv_t* vcd, int track)
return VCD_SECTOR_DATA * vcd_get_msf(vcd);
}
mp_vcd_priv_t*
static mp_vcd_priv_t*
vcd_read_toc(int fd)
{
struct ioc_toc_header tochdr;

View File

@ -63,14 +63,14 @@ int vcd_seek_to_track(mp_vcd_priv_t* vcd, int track)
return VCD_SECTOR_DATA * (sect + 2);
}
int vcd_get_track_end(mp_vcd_priv_t* vcd, int track)
static int vcd_get_track_end(mp_vcd_priv_t* vcd, int track)
{
if (track < vcd->toc.FirstTrack || track > vcd->toc.LastTrack)
return -1;
return VCD_SECTOR_DATA * (vcd_get_msf(vcd, track + 1));
}
mp_vcd_priv_t* vcd_read_toc(int fd)
static mp_vcd_priv_t* vcd_read_toc(int fd)
{
DWORD dwBytesReturned;
HANDLE hd;