static int vlclua_stream_new( lua_State *L ) { vlc_object_t * p_this = vlclua_get_this( L ); const char * psz_url = luaL_checkstring( L, 1 ); stream_t *p_stream = vlc_stream_NewURL( p_this, psz_url ); return vlclua_stream_new_inner( L, p_stream ); }
static int vlclua_memory_stream_new( lua_State *L ) { vlc_object_t * p_this = vlclua_get_this( L ); /* FIXME: duplicating the whole buffer is suboptimal. Keeping a reference to the string so that it doesn't get garbage collected would be better */ char * psz_content = strdup( luaL_checkstring( L, 1 ) ); stream_t *p_stream = vlc_stream_MemoryNew( p_this, (uint8_t *)psz_content, strlen( psz_content ), false ); return vlclua_stream_new_inner( L, p_stream ); }
static int vlclua_stream_new( lua_State *L ) { vlc_object_t * p_this = vlclua_get_this( L ); const char * psz_url = luaL_checkstring( L, 1 ); stream_t *p_stream = vlc_stream_NewURL( p_this, psz_url ); /* XXX: For hysterical raisins, append one inflate decompression stream * filter automatically (if applicable). */ if( p_stream != NULL ) { stream_t *inflated = vlc_stream_FilterNew( p_stream, "inflate" ); if( inflated != NULL ) p_stream = inflated; } return vlclua_stream_new_inner( L, p_stream ); }