Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygenindex.h
Go to the documentation of this file.
00001 #ifndef MPG123_H_INDEX 00002 #define MPG123_H_INDEX 00003 00004 /* 00005 index: frame index data structure and functions 00006 00007 This is for keeping track of frame positions for accurate seeking. 00008 Now in it's own file, with initial code from frame.c and parse.c . 00009 00010 The idea of the index with a certain amount of entries is to cover 00011 all yet-encountered frame positions with minimal coarseness. 00012 Meaning: At first every frame position is recorded, then, when 00013 the index is full, every second position is trown away to make 00014 space. Next time it is full, the same happens. And so on. 00015 In this manner we maintain a good resolution with the given 00016 maximum index size while covering the whole stream. 00017 00018 copyright 2007-8 by the mpg123 project - free software under the terms of the LGPL 2.1 00019 see COPYING and AUTHORS files in distribution or http://mpg123.org 00020 initially written by Thomas Orgis 00021 */ 00022 00023 #include "config.h" 00024 #include "compat.h" 00025 00026 struct frame_index 00027 { 00028 off_t *data; /* actual data, the frame positions */ 00029 off_t step; /* advancement in frame number per index point */ 00030 off_t next; /* frame offset supposed to come next into the index */ 00031 size_t size; /* total number of possible entries */ 00032 size_t fill; /* number of used entries */ 00033 size_t grow_size; /* if > 0: index allowed to grow on need with these steps, instead of lowering resolution */ 00034 }; 00035 00036 /* The condition for a framenum to be appended to the index. 00037 if(FI_NEXT(fr->index, fr->num)) fi_add(offset); */ 00038 #define FI_NEXT(fi, framenum) ((fi).size && framenum == (fi).next) 00039 00040 /* Initialize stuff, set things to zero and NULL... */ 00041 void fi_init(struct frame_index *fi); 00042 /* Deallocate/zero things. */ 00043 void fi_exit(struct frame_index *fi); 00044 00045 /* Prepare a given size, preserving current fill, if possible. 00046 If the new size is smaller than fill, the entry density is reduced. 00047 Return 0 on success. */ 00048 int fi_resize(struct frame_index *fi, size_t newsize); 00049 00050 /* Append a frame position, reducing index density if needed. */ 00051 void fi_add(struct frame_index *fi, off_t pos); 00052 00053 /* Replace the frame index */ 00054 int fi_set(struct frame_index *fi, off_t *offsets, off_t step, size_t fill); 00055 00056 /* Empty the index (setting fill=0 and step=1), but keep current size. */ 00057 void fi_reset(struct frame_index *fi); 00058 00059 #endif Generated on Fri May 25 2012 04:31:41 for ReactOS by
1.7.6.1
|