summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorphintuka <phintuka>2006-08-07 19:40:46 +0000
committerphintuka <phintuka>2006-08-07 19:40:46 +0000
commit94b20c1ffc11a2563dcd1cfe13e3081972ece5be (patch)
treea92b6ea7935d8e623288cc764a3b3909af17bb15
parent206e7effeafaac112b95297325d6e9a00dddfb85 (diff)
downloadxineliboutput-94b20c1ffc11a2563dcd1cfe13e3081972ece5be.tar.gz
xineliboutput-94b20c1ffc11a2563dcd1cfe13e3081972ece5be.tar.bz2
Updated audio out configuration
(support for analog 5.1 surround and AC3 passthru)
-rw-r--r--xine_frontend.c218
1 files changed, 162 insertions, 56 deletions
diff --git a/xine_frontend.c b/xine_frontend.c
index 92e62109..b0888167 100644
--- a/xine_frontend.c
+++ b/xine_frontend.c
@@ -4,7 +4,7 @@
* See the main source file 'xineliboutput.c' for copyright information and
* how to reach the author.
*
- * $Id: xine_frontend.c,v 1.5 2006-07-02 16:47:13 phintuka Exp $
+ * $Id: xine_frontend.c,v 1.6 2006-08-07 19:40:46 phintuka Exp $
*
*/
@@ -38,29 +38,32 @@ typedef struct {
} vdr_input_plugin_t;
-#if !defined(XINELIBOUTPUT_DEBUG_STDOUT) && \
- !defined(XINELIBOUTPUT_DEBUG_STDERR)
-# undef x_syslog
+/*
+ * logging
+ */
- _syscall0(pid_t, gettid)
+#undef x_syslog
- static void x_syslog(int level, const char *fmt, ...)
- {
- va_list argp;
- char buf[512];
- va_start(argp, fmt);
- vsnprintf(buf, 512, fmt, argp);
- if(!LogToSysLog) {
- printf(LOG_MODULENAME "%s\n", buf);
- } else {
- syslog(level, "[%d] " LOG_MODULENAME "%s", gettid(), buf);
- }
- va_end(argp);
+_syscall0(pid_t, gettid)
+
+static void x_syslog(int level, const char *fmt, ...)
+{
+ va_list argp;
+ char buf[512];
+ va_start(argp, fmt);
+ vsnprintf(buf, 512, fmt, argp);
+ if(!LogToSysLog) {
+ printf(LOG_MODULENAME "%s\n", buf);
+ } else {
+ syslog(level, "[%d] " LOG_MODULENAME "%s", gettid(), buf);
}
-#endif
+ va_end(argp);
+}
+/*
+ * detect input plugin
+ */
-/* detect input plugin */
static int find_input(fe_t *this)
{
if(!this->input) {
@@ -189,6 +192,7 @@ static void fe_frame_output_cb (void *data,
*dest_y = 0;
#endif
+#if 1
if(!this->scale_video) {
if(video_height < this->height) {
*dest_height = video_height;
@@ -199,12 +203,14 @@ static void fe_frame_output_cb (void *data,
*dest_x = (this->width - video_width) / 2;
}
}
-
+#endif
+
*win_x = this->xpos;
*win_y = this->ypos;
*dest_pixel_aspect = fe_dest_pixel_aspect(this, video_pixel_aspect,
video_width, video_height);
+
#if 0
if(this->cropping) {
*dest_pixel_aspect = *dest_pixel_aspect * (16.0/9.0)/(4.0/3.0);
@@ -265,9 +271,142 @@ static void xine_event_cb (void *user_data, const xine_event_t *event)
/*
* fe_xine_init
*
- * initialize xine engine, load audio and video ports, setup stream
+ * initialize xine engine, initialize audio and video ports, setup stream
*/
+#define MONO 0
+#define STEREO 1
+#define HEADPHONES 2
+#define SURROUND21 3
+#define SURROUND3 4
+#define SURROUND4 5
+#define SURROUND41 6
+#define SURROUND5 7
+#define SURROUND51 8
+#define SURROUND6 9
+#define SURROUND61 10
+#define SURROUND71 11
+#define A52_PASSTHRU 12
+
+static void configure_audio_out(fe_t *this, const char *audio_driver, const char *audio_port)
+{
+ /* define possible speaker arrangements */
+ /* xine audio_alsa_out.c */
+ static char *speaker_arrangement[] =
+ {"Mono 1.0", "Stereo 2.0", "Headphones 2.0", "Stereo 2.1",
+ "Surround 3.0", "Surround 4.0", "Surround 4.1",
+ "Surround 5.0", "Surround 5.1", "Surround 6.0",
+ "Surround 6.1", "Surround 7.1", "Pass Through", NULL};
+
+ if(!strcmp("alsa", audio_driver) && strlen(audio_port) > 0) {
+
+ this->xine->config->register_string(this->xine->config,
+ "audio.device.alsa_default_device",
+ "default",
+ "device used for mono output",
+ "xine will use this alsa device "
+ "to output mono sound.\n"
+ "See the alsa documentation "
+ "for information on alsa devices.",
+ 10, NULL,
+ NULL);
+ this->xine->config->register_string(this->xine->config,
+ "audio.device.alsa_front_device",
+ "plug:front:default",
+ "device used for stereo output",
+ "xine will use this alsa device "
+ "to output stereo sound.\n"
+ "See the alsa documentation "
+ "for information on alsa devices.",
+ 10, NULL,
+ NULL);
+ this->xine->config->register_string(this->xine->config,
+ "audio.device.alsa_surround51_device",
+ "plug:surround51:0",
+ "device used for 5.1-channel output",
+ "xine will use this alsa device to output "
+ "5 channel plus LFE (5.1) surround sound.\n"
+ "See the alsa documentation for information "
+ "on alsa devices.",
+ 10, NULL,
+ NULL);
+ this->xine->config->register_string(this->xine->config,
+ "audio.device.alsa_passthrough_device",
+ "iec958:AES0=0x6,AES1=0x82,AES2=0x0,AES3=0x2",
+ "device used for 5.1-channel output",
+ "xine will use this alsa device to output "
+ "undecoded digital surround sound. This can "
+ "be used be external surround decoders.\nSee the "
+ "alsa documentation for information on alsa "
+ "devices.",
+ 10, NULL,
+ NULL);
+ this->xine->config->register_enum
+ (this->xine->config,
+ "audio.output.speaker_arrangement",
+ STEREO,
+ speaker_arrangement,
+ "speaker arrangement",
+ "Select how your speakers are arranged, "
+ "this determines which speakers xine uses for sound output. "
+ "The individual values are:\n\n"
+ "Mono 1.0: You have only one speaker.\n"
+ "Stereo 2.0: You have two speakers for left and right channel.\n"
+ "Headphones 2.0: You use headphones.\n"
+ "Stereo 2.1: You have two speakers for left and right channel, and one "
+ "subwoofer for the low frequencies.\n"
+ "Surround 3.0: You have three speakers for left, right and rear channel.\n"
+ "Surround 4.0: You have four speakers for front left and right and rear "
+ "left and right channels.\n"
+ "Surround 4.1: You have four speakers for front left and right and rear "
+ "left and right channels, and one subwoofer for the low frequencies.\n"
+ "Surround 5.0: You have five speakers for front left, center and right and "
+ "rear left and right channels.\n"
+ "Surround 5.1: You have five speakers for front left, center and right and "
+ "rear left and right channels, and one subwoofer for the low frequencies.\n"
+ "Surround 6.0: You have six speakers for front left, center and right and "
+ "rear left, center and right channels.\n"
+ "Surround 6.1: You have six speakers for front left, center and right and "
+ "rear left, center and right channels, and one subwoofer for the low frequencies.\n"
+ "Surround 7.1: You have seven speakers for front left, center and right, "
+ "left and right and rear left and right channels, and one subwoofer for the "
+ "low frequencies.\n"
+ "Pass Through: Your sound system will receive undecoded digital sound from xine. "
+ "You need to connect a digital surround decoder capable of decoding the "
+ "formats you want to play to your sound card's digital output.",
+ 10, NULL,
+ NULL);
+
+ this->xine->config->update_string(this->xine->config,
+ "audio.device.alsa_front_device",
+ audio_port);
+ this->xine->config->update_string(this->xine->config,
+ "audio.device.alsa_default_device",
+ audio_port);
+ this->xine->config->update_string(this->xine->config,
+ "audio.device.alsa_surround51_device",
+ audio_port);
+ if(strstr(audio_port, "iec")) {
+ this->xine->config->update_string(this->xine->config,
+ "audio.device.alsa_passthrough_device",
+ audio_port);
+ this->xine->config->update_num(this->xine->config,
+ "audio.output.speaker_arrangement",
+ A52_PASSTHRU);
+ } else {
+ this->xine->config->update_num(this->xine->config,
+ "audio.output.speaker_arrangement",
+ strstr(audio_port, "surround") ? SURROUND51 : STEREO);
+ }
+ }
+
+ if(!strcmp("oss", audio_driver) && !strncmp("/dev/dsp", audio_port, 8)) {
+ int num = 0;
+ sscanf(audio_port+8,"%d",&num);
+ this->xine->config->update_num(this->xine->config,"audio.device.oss_device_num",num);
+ }
+}
+
static int fe_xine_init(frontend_t *this_gen, const char *audio_driver,
const char *audio_port, const char *video_driver,
int pes_buffers, int priority,
@@ -355,41 +494,8 @@ static int fe_xine_init(frontend_t *this_gen, const char *audio_driver,
/* create audio port */
- if(audio_driver && audio_port) {
- if(!strcmp("alsa", audio_driver) && strlen(audio_port)>0) {
- this->xine->config->register_string(this->xine->config,
- "audio.device.alsa_default_device",
- "default",
- "device used for mono output",
- "xine will use this alsa device "
- "to output mono sound.\n"
- "See the alsa documentation "
- "for information on alsa devices.",
- 10, NULL,
- NULL);
- this->xine->config->register_string(this->xine->config,
- "audio.device.alsa_front_device",
- "plug:front:default",
- "device used for stereo output",
- "xine will use this alsa device "
- "to output stereo sound.\n"
- "See the alsa documentation "
- "for information on alsa devices.",
- 10, NULL,
- NULL);
- this->xine->config->update_string(this->xine->config,
- "audio.device.alsa_front_device",
- audio_port);
- this->xine->config->update_string(this->xine->config,
- "audio.device.alsa_default_device",
- audio_port);
- }
- if(!strcmp("oss", audio_driver) && !strncmp("/dev/dsp", audio_port, 8)) {
- int num = 0;
- sscanf(audio_port+8,"%d",&num);
- this->xine->config->update_num(this->xine->config,"audio.device.oss_device_num",num);
- }
- }
+ if(audio_driver && audio_port)
+ configure_audio_out(this, audio_driver, audio_port);
if(audio_driver && !strcmp(audio_driver, "auto"))
this->audio_port = xine_open_audio_driver (this->xine, NULL, NULL);