Rev 2415 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2415 | Rev 2427 | ||
---|---|---|---|
Line 8... | Line 8... | ||
8 | #include |
8 | #include |
9 | #include |
9 | #include |
10 | #include |
10 | #include |
11 | #include |
11 | #include |
12 | #include |
12 | #include "../winlib/winlib.h" |
Line 13... | Line 13... | ||
13 | 13 | ||
14 | #include "sound.h" |
14 | #include "sound.h" |
Line 15... | Line 15... | ||
15 | #include "fplay.h" |
15 | #include "fplay.h" |
Line 16... | Line 16... | ||
16 | 16 | ||
Line 17... | Line 17... | ||
17 | volatile uint32_t status = 1; |
17 | volatile enum player_state player_state; |
Line 100... | Line 100... | ||
100 | printf("Video stream not detected\n\r"); |
100 | printf("Video stream not detected\n\r"); |
101 | return -1; // Didn't find a video stream |
101 | return -1; // Didn't find a video stream |
102 | } |
102 | } |
103 | 103 | ||
Line -... | Line 104... | ||
- | 104 | player_state = PLAY_RESTART; |
|
- | 105 | ||
104 | // __asm__ __volatile__("int3"); |
106 | // __asm__ __volatile__("int3"); |
Line 105... | Line 107... | ||
105 | 107 | ||
106 | // Get a pointer to the codec context for the video stream |
108 | // Get a pointer to the codec context for the video stream |
107 | pCodecCtx=pFormatCtx->streams[videoStream]->codec; |
109 | pCodecCtx=pFormatCtx->streams[videoStream]->codec; |
Line 202... | Line 204... | ||
202 | int eof = 0; |
204 | int eof = 0; |
203 | AVPacket packet; |
205 | AVPacket packet; |
204 | int ret; |
206 | int ret; |
205 | 207 | ||
Line 206... | Line 208... | ||
206 | while( status != 0 && !eof) |
208 | while( player_state != CLOSED && !eof) |
207 | { |
209 | { |
208 | int err; |
210 | int err; |
Line 209... | Line 211... | ||
209 | 211 | ||
Line -... | Line 212... | ||
- | 212 | // __asm__ __volatile__("int3"); |
|
- | 213 | ||
- | 214 | if( player_state == PAUSE ) |
|
- | 215 | { |
|
- | 216 | delay(1); |
|
- | 217 | continue; |
|
210 | // __asm__ __volatile__("int3"); |
218 | }; |
211 | 219 | ||
212 | if(q_video.size+q_audio.size < 12*1024*1024) |
220 | if(q_video.size+q_audio.size < 12*1024*1024) |
213 | { |
221 | { |
214 | err = av_read_frame(pFormatCtx, &packet); |
222 | err = av_read_frame(pFormatCtx, &packet); |
Line 242... | Line 250... | ||
242 | }; |
250 | }; |
243 | 251 | ||
Line 244... | Line 252... | ||
244 | ret = 1; |
252 | ret = 1; |
Line 245... | Line 253... | ||
245 | 253 | ||
246 | while( (status != 0) && ret) |
254 | while( (player_state != CLOSED) && ret) |
247 | { |
255 | { |
248 | ret = decode_video(pCodecCtx, &q_video); |
256 | ret = decode_video(pCodecCtx, &q_video); |
249 | ret |= decode_audio(aCodecCtx, &q_audio); |
257 | ret |= decode_audio(aCodecCtx, &q_audio); |
250 | delay(1); |
258 | delay(1); |
251 | }; |
259 | }; |
252 | delay(50); |
- | |
253 | status = 0; |
260 | delay(50); |
254 | printf("status = 0\n"); |
261 | player_state = CLOSED; |
255 | delay(300); |
262 | delay(300); |