Merge branch 'tizen_3.0' into tizen for sync
[apps/native/boot-animation.git] / inc / wav_player.h
1 /*
2  * Copyright (c) 2009-2015 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 enum running_state {
19         STATE_UNKNOWN = 0x00,
20         STATE_READY = 0x01,
21         STATE_PLAY = 0x02,
22 };
23
24 struct player {
25         /* initializer will be invoked when the player is ready to play wave file. */
26         /* normally, it is invoked at right after complete the format header loading */
27         int (*init) (struct player * player, struct wave * handle);
28         /* Play if if is ready, normaly, this callback can
29            be invoked after the format header is loaded. */
30         int (*play) (struct player * player, struct wave * handle);
31         /* After parsing all chunks in the wave file, this function will be invoked */
32         int (*fini) (struct player * player);
33
34         void *data;
35         enum running_state state;
36 };
37
38 extern struct player *create_player(void);
39 extern int set_player_initializer(struct player *player,
40                                   int (*init) (struct player * player,
41                                                struct wave * handle));
42 extern int set_player_player(struct player *player,
43                              int (*play) (struct player * player,
44                                           struct wave * handle));
45 extern int set_player_finalizer(struct player *player,
46                                 int (*fini) (struct player * player));
47 extern int init_player(struct player *player, struct wave *handle, void *data);
48 extern int play_player(struct player *player, struct wave *handle);
49 extern int fini_player(struct player *player);
50 extern void destroy_player(struct player *player);