playback_service.h 6.01 KB
Newer Older
1
/*****************************************************************************
Ludovic Fauvet's avatar
Ludovic Fauvet committed
2
 * Copyright © 2015-2016 VideoLAN, VideoLabs SAS
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
 *****************************************************************************
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
 *****************************************************************************/
/*
 * By committing to this project, you allow VideoLAN and VideoLabs to relicense
 * the code to a different OSI approved license, in case it is required for
 * compatibility with the Store
 *****************************************************************************/

#ifndef PLAYBACK_SERVICE_H
#define PLAYBACK_SERVICE_H

#include "application.h"
29
#include "media/media_item.h"
30
#include "media/media_list.h"
31

Thomas Guillem's avatar
Thomas Guillem committed
32
enum PLAYLIST_CONTEXT {
33
    PLAYLIST_CONTEXT_NONE,
Thomas Guillem's avatar
Thomas Guillem committed
34
    PLAYLIST_CONTEXT_AUDIO,
35
    PLAYLIST_CONTEXT_VIDEO,
Thomas Guillem's avatar
Thomas Guillem committed
36 37 38
    PLAYLIST_CONTEXT_OTHERS,
};

39
typedef struct playback_service_cbs_id playback_service_cbs_id;
Thomas Guillem's avatar
Thomas Guillem committed
40 41 42
typedef struct playback_service_callbacks playback_service_callbacks;
struct playback_service_callbacks
{
43 44 45
    void (*pf_on_media_added)(playback_service *p_ps, void *p_user_data, unsigned int i_pos, media_item *p_mi);
    void (*pf_on_media_removed)(playback_service *p_ps, void *p_user_data, unsigned int i_pos, media_item *p_mi);
    void (*pf_on_media_selected)(playback_service *p_ps, void *p_user_data, unsigned int i_pos, media_item *p_mi);
46
    void (*pf_on_started)(playback_service *p_ps, void *p_user_data, media_item *p_mi);
47
    void (*pf_on_playpause)(playback_service *p_ps, void *p_user_data, bool b_playing);
48
    void (*pf_on_stopped)(playback_service *p_ps, void *p_user_data);
49
    void (*pf_on_new_len)(playback_service *p_ps, void *p_user_data, double i_len);
50
    void (*pf_on_new_time)(playback_service *p_ps, void *p_user_data, double i_time, double i_pos);
51
    void (*pf_on_seek_done)(playback_service *p_ps, void *p_user_data);
Thomas Guillem's avatar
Thomas Guillem committed
52
    void *p_user_data;
53
    enum PLAYLIST_CONTEXT i_ctx;
Thomas Guillem's avatar
Thomas Guillem committed
54 55
};

56 57 58 59 60
typedef void      (*ps_on_emotion_restart)(void *data);

void
ps_register_on_emotion_restart_cb(playback_service *p_ps, ps_on_emotion_restart func, void *data);

61
playback_service *
62
playback_service_create(application *p_app);
63 64 65 66

void
playback_service_destroy(playback_service *p_ps);

67
int
68
playback_service_restart_emotion(playback_service *p_ps, bool immediate);
69

Thomas Guillem's avatar
Thomas Guillem committed
70 71 72
int
playback_service_set_context(playback_service *p_ps, enum PLAYLIST_CONTEXT i_ctx);

73 74 75
enum PLAYLIST_CONTEXT
playback_service_get_context(playback_service *p_ps);

76
playback_service_cbs_id *
Thomas Guillem's avatar
Thomas Guillem committed
77 78 79
playback_service_register_callbacks(playback_service *p_ps, playback_service_callbacks *p_cbs);

void
80
playback_service_unregister_callbacks(playback_service *p_ps, playback_service_cbs_id *p_id);
Thomas Guillem's avatar
Thomas Guillem committed
81

82
Evas_Object *
83 84
playback_service_set_evas_video(playback_service *p_ps, Evas *p_evas);

Thomas Guillem's avatar
Thomas Guillem committed
85
int
86
playback_service_start(playback_service *p_ps, double i_time);
Thomas Guillem's avatar
Thomas Guillem committed
87 88 89 90

int
playback_service_stop(playback_service *p_ps);

91 92 93
int
playback_service_stop_notify(playback_service *p_ps, bool b_notify);

94 95 96
bool
playback_service_is_started(playback_service *p_ps);

Thomas Guillem's avatar
Thomas Guillem committed
97 98 99 100 101 102
int
playback_service_play(playback_service *p_ps);

int
playback_service_pause(playback_service *p_ps);

103 104 105 106 107 108
bool
playback_service_toggle_play_pause(playback_service *p_ps);

int
playback_service_pause(playback_service *p_ps);

109 110 111
bool
playback_service_is_playing(playback_service *p_ps);

112 113 114
double
playback_service_get_time(playback_service *p_ps);

Thomas Guillem's avatar
Thomas Guillem committed
115 116 117 118 119 120 121
double
playback_service_get_pos(playback_service *p_ps);

double
playback_service_get_len(playback_service *p_ps);

int
122 123 124 125 126 127 128 129 130 131
playback_service_seek_time(playback_service *p_ps, double i_time);

int
playback_service_seek_pos(playback_service *p_ps, double i_percent);

int
playback_service_seek_forward(playback_service *p_ps);

int
playback_service_seek_backward(playback_service *p_ps);
Thomas Guillem's avatar
Thomas Guillem committed
132

133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170
int
playback_service_list_insert(playback_service *p_ps, int i_index, media_item *p_mi);

static inline int
playback_service_list_append(playback_service *p_ps, media_item *p_mi)
{
    return playback_service_list_insert(p_ps, -1, p_mi);
}

int
playback_service_list_remove(playback_service *p_ps, media_item *p_mi);

int
playback_service_list_remove_index(playback_service *p_ps, unsigned int i_index);

void
playback_service_list_clear(playback_service *p_ps);

unsigned int
playback_service_list_get_count(playback_service *p_ps);

unsigned int
playback_service_list_get_pos(playback_service *p_ps);

void
playback_service_list_set_pos(playback_service *p_ps, unsigned int i_index);

void
playback_service_list_set_next(playback_service *p_ps);

void
playback_service_list_set_prev(playback_service *p_ps);

media_item *
playback_service_list_get_item(playback_service *p_ps);

media_item *
playback_service_list_get_item_at(playback_service *p_ps,  unsigned int i_index);
Thomas Guillem's avatar
Thomas Guillem committed
171

172
Eina_List*
173
playback_service_spu_channel_get_list(playback_service *p_ps);
174 175

void
176
playback_service_spu_channel_set(playback_service *p_ps, int spu);
177

178 179 180 181 182 183
Eina_List*
playback_service_audio_channel_get_list(playback_service *p_ps);

void
playback_service_audio_channel_set(playback_service *p_ps, int channel);

184 185 186
void
playback_service_set_auto_exit(playback_service *p_ps, bool value);

187 188 189 190 191 192
void
playback_service_set_repeat_mode(playback_service *p_ps, enum PLAYLIST_REPEAT i_repeat);

enum PLAYLIST_REPEAT
playback_service_get_repeat_mode(playback_service *p_ps);

193 194 195 196 197 198
double
playback_service_get_play_speed(playback_service *p_ps);

void
playback_service_set_play_speed(playback_service *p_ps, double rate);

199
#endif /* PLAYBACK_SERVICE_H */