[Redbutton-devel] SF.net SVN: redbutton:[506] redbutton-browser/trunk
Brought to you by:
skilvington
|
From: <ski...@us...> - 2008-12-05 16:36:43
|
Revision: 506
http://redbutton.svn.sourceforge.net/redbutton/?rev=506&view=rev
Author: skilvington
Date: 2008-12-05 16:36:37 +0000 (Fri, 05 Dec 2008)
Log Message:
-----------
allow user to choose the ALSA audio device
Modified Paths:
--------------
redbutton-browser/trunk/MHEGAudioOutput.c
redbutton-browser/trunk/MHEGAudioOutput.h
redbutton-browser/trunk/MHEGEngine.c
redbutton-browser/trunk/MHEGEngine.h
redbutton-browser/trunk/MHEGStreamPlayer.c
redbutton-browser/trunk/rb-browser.c
Modified: redbutton-browser/trunk/MHEGAudioOutput.c
===================================================================
--- redbutton-browser/trunk/MHEGAudioOutput.c 2008-11-19 13:16:45 UTC (rev 505)
+++ redbutton-browser/trunk/MHEGAudioOutput.c 2008-12-05 16:36:37 UTC (rev 506)
@@ -12,15 +12,15 @@
#include "utils.h"
bool
-MHEGAudioOutput_init(MHEGAudioOutput *a)
+MHEGAudioOutput_init(MHEGAudioOutput *a, char *alsa_dev)
{
int err;
a->ctx = NULL;
- if((err = snd_pcm_open(&a->ctx, ALSA_AUDIO_DEVICE, SND_PCM_STREAM_PLAYBACK, 0)) < 0)
+ if((err = snd_pcm_open(&a->ctx, alsa_dev, SND_PCM_STREAM_PLAYBACK, 0)) < 0)
{
- error("Unable to open audio device '%s': %s", ALSA_AUDIO_DEVICE, snd_strerror(err));
+ error("Unable to open audio device '%s': %s", alsa_dev, snd_strerror(err));
return false;
}
Modified: redbutton-browser/trunk/MHEGAudioOutput.h
===================================================================
--- redbutton-browser/trunk/MHEGAudioOutput.h 2008-11-19 13:16:45 UTC (rev 505)
+++ redbutton-browser/trunk/MHEGAudioOutput.h 2008-12-05 16:36:37 UTC (rev 506)
@@ -15,9 +15,9 @@
} MHEGAudioOutput;
/* default ALSA device */
-#define ALSA_AUDIO_DEVICE "default"
+#define DEFAULT_ALSA_DEVICE "default"
-bool MHEGAudioOutput_init(MHEGAudioOutput *);
+bool MHEGAudioOutput_init(MHEGAudioOutput *, char *);
void MHEGAudioOutput_fini(MHEGAudioOutput *);
bool MHEGAudioOutput_setParams(MHEGAudioOutput *, snd_pcm_format_t, unsigned int, unsigned int);
Modified: redbutton-browser/trunk/MHEGEngine.c
===================================================================
--- redbutton-browser/trunk/MHEGEngine.c 2008-11-19 13:16:45 UTC (rev 505)
+++ redbutton-browser/trunk/MHEGEngine.c 2008-12-05 16:36:37 UTC (rev 506)
@@ -173,6 +173,7 @@
MHEGDisplay_init(&engine.display, opts->fullscreen, opts->keymap, opts->verbose);
+ engine.audio_dev = safe_strdup(opts->audio_dev);
engine.vo_method = MHEGVideoOutputMethod_fromString(opts->vo_method);
engine.av_disabled = opts->av_disabled;
@@ -321,6 +322,12 @@
return &engine.display;
}
+char *
+MHEGEngine_getAudioOutputDevice(void)
+{
+ return engine.audio_dev;
+}
+
MHEGVideoOutputMethod *
MHEGEngine_getVideoOutputMethod(void)
{
Modified: redbutton-browser/trunk/MHEGEngine.h
===================================================================
--- redbutton-browser/trunk/MHEGEngine.h 2008-11-19 13:16:45 UTC (rev 505)
+++ redbutton-browser/trunk/MHEGEngine.h 2008-12-05 16:36:37 UTC (rev 506)
@@ -88,6 +88,7 @@
int verbose; /* -v flag */
unsigned int timeout; /* seconds to poll for missing content before generating a ContentRefError */
bool fullscreen; /* scale to fullscreen? */
+ char *audio_dev; /* ALSA audio device name */
char *vo_method; /* MHEGVideoOutputMethod name (NULL for default) */
bool av_disabled; /* true => audio and video output totally disabled */
char *keymap; /* keymap config file to use (NULL for default) */
@@ -171,6 +172,7 @@
int verbose; /* -v cmd line flag */
unsigned int timeout; /* how long to poll for missing content before generating an error */
MHEGDisplay display; /* make porting easier */
+ char *audio_dev; /* audio device name */
MHEGVideoOutputMethod *vo_method; /* video output method (resolved from name given in MHEGEngineOptions) */
bool av_disabled; /* true => video and audio output totally disabled */
MHEGBackend backend; /* local or remote access to DSMCC carousel and MPEG streams */
@@ -193,6 +195,7 @@
void MHEGEngine_fini(void);
MHEGDisplay *MHEGEngine_getDisplay(void);
+char *MHEGEngine_getAudioOutputDevice(void);
MHEGVideoOutputMethod *MHEGEngine_getVideoOutputMethod(void);
bool MHEGEngine_avDisabled(void);
Modified: redbutton-browser/trunk/MHEGStreamPlayer.c
===================================================================
--- redbutton-browser/trunk/MHEGStreamPlayer.c 2008-11-19 13:16:45 UTC (rev 505)
+++ redbutton-browser/trunk/MHEGStreamPlayer.c 2008-12-05 16:36:37 UTC (rev 506)
@@ -898,7 +898,7 @@
}
/* even if this fails, we still need to consume the audioq */
- (void) MHEGAudioOutput_init(&ao);
+ (void) MHEGAudioOutput_init(&ao, MHEGEngine_getAudioOutputDevice());
/* assert - if audioq is not empty then the codec cannot be NULL */
if(p->audio_codec == NULL)
Modified: redbutton-browser/trunk/rb-browser.c
===================================================================
--- redbutton-browser/trunk/rb-browser.c 2008-11-19 13:16:45 UTC (rev 505)
+++ redbutton-browser/trunk/rb-browser.c 2008-12-05 16:36:37 UTC (rev 506)
@@ -1,9 +1,10 @@
/*
- * rb-browser [-v] [-f] [-d] [-o <video_output_method>] [-k <keymap_file>] [-t <timeout>] [-r] [<service_gateway>]
+ * rb-browser [-v] [-f] [-d] [-a <alsa_device>] [-o <video_output_method>] [-k <keymap_file>] [-t <timeout>] [-r] [<service_gateway>]
*
* -v is verbose/debug mode
* -f is full screen, otherwise it uses a window
* -d disables all video and audio output
+ * -a changes the ALSA audio device, eg "hw" or "plughw", the default is "default"
* -o allows you to choose a video output method if the default is not supported/too slow on your graphics card
* (do 'rb-browser -o' for a list of available methods)
* -k changes the default key map to the given file
@@ -24,6 +25,7 @@
#include <limits.h>
#include "MHEGEngine.h"
+#include "MHEGAudioOutput.h"
#include "utils.h"
void usage(char *);
@@ -51,12 +53,13 @@
opts.srg_loc = DEFAULT_BACKEND;
opts.verbose = 0;
opts.fullscreen = false;
+ opts.audio_dev = DEFAULT_ALSA_DEVICE;
opts.vo_method = NULL;
opts.av_disabled = false;
opts.timeout = MISSING_CONTENT_TIMEOUT;
opts.keymap = NULL;
- while((arg = getopt(argc, argv, "rvfdo:k:t:")) != EOF)
+ while((arg = getopt(argc, argv, "rvfda:o:k:t:")) != EOF)
{
switch(arg)
{
@@ -76,6 +79,10 @@
opts.av_disabled = true;
break;
+ case 'a':
+ opts.audio_dev = optarg;
+ break;
+
case 'o':
opts.vo_method = optarg;
break;
@@ -125,6 +132,7 @@
"[-v] "
"[-f] "
"[-d] "
+ "[-a <alsa_device>] "
"[-o <video_output_method>] "
"[-k <keymap_file>] "
"[-t <timeout>] "
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|