mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-11 18:34:58 +01:00
New SourcePlayer
Work in progress; Sources now have play/pause and associated play functions. Media player can play all playable sources, and adapts to control a media player when possible. Selection of play groups (to finalize)
This commit is contained in:
23
Stream.cpp
23
Stream.cpp
@@ -31,6 +31,7 @@ Stream::Stream()
|
||||
opened_ = false;
|
||||
enabled_ = true;
|
||||
desired_state_ = GST_STATE_PAUSED;
|
||||
position_ = GST_CLOCK_TIME_NONE;
|
||||
|
||||
width_ = -1;
|
||||
height_ = -1;
|
||||
@@ -371,7 +372,26 @@ bool Stream::isPlaying(bool testpipeline) const
|
||||
return state == GST_STATE_PLAYING;
|
||||
}
|
||||
|
||||
void Stream::rewind()
|
||||
{
|
||||
if ( pipeline_ == nullptr )
|
||||
return;
|
||||
|
||||
GstEvent *seek_event = gst_event_new_seek (1.0, GST_FORMAT_TIME, GST_SEEK_FLAG_FLUSH,
|
||||
GST_SEEK_TYPE_SET, 0, GST_SEEK_TYPE_END, 0);
|
||||
gst_element_send_event(pipeline_, seek_event);
|
||||
}
|
||||
|
||||
GstClockTime Stream::position()
|
||||
{
|
||||
if (position_ == GST_CLOCK_TIME_NONE && pipeline_ != nullptr) {
|
||||
gint64 p = GST_CLOCK_TIME_NONE;
|
||||
if ( gst_element_query_position (pipeline_, GST_FORMAT_TIME, &p) )
|
||||
position_ = p;
|
||||
}
|
||||
|
||||
return position_;
|
||||
}
|
||||
|
||||
void Stream::init_texture(guint index)
|
||||
{
|
||||
@@ -545,6 +565,9 @@ void Stream::update()
|
||||
frame_[read_index].unmap();
|
||||
}
|
||||
|
||||
// we just displayed a vframe : set position time to frame PTS
|
||||
position_ = frame_[read_index].position;
|
||||
|
||||
// avoid reading it again
|
||||
frame_[read_index].status = INVALID;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user