-
-
Notifications
You must be signed in to change notification settings - Fork 247
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
181a161
commit 190fdc0
Showing
3 changed files
with
79 additions
and
27 deletions.
There are no files selected for viewing
46 changes: 46 additions & 0 deletions
46
examples/examples-communication/rtsp/communication-rtsp-i2s/communication-rtsp-i2s.ino
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/** | ||
* @file communication-rtsp-i2s.ino | ||
* @author Phil Schatzmann | ||
* @brief Demo for RTSP Client that is playing mp3 | ||
* @version 0.1 | ||
* @date 2022-05-02 | ||
* | ||
* @copyright Copyright (c) 2022 | ||
* | ||
*/ | ||
|
||
#include "AudioTools.h" // https://github.com/pschatzmann/arduino-audio-tools | ||
#include "AudioCodecs/CodecMP3Helix.h" // https://github.com/pschatzmann/arduino-libhelix | ||
#include "RTSPSimpleClient.hh" // https://github.com/pschatzmann/arduino-live555.git | ||
|
||
I2SStream i2s; | ||
EncodedAudioStream out_mp3(&i2s, new MP3DecoderHelix()); // Decoding stream | ||
RTSPSimpleClient rtsp; | ||
|
||
void setup() { | ||
Serial.begin(115200); | ||
AudioLogger::instance().begin(Serial, AudioLogger::Info); | ||
|
||
// setup output: make sure we can buffer 1 decoded frame | ||
auto cfg_i2s = i2s.defaultConfig(TX_MODE); | ||
cfg_i2s.buffer_size = 1024; | ||
cfg_i2s.buffer_count = 10; | ||
i2s.begin(cfg_i2s); | ||
|
||
out_mp3.begin(); | ||
|
||
// setup rtsp data source | ||
auto cfg = rtsp.defaultConfig(); | ||
cfg.ssid = "ssid"; | ||
cfg.password = "password"; | ||
cfg.url = "rtsp://192.168.1.38:8554/test.mp3"; | ||
cfg.output = &out_mp3; | ||
cfg.buffer_size = 1024*2; // space for 1 encoded frame | ||
//cfg.is_tcp = false; // use udp when false (default false) | ||
//cfg.is_blocking = false; // call singleStep in loop if false (default false) | ||
rtsp.begin(cfg); | ||
} | ||
|
||
void loop() { | ||
rtsp.singleStep(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters