xref: /haiku/src/bin/media_client/media_client.cpp (revision 0fae96c5a349db3761ac2a4ab4a7fbbf23a3b76c)
1 /*
2  * Copyright 2016-2017, Dario Casalinuovo. All rights reserved.
3  * Distributed under the terms of the MIT License.
4  */
5 
6 #include <Application.h>
7 
8 #include <stdio.h>
9 #include <string.h>
10 
11 #include "MediaPlay.h"
12 #include "MediaTest.h"
13 
14 
15 void print_usage()
16 {
17 	printf("Usage:\n");
18 	printf("  media_client play <uri>\n");
19 	printf("  media_client test\n");
20 }
21 
22 
23 int main(int argc, char *argv[])
24 {
25 	if (argc < 2) {
26 		print_usage();
27 		return 0;
28 	}
29 
30 	BApplication app("application/x-vnd.Haiku-media_client");
31 
32 	int ret = 0;
33 	if (strcmp(argv[1], "play") == 0) {
34 		if (argc < 3) {
35 			print_usage();
36 		} else
37 			ret = media_play(argv[2]);
38 	} else if (strcmp(argv[1], "test") == 0)
39 		media_test();
40 	else
41 		print_usage();
42 
43 	return ret;
44 }
45