imeghar2408-max opened a new pull request, #3840: URL: https://github.com/apache/nuttx-apps/pull/3840
Parse RIFF/WAVE headers and play supported PCM 16-bit mono and stereo WAV files through the existing audio playback path. Validate chunk boundaries, format parameters, and data length before playback. Preserve the existing raw PCM playback path and report read errors during WAV playback cleanup. Assisted-by: OpenAI:GPT-6 ## Summary Add WAV file playback support to `system/nxplayer`. The implementation parses RIFF/WAVE headers and supports 16-bit PCM mono and stereo WAV files. It validates chunk boundaries, format parameters, and data length before playback. ## Changes - Add RIFF/WAVE header parsing for PCM WAV files. - Support 16-bit mono and stereo audio. - Validate WAV format parameters, chunk boundaries, and data length. - Preserve the existing raw PCM playback path. - Report read errors during WAV playback cleanup. ## Impact This change adds WAV playback support to `nxplayer` while preserving existing raw PCM playback through `playraw`. Invalid or unsupported WAV files are rejected. ## Validation ### SIM ALSA Build Command: ```sh make -j1 ``` Result: Build completed successfully, including linking `nuttx`. ### WAV Playback Tested a valid WAV file: ```text nxplayer> play /data/test.wav ``` Result: Audio playback was audible. Tested a WAV file containing an odd-sized `JUNK` chunk. Result: Audio playback was audible. ### Malformed WAV Files Tested a truncated WAV header and an invalid RIFF length. Observed output for the truncated header: ```text Error playing file: 22 ``` Result: Malformed WAV files were rejected. ### Raw PCM Playback Command: ```text nxplayer> playraw /data/test.raw ``` Result: Audio playback was audible. ### Read Error During WAV Playback Truncated the WAV file while playback was in progress. Observed output: ```text ERROR: WAV playback read failed: 5 ``` After entering `q`, the application returned to the NSH prompt. ### Checkpatch Command: ```sh ~/nuttx-work/nuttx-sim-alsa/tools/checkpatch.sh -g HEAD ``` Output: ```text ✔️ All checks pass. ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
