mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-24 02:31:03 +00:00
- properly unref events
Original commit message from CVS: - properly unref events - slightly better seeking
This commit is contained in:
parent
d04ad3e5b0
commit
8a4b3564b5
1 changed files with 28 additions and 7 deletions
|
@ -634,12 +634,14 @@ gst_avi_demux_parse_index (GstAviDemux *avi_demux,
|
||||||
GstEvent *event;
|
GstEvent *event;
|
||||||
|
|
||||||
gst_bytestream_get_status (avi_demux->bs, &remaining, &event);
|
gst_bytestream_get_status (avi_demux->bs, &remaining, &event);
|
||||||
|
gst_event_unref (event);
|
||||||
|
|
||||||
got_bytes = gst_bytestream_read (avi_demux->bs, &buf, 8);
|
got_bytes = gst_bytestream_read (avi_demux->bs, &buf, 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GST_BUFFER_OFFSET (buf) != filepos + offset || GST_BUFFER_SIZE (buf) != 8) {
|
if (GST_BUFFER_OFFSET (buf) != filepos + offset || GST_BUFFER_SIZE (buf) != 8) {
|
||||||
GST_INFO (GST_CAT_PLUGIN_INFO, "avidemux: could not get index");
|
GST_INFO (GST_CAT_PLUGIN_INFO, "avidemux: could not get index, got %lld %d, expected %ld",
|
||||||
|
GST_BUFFER_OFFSET (buf), GST_BUFFER_SIZE (buf), filepos + offset);
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -957,12 +959,19 @@ gst_avi_demux_send_event (GstElement *element, GstEvent *event)
|
||||||
GstPad *pad = GST_PAD (pads->data);
|
GstPad *pad = GST_PAD (pads->data);
|
||||||
|
|
||||||
if (GST_PAD_DIRECTION (pad) == GST_PAD_SRC) {
|
if (GST_PAD_DIRECTION (pad) == GST_PAD_SRC) {
|
||||||
return gst_avi_demux_handle_src_event (pad, event);
|
/* we ref the event here as we might have to try again if the event
|
||||||
|
* failed on this pad */
|
||||||
|
gst_event_ref (event);
|
||||||
|
if (gst_avi_demux_handle_src_event (pad, event)) {
|
||||||
|
gst_event_unref (event);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pads = g_list_next (pads);
|
pads = g_list_next (pads);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gst_event_unref (event);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -977,6 +986,7 @@ gst_avi_demux_handle_src_event (GstPad *pad, GstEvent *event)
|
||||||
|
|
||||||
switch (GST_EVENT_TYPE (event)) {
|
switch (GST_EVENT_TYPE (event)) {
|
||||||
case GST_EVENT_SEEK:
|
case GST_EVENT_SEEK:
|
||||||
|
GST_DEBUG (0, "seek format %d, %08x", GST_EVENT_SEEK_FORMAT (event), stream->strh.type);
|
||||||
switch (GST_EVENT_SEEK_FORMAT (event)) {
|
switch (GST_EVENT_SEEK_FORMAT (event)) {
|
||||||
case GST_FORMAT_BYTES:
|
case GST_FORMAT_BYTES:
|
||||||
case GST_FORMAT_UNITS:
|
case GST_FORMAT_UNITS:
|
||||||
|
@ -989,8 +999,10 @@ gst_avi_demux_handle_src_event (GstPad *pad, GstEvent *event)
|
||||||
guint64 min_index;
|
guint64 min_index;
|
||||||
|
|
||||||
/* no seek on audio yet */
|
/* no seek on audio yet */
|
||||||
if (stream->strh.type == GST_RIFF_FCC_auds)
|
if (stream->strh.type == GST_RIFF_FCC_auds) {
|
||||||
return FALSE;
|
res = FALSE;
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
flags = GST_RIFF_IF_KEYFRAME;
|
flags = GST_RIFF_IF_KEYFRAME;
|
||||||
|
|
||||||
|
@ -1007,6 +1019,7 @@ gst_avi_demux_handle_src_event (GstPad *pad, GstEvent *event)
|
||||||
avi_demux->last_seek = seek_entry->ts;
|
avi_demux->last_seek = seek_entry->ts;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
GST_DEBUG (0, "no index entry found for time %lld", desired_offset);
|
||||||
res = FALSE;
|
res = FALSE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -1020,7 +1033,10 @@ gst_avi_demux_handle_src_event (GstPad *pad, GstEvent *event)
|
||||||
res = FALSE;
|
res = FALSE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
done:
|
||||||
|
gst_event_unref (event);
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1037,6 +1053,7 @@ gst_avi_demux_handle_sink_event (GstAviDemux *avi_demux)
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case GST_EVENT_EOS:
|
case GST_EVENT_EOS:
|
||||||
|
gst_bytestream_flush (avi_demux->bs, remaining);
|
||||||
gst_pad_event_default (avi_demux->sinkpad, event);
|
gst_pad_event_default (avi_demux->sinkpad, event);
|
||||||
break;
|
break;
|
||||||
case GST_EVENT_FLUSH:
|
case GST_EVENT_FLUSH:
|
||||||
|
@ -1045,15 +1062,16 @@ gst_avi_demux_handle_sink_event (GstAviDemux *avi_demux)
|
||||||
case GST_EVENT_DISCONTINUOUS:
|
case GST_EVENT_DISCONTINUOUS:
|
||||||
{
|
{
|
||||||
gint i;
|
gint i;
|
||||||
|
GstEvent *discont;
|
||||||
|
|
||||||
for (i = 0; i < avi_demux->num_streams; i++) {
|
for (i = 0; i < avi_demux->num_streams; i++) {
|
||||||
avi_stream_context *stream = &avi_demux->stream[i];
|
avi_stream_context *stream = &avi_demux->stream[i];
|
||||||
|
|
||||||
GST_DEBUG (GST_CAT_EVENT, "sending discont on %d %lld + %lld = %lld", i,
|
GST_DEBUG (GST_CAT_EVENT, "sending discont on %d %lld + %lld = %lld", i,
|
||||||
avi_demux->last_seek, stream->delay, avi_demux->last_seek + stream->delay);
|
avi_demux->last_seek, stream->delay, avi_demux->last_seek + stream->delay);
|
||||||
event = gst_event_new_discontinuous (FALSE, GST_FORMAT_TIME,
|
discont = gst_event_new_discontinuous (FALSE, GST_FORMAT_TIME,
|
||||||
avi_demux->last_seek + stream->delay , NULL);
|
avi_demux->last_seek + stream->delay , NULL);
|
||||||
gst_pad_push (stream->pad, GST_BUFFER (event));
|
gst_pad_push (stream->pad, GST_BUFFER (discont));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1062,6 +1080,8 @@ gst_avi_demux_handle_sink_event (GstAviDemux *avi_demux)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gst_event_unref (event);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1164,6 +1184,7 @@ gst_avi_demux_process_chunk (GstAviDemux *avi_demux, guint64 *filepos,
|
||||||
GstEvent *event;
|
GstEvent *event;
|
||||||
|
|
||||||
gst_bytestream_get_status (avi_demux->bs, &remaining, &event);
|
gst_bytestream_get_status (avi_demux->bs, &remaining, &event);
|
||||||
|
gst_event_unref (event);
|
||||||
}
|
}
|
||||||
if (avi_demux->avih.bufsize)
|
if (avi_demux->avih.bufsize)
|
||||||
gst_bytestream_size_hint (avi_demux->bs, avi_demux->avih.bufsize);
|
gst_bytestream_size_hint (avi_demux->bs, avi_demux->avih.bufsize);
|
||||||
|
|
Loading…
Reference in a new issue