author | kergoth <kergoth> | 2002-01-25 22:14:26 (UTC) |
---|---|---|
committer | kergoth <kergoth> | 2002-01-25 22:14:26 (UTC) |
commit | 15318cad33835e4e2dc620d033e43cd930676cdd (patch) (unidiff) | |
tree | c2fa0399a2c47fda8e2cd0092c73a809d17f68eb /core/multimedia/opieplayer/libmpeg3/dump.c | |
download | opie-15318cad33835e4e2dc620d033e43cd930676cdd.zip opie-15318cad33835e4e2dc620d033e43cd930676cdd.tar.gz opie-15318cad33835e4e2dc620d033e43cd930676cdd.tar.bz2 |
Initial revision
Diffstat (limited to 'core/multimedia/opieplayer/libmpeg3/dump.c') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/multimedia/opieplayer/libmpeg3/dump.c | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/core/multimedia/opieplayer/libmpeg3/dump.c b/core/multimedia/opieplayer/libmpeg3/dump.c new file mode 100644 index 0000000..7158712 --- a/dev/null +++ b/core/multimedia/opieplayer/libmpeg3/dump.c | |||
@@ -0,0 +1,79 @@ | |||
1 | #include "libmpeg3.h" | ||
2 | #include <stdlib.h> | ||
3 | |||
4 | #define BUFSIZE 4096 | ||
5 | |||
6 | int main(int argc, char *argv[]) | ||
7 | { | ||
8 | mpeg3_t *file; | ||
9 | int i, result = 0; | ||
10 | unsigned char *output, **output_rows; | ||
11 | float *audio_output_f; | ||
12 | short *audio_output_i; | ||
13 | long total_samples = 0; | ||
14 | |||
15 | if(argc < 2) | ||
16 | { | ||
17 | printf("Need an MPEG stream.\n"); | ||
18 | exit(1); | ||
19 | } | ||
20 | |||
21 | file = mpeg3_open(argv[1]); | ||
22 | if(file) | ||
23 | { | ||
24 | fprintf(stderr, "MMX supported %d\n", file->have_mmx); | ||
25 | fprintf(stderr, "Audio streams: %d\n", mpeg3_total_astreams(file)); | ||
26 | for(i = 0; i < mpeg3_total_astreams(file); i++) | ||
27 | { | ||
28 | fprintf(stderr, " Stream %d: channels %d sample rate %d total samples %ld\n", | ||
29 | i, | ||
30 | mpeg3_audio_channels(file, i), | ||
31 | mpeg3_sample_rate(file, i), | ||
32 | mpeg3_audio_samples(file, i)); | ||
33 | } | ||
34 | fprintf(stderr, "Video streams: %d\n", mpeg3_total_vstreams(file)); | ||
35 | for(i = 0; i < mpeg3_total_vstreams(file); i++) | ||
36 | { | ||
37 | fprintf(stderr, " Stream %d: width %d height %d frame rate %0.3f total frames %ld\n", | ||
38 | i, | ||
39 | mpeg3_video_width(file, i), | ||
40 | mpeg3_video_height(file, i), | ||
41 | mpeg3_frame_rate(file, i), | ||
42 | mpeg3_video_frames(file, i)); | ||
43 | } | ||
44 | fprintf(stderr,"S"); | ||
45 | |||
46 | mpeg3_set_cpus(file, 1); | ||
47 | fprintf(stderr,"s"); | ||
48 | /* audio_output_f = malloc(BUFSIZE * sizeof(float)); */ | ||
49 | audio_output_i = (short*)malloc(BUFSIZE * 2 * sizeof(short)); | ||
50 | fprintf(stderr,"x"); | ||
51 | /* mpeg3_set_sample(file, 11229518, 0); */ | ||
52 | /*result = mpeg3_read_audio(file, audio_output_f, 0, 0, BUFSIZE, 0);*/ | ||
53 | for (i=0; i<100; i++) { | ||
54 | fprintf(stderr,"c"); | ||
55 | result = mpeg3_read_audio(file, 0, audio_output_i, 0, BUFSIZE, 0); | ||
56 | fprintf(stderr,"read\n"); | ||
57 | } | ||
58 | //fwrite(audio_output_i, BUFSIZE, 1, stdout); | ||
59 | |||
60 | output = (unsigned char*)malloc(mpeg3_video_width(file, 0) * mpeg3_video_height(file, 0) * 3 + 4); | ||
61 | output_rows = (unsigned char**)malloc(sizeof(unsigned char*) * mpeg3_video_height(file, 0)); | ||
62 | for(i = 0; i < mpeg3_video_height(file, 0); i++) | ||
63 | output_rows[i] = &output[i * mpeg3_video_width(file, 0) * 3]; | ||
64 | // mpeg3_set_frame(file, 1000, 0); | ||
65 | result = mpeg3_read_frame(file, | ||
66 | output_rows, | ||
67 | 0, | ||
68 | 0, | ||
69 | mpeg3_video_width(file, 0), | ||
70 | mpeg3_video_height(file, 0), | ||
71 | mpeg3_video_width(file, 0), | ||
72 | mpeg3_video_height(file, 0), | ||
73 | MPEG3_RGB888, | ||
74 | 0); | ||
75 | |||
76 | mpeg3_close(file); | ||
77 | } | ||
78 | return 0; | ||
79 | } | ||