AAC: Detect corrupted stream
[cmus.git] / track.h
blobdf25e37908ff42ce943bac807d8efbda2a6f3618
1 /*
2 * Copyright 2006 Timo Hirvonen
3 */
5 #ifndef TRACK_H
6 #define TRACK_H
8 #include "list.h"
9 #include "iter.h"
11 struct simple_track {
12 struct list_head node;
13 struct track_info *info;
14 unsigned int marked : 1;
17 struct shuffle_track {
18 struct simple_track simple_track;
19 struct list_head node;
22 static inline struct track_info *shuffle_track_info(const struct shuffle_track *track)
24 return ((struct simple_track *)track)->info;
27 static inline struct simple_track *to_simple_track(const struct list_head *item)
29 return container_of(item, struct simple_track, node);
32 static inline struct shuffle_track *to_shuffle_track(const struct list_head *item)
34 return container_of(item, struct shuffle_track, node);
37 static inline struct simple_track *iter_to_simple_track(const struct iter *iter)
39 return iter->data1;
42 /* NOTE: does not ref ti */
43 void simple_track_init(struct simple_track *track, struct track_info *ti);
45 /* refs ti */
46 struct simple_track *simple_track_new(struct track_info *ti);
48 int simple_track_get_prev(struct iter *);
49 int simple_track_get_next(struct iter *);
51 /* data is window */
52 int simple_track_search_get_current(void *data, struct iter *iter);
53 int simple_track_search_matches(void *data, struct iter *iter, const char *text);
55 struct shuffle_track *shuffle_list_get_next(struct list_head *head, struct shuffle_track *cur,
56 int (*filter)(const struct simple_track *));
58 struct shuffle_track *shuffle_list_get_prev(struct list_head *head, struct shuffle_track *cur,
59 int (*filter)(const struct simple_track *));
61 struct simple_track *simple_list_get_next(struct list_head *head, struct simple_track *cur,
62 int (*filter)(const struct simple_track *));
64 struct simple_track *simple_list_get_prev(struct list_head *head, struct simple_track *cur,
65 int (*filter)(const struct simple_track *));
67 void sorted_list_add_track(struct list_head *head, struct simple_track *track, const char * const *keys);
69 void shuffle_list_add_track(struct list_head *head, struct list_head *node, int nr);
70 void reshuffle(struct list_head *head);
72 int simple_list_for_each_marked(struct list_head *head,
73 int (*cb)(void *data, struct track_info *ti), void *data, int reverse);
75 #endif