core/audio: Remove playbin-based player
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This commit is contained in:
parent
0f2e30589d
commit
c03530f318
26
core/audio.c
26
core/audio.c
|
@ -13,9 +13,6 @@ static struct file audio_file = FILE_INIT("cur_track", 0);
|
|||
static struct track *audio_track = NULL;
|
||||
static int audio_pause_count = -1;
|
||||
|
||||
static GstElement *audio_player = NULL;
|
||||
static guint audio_old_id = 0;
|
||||
|
||||
static GstElement *audio_pipeline = NULL;
|
||||
static GstElement *audio_source = NULL;
|
||||
static GstElement *audio_decoder = NULL;
|
||||
|
@ -44,12 +41,8 @@ static bool __audio_change_state(GstState state)
|
|||
static void __audio_gst_load(struct track *track, GstState state)
|
||||
{
|
||||
gchar *path = track_path(track);
|
||||
gchar *uri = gst_filename_to_uri(path, NULL);
|
||||
|
||||
audio_track = track;
|
||||
gst_element_set_state(audio_player, GST_STATE_NULL);
|
||||
g_object_set(G_OBJECT(audio_player), "uri", uri, NULL);
|
||||
|
||||
gst_element_set_state(audio_pipeline, GST_STATE_READY);
|
||||
g_object_set(G_OBJECT(audio_source), "location", path, NULL);
|
||||
|
||||
|
@ -59,7 +52,6 @@ static void __audio_gst_load(struct track *track, GstState state)
|
|||
audio_cb->audio_cb_load(track);
|
||||
|
||||
audio_save();
|
||||
g_free(uri);
|
||||
g_free(path);
|
||||
}
|
||||
|
||||
|
@ -139,13 +131,7 @@ void audio_init(int *argc, char ***argv, struct audio_callbacks *callbacks)
|
|||
GstBus *bus;
|
||||
|
||||
gst_init(argc, argv);
|
||||
audio_player = gst_element_factory_make("playbin", "ocarina_player");
|
||||
audio_cb = callbacks;
|
||||
|
||||
bus = gst_pipeline_get_bus(GST_PIPELINE(audio_player));
|
||||
audio_old_id = gst_bus_add_watch(bus, __audio_message, NULL);
|
||||
gst_object_unref(bus);
|
||||
|
||||
audio_cb = callbacks;
|
||||
audio_pipeline = gst_pipeline_new("pipeline");
|
||||
audio_source = gst_element_factory_make("filesrc", "source");
|
||||
audio_decoder = gst_element_factory_make("decodebin", "decoder");
|
||||
|
@ -172,15 +158,10 @@ void audio_init(int *argc, char ***argv, struct audio_callbacks *callbacks)
|
|||
|
||||
void audio_deinit()
|
||||
{
|
||||
gst_element_set_state(audio_player, GST_STATE_NULL);
|
||||
gst_object_unref(GST_ELEMENT(audio_player));
|
||||
g_source_remove(audio_old_id);
|
||||
|
||||
gst_element_set_state(audio_pipeline, GST_STATE_NULL);
|
||||
gst_object_unref(GST_ELEMENT(audio_pipeline));
|
||||
g_source_remove(audio_bus_id);
|
||||
|
||||
audio_player = NULL;
|
||||
audio_pipeline = NULL;
|
||||
audio_source = NULL;
|
||||
audio_decoder = NULL;
|
||||
|
@ -345,9 +326,4 @@ GstElement *test_audio_pipeline()
|
|||
{
|
||||
return audio_pipeline;
|
||||
}
|
||||
|
||||
GstElement *test_old_player()
|
||||
{
|
||||
return audio_player;
|
||||
}
|
||||
#endif /* CONFIG_TESTING */
|
||||
|
|
|
@ -83,6 +83,5 @@ void audio_pause_after(int);
|
|||
|
||||
#ifdef CONFIG_TESTING
|
||||
GstElement *test_audio_pipeline();
|
||||
GstElement *test_old_player();
|
||||
#endif /* CONFIG_TESTING */
|
||||
#endif /* OCARINA_CORE_AUDIO_H */
|
||||
|
|
|
@ -48,7 +48,6 @@ static struct audio_callbacks test_audio_cb = {
|
|||
static void test_init()
|
||||
{
|
||||
g_assert_null(test_audio_pipeline());
|
||||
g_assert_null(test_old_player());
|
||||
g_assert_null(audio_cur_track());
|
||||
g_assert_cmpuint(audio_cur_state(), ==, GST_STATE_NULL);
|
||||
g_assert_null(audio_next());
|
||||
|
@ -75,7 +74,6 @@ static void test_init()
|
|||
|
||||
g_assert_null(audio_cur_track());
|
||||
g_assert_nonnull(test_audio_pipeline());
|
||||
g_assert_nonnull(test_old_player());
|
||||
}
|
||||
|
||||
static void test_playback()
|
||||
|
@ -239,7 +237,6 @@ static void test_deinit()
|
|||
core_deinit();
|
||||
g_assert_null(audio_cur_track());
|
||||
g_assert_null(test_audio_pipeline());
|
||||
g_assert_null(test_old_player());
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue