mirror of
https://github.com/tuxbox-neutrino/libstb-hal.git
synced 2025-08-26 23:13:16 +02:00
armbox: fix gst playback
This commit is contained in:
@@ -376,6 +376,7 @@ cPlayback::cPlayback(int num)
|
|||||||
playing = false;
|
playing = false;
|
||||||
playstate = STATE_STOP;
|
playstate = STATE_STOP;
|
||||||
decoders_closed = false;
|
decoders_closed = false;
|
||||||
|
first = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
cPlayback::~cPlayback()
|
cPlayback::~cPlayback()
|
||||||
@@ -544,6 +545,8 @@ bool cPlayback::Start(char *filename, int /*vpid*/, int /*vtype*/, int /*apid*/,
|
|||||||
gst_bus_set_sync_handler(bus, Gst_bus_call, NULL, NULL);
|
gst_bus_set_sync_handler(bus, Gst_bus_call, NULL, NULL);
|
||||||
gst_object_unref(bus);
|
gst_object_unref(bus);
|
||||||
|
|
||||||
|
first = true;
|
||||||
|
|
||||||
// state playing
|
// state playing
|
||||||
if(isHTTP)
|
if(isHTTP)
|
||||||
{
|
{
|
||||||
@@ -629,25 +632,17 @@ bool cPlayback::SetAPid(int pid, bool /*ac3*/)
|
|||||||
|
|
||||||
void cPlayback::trickSeek(int ratio)
|
void cPlayback::trickSeek(int ratio)
|
||||||
{
|
{
|
||||||
bool validposition = false;
|
GstFormat fmt = GST_FORMAT_TIME;
|
||||||
gint64 pos = 0;
|
gint64 pos = 0;
|
||||||
int position;
|
|
||||||
int duration;
|
|
||||||
|
|
||||||
if( GetPosition(position, duration) )
|
|
||||||
{
|
|
||||||
validposition = true;
|
|
||||||
pos = position*1000000;
|
|
||||||
}
|
|
||||||
|
|
||||||
gst_element_set_state(m_gst_playbin, GST_STATE_PLAYING);
|
gst_element_set_state(m_gst_playbin, GST_STATE_PLAYING);
|
||||||
|
|
||||||
if (validposition)
|
if (gst_element_query_position(m_gst_playbin, fmt, &pos))
|
||||||
{
|
{
|
||||||
if(ratio >= 0.0)
|
if(ratio >= 0.0)
|
||||||
gst_element_seek(m_gst_playbin, ratio, GST_FORMAT_TIME, (GstSeekFlags)(GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_SKIP), GST_SEEK_TYPE_SET, pos, GST_SEEK_TYPE_SET, -1);
|
gst_element_seek(m_gst_playbin, ratio, fmt, (GstSeekFlags)(GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_SKIP | GST_SEEK_FLAG_ACCURATE), GST_SEEK_TYPE_SET, pos, GST_SEEK_TYPE_SET, -1);
|
||||||
else
|
else
|
||||||
gst_element_seek(m_gst_playbin, ratio, GST_FORMAT_TIME, (GstSeekFlags)(GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_SKIP), GST_SEEK_TYPE_SET, 0, GST_SEEK_TYPE_SET, pos);
|
gst_element_seek(m_gst_playbin, ratio, fmt, (GstSeekFlags)(GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_SKIP | GST_SEEK_FLAG_ACCURATE), GST_SEEK_TYPE_SET, 0, GST_SEEK_TYPE_SET, pos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -789,9 +784,10 @@ bool cPlayback::SetPosition(int position, bool absolute)
|
|||||||
{
|
{
|
||||||
gst_element_get_state(m_gst_playbin, &state, NULL, GST_CLOCK_TIME_NONE);
|
gst_element_get_state(m_gst_playbin, &state, NULL, GST_CLOCK_TIME_NONE);
|
||||||
|
|
||||||
if ( state == GST_STATE_PAUSED )
|
if ( (state == GST_STATE_PAUSED) && first)
|
||||||
{
|
{
|
||||||
init_jump = position;
|
init_jump = position;
|
||||||
|
first = false;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!absolute)
|
if (!absolute)
|
||||||
|
@@ -47,7 +47,7 @@ struct AVFormatContext;
|
|||||||
class cPlayback
|
class cPlayback
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
bool playing;
|
bool playing, first;
|
||||||
bool decoders_closed;
|
bool decoders_closed;
|
||||||
|
|
||||||
int mSpeed;
|
int mSpeed;
|
||||||
|
Reference in New Issue
Block a user