From d94b5b478f7bdfd19db65045cf5e00dbb425d67c Mon Sep 17 00:00:00 2001 From: Mohammad Rafi Shaik Date: Thu, 28 Sep 2023 11:04:19 +0530 Subject: [PATCH] fcplay: Add multiple audio files playback support This patch will add changes which is required to play multiple audio files. The file_count variable is required for index validation and play multiple audio files. Signed-off-by: Srinivas Kandagatla Signed-off-by: Mohammad Rafi Shaik Signed-off-by: Vinod Koul --- src/utils-lgpl/fcplay.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/utils-lgpl/fcplay.c b/src/utils-lgpl/fcplay.c index 83d48a0..ef222fb 100644 --- a/src/utils-lgpl/fcplay.c +++ b/src/utils-lgpl/fcplay.c @@ -62,7 +62,8 @@ static void usage(void) "-h\tPrints this help list\n\n" "Example:\n" "\tfcplay -c 1 -d 2 test.mp3\n" - "\tfcplay -f 5 test.mp3\n\n" + "\tfcplay -f 5 test.mp3\n" + "\tfcplay -c 1 -d 2 test1.mp3 test2.mp3\n\n" "Valid codec IDs:\n"); for (i = 0; i < CPLAY_NUM_CODEC_IDS; ++i) @@ -94,11 +95,12 @@ static int print_time(struct compress *compress) int main(int argc, char **argv) { - char *file; + char **file; unsigned long buffer_size = 0; int c, i; unsigned int card = 0, device = 0, frag = 0; unsigned int codec_id = SND_AUDIOCODEC_MP3; + unsigned int file_count = 0; if (argc < 2) usage(); @@ -150,9 +152,12 @@ int main(int argc, char **argv) if (optind >= argc) usage(); - file = argv[optind]; + file = &argv[optind]; - play_samples(file, card, device, buffer_size, frag, codec_id); + //file_count represents total number of files to play + file_count = argc - optind; + + play_samples(file, card, device, buffer_size, frag, codec_id, file_count); fprintf(stderr, "Finish Playing.... Close Normally\n"); exit(EXIT_SUCCESS); -- 2.47.3