1 /*****************************************************************************
3 *****************************************************************************
4 * Copyright (C) 2010-2014 L-SMASH project
6 * Authors: Yusuke Nakamura <muken.the.vfrmaniac@gmail.com>
8 * Permission to use, copy, modify, and/or distribute this software for any
9 * purpose with or without fee is hereby granted, provided that the above
10 * copyright notice and this permission notice appear in all copies.
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
13 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
14 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
15 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
16 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
17 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
18 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19 *****************************************************************************/
21 /* This file is available under an ISC license. */
23 typedef struct lsmash_entry_tag lsmash_entry_t
;
25 struct lsmash_entry_tag
36 lsmash_entry_t
*last_accessed_entry
;
37 uint32_t last_accessed_number
;
39 } lsmash_entry_list_t
;
41 typedef void (*lsmash_entry_data_eliminator
)(void *data
); /* very same as free() of standard c lib; void free(void *); */
43 #define lsmash_remove_entry_direct( list, entry, eliminator ) \
44 lsmash_remove_entry_direct_orig( list, entry, (lsmash_entry_data_eliminator)(eliminator) )
46 #define lsmash_remove_entry( list, entry_number, eliminator ) \
47 lsmash_remove_entry_orig( list, entry_number, (lsmash_entry_data_eliminator)(eliminator) )
49 #define lsmash_remove_entry_tail( list, eliminator ) \
50 lsmash_remove_entry_tail_orig( list, (lsmash_entry_data_eliminator)(eliminator) )
52 #define lsmash_remove_entries( list, eliminator ) \
53 lsmash_remove_entries_orig( list, (lsmash_entry_data_eliminator)(eliminator) )
55 #define lsmash_remove_list( list, eliminator ) \
56 lsmash_remove_list_orig( list, (lsmash_entry_data_eliminator)(eliminator) )
58 void lsmash_init_entry_list( lsmash_entry_list_t
*list
);
59 lsmash_entry_list_t
*lsmash_create_entry_list( void );
60 int lsmash_add_entry( lsmash_entry_list_t
*list
, void *data
);
61 int lsmash_remove_entry_direct_orig( lsmash_entry_list_t
*list
, lsmash_entry_t
*entry
, lsmash_entry_data_eliminator eliminator
);
62 int lsmash_remove_entry_orig( lsmash_entry_list_t
*list
, uint32_t entry_number
, lsmash_entry_data_eliminator eliminator
);
63 int lsmash_remove_entry_tail_orig( lsmash_entry_list_t
*list
, lsmash_entry_data_eliminator eliminator
);
64 void lsmash_remove_entries_orig( lsmash_entry_list_t
*list
, lsmash_entry_data_eliminator eliminator
);
65 void lsmash_remove_list_orig( lsmash_entry_list_t
*list
, lsmash_entry_data_eliminator eliminator
);
67 lsmash_entry_t
*lsmash_get_entry( lsmash_entry_list_t
*list
, uint32_t entry_number
);
68 void *lsmash_get_entry_data( lsmash_entry_list_t
*list
, uint32_t entry_number
);