[vlc-commits] imem-access: return an error when file size is unknown
Rémi Denis-Courmont
git at videolan.org
Mon Aug 31 17:45:07 CEST 2015
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Aug 31 18:36:28 2015 +0300| [d1ed9f952dec371b893c063695549de926d5b90d] | committer: Rémi Denis-Courmont
imem-access: return an error when file size is unknown
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d1ed9f952dec371b893c063695549de926d5b90d
---
include/vlc/libvlc_media.h | 2 +-
modules/access/imem-access.c | 5 ++++-
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/include/vlc/libvlc_media.h b/include/vlc/libvlc_media.h
index 392fe1c..e47a6a0 100644
--- a/include/vlc/libvlc_media.h
+++ b/include/vlc/libvlc_media.h
@@ -276,7 +276,7 @@ typedef enum libvlc_media_parse_flag_t
*
* \param opaque private pointer as passed to libvlc_media_new_callbacks()
* \param datap storage space for a private data pointer [OUT]
- * \param sizep byte length of the bitstream or 0 if unknown [OUT]
+ * \param sizep byte length of the bitstream or UINT64_MAX if unknown [OUT]
*
* \note For convenience, *datap is initially NULL and *sizep is initially 0.
*
diff --git a/modules/access/imem-access.c b/modules/access/imem-access.c
index f92006a..ce69b3d 100644
--- a/modules/access/imem-access.c
+++ b/modules/access/imem-access.c
@@ -22,6 +22,7 @@
# include "config.h"
#endif
#include <assert.h>
+#include <stdint.h>
#include <vlc_common.h>
#include <vlc_access.h>
@@ -89,6 +90,8 @@ static int Control(access_t *access, int query, va_list args)
break;
case ACCESS_GET_SIZE:
+ if (sys->size == UINT64_MAX)
+ return VLC_EGENERIC;
*va_arg(args, uint64_t *) = sys->size;
break;
@@ -130,7 +133,7 @@ static int Open(vlc_object_t *object)
sys->read_cb = var_InheritAddress(access, "imem-read");
sys->seek_cb = var_InheritAddress(access, "imem-seek");
sys->close_cb = var_InheritAddress(access, "imem-close");
- sys->size = 0;
+ sys->size = UINT64_MAX;
if (open_cb == NULL)
open_cb = open_cb_default;
More information about the vlc-commits
mailing list