Skip to content

Latest commit

 

History

History
57 lines (47 loc) · 1.46 KB

testtheoraplay.c

File metadata and controls

57 lines (47 loc) · 1.46 KB
 
Jun 10, 2011
Jun 10, 2011
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
/**
* TheoraPlay; multithreaded Ogg Theora/Ogg Vorbis decoding.
*
* Please see the file LICENSE.txt in the source's root directory.
*
* This file written by Ryan C. Gordon.
*/
#include <stdio.h>
#include <unistd.h>
#include "theoraplay.h"
int main(int argc, char **argv)
{
THEORAPLAY_Decoder *decoder;
const THEORAPLAY_YuvVideoItem *video = NULL;
const THEORAPLAY_PcmAudioItem *audio = NULL;
int i;
for (i = 1; i < argc; i++)
{
printf("Trying file '%s' ...\n", argv[i]);
decoder = THEORAPLAY_startDecode(argv[i], 20);
while (THEORAPLAY_isDecoding(decoder))
{
video = THEORAPLAY_getVideo(decoder);
if (video)
{
printf("Got video frame (%u ms)!\n", video->playms);
THEORAPLAY_freeVideo(video);
} // if
audio = THEORAPLAY_getAudio(decoder);
if (audio)
{
printf("Got %d frames of audio (%u ms)!\n", audio->frames, audio->playms);
THEORAPLAY_freeAudio(audio);
} // if
if (!video && !audio)
usleep(10000);
} // while
Jun 10, 2011
Jun 10, 2011
44
45
46
47
48
if (THEORAPLAY_decodingError(decoder))
printf("There was an error decoding this file!\n");
else
printf("done with this file!\n");
Jun 10, 2011
Jun 10, 2011
49
50
51
52
53
54
55
56
THEORAPLAY_stopDecode(decoder);
} // for
printf("done all files!\n");
return 0;
} // main
// end of testtheoraplay.c ...