aboutsummaryrefslogtreecommitdiffstats
path: root/examples/alffplay.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2016-09-08 12:05:08 -0700
committerChris Robinson <[email protected]>2016-09-08 12:14:28 -0700
commit0f24f49a44a12d139692d0846b2722de2213f1a8 (patch)
treeed7a9c9954e56082a27bebfa07fc4c6fbce18c43 /examples/alffplay.c
parentb21e481827b660e7439fcebb505cdb0349517a54 (diff)
Allow specifying the device to open for the examples
Diffstat (limited to 'examples/alffplay.c')
-rw-r--r--examples/alffplay.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/examples/alffplay.c b/examples/alffplay.c
index 2d38216f..e95dede6 100644
--- a/examples/alffplay.c
+++ b/examples/alffplay.c
@@ -1332,6 +1332,7 @@ int main(int argc, char *argv[])
SDL_Renderer *renderer;
ALCdevice *device;
ALCcontext *context;
+ int fileidx;
if(argc < 2)
{
@@ -1389,7 +1390,17 @@ int main(int argc, char *argv[])
SDL_RenderPresent(renderer);
/* Open an audio device */
- device = alcOpenDevice(NULL);
+ fileidx = 1;
+ device = NULL;
+ if(argc > 3 && strcmp(argv[1], "-device") == 0)
+ {
+ fileidx = 3;
+ device = alcOpenDevice(argv[2]);
+ if(!device)
+ fprintf(stderr, "OpenAL: could not open \"%s\" - trying default\n", argv[2]);
+ }
+ if(!device)
+ device = alcOpenDevice(NULL);
if(!device)
{
fprintf(stderr, "OpenAL: could not open device - exiting\n");
@@ -1429,7 +1440,7 @@ int main(int argc, char *argv[])
movState = av_mallocz(sizeof(MovieState));
- av_strlcpy(movState->filename, argv[1], sizeof(movState->filename));
+ av_strlcpy(movState->filename, argv[fileidx], sizeof(movState->filename));
packet_queue_init(&movState->audio.q);
packet_queue_init(&movState->video.q);