author | erik <erik> | 2007-01-24 19:46:19 (UTC) |
---|---|---|
committer | erik <erik> | 2007-01-24 19:46:19 (UTC) |
commit | a017bf21dd89159052f2f7a3fbc043a24956c08c (patch) (unidiff) | |
tree | 008be2b62ee5487dc55b8a7c7f043c94268f8362 /core/multimedia/opieplayer/libmpeg3/libmpeg3.c | |
parent | a4a7bd22feb060a80e20c81cded43cc24f5cd423 (diff) | |
download | opie-a017bf21dd89159052f2f7a3fbc043a24956c08c.zip opie-a017bf21dd89159052f2f7a3fbc043a24956c08c.tar.gz opie-a017bf21dd89159052f2f7a3fbc043a24956c08c.tar.bz2 |
Every file in this commit has a memory leak of some kind or another. I think
all of them are minor and should not effect properly running code. But if I
were you I would give libstocks and the stockticker plugin in Today a wide
berth. That library is atrocious.
Diffstat (limited to 'core/multimedia/opieplayer/libmpeg3/libmpeg3.c') (more/less context) (show whitespace changes)
-rw-r--r-- | core/multimedia/opieplayer/libmpeg3/libmpeg3.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/core/multimedia/opieplayer/libmpeg3/libmpeg3.c b/core/multimedia/opieplayer/libmpeg3/libmpeg3.c index acaecf7..c8cd3e2 100644 --- a/core/multimedia/opieplayer/libmpeg3/libmpeg3.c +++ b/core/multimedia/opieplayer/libmpeg3/libmpeg3.c | |||
@@ -1,94 +1,94 @@ | |||
1 | #include "libmpeg3.h" | 1 | #include "libmpeg3.h" |
2 | #include "mpeg3protos.h" | 2 | #include "mpeg3protos.h" |
3 | 3 | ||
4 | #include <stdlib.h> | 4 | #include <stdlib.h> |
5 | #include <string.h> | 5 | #include <string.h> |
6 | 6 | ||
7 | #define MAX(a, b) ((a) > (b) ? (a) : (b)) | 7 | #define MAX(a, b) ((a) > (b) ? (a) : (b)) |
8 | 8 | ||
9 | mpeg3_t* mpeg3_new(char *path) | 9 | mpeg3_t* mpeg3_new(char *path) |
10 | { | 10 | { |
11 | int i; | 11 | int i; |
12 | mpeg3_t *file = (mpeg3_t*)calloc(1, sizeof(mpeg3_t)); | 12 | mpeg3_t *file = (mpeg3_t*)calloc(1, sizeof(mpeg3_t)); |
13 | file->cpus = 1; | 13 | file->cpus = 1; |
14 | file->fs = mpeg3_new_fs(path); | 14 | file->fs = mpeg3_new_fs(path); |
15 | file->have_mmx = mpeg3_mmx_test(); | 15 | file->have_mmx = mpeg3_mmx_test(); |
16 | file->demuxer = mpeg3_new_demuxer(file, 0, 0, -1); | 16 | file->demuxer = mpeg3_new_demuxer(file, 0, 0, -1); |
17 | return file; | 17 | return file; |
18 | } | 18 | } |
19 | 19 | ||
20 | int mpeg3_delete(mpeg3_t *file) | 20 | int mpeg3_delete(mpeg3_t *file) |
21 | { | 21 | { |
22 | int i; | 22 | int i; |
23 | 23 | ||
24 | for(i = 0; i < file->total_vstreams; i++) | 24 | for(i = 0; i < file->total_vstreams; i++) |
25 | mpeg3_delete_vtrack(file, file->vtrack[i]); | 25 | mpeg3_delete_vtrack(file, file->vtrack[i]); |
26 | 26 | ||
27 | for(i = 0; i < file->total_astreams; i++) | 27 | for(i = 0; i < file->total_astreams; i++) |
28 | mpeg3_delete_atrack(file, file->atrack[i]); | 28 | mpeg3_delete_atrack(file, file->atrack[i]); |
29 | 29 | ||
30 | mpeg3_delete_fs(file->fs); | 30 | mpeg3_delete_fs(file->fs); |
31 | mpeg3_delete_demuxer(file->demuxer); | 31 | mpeg3_delete_demuxer(file->demuxer); |
32 | free(file); | 32 | free(file); |
33 | } | 33 | } |
34 | 34 | ||
35 | int mpeg3_check_sig(char *path) | 35 | int mpeg3_check_sig(char *path) |
36 | { | 36 | { |
37 | mpeg3_fs_t *fs; | 37 | mpeg3_fs_t *fs; |
38 | unsigned int bits; | 38 | unsigned int bits; |
39 | char *ext; | 39 | char *ext; |
40 | int result = 0; | 40 | int result = 0; |
41 | 41 | ||
42 | fs = mpeg3_new_fs(path); | 42 | fs = mpeg3_new_fs(path); |
43 | if(mpeg3io_open_file(fs)) | 43 | if(mpeg3io_open_file(fs)) |
44 | { | 44 | { |
45 | /* File not found */ | 45 | /* File not found */ |
46 | return 0; | 46 | return mpeg3_delete_fs(fs); |
47 | } | 47 | } |
48 | 48 | ||
49 | bits = mpeg3io_read_int32(fs); | 49 | bits = mpeg3io_read_int32(fs); |
50 | /* Test header */ | 50 | /* Test header */ |
51 | if(bits == MPEG3_TOC_PREFIX || bits == MPEG3_TOC_PREFIXLOWER) | 51 | if(bits == MPEG3_TOC_PREFIX || bits == MPEG3_TOC_PREFIXLOWER) |
52 | { | 52 | { |
53 | result = 1; | 53 | result = 1; |
54 | } | 54 | } |
55 | else | 55 | else |
56 | if((((bits >> 24) & 0xff) == MPEG3_SYNC_BYTE) || | 56 | if((((bits >> 24) & 0xff) == MPEG3_SYNC_BYTE) || |
57 | (bits == MPEG3_PACK_START_CODE) || | 57 | (bits == MPEG3_PACK_START_CODE) || |
58 | ((bits & 0xfff00000) == 0xfff00000) || | 58 | ((bits & 0xfff00000) == 0xfff00000) || |
59 | (bits == MPEG3_SEQUENCE_START_CODE) || | 59 | (bits == MPEG3_SEQUENCE_START_CODE) || |
60 | (bits == MPEG3_PICTURE_START_CODE) || | 60 | (bits == MPEG3_PICTURE_START_CODE) || |
61 | (((bits & 0xffff0000) >> 16) == MPEG3_AC3_START_CODE) || | 61 | (((bits & 0xffff0000) >> 16) == MPEG3_AC3_START_CODE) || |
62 | ((bits >> 8) == MPEG3_ID3_PREFIX) || | 62 | ((bits >> 8) == MPEG3_ID3_PREFIX) || |
63 | (bits == MPEG3_RIFF_CODE)) | 63 | (bits == MPEG3_RIFF_CODE)) |
64 | { | 64 | { |
65 | result = 1; | 65 | result = 1; |
66 | 66 | ||
67 | ext = strrchr(path, '.'); | 67 | ext = strrchr(path, '.'); |
68 | if(ext) | 68 | if(ext) |
69 | { | 69 | { |
70 | /* Test file extension. */ | 70 | /* Test file extension. */ |
71 | if(strncasecmp(ext, ".mp2", 4) && | 71 | if(strncasecmp(ext, ".mp2", 4) && |
72 | // strncasecmp(ext, ".mp3", 4) && | 72 | // strncasecmp(ext, ".mp3", 4) && |
73 | strncasecmp(ext, ".m1v", 4) && | 73 | strncasecmp(ext, ".m1v", 4) && |
74 | strncasecmp(ext, ".m2v", 4) && | 74 | strncasecmp(ext, ".m2v", 4) && |
75 | strncasecmp(ext, ".m2s", 4) && | 75 | strncasecmp(ext, ".m2s", 4) && |
76 | strncasecmp(ext, ".mpg", 4) && | 76 | strncasecmp(ext, ".mpg", 4) && |
77 | strncasecmp(ext, ".vob", 4) && | 77 | strncasecmp(ext, ".vob", 4) && |
78 | strncasecmp(ext, ".mpeg", 4) && | 78 | strncasecmp(ext, ".mpeg", 4) && |
79 | strncasecmp(ext, ".ac3", 4)) | 79 | strncasecmp(ext, ".ac3", 4)) |
80 | result = 0; | 80 | result = 0; |
81 | } | 81 | } |
82 | } | 82 | } |
83 | 83 | ||
84 | mpeg3io_close_file(fs); | 84 | mpeg3io_close_file(fs); |
85 | mpeg3_delete_fs(fs); | 85 | mpeg3_delete_fs(fs); |
86 | return result; | 86 | return result; |
87 | } | 87 | } |
88 | 88 | ||
89 | mpeg3_t* mpeg3_open_copy(char *path, mpeg3_t *old_file) | 89 | mpeg3_t* mpeg3_open_copy(char *path, mpeg3_t *old_file) |
90 | { | 90 | { |
91 | mpeg3_t *file = 0; | 91 | mpeg3_t *file = 0; |
92 | unsigned int bits; | 92 | unsigned int bits; |
93 | int i, done; | 93 | int i, done; |
94 | 94 | ||