Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

mpeg3io.h

Go to the documentation of this file.
00001 /**********************************************************************
00002 ** Copyright (C) 2000 Trolltech AS.  All rights reserved.
00003 **
00004 ** This file is part of Qtopia Environment.
00005 **
00006 ** This file may be distributed and/or modified under the terms of the
00007 ** GNU General Public License version 2 as published by the Free Software
00008 ** Foundation and appearing in the file LICENSE.GPL included in the
00009 ** packaging of this file.
00010 **
00011 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00012 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00013 **
00014 ** See http://www.trolltech.com/gpl/ for GPL licensing information.
00015 **
00016 ** Contact info@trolltech.com if any conditions of this licensing are
00017 ** not clear to you.
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 /* Filesystem structure */
00029 
00030 typedef struct
00031 {
00032         FILE *fd;
00033         mpeg3_css_t *css;          /* Encryption object */
00034         char path[MPEG3_STRLEN];
00035 /* Hypothetical position of file pointer */
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 // End of file
00043 #define mpeg3io_eof(fs) (((mpeg3_fs_t *)(fs))->current_byte >= ((mpeg3_fs_t *)(fs))->total_bytes)
00044 
00045 // Beginning of file
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 /* Do not fread.  This breaks byte ordering. */
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

Generated on Sat Nov 5 16:15:37 2005 for OPIE by  doxygen 1.4.2