ext/ffmpeg/gstffmpegdemux.c: Rework the demuxer, implement all seeking stuff including seek in ready.

Original commit message from CVS:
* ext/ffmpeg/gstffmpegdemux.c: (gst_ffmpegdemux_base_init),
(gst_ffmpegdemux_class_init), (gst_ffmpegdemux_init),
(gst_ffmpegdemux_close), (gst_ffmpegdemux_push_event),
(gst_ffmpegdemux_set_flags), (gst_ffmpegdemux_is_eos),
(gst_ffmpegdemux_do_seek), (gst_ffmpegdemux_perform_seek),
(gst_ffmpegdemux_src_event), (gst_ffmpegdemux_send_event),
(gst_ffmpegdemux_src_query), (gst_ffmpegdemux_src_convert),
(gst_ffmpegdemux_get_stream), (my_safe_copy),
(gst_ffmpegdemux_read_tags), (gst_ffmpegdemux_open),
(gst_ffmpegdemux_loop), (gst_ffmpegdemux_sink_activate),
(gst_ffmpegdemux_sink_activate_pull),
(gst_ffmpegdemux_change_state), (gst_ffmpegdemux_register):
Rework the demuxer, implement all seeking stuff including
seek in ready.
* ext/ffmpeg/gstffmpegprotocol.c: (gst_ffmpegdata_peek),
(gst_ffmpegdata_close):
Handle some more cases.
This commit is contained in:
Wim Taymans 2006-04-13 16:22:53 +00:00
parent 0c66583ee9
commit 55eac5b0c0
3 changed files with 827 additions and 480 deletions

View file

@ -1,3 +1,24 @@
2006-04-13 Wim Taymans <wim@fluendo.com>
* ext/ffmpeg/gstffmpegdemux.c: (gst_ffmpegdemux_base_init),
(gst_ffmpegdemux_class_init), (gst_ffmpegdemux_init),
(gst_ffmpegdemux_close), (gst_ffmpegdemux_push_event),
(gst_ffmpegdemux_set_flags), (gst_ffmpegdemux_is_eos),
(gst_ffmpegdemux_do_seek), (gst_ffmpegdemux_perform_seek),
(gst_ffmpegdemux_src_event), (gst_ffmpegdemux_send_event),
(gst_ffmpegdemux_src_query), (gst_ffmpegdemux_src_convert),
(gst_ffmpegdemux_get_stream), (my_safe_copy),
(gst_ffmpegdemux_read_tags), (gst_ffmpegdemux_open),
(gst_ffmpegdemux_loop), (gst_ffmpegdemux_sink_activate),
(gst_ffmpegdemux_sink_activate_pull),
(gst_ffmpegdemux_change_state), (gst_ffmpegdemux_register):
Rework the demuxer, implement all seeking stuff including
seek in ready.
* ext/ffmpeg/gstffmpegprotocol.c: (gst_ffmpegdata_peek),
(gst_ffmpegdata_close):
Handle some more cases.
2006-04-11 Wim Taymans <wim@fluendo.com> 2006-04-11 Wim Taymans <wim@fluendo.com>
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_sink_event): * ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_sink_event):

File diff suppressed because it is too large Load diff

View file

@ -103,17 +103,29 @@ gst_ffmpegdata_peek (URLContext * h, unsigned char *buf, int size)
g_return_val_if_fail (h->flags == URL_RDONLY, AVERROR_IO); g_return_val_if_fail (h->flags == URL_RDONLY, AVERROR_IO);
info = (GstProtocolInfo *) h->priv_data; info = (GstProtocolInfo *) h->priv_data;
GST_DEBUG ("Pulling %d bytes at position %lld", size, info->offset);
ret = gst_pad_pull_range(info->pad, info->offset, (guint) size, &inbuf); ret = gst_pad_pull_range(info->pad, info->offset, (guint) size, &inbuf);
if ((ret == GST_FLOW_OK) || (ret == GST_FLOW_UNEXPECTED)) { switch (ret) {
if (inbuf) { case GST_FLOW_OK:
total = (gint) GST_BUFFER_SIZE (inbuf); total = (gint) GST_BUFFER_SIZE (inbuf);
memcpy (buf, GST_BUFFER_DATA (inbuf), total); memcpy (buf, GST_BUFFER_DATA (inbuf), total);
gst_buffer_unref (inbuf); gst_buffer_unref (inbuf);
break;
case GST_FLOW_UNEXPECTED:
total = 0;
break;
case GST_FLOW_WRONG_STATE:
total = -1;
break;
default:
case GST_FLOW_ERROR:
total = -2;
break;
} }
} else {
return -1; GST_DEBUG ("Got %d (%s) return result %d", ret, gst_flow_get_name (ret), total);
}
return total; return total;
} }
@ -227,21 +239,25 @@ gst_ffmpegdata_close (URLContext * h)
GstProtocolInfo *info; GstProtocolInfo *info;
info = (GstProtocolInfo *) h->priv_data; info = (GstProtocolInfo *) h->priv_data;
if (info == NULL)
return 0;
GST_LOG ("Closing file"); GST_LOG ("Closing file");
switch (h->flags) { switch (h->flags) {
case URL_WRONLY:{ case URL_WRONLY:
{
/* send EOS - that closes down the stream */ /* send EOS - that closes down the stream */
gst_pad_push_event (info->pad, gst_event_new_eos()); gst_pad_push_event (info->pad, gst_event_new_eos());
}
break; break;
}
default: default:
break; break;
} }
/* clean up data */ /* clean up data */
g_free (info); g_free (info);
h->priv_data = NULL;
return 0; return 0;
} }