diff --git a/system/nxplayer/nxplayer_main.c b/system/nxplayer/nxplayer_main.c index e9849cf69..48a9a2bfa 100644 --- a/system/nxplayer/nxplayer_main.c +++ b/system/nxplayer/nxplayer_main.c @@ -198,34 +198,33 @@ static int nxplayer_cmd_play(FAR struct nxplayer_s *pPlayer, char* parg) * -ENOENT The media file was not found */ - if (ret == -ENODEV) + switch (-ret) { - printf("No suitable Audio Device found\n"); + case OK: + break; + + case ENODEV: + printf("No suitable Audio Device found\n"); + break; + + case EBUSY: + printf("Audio device busy\n"); + break; + + case ENOENT: + printf("File %s not found\n", parg); + break; + + case ENOSYS: + printf("Unknown audio format\n"); + break; + + default: + printf("Error playing file: %d\n", -ret); + break; } - else if (ret == -EBUSY) - { - printf("Audio device busy\n"); - } - - else if (ret == -ENOENT) - { - printf("File %s not found\n", parg); - } - - else if (ret == -ENOSYS) - { - printf("Unknown audio format\n"); - } - - if (ret < 0) - { - return ret; - } - - /* File playing successfully */ - - return OK; + return ret; } /****************************************************************************