NextPVR Forums
  • ______
  • Home
  • New Posts
  • Wiki
  • Members
  • Help
  • Search
  • Register
  • Login
  • Home
  • Wiki
  • Members
  • Help
  • Search
NextPVR Forums Public Developers v
« Previous 1 … 22 23 24 25 26 … 93 Next »
Drawing UiStatic

 
  • 0 Vote(s) - 0 Average
Drawing UiStatic
mvallevand
Online

Posting Freak

Ontario Canada
Posts: 52,920
Threads: 956
Joined: May 2006
#1
2009-09-02, 02:29 AM
I am having trouble with UiStatic's not being redrawn if I don't use a ForceRePaint

Code:
long slen = 0;
            for (int i = 0; i < 8 && slen < 250000; i++)
            {

                try
                {
                    FileInfo flen = new FileInfo(myVlcRecorder.outputFile);
                    slen = flen.Length;
                    flen = null;
                    Hashtable args = new Hashtable();
                    args["@nowPlaying"] = "Buffered " + slen.ToString();
                    nowPlayingUiStatic.SetArgs(args);
                    PluginHelperFactory.getPluginHelper().ForceRepaint();
                }
                catch
                {
                    slen = 0;
                }
                Thread.Sleep(1000);
            }

I assume this is because the Sleep blocks needsRendering(), but I tried with a Timer too and that seems no better because I guess the needsRendering() doesn't work when the code is in another thread. I've fought this for a couple of evenings. Is there are better solution?

Martin
sub
Offline

Administrator

NextPVR HQ, New Zealand
Posts: 106,699
Threads: 767
Joined: Nov 2003
#2
2009-09-02, 02:56 AM
Instead of blocking, you could try doing it asynchronously. ie, do something like this:

Code:
private DateTime bufferingStartTime = DateTime.Min;
Code:
// in place of your code above
   bufferingStartTime = DateTime.Now;
Code:
// in needsRendering
  public override bool needsRendering()
  {
     ...
     if (bufferingStartTime != DateTime.Min)
     {
        if (bufferingStartTime < DateTime.Now.AddSeconds(10))
        {
            FileInfo flen = new FileInfo(myVlcRecorder.outputFile);
            slen = flen.Length;
            flen = null;
            Hashtable args = new Hashtable();
            args["@nowPlaying"] = "Buffered " + slen.ToString();
            nowPlayingUiStatic.SetArgs(args);

            // check if we're already buffered enough
            if (slen > 250000)
                bufferingStartTime = DateTime.Min;

            if (nowPlayingUiStatic.needsRendering())
                return true;
        }
        else
        {
            ...maybe some handling here to check filesize didnt get to the require size in the timeout period...
        }
     }
     ...
  }

or something like that.
mvallevand
Online

Posting Freak

Ontario Canada
Posts: 52,920
Threads: 956
Joined: May 2006
#3
2009-09-02, 03:07 AM
Ok, I am starting to get that the needsRendering() can become huge. Would the muxex I would have add block too or will I just release it in needsRendering()?

Martin
sub
Offline

Administrator

NextPVR HQ, New Zealand
Posts: 106,699
Threads: 767
Joined: Nov 2003
#4
2009-09-02, 03:23 AM
mvallevand Wrote:Would the muxex I would have add block too or will I just release it in needsRendering()?
What mutex? All the calls to your plugin form GB-PVR will come in on the same thread, so you dont need to be worried about needsRendering() getting called at the same time as anything else.

ie, if you're lauched some process in response to a keystroke or button, and it was started transcoding (using something like ffmpeg), then while you're waiting for it to get to a particular size, you can regularly check its size in needsRendering(), which is called very regularly by the app. There is no background threads, but the processing is being done asynchronously (think bit-at-time, like a state machine).
mvallevand
Online

Posting Freak

Ontario Canada
Posts: 52,920
Threads: 956
Joined: May 2006
#5
2009-09-02, 10:06 PM
The thread sync problem I was thinking about was handling of the mvp comm. thread 6 and mvp streaming thread 7 both returning MusicStopping. I was trying to figure some way to harmonize this when someone clicks on a new station while music is playing. After thinking about your comments I will need a much better state machine than I have now.

Martin
« Next Oldest | Next Newest »

Users browsing this thread: 1 Guest(s)



Possibly Related Threads…
Thread Author Replies Views Last Post
  UiStatic vs UiElement? imilne 8 3,357 2012-12-24, 02:31 PM
Last Post: imilne
  Skin Help with Line Drawing Northpole 2 1,907 2011-07-19, 05:14 PM
Last Post: Northpole
  Problem using UIStatic philcooling 13 4,364 2010-02-12, 06:34 PM
Last Post: whurlston
  UIStatic update idkpmiller 3 1,900 2008-01-10, 02:35 AM
Last Post: idkpmiller
  UIStatic issue idkpmiller 8 5,139 2008-01-08, 05:01 PM
Last Post: whurlston
  Save a UiStatic out as a jpg McBainUK 4 1,831 2007-11-16, 03:23 PM
Last Post: McBainUK
  Drawing an interface boohiss 2 1,813 2006-07-31, 08:20 PM
Last Post: boohiss

  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Designed by D&D, modified by NextPVR - Powered by MyBB

Linear Mode
Threaded Mode