00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef MPEG3IO_H
00021 #define MPEG3IO_H
00022
00023
00024 #include <stdio.h>
00025 #include "mpeg3css.h"
00026 #include "mpeg3private.inc"
00027
00028
00029
00030 typedef struct
00031 {
00032 FILE *fd;
00033 mpeg3_css_t *css;
00034 char path[MPEG3_STRLEN];
00035
00036 long current_byte;
00037 long total_bytes;
00038 } mpeg3_fs_t;
00039
00040 #define mpeg3io_tell(fs) (((mpeg3_fs_t *)(fs))->current_byte)
00041
00042
00043 #define mpeg3io_eof(fs) (((mpeg3_fs_t *)(fs))->current_byte >= ((mpeg3_fs_t *)(fs))->total_bytes)
00044
00045
00046 #define mpeg3io_bof(fs) (((mpeg3_fs_t *)(fs))->current_byte < 0)
00047
00048
00049 #define mpeg3io_total_bytes(fs) (((mpeg3_fs_t *)(fs))->total_bytes)
00050
00051 extern inline unsigned int mpeg3io_read_int32(mpeg3_fs_t *fs)
00052 {
00053 int a, b, c, d;
00054 unsigned int result;
00055
00056 a = (unsigned char)fgetc(fs->fd);
00057 b = (unsigned char)fgetc(fs->fd);
00058 c = (unsigned char)fgetc(fs->fd);
00059 d = (unsigned char)fgetc(fs->fd);
00060 result = ((int)a << 24) |
00061 ((int)b << 16) |
00062 ((int)c << 8) |
00063 ((int)d);
00064 fs->current_byte += 4;
00065 return result;
00066 }
00067
00068 extern inline unsigned int mpeg3io_read_char(mpeg3_fs_t *fs)
00069 {
00070 fs->current_byte++;
00071 return fgetc(fs->fd);
00072 }
00073
00074 #endif