LoadBrush() with http.streamer plugin

General questions that have to do with plugins go here
Post Reply
User avatar
Amile
Posts: 2
Joined: Tue Oct 02, 2012 2:00 am

LoadBrush() with http.streamer plugin

Post by Amile » Mon Sep 28, 2015 12:54 am

First, thank you for the new http.streamer plugin. The announcement sounds really promising. Unfortunatily there is nearly no documentation by now.
But i gave it a try. In my script, i calculate the url for several files, fetch them with DownloadFile(), load them with LoadBrush() and display them with DisplayBrush() (on a larger Brush).

Code: Select all

If Exists(file$) = False
    DownloadFile(url$,{File = file$})
EndIf
LoadBrush(1,file$)
DisplayBrush(1,0,0) 
this can now be changed to

Code: Select all

LoadBrush(1,url$)
DisplayBrush(1,0,0) 
But the executiontime of the the new LoadBrush(1,url$) is exactly the same as the DownloadFile() before. And in a loop each download has to be finished before the next can be started.

How do i enable Multithreading ?
How can i see, if a download has finished ?
Is there any Eventhandler possible or callback function setable ?

Hopefully more documention can clear any of these questions 8-)
Until this time, keep the good work ;)

User avatar
airsoftsoftwair
Posts: 2477
Joined: Fri Feb 12, 2010 3:33 pm
Location: Germany
Contact:

Re: LoadBrush() with http.streamer plugin

Post by airsoftsoftwair » Mon Sep 28, 2015 6:12 pm

LoadBrush() is a synchronous command so it will always block until the complete image has been loaded. That's why you won't see any major speedup between DownloadFile() and LoadBrush() and the HTTP streamer plugin.

The multithreading design kicks in when you do something like this:

Code: Select all

OpenVideo(1, "http://www.example.com/video.mpg")
OpenMusic(1, "http://www.example.com/music.mp3")
PlayVideo(1)
PlayMusic(1)
In that case, two different threads will stream the data from the HTTP source because PlayVideo() and PlayMusic() are both asynchronous. LoadBrush(), however, always loads the full image so there won't be a big speedup but of course there's the advantage that you don't have to use a temporary file.

Post Reply