Skip to content

Commit c3f0468

Browse files
authored
Add Demuxer Example Guide and API (Ameba-AIoT#30)
- Add Demuxer Example Guide and API - Add example links in VideoStreamOverlay API
1 parent 0cbeade commit c3f0468

File tree

11 files changed

+261
-8
lines changed

11 files changed

+261
-8
lines changed
Loading
Loading
Loading
Loading
Loading
Loading
Lines changed: 174 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,174 @@
1+
Class Demuxer
2+
=============
3+
4+
.. contents::
5+
:local:
6+
:depth: 2
7+
8+
**Demuxer Class**
9+
------------------
10+
11+
**Description**
12+
~~~~~~~~~~~~~~~
13+
14+
A class used to handle MP4 file processing and extract audio and video streams from an MP4 file.
15+
16+
**Syntax**
17+
~~~~~~~~~~
18+
19+
.. code-block:: c++
20+
21+
class Demuxer
22+
23+
**Members**
24+
~~~~~~~~~~~
25+
26+
+---------------------------+------------------------------------------+
27+
| **Public Constructors** |
28+
+===========================+==========================================+
29+
| Demuxer::Demuxer | Constructs a Demuxer object. |
30+
+---------------------------+------------------------------------------+
31+
| **Public Methods** |
32+
+---------------------------+------------------------------------------+
33+
| Demuxer::begin | Begin initializes and starts the demuxer |
34+
| | for processing an MP4 file. |
35+
+---------------------------+------------------------------------------+
36+
| Demuxer::pause | Pause the RTSP streaming. |
37+
+---------------------------+------------------------------------------+
38+
| Demuxer::resume | Resume the RTSP streaming. |
39+
+---------------------------+------------------------------------------+
40+
| Demuxer::end | Stop demuxer. |
41+
+---------------------------+------------------------------------------+
42+
43+
**Demuxer::begin**
44+
-------------------
45+
46+
**Description**
47+
~~~~~~~~~~~~~~~
48+
49+
Begin initializes and starts the demuxer for processing an MP4 file.
50+
51+
**Syntax**
52+
~~~~~~~~~~
53+
54+
.. code-block:: c++
55+
56+
void begin(const char* MP4FileName, uint32_t loopMode, uint32_t startTime = 0);
57+
58+
**Parameters**
59+
~~~~~~~~~~~~~~
60+
61+
MP4FileName: The name of the MP4 file to be processed.
62+
63+
loopMode: Determines whether the file should play in a loop. (Valid value: 0 (No looping) & 1 (looping))
64+
65+
startTime: The starting position (in milliseconds) from which playback begins. (Default: 0ms)
66+
67+
**Returns**
68+
~~~~~~~~~~~
69+
70+
NA
71+
72+
**Example Code**
73+
~~~~~~~~~~~~~~~~
74+
75+
Example: `DemuxerRTSP <https://github.com/Ameba-AIoT/ameba-arduino-pro2/blob/dev/Arduino_package/hardware/libraries/Multimedia/examples/DemuxerRTSP/DemuxerRTSP.ino>`_
76+
77+
.. note :: "Demuxer.h" must be included to use the class function.
78+
79+
**Demuxer::pause**
80+
-------------------
81+
82+
**Description**
83+
~~~~~~~~~~~~~~~
84+
85+
Pause the RTSP streaming.
86+
87+
**Syntax**
88+
~~~~~~~~~~
89+
90+
.. code-block:: c++
91+
92+
void pause(void);
93+
94+
**Parameters**
95+
~~~~~~~~~~~~~~
96+
97+
NA
98+
99+
**Returns**
100+
~~~~~~~~~~~
101+
102+
NA
103+
104+
**Example Code**
105+
~~~~~~~~~~~~~~~~
106+
107+
Example: `DemuxerRTSP <https://github.com/Ameba-AIoT/ameba-arduino-pro2/blob/dev/Arduino_package/hardware/libraries/Multimedia/examples/DemuxerRTSP/DemuxerRTSP.ino>`_
108+
109+
.. note :: "Demuxer.h" must be included to use the class function.
110+
111+
**Demuxer::resume**
112+
--------------------
113+
114+
**Description**
115+
~~~~~~~~~~~~~~~
116+
117+
Resume the RTSP streaming.
118+
119+
**Syntax**
120+
~~~~~~~~~~
121+
122+
.. code-block:: c++
123+
124+
void pause(void);
125+
126+
**Parameters**
127+
~~~~~~~~~~~~~~
128+
129+
NA
130+
131+
**Returns**
132+
~~~~~~~~~~~
133+
134+
NA
135+
136+
**Example Code**
137+
~~~~~~~~~~~~~~~~
138+
139+
Example: `DemuxerRTSP <https://github.com/Ameba-AIoT/ameba-arduino-pro2/blob/dev/Arduino_package/hardware/libraries/Multimedia/examples/DemuxerRTSP/DemuxerRTSP.ino>`_
140+
141+
.. note :: "Demuxer.h" must be included to use the class function.
142+
143+
**Demuxer::end**
144+
-----------------
145+
146+
**Description**
147+
~~~~~~~~~~~~~~~
148+
149+
Stop demuxer.
150+
151+
**Syntax**
152+
~~~~~~~~~~
153+
154+
.. code-block:: c++
155+
156+
void end(void);
157+
158+
**Parameters**
159+
~~~~~~~~~~~~~~
160+
161+
NA
162+
163+
**Returns**
164+
~~~~~~~~~~~
165+
166+
NA
167+
168+
**Example Code**
169+
~~~~~~~~~~~~~~~~
170+
171+
NA
172+
173+
.. note :: "RTP.h" must be included to use the class function.
174+

source/amebapro2/API_Documents/Multimedia/Class VideoStreamOverlay.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -905,7 +905,7 @@ This function returns the calculated resized width.
905905
**Example Code**
906906
~~~~~~~~~~~~~~~~
907907

908-
Example: TBD
908+
Example: `VideoOSDImage <https://github.com/Ameba-AIoT/ameba-arduino-pro2/blob/dev/Arduino_package/hardware/libraries/Multimedia/examples/VideoOSDImage/VideoOSDImage.ino>`_
909909

910910
.. note :: "VideoStreamOverlay.h" must be included to use the class function.
911911
@@ -941,7 +941,7 @@ This function returns the calculated resized height.
941941
**Example Code**
942942
~~~~~~~~~~~~~~~~
943943

944-
Example: TBD
944+
Example: `VideoOSDImage <https://github.com/Ameba-AIoT/ameba-arduino-pro2/blob/dev/Arduino_package/hardware/libraries/Multimedia/examples/VideoOSDImage/VideoOSDImage.ino>`_
945945

946946
.. note :: "VideoStreamOverlay.h" must be included to use the class function.
947947
@@ -977,7 +977,7 @@ This function returns the calculated heapsize as an unsigned int.
977977
**Example Code**
978978
~~~~~~~~~~~~~~~~
979979

980-
Example: TBD
980+
Example: `VideoOSDImage <https://github.com/Ameba-AIoT/ameba-arduino-pro2/blob/dev/Arduino_package/hardware/libraries/Multimedia/examples/VideoOSDImage/VideoOSDImage.ino>`_
981981

982982
.. note :: "VideoStreamOverlay.h" must be included to use the class function.
983983
@@ -1033,7 +1033,7 @@ NA
10331033
**Example Code**
10341034
~~~~~~~~~~~~~~~~
10351035

1036-
Example: TBD
1036+
Example: `VideoOSDImage <https://github.com/Ameba-AIoT/ameba-arduino-pro2/blob/dev/Arduino_package/hardware/libraries/Multimedia/examples/VideoOSDImage/VideoOSDImage.ino>`_
10371037

10381038
.. note :: "VideoStreamOverlay.h" must be included to use the class function.
10391039
@@ -1065,7 +1065,7 @@ NA
10651065
**Example Code**
10661066
~~~~~~~~~~~~~~~~
10671067

1068-
Example: TBD
1068+
Example: `VideoOSDImage <https://github.com/Ameba-AIoT/ameba-arduino-pro2/blob/dev/Arduino_package/hardware/libraries/Multimedia/examples/VideoOSDImage/VideoOSDImage.ino>`_
10691069

10701070
.. note :: "VideoStreamOverlay.h" must be included to use the class function. Each image requires setting a new block index.
10711071

source/amebapro2/API_Documents/Multimedia/index.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@ Multimedia
77
Class AudioDecoder
88
Class AudioEncoder
99
Class AudioStream
10+
Class Demuxer
1011
Class MotionDetection
1112
Class MP4Recording
1213
Class RTP
1314
Class RTSP
1415
Class StreamIO
1516
Class VideoStream
16-
Class VideoStreamOverlay
17+
Class VideoStreamOverlay
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
RTSP Demuxer
2+
=============
3+
4+
.. contents::
5+
:local:
6+
:depth: 2
7+
8+
Materials
9+
---------
10+
11+
- `AMB82-mini <https://www.amebaiot.com/en/where-to-buy-link/#buy_amb82_mini>`_ x 1
12+
- SD Card
13+
14+
Example
15+
-------
16+
This example demonstrates on how to use a demuxer on the AmebaPro2 board to process an MP4 file from an SD card and stream its content over RTSP (Real-Time Streaming Protocol).
17+
18+
Open the example in “File” -> “Examples” -> “AmebaMultimedia” -> “DemuxerRTSP”.
19+
20+
|image01|
21+
22+
First, you can choose whether to loop the MP4 file during streaming. If looping is enabled, the stream will play continuously without stopping.
23+
24+
Next, fill in the “ssid” with your WiFi network SSID and “pass” with the network password.
25+
26+
Finally, specify the name of the MP4 file you want to stream via RTSP. It is recommended to use an MP4 file recorded with the AmebaPro2 board.
27+
28+
|image02|
29+
30+
Compile the code and upload it to Ameba.
31+
32+
After pressing the Reset button, wait for the Ameba Pro 2 board to connect to the WiFi network. The board’s IP address and network port number for RTSP will be shown in the Serial Monitor.
33+
34+
On a computer connected to the same WiFi network, open VLC media player, and go to “Media” -> “Open Network Stream”.
35+
36+
|image03|
37+
38+
Since RTSP is used as the streaming protocol, key in `“rtsp://{IPaddress}:{port}”`` as the Network URL in VLC media player, replacing {IPaddress} with the IP address of your Ameba Pro2 board, and {port} with the RTSP port shown in Serial Monitor. The default RTSP port number is 554.
39+
40+
Next, click “Play” to start RTSP streaming.
41+
42+
|image04|
43+
44+
**To pause the streaming:**
45+
46+
Enter the command **“pause”** to pause the stream using Serial Monitor.
47+
48+
|image05|
49+
50+
**To resume the streaming:**
51+
52+
Enter the command **“resume"** to resume the stream using Serial Monitor.
53+
54+
|image06|
55+
56+
.. |image01| image:: ../../../_static/amebapro2/Example_Guides/Multimedia/RTSP_Demuxer/image01.png
57+
:width: 654 px
58+
:height: 854 px
59+
60+
.. |image02| image:: ../../../_static/amebapro2/Example_Guides/Multimedia/RTSP_Demuxer/image02.png
61+
:width: 606 px
62+
:height: 298 px
63+
64+
.. |image03| image:: ../../../_static/amebapro2/Example_Guides/Multimedia/RTSP_Demuxer/image03.png
65+
:width: 432 px
66+
:height: 482 px
67+
68+
.. |image04| image:: ../../../_static/amebapro2/Example_Guides/Multimedia/RTSP_Demuxer/image04.png
69+
:width: 765 px
70+
:height: 659 px
71+
72+
.. |image05| image:: ../../../_static/amebapro2/Example_Guides/Multimedia/RTSP_Demuxer/image05.png
73+
:width: 348 px
74+
:height: 388 px
75+
76+
.. |image06| image:: ../../../_static/amebapro2/Example_Guides/Multimedia/RTSP_Demuxer/image06.png
77+
:width: 318 px
78+
:height: 385 px

0 commit comments

Comments
 (0)