mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 00:36:51 +00:00
Do better sync
Original commit message from CVS: Do better sync
This commit is contained in:
parent
4c137abcf6
commit
b89f95f179
1 changed files with 14 additions and 20 deletions
|
@ -355,6 +355,8 @@ gst_vorbisfile_loop (GstElement *element)
|
||||||
VorbisFile *vorbisfile = GST_VORBISFILE (element);
|
VorbisFile *vorbisfile = GST_VORBISFILE (element);
|
||||||
GstBuffer *outbuf;
|
GstBuffer *outbuf;
|
||||||
long ret;
|
long ret;
|
||||||
|
GstClockTime time;
|
||||||
|
gint64 samples;
|
||||||
|
|
||||||
if (vorbisfile->restart) {
|
if (vorbisfile->restart) {
|
||||||
vorbisfile->current_section = 0;
|
vorbisfile->current_section = 0;
|
||||||
|
@ -403,13 +405,20 @@ gst_vorbisfile_loop (GstElement *element)
|
||||||
vorbisfile->seek_pending = FALSE;
|
vorbisfile->seek_pending = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
outbuf = gst_buffer_new ();
|
||||||
|
GST_BUFFER_DATA (outbuf) = g_malloc (4096);
|
||||||
|
GST_BUFFER_SIZE (outbuf) = 4096;
|
||||||
|
|
||||||
|
/* get current time for discont and buffer timestamp */
|
||||||
|
time = (GstClockTime) (ov_time_tell (&vorbisfile->vf) * GST_SECOND);
|
||||||
|
|
||||||
|
ret = ov_read (&vorbisfile->vf, GST_BUFFER_DATA (outbuf), GST_BUFFER_SIZE (outbuf),
|
||||||
|
0, 2, 1, &vorbisfile->current_section);
|
||||||
|
|
||||||
if (vorbisfile->need_discont) {
|
if (vorbisfile->need_discont) {
|
||||||
GstEvent *discont;
|
GstEvent *discont;
|
||||||
GstClockTime time;
|
|
||||||
gint64 samples;
|
|
||||||
|
|
||||||
/* get stream stats */
|
/* get stream stats */
|
||||||
time = (gint64) (ov_time_tell (&vorbisfile->vf) * GST_SECOND);
|
|
||||||
samples = (gint64) (ov_pcm_tell (&vorbisfile->vf));
|
samples = (gint64) (ov_pcm_tell (&vorbisfile->vf));
|
||||||
|
|
||||||
discont = gst_event_new_discontinuous (FALSE, GST_FORMAT_TIME, time,
|
discont = gst_event_new_discontinuous (FALSE, GST_FORMAT_TIME, time,
|
||||||
|
@ -419,13 +428,6 @@ gst_vorbisfile_loop (GstElement *element)
|
||||||
gst_pad_push (vorbisfile->srcpad, GST_BUFFER (discont));
|
gst_pad_push (vorbisfile->srcpad, GST_BUFFER (discont));
|
||||||
}
|
}
|
||||||
|
|
||||||
outbuf = gst_buffer_new ();
|
|
||||||
GST_BUFFER_DATA (outbuf) = g_malloc (4096);
|
|
||||||
GST_BUFFER_SIZE (outbuf) = 4096;
|
|
||||||
|
|
||||||
ret = ov_read (&vorbisfile->vf, GST_BUFFER_DATA (outbuf), GST_BUFFER_SIZE (outbuf),
|
|
||||||
0, 2, 1, &vorbisfile->current_section);
|
|
||||||
|
|
||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
GST_DEBUG (0, "eos");
|
GST_DEBUG (0, "eos");
|
||||||
//ov_clear (&vorbisfile->vf);
|
//ov_clear (&vorbisfile->vf);
|
||||||
|
@ -461,21 +463,13 @@ gst_vorbisfile_loop (GstElement *element)
|
||||||
|
|
||||||
vorbisfile->may_eos = TRUE;
|
vorbisfile->may_eos = TRUE;
|
||||||
|
|
||||||
{
|
GST_BUFFER_TIMESTAMP (outbuf) = time;
|
||||||
GstFormat format;
|
|
||||||
gint64 value;
|
|
||||||
|
|
||||||
format = GST_FORMAT_TIME;
|
|
||||||
gst_vorbisfile_src_query (vorbisfile->srcpad, GST_PAD_QUERY_POSITION, &format, &value);
|
|
||||||
|
|
||||||
GST_BUFFER_TIMESTAMP (outbuf) = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!vorbisfile->vf.seekable) {
|
if (!vorbisfile->vf.seekable) {
|
||||||
vorbisfile->total_bytes += GST_BUFFER_SIZE (outbuf);
|
vorbisfile->total_bytes += GST_BUFFER_SIZE (outbuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GST_PAD_IS_CONNECTED (vorbisfile->srcpad)) {
|
if (GST_PAD_IS_USABLE (vorbisfile->srcpad)) {
|
||||||
gst_pad_push (vorbisfile->srcpad, outbuf);
|
gst_pad_push (vorbisfile->srcpad, outbuf);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
Loading…
Reference in a new issue