gst/base/gstbasesrc.c: Small update to stop at the configured segment_end position.

Original commit message from CVS:
* gst/base/gstbasesrc.c: (gst_base_src_get_range):
Small update to stop at the configured segment_end
position.
This commit is contained in:
Wim Taymans 2005-11-04 15:33:40 +00:00
parent 77a1cfd244
commit 875b25482c
3 changed files with 44 additions and 18 deletions

View file

@ -1,3 +1,9 @@
2005-11-04 Wim Taymans <wim@fluendo.com>
* gst/base/gstbasesrc.c: (gst_base_src_get_range):
Small update to stop at the configured segment_end
position.
2005-11-04 Stefan Kost <ensonic@users.sf.net>
* gst/gstregistry.c:

View file

@ -786,6 +786,7 @@ gst_base_src_get_range (GstBaseSrc * src, guint64 offset, guint length,
{
GstFlowReturn ret;
GstBaseSrcClass *bclass;
gint64 maxsize;
bclass = GST_BASE_SRC_GET_CLASS (src);
@ -816,21 +817,30 @@ gst_base_src_get_range (GstBaseSrc * src, guint64 offset, guint length,
"reading offset %" G_GUINT64_FORMAT ", length %u, size %"
G_GINT64_FORMAT, offset, length, src->size);
/* the max amount of bytes to read is the total size or
* up to the segment_end if present. */
if (src->segment_end != -1)
maxsize = MIN (src->size, src->segment_end);
else
maxsize = src->size;
/* check size */
if (src->size != -1) {
if (offset > src->size)
if (maxsize != -1) {
if (offset > maxsize)
goto unexpected_length;
/* is segment done ? */
if (src->segment_loop && (offset > src->segment_end))
goto unexpected_length;
if (offset + length > src->size) {
if (offset + length > maxsize) {
/* see if length of the file changed */
if (bclass->get_size)
bclass->get_size (src, &src->size);
if (offset + length > src->size) {
length = src->size - offset;
if (src->segment_end != -1)
maxsize = MIN (src->size, src->segment_end);
else
maxsize = src->size;
if (offset + length > maxsize) {
length = maxsize - offset;
}
}
}

View file

@ -786,6 +786,7 @@ gst_base_src_get_range (GstBaseSrc * src, guint64 offset, guint length,
{
GstFlowReturn ret;
GstBaseSrcClass *bclass;
gint64 maxsize;
bclass = GST_BASE_SRC_GET_CLASS (src);
@ -816,21 +817,30 @@ gst_base_src_get_range (GstBaseSrc * src, guint64 offset, guint length,
"reading offset %" G_GUINT64_FORMAT ", length %u, size %"
G_GINT64_FORMAT, offset, length, src->size);
/* the max amount of bytes to read is the total size or
* up to the segment_end if present. */
if (src->segment_end != -1)
maxsize = MIN (src->size, src->segment_end);
else
maxsize = src->size;
/* check size */
if (src->size != -1) {
if (offset > src->size)
if (maxsize != -1) {
if (offset > maxsize)
goto unexpected_length;
/* is segment done ? */
if (src->segment_loop && (offset > src->segment_end))
goto unexpected_length;
if (offset + length > src->size) {
if (offset + length > maxsize) {
/* see if length of the file changed */
if (bclass->get_size)
bclass->get_size (src, &src->size);
if (offset + length > src->size) {
length = src->size - offset;
if (src->segment_end != -1)
maxsize = MIN (src->size, src->segment_end);
else
maxsize = src->size;
if (offset + length > maxsize) {
length = maxsize - offset;
}
}
}