[MPlayer-cvslog] r30276 - in trunk: libaf/af_format.h libao2/ao_alsa.c libao2/ao_coreaudio.c libao2/ao_dxr2.c
reimar
subversion at mplayerhq.hu
Mon Jan 11 20:23:18 CET 2010
Author: reimar
Date: Mon Jan 11 20:23:18 2010
New Revision: 30276
Log:
Add and use AF_FORMAT_IS_AC3 macro.
Modified:
trunk/libaf/af_format.h
trunk/libao2/ao_alsa.c
trunk/libao2/ao_coreaudio.c
trunk/libao2/ao_dxr2.c
Modified: trunk/libaf/af_format.h
==============================================================================
--- trunk/libaf/af_format.h Mon Jan 11 20:08:15 2010 (r30275)
+++ trunk/libaf/af_format.h Mon Jan 11 20:23:18 2010 (r30276)
@@ -103,6 +103,8 @@
#define AF_FORMAT_UNKNOWN (-1)
+#define AF_FORMAT_IS_AC3(fmt) (((fmt) & AF_FORMAT_SPECIAL_MASK) == AF_FORMAT_AC3)
+
int af_str2fmt(const char *str);
int af_str2fmt_short(const char *str);
int af_fmt2bits(int format);
Modified: trunk/libao2/ao_alsa.c
==============================================================================
--- trunk/libao2/ao_alsa.c Mon Jan 11 20:08:15 2010 (r30275)
+++ trunk/libao2/ao_alsa.c Mon Jan 11 20:23:18 2010 (r30276)
@@ -127,7 +127,7 @@ static int control(int cmd, void *arg)
long get_vol, set_vol;
float f_multi;
- if(ao_data.format == AF_FORMAT_AC3)
+ if(AF_FORMAT_IS_AC3(ao_data.format))
return CONTROL_TRUE;
if(mixer_channel) {
@@ -427,7 +427,7 @@ static int init(int rate_hz, int channel
* while opening the abstract alias for the spdif subdevice
* 'iec958'
*/
- if (format == AF_FORMAT_AC3) {
+ if (AF_FORMAT_IS_AC3(format)) {
device.str = "iec958";
mp_msg(MSGT_AO,MSGL_V,"alsa-spdif-init: playing AC3, %i channels\n", channels);
}
@@ -486,12 +486,13 @@ static int init(int rate_hz, int channel
}
if (!alsa_handler) {
+ int isac3 = AF_FORMAT_IS_AC3(format);
//modes = 0, SND_PCM_NONBLOCK, SND_PCM_ASYNC
- if ((err = try_open_device(alsa_device, open_mode, format == AF_FORMAT_AC3)) < 0)
+ if ((err = try_open_device(alsa_device, open_mode, isac3)) < 0)
{
if (err != -EBUSY && ao_noblock) {
mp_msg(MSGT_AO,MSGL_INFO,MSGTR_AO_ALSA_OpenInNonblockModeFailed);
- if ((err = try_open_device(alsa_device, 0, format == AF_FORMAT_AC3)) < 0) {
+ if ((err = try_open_device(alsa_device, 0, isac3)) < 0) {
mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_ALSA_PlaybackOpenError, snd_strerror(err));
return 0;
}
Modified: trunk/libao2/ao_coreaudio.c
==============================================================================
--- trunk/libao2/ao_coreaudio.c Mon Jan 11 20:08:15 2010 (r30275)
+++ trunk/libao2/ao_coreaudio.c Mon Jan 11 20:23:18 2010 (r30276)
@@ -263,7 +263,7 @@ int b_alive;
ao->b_changed_mixing = 0;
/* Probe whether device support S/PDIF stream output if input is AC3 stream. */
- if ((format & AF_FORMAT_SPECIAL_MASK) == AF_FORMAT_AC3)
+ if (AF_FORMAT_IS_AC3(format))
{
/* Find the ID of the default Device. */
i_param_size = sizeof(AudioDeviceID);
@@ -344,7 +344,7 @@ int b_alive;
// unsigned int
inDesc.mFormatFlags = kAudioFormatFlagIsPacked;
}
- if ((format & AF_FORMAT_SPECIAL_MASK) == AF_FORMAT_AC3) {
+ if (AF_FORMAT_IS_AC3(format)) {
// Currently ac3 input (comes from hwac3) is always in native byte-order.
#if HAVE_BIGENDIAN
inDesc.mFormatFlags |= kAudioFormatFlagIsBigEndian;
Modified: trunk/libao2/ao_dxr2.c
==============================================================================
--- trunk/libao2/ao_dxr2.c Mon Jan 11 20:08:15 2010 (r30275)
+++ trunk/libao2/ao_dxr2.c Mon Jan 11 20:23:18 2010 (r30276)
@@ -201,7 +201,7 @@ static int play(void* data,int len,int f
// MPEG and AC3 don't work :-(
if(ao_data.format==AF_FORMAT_MPEG2)
send_mpeg_ps_packet (data, len, 0xC0, ao_data.pts, 2, write_dxr2);
- else if(ao_data.format==AF_FORMAT_AC3)
+ else if(AF_FORMAT_IS_AC3(ao_data.format))
send_mpeg_ps_packet (data, len, 0x80, ao_data.pts, 2, write_dxr2);
else {
int i;
More information about the MPlayer-cvslog
mailing list