ReactOS
0.4.16-dev-338-g34e76ad
index.h
Go to the documentation of this file.
1
#ifndef MPG123_H_INDEX
2
#define MPG123_H_INDEX
3
4
/*
5
index: frame index data structure and functions
6
7
This is for keeping track of frame positions for accurate seeking.
8
Now in it's own file, with initial code from frame.c and parse.c .
9
10
The idea of the index with a certain amount of entries is to cover
11
all yet-encountered frame positions with minimal coarseness.
12
Meaning: At first every frame position is recorded, then, when
13
the index is full, every second position is trown away to make
14
space. Next time it is full, the same happens. And so on.
15
In this manner we maintain a good resolution with the given
16
maximum index size while covering the whole stream.
17
18
copyright 2007-8 by the mpg123 project - free software under the terms of the LGPL 2.1
19
see COPYING and AUTHORS files in distribution or http://mpg123.org
20
initially written by Thomas Orgis
21
*/
22
23
#include "
config.h
"
24
#include "
compat.h
"
25
26
struct
frame_index
27
{
28
off_t
*
data
;
/* actual data, the frame positions */
29
off_t
step
;
/* advancement in frame number per index point */
30
off_t
next
;
/* frame offset supposed to come next into the index */
31
size_t
size
;
/* total number of possible entries */
32
size_t
fill
;
/* number of used entries */
33
size_t
grow_size
;
/* if > 0: index allowed to grow on need with these steps, instead of lowering resolution */
34
};
35
36
/* The condition for a framenum to be appended to the index.
37
if(FI_NEXT(fr->index, fr->num)) fi_add(offset); */
38
#define FI_NEXT(fi, framenum) ((fi).size && framenum == (fi).next)
39
40
/* Initialize stuff, set things to zero and NULL... */
41
void
fi_init
(
struct
frame_index
*fi);
42
/* Deallocate/zero things. */
43
void
fi_exit
(
struct
frame_index
*fi);
44
45
/* Prepare a given size, preserving current fill, if possible.
46
If the new size is smaller than fill, the entry density is reduced.
47
Return 0 on success. */
48
int
fi_resize
(
struct
frame_index
*fi,
size_t
newsize);
49
50
/* Append a frame position, reducing index density if needed. */
51
void
fi_add
(
struct
frame_index
*fi,
off_t
pos
);
52
53
/* Replace the frame index */
54
int
fi_set
(
struct
frame_index
*fi,
off_t
*
offsets
,
off_t
step,
size_t
fill
);
55
56
/* Empty the index (setting fill=0 and step=1), but keep current size. */
57
void
fi_reset
(
struct
frame_index
*fi);
58
59
#endif
fill
_STLP_MOVE_TO_STD_NAMESPACE void fill(_ForwardIter __first, _ForwardIter __last, const _Tp &__val)
Definition:
_algobase.h:449
off_t
__kernel_off_t off_t
Definition:
linux.h:201
pos
DWORD pos
Definition:
NtGdiDdQueryDirectDrawObject.c:15
offsets
static const FxOffsetAndName offsets[]
Definition:
fxdeviceapi.cpp:800
fi_set
#define fi_set
Definition:
intsym.h:221
fi_init
#define fi_init
Definition:
intsym.h:217
fi_resize
#define fi_resize
Definition:
intsym.h:219
fi_reset
#define fi_reset
Definition:
intsym.h:222
fi_add
#define fi_add
Definition:
intsym.h:220
fi_exit
#define fi_exit
Definition:
intsym.h:218
compat.h
config.h
frame_index
Definition:
index.h:27
frame_index::next
off_t next
Definition:
index.h:30
frame_index::grow_size
size_t grow_size
Definition:
index.h:33
frame_index::fill
size_t fill
Definition:
index.h:32
frame_index::step
off_t step
Definition:
index.h:29
frame_index::data
off_t * data
Definition:
index.h:28
frame_index::size
size_t size
Definition:
index.h:31
sdk
include
reactos
libs
libmpg123
index.h
Generated on Wed Dec 11 2024 06:12:38 for ReactOS by
1.9.6