Commit d1ed9f95 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

imem-access: return an error when file size is unknown

parent 1d96a2e7
......@@ -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.
*
......
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment