TvOSD.cs under TvEngine3/TVLibrary/TvPlugin (1 Viewer)

mattjcurry

Retired Team Member
  • Premium Supporter
  • October 24, 2011
    261
    207
    43
    Can someone please explain this code to me?

    Code:
        private void SetVideoProgress()
        {
          if (g_Player.Playing)
          {
            //  double fPercentage=g_Player.CurrentPosition / g_Player.Duration;
            //      GUIProgressControl pControl = (GUIProgressControl)GetControl((int)Controls.OSD_VIDEOPROGRESS);
            //    if (null!=pControl) pControl.Percentage=(int)(100*fPercentage);			// Update our progress bar accordingly ...
    
            int iValue = g_Player.Volume;
            GUISliderControl pSlider = GetControl((int)Controls.OSD_VOLUMESLIDER) as GUISliderControl;
            if (null != pSlider)
            {
              pSlider.Percentage = iValue; // Update our progress bar accordingly ...
            }
          }
        }

    Why is the volume slider being referenced to update the progress bar? What does videoProgress have to do with volume?
     

    mattjcurry

    Retired Team Member
  • Premium Supporter
  • October 24, 2011
    261
    207
    43
    OK, that makes sense. Thanks for the info.

    The followup question to that is that the actual progress bar looks like it gets updated using private void UpdateProgressBar():

    Code:
    GUIPropertyManager.SetProperty("#TV.View.Percentage", fPercent.ToString());

    Code:
    GUIPropertyManager.SetProperty("#TV.View.start",
                                             prog.StartTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat));
              GUIPropertyManager.SetProperty("#TV.View.stop",
                                             prog.EndTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat));
              GUIPropertyManager.SetProperty("#TV.View.remaining", Utils.SecondsToHMSString(prog.EndTime - prog.StartTime));

    The question I have is, where is the progress bar initially rendered?
    I can see that GUITVProgressControl (mediaportal\Core\guilib\GUITVProgressControl.cs) has a few different properties:

    There are three percentages. I think that they represent the time of the program, the time that timeshifting is availible, and the time remaining?

    When I look in PropertyManager.cs, I cannot figure out how it is associating the value with the actual control.

    Thanks for any insight you can provide.

    Matt C
     

    SilentException

    Retired Team Member
  • Premium Supporter
  • October 27, 2008
    2,617
    1,130
    Rijeka, Croatia
    Home Country
    Croatia Croatia
    Well, 3 properties are set in skin file to 3 labels.

    Code:
    [XMLSkinElement("label")] private string _label1 = "";
    [XMLSkinElement("label1")] private string _label2 = "";
    [XMLSkinElement("label2")] private string _label3 = "";

    Then the labels (properties) are parsed with GUIPRopertyManager, which returns numerical value and this numerical value is used to render various images (depending on percentages). Whole rendering is done in GUITvProgressControl.cs.
     

    mattjcurry

    Retired Team Member
  • Premium Supporter
  • October 24, 2011
    261
    207
    43
    Code:
        <control>
          <description>TV Progress Bar</description>
          <type>tvprogress</type>
          <id>1</id>
          <posX>160</posX>
          <posY>606</posY>
          <width>645</width>
          <height>20</height>
          <toptexture>osd_progress_indicator.png</toptexture>
          <TextureOffsetY>22</TextureOffsetY>
          <bottomtexture>-</bottomtexture>
          <texturetick>-</texturetick>
          <lefttexture>-</lefttexture>
          <midtexture>-</midtexture>
          <righttexture>-</righttexture>
          <logotexture>-</logotexture>
          <fillbackgroundtexture>-</fillbackgroundtexture>
          <fillbgxoff>0</fillbgxoff>
          <fillbgyoff>0</fillbgyoff>
          <filltexture1>osd_progress_mid_red.png</filltexture1>
          <filltexture2>osd_progress_mid.png</filltexture2>
          <filltexture3>osd_progress_mid_orange.png</filltexture3>
          <fillheight>20</fillheight>
          <label>#TV.Record.percent1</label>
          <label1>#TV.Record.percent2</label1>
          <label2>#TV.Record.percent3</label2>
          <startlabel />
          <endlabel />
          <toplabel />
          <font>font10</font>
          <textcolor>FFffffff</textcolor>
          <visible>!control.hasfocus(1237)</visible>
        </control>

    A couple more questions...
    1.) Where is it defined that tvprogress = GUITvProgressControl?
    2.) Where are #TV.Record.percent1, #TV.Record.percent2, and #TV.Record.percent3 defined?

    I really want to express how much I appreciate your help. I am really excited to learn more about the code.
     

    mattjcurry

    Retired Team Member
  • Premium Supporter
  • October 24, 2011
    261
    207
    43
    alright, so I answered my own question a little bit.

    It looks like tvprogress gets defined in GUIControlFactory.cs under mediaportal\core\guilib\GUIControlFactory.cs

    looks like it simply returns the appropriate type casting needed to apply the properties from the skin to the class.

    Secondarily, it looks like the #TV.Record.percent1 stuff gets set in TVHome.cs file (\TvEngine3\TVLibrary\TvPlugin\TvPlugin\TVHome.cs).

    Now comes a tricky one, If I want to define a new collection in TVHome.cs, what is the recommended way to do that? Should I do it using XML marshalling, JSON, or some other way?

    I should be able to pull the chapter information out of g_player, but need to know the best way to make it accessible to the skin.

    Thanks,
    Matt

    SilentException,

    You are the man. Thanks for all the info. I think that I have what I need to do what I need to do. I believe that the answer to m collections question is somewhat irrelevant. I can just access gplayer directly from my own implementation of GUITvProgressControl.

    Thanks for all the helpful info. Now it is time to code.
     

    Users who are viewing this thread

    Top Bottom