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:
parent
76e400e156
commit
0f2e30589d
16
core/audio.c
16
core/audio.c
|
@ -32,7 +32,7 @@ static bool __audio_change_state(GstState state)
|
||||||
GstStateChangeReturn ret = GST_STATE_CHANGE_FAILURE;
|
GstStateChangeReturn ret = GST_STATE_CHANGE_FAILURE;
|
||||||
|
|
||||||
if (audio_cur_state() != state)
|
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)
|
if (ret == GST_STATE_CHANGE_FAILURE)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -213,8 +213,8 @@ struct track *audio_cur_track()
|
||||||
GstState audio_cur_state()
|
GstState audio_cur_state()
|
||||||
{
|
{
|
||||||
GstState cur = GST_STATE_NULL;
|
GstState cur = GST_STATE_NULL;
|
||||||
if (audio_player)
|
if (audio_pipeline)
|
||||||
gst_element_get_state(audio_player,
|
gst_element_get_state(audio_pipeline,
|
||||||
&cur, NULL,
|
&cur, NULL,
|
||||||
GST_CLOCK_TIME_NONE);
|
GST_CLOCK_TIME_NONE);
|
||||||
return cur;
|
return cur;
|
||||||
|
@ -229,13 +229,13 @@ void audio_set_volume(unsigned int volume)
|
||||||
vol = (gdouble)volume / 100;
|
vol = (gdouble)volume / 100;
|
||||||
|
|
||||||
settings_set(SETTINGS_VOLUME, volume);
|
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()
|
unsigned int audio_get_volume()
|
||||||
{
|
{
|
||||||
gdouble 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;
|
return volume * 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -257,7 +257,7 @@ bool audio_seek(gint64 offset)
|
||||||
{
|
{
|
||||||
if (!audio_track)
|
if (!audio_track)
|
||||||
return false;
|
return false;
|
||||||
return gst_element_seek_simple(audio_player,
|
return gst_element_seek_simple(audio_pipeline,
|
||||||
GST_FORMAT_TIME,
|
GST_FORMAT_TIME,
|
||||||
GST_SEEK_FLAG_FLUSH,
|
GST_SEEK_FLAG_FLUSH,
|
||||||
offset);
|
offset);
|
||||||
|
@ -266,7 +266,7 @@ bool audio_seek(gint64 offset)
|
||||||
gint64 audio_position()
|
gint64 audio_position()
|
||||||
{
|
{
|
||||||
gint64 position;
|
gint64 position;
|
||||||
if (gst_element_query_position(audio_player,
|
if (gst_element_query_position(audio_pipeline,
|
||||||
GST_FORMAT_TIME,
|
GST_FORMAT_TIME,
|
||||||
&position))
|
&position))
|
||||||
return position;
|
return position;
|
||||||
|
@ -276,7 +276,7 @@ gint64 audio_position()
|
||||||
gint64 audio_duration()
|
gint64 audio_duration()
|
||||||
{
|
{
|
||||||
gint64 duration;
|
gint64 duration;
|
||||||
if (gst_element_query_duration(audio_player,
|
if (gst_element_query_duration(audio_pipeline,
|
||||||
GST_FORMAT_TIME,
|
GST_FORMAT_TIME,
|
||||||
&duration))
|
&duration))
|
||||||
return duration;
|
return duration;
|
||||||
|
|
|
@ -25,7 +25,7 @@ static void test_send_error()
|
||||||
GError *error;
|
GError *error;
|
||||||
|
|
||||||
error = g_error_new(1, G_FILE_ERROR_BADF, "Simulated 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");
|
error, "Fake error for testing");
|
||||||
audio_error(message);
|
audio_error(message);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue