core/audio: Switch controls to the new pipeline player

Implements #103: Switch to custom GstPipeline
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This commit is contained in:
Anna Schumaker 2017-04-05 11:47:02 -04:00
parent 76e400e156
commit 0f2e30589d
2 changed files with 9 additions and 9 deletions

View File

@ -32,7 +32,7 @@ static bool __audio_change_state(GstState state)
GstStateChangeReturn ret = GST_STATE_CHANGE_FAILURE;
if (audio_cur_state() != state)
ret = gst_element_set_state(audio_player, state);
ret = gst_element_set_state(audio_pipeline, state);
if (ret == GST_STATE_CHANGE_FAILURE)
return false;
@ -213,8 +213,8 @@ struct track *audio_cur_track()
GstState audio_cur_state()
{
GstState cur = GST_STATE_NULL;
if (audio_player)
gst_element_get_state(audio_player,
if (audio_pipeline)
gst_element_get_state(audio_pipeline,
&cur, NULL,
GST_CLOCK_TIME_NONE);
return cur;
@ -229,13 +229,13 @@ void audio_set_volume(unsigned int volume)
vol = (gdouble)volume / 100;
settings_set(SETTINGS_VOLUME, volume);
g_object_set(G_OBJECT(audio_player), "volume", vol, NULL);
g_object_set(G_OBJECT(audio_volume), "volume", vol, NULL);
}
unsigned int audio_get_volume()
{
gdouble volume;
g_object_get(G_OBJECT(audio_player), "volume", &volume, NULL);
g_object_get(G_OBJECT(audio_volume), "volume", &volume, NULL);
return volume * 100;
}
@ -257,7 +257,7 @@ bool audio_seek(gint64 offset)
{
if (!audio_track)
return false;
return gst_element_seek_simple(audio_player,
return gst_element_seek_simple(audio_pipeline,
GST_FORMAT_TIME,
GST_SEEK_FLAG_FLUSH,
offset);
@ -266,7 +266,7 @@ bool audio_seek(gint64 offset)
gint64 audio_position()
{
gint64 position;
if (gst_element_query_position(audio_player,
if (gst_element_query_position(audio_pipeline,
GST_FORMAT_TIME,
&position))
return position;
@ -276,7 +276,7 @@ gint64 audio_position()
gint64 audio_duration()
{
gint64 duration;
if (gst_element_query_duration(audio_player,
if (gst_element_query_duration(audio_pipeline,
GST_FORMAT_TIME,
&duration))
return duration;

View File

@ -25,7 +25,7 @@ static void test_send_error()
GError *error;
error = g_error_new(1, G_FILE_ERROR_BADF, "Simulated Error");
message = gst_message_new_error(GST_OBJECT(test_old_player()),
message = gst_message_new_error(GST_OBJECT(test_audio_pipeline()),
error, "Fake error for testing");
audio_error(message);