Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#8656 closed patch (fixed)

Display video format in INFO OSD

Reported by: Nigel Owned by: markk
Priority: minor Milestone: 0.24
Component: MythTV - Video Playback Version: Master Head
Severity: low Keywords:
Cc: Ticket locked: no

Description

Several times I have wanted to check the format of Live TV channels. I thought about adding another OSD "page" to cycle through, and add signal monitoring in there, but the latter was too hard to hook into the timing events.
Building on the mythui OSD theming (thanks Mark), the following adds a small OSD string after the show time/length, and also works for recordings (should be safe for videos, and optical media too):

% svn diff libs/libmythtv/playercontext.cpp themes/default/osd.xml 
Index: libs/libmythtv/playercontext.cpp
===================================================================
--- libs/libmythtv/playercontext.cpp	(revision 25340)
+++ libs/libmythtv/playercontext.cpp	(working copy)
@@ -751,6 +751,18 @@
             infoMap["screenshotpath"] = VideoMetaDataUtil::GetArtPath(
                 playingInfo->GetPathname(), "Screenshots");
         }
+        // Store video format, except when tuning Live TV.
+        if (playingState != kState_WatchingLiveTV   // Recorded TV, videos/DVDs
+            || tvchain->GetCardType() != "DUMMY")   // Live TV after tuning
+        {
+            float rate = nvp->GetFrameRate();
+            QSize size = nvp->GetVideoSize();
+            infoMap["format"] = QString("%1x%2%3%4, %5")
+                .arg(size.width()).arg(size.height())
+                .arg(rate > 31 ? 'p' : 'i')   // TODO: should lookup, not guess
+                .arg(rate)
+                .arg(nvp->GetEncodingType());
+        }
         infoMap.detach();
         loaded = true;
     }
Index: themes/default/osd.xml
===================================================================
--- themes/default/osd.xml	(revision 25328)
+++ themes/default/osd.xml	(working copy)
@@ -118,10 +118,15 @@
         </textarea>
         <textarea name="starttime">
             <font>smaller</font>
-            <area>6,42,437,25</area>
+            <area>6,42,290,25</area>
             <align>left,top</align>
             <template>%STARTTIME%-%ENDTIME% : %LENMINS%</template>
         </textarea>
+        <textarea name="format">
+            <font>smaller</font>
+            <area>300,42,200,25</area>
+            <align>left,top</align>
+        </textarea>
         <clock name="clock">
             <area>481,8,187,25</area>
             <font>small</font>

Attachments (2)

format.patch (2.2 KB) - added by robertm 9 years ago.
format.diff (2.3 KB) - added by robertm 9 years ago.
Patch that actually works.

Download all attachments as: .zip

Change History (11)

comment:1 Changed 9 years ago by markk

Milestone: 0.24
Owner: changed from Janne Grunau to markk
Status: newaccepted

comment:2 Changed 9 years ago by robertm

Nigel/Mark?: I like this a lot too-- I was hoping in the committed version that it would be okay to split out the individual components to allow the themer to decide how to present the information (though I have no objection to the "format" textarea also being there). Personally would see myself putting width and height on different lines, or templating the strings differently, etc.

Changed 9 years ago by robertm

Attachment: format.patch added

comment:3 Changed 9 years ago by robertm

Updated patch for trunk, and to include additional variables for more flexible use by themers. Untested.

Changed 9 years ago by robertm

Attachment: format.diff added

Patch that actually works.

comment:4 Changed 9 years ago by markk

Resolution: fixed
Status: acceptedclosed

(In [25750]) Add additional format and state information to the OSD.

For the videodescrip state, I've deliberately used a strict definition of what is flagged as 1080/720 etc so that the OSD can fallback to displaying the actual video parameters for non-standard formats. This may need some tweaking to ensure the default state is working.

Closes #8656

comment:5 Changed 9 years ago by Nigel

(In [25850]) Fix for framerate in OSD. [25750] had it right (1e6/prate), but in moving it to MythPlayer? [25753], prate became frame_rate which doesn't need interval to frequency conversion math. Refs #8656

comment:6 Changed 9 years ago by Nigel

(In [25888]) Add video info to INFO. Refs #8656. Style will not suit everyone, and the fps might need to be translated, but most other OSD themes would override? If we decide it shouldn't be in default, please comment out instead of removing completety - that way themers at lease get the doco value.

comment:7 Changed 9 years ago by Nigel

(In [25889]) Better codec descriptions (than MPEG2) in the themed INFO OSD. Refs #8656.

Currently, MythPlayer::GetEncodingType?() uses GetVideoCodecID(), which only iterates some of the FFmpeg codecs (plus, AVF's video_codec_id is often mapped to MPEG2 in ScanStream?()). Basically, a more opaque way of getting codec descriptions was needed, and what is more opaque than a string?

Technically, this changes the library API, but since only libmythtv is calling the extra method, no version change - to save a full recompile.

comment:8 Changed 9 years ago by robertm

(In [25922]) Fix display of MPEG-2 and MPEG-2 statetypes in OSD. Refs #8656.

comment:9 Changed 9 years ago by stuartm

Nigel, since format was intended to be used as a statetype, it should be the following instead:

<statetype name="videocodec">
    <state name="MPEG2">
        <textarea name="description">
            <area>10,10,100,30</area>
            <value>MPEG-2</value>
        </textarea>
    </state>
    <state name="H.264" from="MPEG2">
        <textarea name="description">
            <value>MPEG-2</value>
        </textarea>
    </state>
    <!-- Etc. -->
</statetype>

As you can imagine that's slightly more work for the themer, although many would probably just cut/paste, from another theme. The benefits are numerous, e.g. you can mix images (icons), text, shapes etc to represent each codec.

Mark

[25889] contains an error, the values return by GetEncodingType?() are being translated when they shouldn't be.

Note: See TracTickets for help on using tickets.