-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathffplay_arch.drawio
322 lines (322 loc) · 42 KB
/
ffplay_arch.drawio
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
<mxfile host="65bd71144e">
<diagram id="FdFCppq6Der4e5SaIO5y" name="Page-1">
<mxGraphModel dx="277" dy="742" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0">
<root>
<mxCell id="0"/>
<mxCell id="1" parent="0"/>
<mxCell id="4" style="edgeStyle=none;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" parent="1" source="2" target="3" edge="1">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="2" value="SDL主线程(入口main函数)" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#6a00ff;fontColor=#ffffff;strokeColor=#3700CC;" parent="1" vertex="1">
<mxGeometry x="310" y="30" width="120" height="30" as="geometry"/>
</mxCell>
<mxCell id="8" style="edgeStyle=none;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" parent="1" source="3" target="5" edge="1">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="3" value="创建SDL上下文" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#008a00;fontColor=#ffffff;strokeColor=#005700;" parent="1" vertex="1">
<mxGeometry x="310" y="90" width="120" height="20" as="geometry"/>
</mxCell>
<mxCell id="13" style="edgeStyle=none;html=1;entryX=1;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="5" target="12" edge="1">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="5" value="<div style="color: rgb(204, 204, 204); font-family: Menlo, Monaco, &quot;Courier New&quot;, monospace; font-size: 10.8px; line-height: 16px;"><span style="color: rgb(156, 220, 254);">is</span> <span style="color: rgb(212, 212, 212);">=</span> <span style="color: rgb(220, 220, 170);">stream_open</span>(<span style="color: rgb(156, 220, 254);">input_filename</span>, <span style="color: rgb(156, 220, 254);">file_iformat</span>)创建解复用线程</div>" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="270" y="140" width="200" height="60" as="geometry"/>
</mxCell>
<mxCell id="16" style="edgeStyle=none;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" parent="1" source="12" target="15" edge="1">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="12" value="初始化VideoState结构体(3个FrameQueue和对应的PacketQueue,三个时钟还有音量等其它参数)" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#008a00;fontColor=#ffffff;strokeColor=#005700;" parent="1" vertex="1">
<mxGeometry x="80" y="122.5" width="130" height="95" as="geometry"/>
</mxCell>
<mxCell id="19" style="edgeStyle=none;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;dashed=1;" parent="1" source="15" target="18" edge="1">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="20" value="create" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="19" vertex="1" connectable="0">
<mxGeometry x="-0.2686" y="2" relative="1" as="geometry">
<mxPoint x="-2" as="offset"/>
</mxGeometry>
</mxCell>
<mxCell id="22" style="edgeStyle=none;html=1;entryX=0;entryY=0.5;entryDx=0;entryDy=0;fontColor=none;" parent="1" source="15" target="21" edge="1">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="23" value="<div style="color: rgb(204, 204, 204); background-color: rgb(31, 31, 31); font-family: Menlo, Monaco, &quot;Courier New&quot;, monospace; font-size: 10.8px; line-height: 16px;"><span style="color: #c586c0;">return</span> <span style="color: #9cdcfe;">is</span></div>" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];fontColor=none;" parent="22" vertex="1" connectable="0">
<mxGeometry x="0.4847" y="1" relative="1" as="geometry">
<mxPoint x="-20" y="-14" as="offset"/>
</mxGeometry>
</mxCell>
<mxCell id="15" value="<div style="color: rgb(204, 204, 204); background-color: rgb(31, 31, 31); font-family: Menlo, Monaco, &quot;Courier New&quot;, monospace; font-size: 10.8px; line-height: 16px;"><span style="color: #9cdcfe;">is</span>-&gt;<span style="color: #9cdcfe;">read_tid</span> <span style="color: #d4d4d4;">=</span> <span style="color: #dcdcaa;">SDL_CreateThread</span>(<span style="color: #dcdcaa;">read_thread</span>, <span style="color: #ce9178;">"read_thread"</span>, <span style="color: #9cdcfe;">is</span>);</div>" style="rounded=1;whiteSpace=wrap;html=1;labelBackgroundColor=none;" parent="1" vertex="1">
<mxGeometry x="37.5" y="270" width="215" height="60" as="geometry"/>
</mxCell>
<mxCell id="27" style="edgeStyle=none;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;fontColor=none;" parent="1" source="18" target="26" edge="1">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="18" value="解复用线程(read_thread)" style="rounded=0;whiteSpace=wrap;html=1;labelBackgroundColor=none;fillColor=#6a00ff;fontColor=#ffffff;strokeColor=#3700CC;" parent="1" vertex="1">
<mxGeometry x="85" y="380" width="120" height="30" as="geometry"/>
</mxCell>
<mxCell id="118" style="edgeStyle=none;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;fontSize=8;fontColor=#CCCCCC;" edge="1" parent="1" source="21" target="117">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="21" value="<div style="font-family: Menlo, Monaco, &quot;Courier New&quot;, monospace; font-size: 10.8px; line-height: 16px;"><div style="color: rgb(204, 204, 204); background-color: rgb(31, 31, 31); font-size: 9.6px; line-height: 14px;"><span style="color: #dcdcaa;">event_loop</span>(<span style="color: #9cdcfe;">is</span>);进入SDL窗口主循环</div></div>" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="340" y="285" width="130" height="30" as="geometry"/>
</mxCell>
<mxCell id="29" style="edgeStyle=none;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;fontColor=none;" parent="1" source="26" target="28" edge="1">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="26" value="<div style="color: rgb(204, 204, 204); font-family: Menlo, Monaco, &quot;Courier New&quot;, monospace; font-size: 10.8px; line-height: 16px;"><span style="color: rgb(220, 220, 170);">avformat_open_input标准流程初始化</span><span style="font-size: 10.8px; color: rgb(78, 201, 176);">AVFormatContext</span><span style="background-color: rgb(31, 31, 31); font-size: 10.8px;"> </span><span style="font-size: 10.8px; color: rgb(212, 212, 212);">*</span><span style="font-size: 10.8px; color: rgb(156, 220, 254);">ic</span></div>" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="40" y="450" width="210" height="50" as="geometry"/>
</mxCell>
<mxCell id="34" style="edgeStyle=none;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;fontColor=#FFFFFF;" parent="1" source="28" target="33" edge="1">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="28" value="<div style="font-family: Menlo, Monaco, &quot;Courier New&quot;, monospace; font-size: 10.8px; line-height: 16px;"><div style=""><span style="color: rgb(156, 220, 254);">st_index</span><font style="" color="#cccccc">[</font><font style="" color="#4fc1ff">AVMEDIA_TYPE_XXX</font><font style="" color="#cccccc">] </font><span style="color: rgb(212, 212, 212);">=</span></div><div style=""><span style="color: rgb(204, 204, 204);"> <span style="color: #dcdcaa;">av_find_best_stream</span>(</span><font style="" color="#9cdcfe">...</font><span style="color: rgb(204, 204, 204); font-size: 10.8px;">)实现解复用,得到的stream索引用数组维护</span></div></div>" style="rounded=0;whiteSpace=wrap;html=1;labelBackgroundColor=none;" parent="1" vertex="1">
<mxGeometry x="42.5" y="540" width="205" height="60" as="geometry"/>
</mxCell>
<mxCell id="75" style="edgeStyle=none;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;fontColor=#cccccc;" edge="1" parent="1" source="33" target="74">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="109" style="edgeStyle=none;html=1;fontColor=#cccccc;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="33" target="111">
<mxGeometry relative="1" as="geometry">
<mxPoint x="280" y="655" as="targetPoint"/>
</mxGeometry>
</mxCell>
<mxCell id="110" value="创建完毕" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];fontColor=#cccccc;" vertex="1" connectable="0" parent="109">
<mxGeometry x="0.4924" y="4" relative="1" as="geometry">
<mxPoint x="-41" y="4" as="offset"/>
</mxGeometry>
</mxCell>
<mxCell id="33" value="创建解码线程" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#008a00;fontColor=#ffffff;strokeColor=#005700;" parent="1" vertex="1">
<mxGeometry x="80" y="640" width="130" height="30" as="geometry"/>
</mxCell>
<mxCell id="54" style="edgeStyle=none;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="1" source="40" target="53">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="40" value="Video解码线程(video_thread)" style="rounded=0;whiteSpace=wrap;html=1;labelBackgroundColor=none;fillColor=#6a00ff;fontColor=#ffffff;strokeColor=#3700CC;" parent="1" vertex="1">
<mxGeometry x="85.5" y="865" width="120" height="30" as="geometry"/>
</mxCell>
<mxCell id="64" style="edgeStyle=none;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="1" source="41" target="62">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="41" value="Audio解码线程(audio_thread)" style="rounded=0;whiteSpace=wrap;html=1;labelBackgroundColor=none;fillColor=#6a00ff;fontColor=#ffffff;strokeColor=#3700CC;" parent="1" vertex="1">
<mxGeometry x="330" y="850" width="120" height="30" as="geometry"/>
</mxCell>
<mxCell id="56" style="edgeStyle=none;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="1" source="53" target="55">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="53" value="<div style="color: rgb(204, 204, 204); background-color: rgb(31, 31, 31); font-family: Menlo, Monaco, &quot;Courier New&quot;, monospace; font-size: 10.8px; line-height: 16px;"><span style="color: #9cdcfe;">ret</span> <span style="color: #d4d4d4;">=</span> <span style="color: #dcdcaa;">get_video_frame</span>(<span style="color: #9cdcfe;">is</span>, <span style="color: #9cdcfe;">frame</span>)获取一帧(内部调用<span style="color: rgb(220, 220, 170); font-size: 9.6px;">decoder_decode_frame</span><span style="font-size: 10.8px;">,同时还有别的操作,实现下文详述)</span></div>" style="rounded=1;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="48" y="915" width="195" height="80" as="geometry"/>
</mxCell>
<mxCell id="58" style="edgeStyle=none;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="1" source="55" target="57">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="55" value="帧参数处理(计算duration,秒pts,序列号等)" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#008a00;fontColor=#ffffff;strokeColor=#005700;" vertex="1" parent="1">
<mxGeometry x="85.5" y="1015" width="120" height="50" as="geometry"/>
</mxCell>
<mxCell id="61" style="edgeStyle=none;html=1;" edge="1" parent="1" source="57">
<mxGeometry relative="1" as="geometry">
<mxPoint x="145.5" y="905" as="targetPoint"/>
<Array as="points">
<mxPoint x="145.5" y="1125"/>
<mxPoint x="145.5" y="1155"/>
<mxPoint x="210.5" y="1155"/>
<mxPoint x="260.5" y="1155"/>
<mxPoint x="260.5" y="1015"/>
<mxPoint x="260.5" y="905"/>
</Array>
</mxGeometry>
</mxCell>
<mxCell id="57" value="<div style="background-color: rgb(31, 31, 31); font-family: Menlo, Monaco, &quot;Courier New&quot;, monospace; font-size: 10.8px; line-height: 16px;"><div style="font-size: 10.8px; line-height: 16px;"><span style="color: rgb(156, 220, 254);">ret</span> <span style="color: rgb(212, 212, 212);">=</span> <span style="color: rgb(220, 220, 170);">queue_picture</span><font color="#cccccc">(</font><font color="#9cdcfe">...</font><font color="#cccccc">)将帧放入</font><span style="font-size: 9.6px; color: rgb(156, 220, 254);">is</span><span style="color: rgb(204, 204, 204); font-size: 9.6px;">-&gt;</span><span style="font-size: 9.6px; color: rgb(156, 220, 254);">pictq</span><span style="font-size: 9.6px;"><font color="#cccccc">(内部实现调用</font></span><span style="color: rgb(220, 220, 170); font-size: 9.6px;">frame_queue_push</span><span style="font-size: 9.6px;"><font color="#cccccc">)</font></span></div></div>" style="rounded=1;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="48" y="1085" width="192.5" height="50" as="geometry"/>
</mxCell>
<mxCell id="66" style="edgeStyle=none;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;fontColor=#cccccc;" edge="1" parent="1" source="62" target="65">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="62" value="<div style="color: rgb(204, 204, 204); background-color: rgb(31, 31, 31); font-family: Menlo, Monaco, &quot;Courier New&quot;, monospace; font-size: 9.6px; line-height: 14px;"><span style="color: #9cdcfe;">got_frame</span> <span style="color: #d4d4d4;">=</span> <span style="color: #dcdcaa;">decoder_decode_frame</span>(<span style="color: #d4d4d4;">&amp;</span><span style="color: #9cdcfe;">is</span>-&gt;<span style="color: #9cdcfe;">auddec</span>, <span style="color: #9cdcfe;">frame</span>, <span style="color: #569cd6;">NULL</span>)获取一帧采样数据</div>" style="rounded=1;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="315" y="905" width="150" height="70" as="geometry"/>
</mxCell>
<mxCell id="68" style="edgeStyle=none;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;fontColor=#cccccc;" edge="1" parent="1" source="65" target="67">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="65" value="帧参数处理(计算duration,秒pts,序列号等)" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#008a00;fontColor=#ffffff;strokeColor=#005700;" vertex="1" parent="1">
<mxGeometry x="330" y="1000" width="120" height="50" as="geometry"/>
</mxCell>
<mxCell id="69" style="edgeStyle=none;html=1;fontColor=#cccccc;" edge="1" parent="1" source="67">
<mxGeometry relative="1" as="geometry">
<mxPoint x="390" y="890" as="targetPoint"/>
<Array as="points">
<mxPoint x="390" y="1140"/>
<mxPoint x="450" y="1140"/>
<mxPoint x="500" y="1140"/>
<mxPoint x="500" y="1080"/>
<mxPoint x="500" y="980"/>
<mxPoint x="500" y="940"/>
<mxPoint x="500" y="890"/>
<mxPoint x="490" y="890"/>
</Array>
</mxGeometry>
</mxCell>
<mxCell id="67" value="<div style="background-color: rgb(31, 31, 31); font-family: Menlo, Monaco, &quot;Courier New&quot;, monospace; line-height: 16px;"><div style="line-height: 16px;"><span style="font-size: 9.6px; color: rgb(220, 220, 170);">frame_queue_push</span><span style="font-size: 9.6px; color: rgb(204, 204, 204);">(</span><span style="font-size: 9.6px; color: rgb(212, 212, 212);">&amp;</span><span style="font-size: 9.6px; color: rgb(156, 220, 254);">is</span><span style="font-size: 9.6px; color: rgb(204, 204, 204);">-&gt;</span><span style="font-size: 9.6px; color: rgb(156, 220, 254);">sampq</span><span style="font-size: 9.6px; color: rgb(204, 204, 204);">)</span><font style="font-size: 10.8px;" color="#cccccc">将帧放入</font><font size="1" color="#9cdcfe" style="">is-&gt;sampq</font></div></div>" style="rounded=1;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="293.75" y="1070" width="192.5" height="50" as="geometry"/>
</mxCell>
<mxCell id="77" style="edgeStyle=none;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;fontColor=#cccccc;" edge="1" parent="1" source="74" target="76">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="74" value="<div style="color: rgb(204, 204, 204); background-color: rgb(31, 31, 31); font-family: Menlo, Monaco, &quot;Courier New&quot;, monospace; font-weight: normal; font-size: 9.6px; line-height: 14px;"><div><span style="color: #dcdcaa;">stream_component_open(...)</span></div></div>" style="rounded=1;whiteSpace=wrap;html=1;fontColor=#cccccc;" vertex="1" parent="1">
<mxGeometry x="57.5" y="690" width="175" height="20" as="geometry"/>
</mxCell>
<mxCell id="78" style="edgeStyle=none;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;fontColor=#cccccc;" edge="1" parent="1" source="76" target="104">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="79" value="false" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];fontColor=#cccccc;" vertex="1" connectable="0" parent="78">
<mxGeometry y="2" relative="1" as="geometry">
<mxPoint x="-2" y="-10" as="offset"/>
</mxGeometry>
</mxCell>
<mxCell id="82" style="edgeStyle=none;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;fontColor=#cccccc;" edge="1" parent="1" source="76" target="80">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="85" value="true" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];fontColor=#cccccc;" vertex="1" connectable="0" parent="82">
<mxGeometry x="-0.06" y="-3" relative="1" as="geometry">
<mxPoint y="-3" as="offset"/>
</mxGeometry>
</mxCell>
<mxCell id="76" value="<div style="font-family: Menlo, Monaco, &quot;Courier New&quot;, monospace; font-size: 9.6px; line-height: 14px;"><span style="color: rgb(156, 220, 254);">avctx</span>-&gt;<span style="color: rgb(156, 220, 254);">codec_type ==&nbsp;</span><span style="color: rgb(79, 193, 255); font-size: 9.6px;">AVMEDIA_TYPE_AUDIO</span></div>" style="rhombus;whiteSpace=wrap;html=1;fontColor=#ffffff;fillColor=#76608a;strokeColor=#432D57;" vertex="1" parent="1">
<mxGeometry x="15" y="730" width="260" height="40" as="geometry"/>
</mxCell>
<mxCell id="87" style="edgeStyle=none;html=1;fontColor=#cccccc;" edge="1" parent="1" source="80" target="88">
<mxGeometry relative="1" as="geometry">
<mxPoint x="530" y="750.0000000000002" as="targetPoint"/>
</mxGeometry>
</mxCell>
<mxCell id="80" value="创建音频播放线程" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#008a00;fontColor=#ffffff;strokeColor=#005700;" vertex="1" parent="1">
<mxGeometry x="325" y="735" width="130" height="30" as="geometry"/>
</mxCell>
<mxCell id="94" style="edgeStyle=none;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;fontColor=#cccccc;" edge="1" parent="1" source="86" target="93">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="86" value="Audio播放线程(回调函数<span style="color: rgb(220, 220, 170); font-family: Menlo, Monaco, &quot;Courier New&quot;, monospace; font-size: 9.6px;">sdl_audio_callback)</span>" style="rounded=0;whiteSpace=wrap;html=1;labelBackgroundColor=none;fillColor=#6a00ff;fontColor=#ffffff;strokeColor=#3700CC;" vertex="1" parent="1">
<mxGeometry x="580" y="800" width="120" height="50" as="geometry"/>
</mxCell>
<mxCell id="89" style="edgeStyle=none;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;fontColor=#cccccc;dashed=1;" edge="1" parent="1" source="88" target="86">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="91" style="edgeStyle=none;html=1;exitX=0.25;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;fontColor=#cccccc;" edge="1" parent="1" source="88" target="106">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="603" y="780"/>
<mxPoint x="390" y="780"/>
</Array>
</mxGeometry>
</mxCell>
<mxCell id="92" value="<span style="font-family: Menlo, Monaco, &quot;Courier New&quot;, monospace; font-size: 9.6px; color: rgb(197, 134, 192);">return</span><span style="font-family: Menlo, Monaco, &quot;Courier New&quot;, monospace; font-size: 9.6px; background-color: rgb(31, 31, 31);">&nbsp;</span><span style="font-family: Menlo, Monaco, &quot;Courier New&quot;, monospace; font-size: 9.6px; color: rgb(156, 220, 254);">spec</span><span style="font-family: Menlo, Monaco, &quot;Courier New&quot;, monospace; font-size: 9.6px; background-color: rgb(31, 31, 31);">.</span><span style="font-family: Menlo, Monaco, &quot;Courier New&quot;, monospace; font-size: 9.6px; color: rgb(156, 220, 254);">size</span><span style="font-family: Menlo, Monaco, &quot;Courier New&quot;, monospace; font-size: 9.6px; background-color: rgb(31, 31, 31);">;</span>" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];fontColor=#cccccc;" vertex="1" connectable="0" parent="91">
<mxGeometry x="0.1316" y="1" relative="1" as="geometry">
<mxPoint x="28" y="-1" as="offset"/>
</mxGeometry>
</mxCell>
<mxCell id="88" value="<div style="background-color: rgb(31, 31, 31); font-family: Menlo, Monaco, &quot;Courier New&quot;, monospace; font-size: 9.6px; line-height: 14px;"><span style="color: #9cdcfe;">audio_dev</span> <span style="color: #d4d4d4;">=</span> <span style="color: #dcdcaa;">SDL_OpenAudioDevice</span>(<font color="#569cd6">...</font>)</div>" style="rounded=1;whiteSpace=wrap;html=1;labelBackgroundColor=none;fontColor=#cccccc;" vertex="1" parent="1">
<mxGeometry x="565" y="730" width="150" height="35" as="geometry"/>
</mxCell>
<mxCell id="96" style="edgeStyle=none;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;fontColor=#cccccc;" edge="1" parent="1" source="93">
<mxGeometry relative="1" as="geometry">
<mxPoint x="640" y="930" as="targetPoint"/>
</mxGeometry>
</mxCell>
<mxCell id="93" value="<div style="font-family: Menlo, Monaco, &quot;Courier New&quot;, monospace; font-size: 9.6px; line-height: 14px;"><div style="font-size: 9.6px; line-height: 14px;"><span style="color: rgb(156, 220, 254);">audio_size</span> <span style="color: rgb(212, 212, 212);">=</span> <span style="color: rgb(220, 220, 170);">audio_decode_frame</span>(<span style="color: rgb(156, 220, 254);">is</span>);</div></div>" style="rounded=1;whiteSpace=wrap;html=1;labelBackgroundColor=none;fontColor=#cccccc;" vertex="1" parent="1">
<mxGeometry x="565" y="880" width="150" height="30" as="geometry"/>
</mxCell>
<mxCell id="98" style="edgeStyle=none;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;fontColor=#cccccc;" edge="1" parent="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="640" y="980" as="sourcePoint"/>
<mxPoint x="640" y="1000" as="targetPoint"/>
</mxGeometry>
</mxCell>
<mxCell id="95" value="<div style="font-family: Menlo, Monaco, &quot;Courier New&quot;, monospace; font-size: 9.6px; line-height: 14px;"><div style="font-size: 9.6px; line-height: 14px;"><div style="background-color: rgb(31, 31, 31); font-size: 9.6px; line-height: 14px;"><span style="color: #9cdcfe;">af</span> <span style="color: #d4d4d4;">=</span> <span style="color: #dcdcaa;">frame_queue_peek_readable</span>(<span style="color: #d4d4d4;">&amp;</span><span style="color: #9cdcfe;">is</span>-&gt;<span style="color: #9cdcfe;">sampq</span>)</div></div></div>" style="rounded=1;whiteSpace=wrap;html=1;labelBackgroundColor=none;fontColor=#cccccc;" vertex="1" parent="1">
<mxGeometry x="547.5" y="930" width="185" height="50" as="geometry"/>
</mxCell>
<mxCell id="100" style="edgeStyle=none;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;fontColor=#cccccc;" edge="1" parent="1" target="99">
<mxGeometry relative="1" as="geometry">
<mxPoint x="640" y="1040" as="sourcePoint"/>
</mxGeometry>
</mxCell>
<mxCell id="101" value="audio_decode_frame得到的数据放在<span style="font-family: Menlo, Monaco, &quot;Courier New&quot;, monospace; font-size: 9.6px; color: rgb(156, 220, 254);">is</span><span style="background-color: rgb(31, 31, 31); font-family: Menlo, Monaco, &quot;Courier New&quot;, monospace; font-size: 9.6px;">-&gt;</span><span style="font-family: Menlo, Monaco, &quot;Courier New&quot;, monospace; font-size: 9.6px; color: rgb(156, 220, 254);">audio_buf里面<br></span>" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];fontColor=#cccccc;" vertex="1" connectable="0" parent="100">
<mxGeometry x="0.0667" y="3" relative="1" as="geometry">
<mxPoint x="7" y="-1" as="offset"/>
</mxGeometry>
</mxCell>
<mxCell id="97" value="<div style="font-family: Menlo, Monaco, &quot;Courier New&quot;, monospace; font-size: 9.6px; line-height: 14px;"><div style="font-size: 9.6px; line-height: 14px;"><div style="background-color: rgb(31, 31, 31); font-size: 9.6px; line-height: 14px;"><div style="font-size: 9.6px; line-height: 14px;"><span style="color: #9cdcfe;">len2</span> <span style="color: #d4d4d4;">=</span> <span style="color: #dcdcaa;">swr_convert</span>(...)对af中解码得到的音频数据进行重采样</div></div></div></div>" style="rounded=1;whiteSpace=wrap;html=1;labelBackgroundColor=none;fontColor=#cccccc;" vertex="1" parent="1">
<mxGeometry x="543.75" y="1000" width="192.5" height="40" as="geometry"/>
</mxCell>
<mxCell id="102" style="edgeStyle=none;html=1;fontColor=#cccccc;exitX=0.5;exitY=1;exitDx=0;exitDy=0;" edge="1" parent="1" source="99">
<mxGeometry relative="1" as="geometry">
<mxPoint x="640" y="860" as="targetPoint"/>
<Array as="points">
<mxPoint x="640" y="1160"/>
<mxPoint x="800" y="1160"/>
<mxPoint x="800" y="860"/>
</Array>
</mxGeometry>
</mxCell>
<mxCell id="99" value="<div style="background-color: rgb(31, 31, 31); font-family: Menlo, Monaco, &quot;Courier New&quot;, monospace; font-size: 9.6px; line-height: 14px;"><span style="color: #569cd6;">memcpy</span>(<span style="color: #9cdcfe;">stream</span>, (<span style="color: #4ec9b0;">uint8_t</span> <span style="color: #d4d4d4;">*</span>)<span style="color: #9cdcfe;">is</span>-&gt;<span style="color: #9cdcfe;">audio_buf</span> <span style="color: #d4d4d4;">+</span> <span style="color: #9cdcfe;">is</span>-&gt;<span style="color: #9cdcfe;">audio_buf_index</span>, <span style="color: #9cdcfe;">len1</span>)把重采样后的数据拷到声卡,供SDL播放</div>" style="rounded=1;whiteSpace=wrap;html=1;labelBackgroundColor=none;fontColor=#cccccc;" vertex="1" parent="1">
<mxGeometry x="550" y="1070" width="180" height="60" as="geometry"/>
</mxCell>
<mxCell id="105" style="edgeStyle=none;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;fontColor=#cccccc;entryX=0.5;entryY=0;entryDx=0;entryDy=0;dashed=1;" edge="1" parent="1" source="104" target="40">
<mxGeometry relative="1" as="geometry">
<mxPoint x="140" y="870" as="targetPoint"/>
</mxGeometry>
</mxCell>
<mxCell id="104" value="<div style="background-color: rgb(31, 31, 31); font-family: Menlo, Monaco, &quot;Courier New&quot;, monospace; font-size: 9.6px; line-height: 14px;"><span style="color: #dcdcaa;">decoder_init(...)</span></div><div style="background-color: rgb(31, 31, 31); font-family: Menlo, Monaco, &quot;Courier New&quot;, monospace; font-size: 9.6px; line-height: 14px;"><div style="font-size: 9.6px; line-height: 14px;"><span style="color: #dcdcaa;">decoder_start(...)</span></div></div>" style="rounded=1;whiteSpace=wrap;html=1;labelBackgroundColor=none;fontColor=#cccccc;" vertex="1" parent="1">
<mxGeometry x="85" y="805" width="120" height="35" as="geometry"/>
</mxCell>
<mxCell id="107" style="edgeStyle=none;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;fontColor=#cccccc;dashed=1;" edge="1" parent="1" source="106" target="41">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="106" value="<div style="background-color: rgb(31, 31, 31); font-family: Menlo, Monaco, &quot;Courier New&quot;, monospace; font-size: 9.6px; line-height: 14px;"><span style="color: #dcdcaa;">decoder_init(...)</span></div><div style="background-color: rgb(31, 31, 31); font-family: Menlo, Monaco, &quot;Courier New&quot;, monospace; font-size: 9.6px; line-height: 14px;"><div style="font-size: 9.6px; line-height: 14px;"><span style="color: #dcdcaa;">decoder_start(...)</span></div></div>" style="rounded=1;whiteSpace=wrap;html=1;labelBackgroundColor=none;fontColor=#cccccc;" vertex="1" parent="1">
<mxGeometry x="330" y="800" width="120" height="35" as="geometry"/>
</mxCell>
<mxCell id="113" style="edgeStyle=none;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;fontColor=#CCCCCC;" edge="1" parent="1" source="111" target="112">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="111" value="处理<span style="font-family: Menlo, Monaco, &quot;Courier New&quot;, monospace; font-size: 9.6px;">seek_req,</span><span style="font-family: Menlo, Monaco, &quot;Courier New&quot;, monospace; font-size: 9.6px;">queue_attachments_req,pause,PacketQueue满等情况</span>" style="rounded=1;whiteSpace=wrap;html=1;labelBackgroundColor=none;fontColor=#ffffff;fillColor=#60a917;strokeColor=#2D7600;" vertex="1" parent="1">
<mxGeometry x="315" y="625" width="150" height="60" as="geometry"/>
</mxCell>
<mxCell id="115" style="edgeStyle=none;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;fontSize=8;fontColor=#CCCCCC;" edge="1" parent="1" source="112" target="114">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="112" value="<div style="font-family: Menlo, Monaco, &quot;Courier New&quot;, monospace; font-size: 9.6px; line-height: 14px;"><span style="color: rgb(220, 220, 170);">av_read_frame(...)从输入读一个packet</span></div>" style="rounded=1;whiteSpace=wrap;html=1;labelBackgroundColor=none;fontColor=#ffffff;fillColor=#0050ef;strokeColor=#001DBC;" vertex="1" parent="1">
<mxGeometry x="500" y="632.5" width="110" height="45" as="geometry"/>
</mxCell>
<mxCell id="116" style="edgeStyle=none;html=1;fontSize=8;fontColor=#CCCCCC;exitX=0.5;exitY=0;exitDx=0;exitDy=0;" edge="1" parent="1" source="114">
<mxGeometry relative="1" as="geometry">
<mxPoint x="290" y="655" as="targetPoint"/>
<Array as="points">
<mxPoint x="700" y="600"/>
<mxPoint x="290" y="600"/>
</Array>
</mxGeometry>
</mxCell>
<mxCell id="114" value="<font style="font-size: 8px;">处理pkt相关参数后,根据<br><span style="font-family: Menlo, Monaco, &quot;Courier New&quot;, monospace; color: rgb(156, 220, 254);">pkt</span><span style="background-color: rgb(31, 31, 31); font-family: Menlo, Monaco, &quot;Courier New&quot;, monospace;">-&gt;</span><span style="font-family: Menlo, Monaco, &quot;Courier New&quot;, monospace; color: rgb(156, 220, 254);">stream_index</span><span style="font-family: Menlo, Monaco, &quot;Courier New&quot;, monospace;">,调用</span><span style="background-color: rgb(31, 31, 31); color: rgb(220, 220, 170); font-family: Menlo, Monaco, &quot;Courier New&quot;, monospace;">packet_queue_put(...)放入对应的PacketQueue中</span></font>" style="rounded=1;whiteSpace=wrap;html=1;labelBackgroundColor=none;fontColor=#CCCCCC;" vertex="1" parent="1">
<mxGeometry x="640" y="625" width="120" height="60" as="geometry"/>
</mxCell>
<mxCell id="120" style="edgeStyle=none;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;fontSize=8;fontColor=#CCCCCC;" edge="1" parent="1" source="117" target="119">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="117" value="<div style="font-family: Menlo, Monaco, &quot;Courier New&quot;, monospace; font-size: 10.8px; line-height: 16px;"><div style="color: rgb(204, 204, 204); background-color: rgb(31, 31, 31); font-size: 9.6px; line-height: 14px;"><div style="font-size: 9.6px; line-height: 14px;"><span style="color: #dcdcaa;">refresh_loop_wait_event</span>(<span style="color: #9cdcfe;">cur_stream</span>, <span style="color: #d4d4d4;">&amp;</span><span style="color: #9cdcfe;">event</span>);视音频播放与同步实现,原理详见下文</div></div></div>" style="rounded=1;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="295" y="350" width="220" height="30" as="geometry"/>
</mxCell>
<mxCell id="121" style="edgeStyle=none;html=1;fontSize=8;fontColor=#CCCCCC;exitX=0.5;exitY=1;exitDx=0;exitDy=0;" edge="1" parent="1" source="119">
<mxGeometry relative="1" as="geometry">
<mxPoint x="405" y="330" as="targetPoint"/>
<Array as="points">
<mxPoint x="405" y="470"/>
<mxPoint x="340" y="470"/>
<mxPoint x="280" y="470"/>
<mxPoint x="280" y="330"/>
</Array>
</mxGeometry>
</mxCell>
<mxCell id="119" value="<div style="color: rgb(204, 204, 204); background-color: rgb(31, 31, 31); font-family: Menlo, Monaco, &quot;Courier New&quot;, monospace; font-weight: normal; font-size: 9.6px; line-height: 14px;"><div><span style="color: #c586c0;">switch</span><span style="color: #cccccc;"> (</span><span style="color: #9cdcfe;">event</span><span style="color: #cccccc;">.</span><span style="color: #9cdcfe;">type</span><span style="color: #cccccc;">)处理SDL消息</span></div></div>" style="rounded=1;whiteSpace=wrap;html=1;labelBackgroundColor=none;fontSize=8;fontColor=#CCCCCC;" vertex="1" parent="1">
<mxGeometry x="344.5" y="410" width="121" height="40" as="geometry"/>
</mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>