Skip to content

Commit

Permalink
add hdmirecord setup
Browse files Browse the repository at this point in the history
  • Loading branch information
peteru authored and atvcaptain committed Apr 3, 2018
1 parent 434e1d7 commit 9ff2375
Show file tree
Hide file tree
Showing 7 changed files with 141 additions and 2 deletions.
3 changes: 2 additions & 1 deletion data/menu.xml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@
<menu weight="10" level="1" text="Recordings &amp; Timeshift" entryID="rec_setup">
<id val="rec" />
<item weight="10" level="0" text="Recording settings" entryID="recording_setup"><screen module="Recordings" screen="RecordingSettings" /></item>
<item weight="15" level="0" text="Timeshift settings" entryID="timshift_setup"><screen module="Timershift" screen="TimeshiftSettings" /></item>
<item weight="15" level="0" text="HDMI-IN Recording settings" entryID="hdmirecord_setup" requires="HDMIin"><setup id="HDMIRecord"/></item>
<item weight="20" level="0" text="Timeshift settings" entryID="timshift_setup"><screen module="Timershift" screen="TimeshiftSettings" /></item>
</menu>

<!-- Menu / Settings / GUI -->
Expand Down
8 changes: 8 additions & 0 deletions data/setup.xml
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,14 @@
<item level="2" text="Show recording symbol" description="Configure whether the 'recording' symbol (in the display skin and LCD skin) is visible for real recordings only or also for streaming and pseuso recordings (e.g. EPGrefresh).">config.recording.show_rec_symbol_for_rec_types</item>
<item level="2" text="Show warning before restart" description="Configure for which types of recordings a warning about active recordings is shown when attempting to restart the box or the GUI.">config.recording.warn_box_restart_rec_types</item>
</setup>
<setup key="HDMIRecord" title="HDMI Recording">
<item level="0" text="Bitrate" description="The bitrate of the video encoder. Larger value improves quality and increases file size.">config.hdmirecord.bitrate</item>
<item level="0" text="Width" description="The width of the picture. The input will be scaled to match this value.">config.hdmirecord.width</item>
<item level="0" text="Height" description="The height of the picture. The input will be scaled to match this value.">config.hdmirecord.height</item>
<item level="0" text="Frame rate" description="The frame rate of the recording. Ideally, this will match the frame rate of the source or be an integer multiple. If in doubt, set to 60, which should work with most sources.">config.hdmirecord.framerate</item>
<item level="2" text="Interlaced" description="In most cases this should be set to No. Only enable if you have a very specific need.">config.hdmirecord.interlaced</item>
<item level="1" text="Aspect ratio" description="The aspect ratio of the recording.">config.hdmirecord.aspectratio</item>
</setup>
<setup key="harddisk" title="Hard disk setup" >
<item level="0" text="Hard disk standby after" description="Configure the hard disk drive to go to standby after the specified idle time.">config.usage.hdd_standby</item>
<item level="0" text="Hard disk standby in box standby after" description="Configure the hard disk drive to go to standby after the specified idle time when the box is in standby.">config.usage.hdd_standby_in_standby</item>
Expand Down
85 changes: 85 additions & 0 deletions lib/python/Components/HdmiRecord.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
from config import config, ConfigSelection, ConfigSubsection
from boxbranding import getBoxType, getMachineBuild


def InitHdmiRecord():
full_hd = getMachineBuild() in ('et10000','dm900', 'dm920', 'et13000', 'sf5008', 'vuuno4kse') or getBoxType() in ('spycat4k','spycat4kcombo','gbquad4k')

config.hdmirecord = ConfigSubsection()

choices = [
("512000", "0.5 Mb/s"),
("1024000", "1 Mb/s"),
("2048000", "2 Mb/s"),
("3072000", "3 Mb/s"),
("4096000", "4 Mb/s"),
("5120000", "5 Mb/s"),
("6144000", "6 Mb/s"),
("7168000", "7 Mb/s"),
("8192000", "8 Mb/s"),
("9216000", "9 Mb/s"),
("10240000", "10 Mb/s"),
("15360000", "15 Mb/s"),
("20480000", "20 Mb/s"),
("25600000", "25 Mb/s"),
]
config.hdmirecord.bitrate = ConfigSelection(choices, default="5120000")

choices = [
("180", "180"), # SD / 4
("240", "240"), # FullHD / 8, SD / 3
("320", "320"), # FullHD / 6
("360", "360"), # SD / 2
("384", "384"), # FullHD / 5
("480", "480"), # FullHD / 4
("640", "640"), # FullHD / 3
("720", "720"), # SD
("960", "960"), # FullHD / 2
("1280", "1280"), # FullHD / 1.5
]
if(full_hd):
choices.append(("1920", "1920")) # FullHD

config.hdmirecord.width = ConfigSelection(choices, default="1280")

choices = [
("144", "144"), # SD / 4
("135", "135"), # FullHD / 8
("192", "192"), # SD / 3
("180", "180"), # FullHD / 6
("288", "288"), # SD / 2
("216", "216"), # FullHD / 5
("270", "270"), # FullHD / 4
("360", "360"), # FullHD / 3
("576", "576"), # SD
("540", "540"), # FullHD / 2
("720", "720"), # FullHD / 1.5
]

if(full_hd):
choices.append(("1080", "1080")) # FullHD

config.hdmirecord.height = ConfigSelection(choices, default="720")

config.hdmirecord.framerate = ConfigSelection(
choices=[
("24000", "24"),
("25000", "25"),
("30000", "30"),
("50000", "50"),
("60000", "60"),
], default="60000")

# Intentionally not a boolean because the API expects an integer parsed from the string
config.hdmirecord.interlaced = ConfigSelection(
choices=[
("0", "No"),
("1", "Yes"),
], default="0")

config.hdmirecord.aspectratio = ConfigSelection(
choices=[
("0", "Auto"),
("1", "4:3"),
("2", "16:9"),
], default="0")
5 changes: 5 additions & 0 deletions lib/python/Screens/InfoBarGenerics.py
Original file line number Diff line number Diff line change
Expand Up @@ -1578,6 +1578,7 @@ def __init__(self):
"showNetworkSetup": (self.showNetworkMounts, _("Show network mounts ...")),
"showSystemSetup": (self.showSystemMenu, _("Show network mounts ...")),
"showRFmod": (self.showRFSetup, _("Show RFmod setup...")),
"showHDMIRecord": (self.showHDMiRecordSetup, _("Show HDMIRecord setup...")),
"toggleAspectRatio": (self.toggleAspectRatio, _("Toggle aspect ratio...")),
})
self.session.infobar = None
Expand Down Expand Up @@ -1636,6 +1637,10 @@ def showRFSetup(self):
if SystemInfo["RfModulator"]:
self.session.openWithCallback(self.mainMenuClosed, Setup, 'RFmod')

def showHDMiRecordSetup(self):
if SystemInfo["HDMIin"]:
self.session.openWithCallback(self.mainMenuClosed, Setup, 'HDMIRecord')

def mainMenuClosed(self, *val):
self.session.infobar = None

Expand Down
11 changes: 10 additions & 1 deletion lib/service/servicehdmi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,16 @@ int eServiceHDMIRecord::doPrepare()
{
if (!m_simulate && m_encoder_fd < 0)
{
if (eEncoder::getInstance()) m_encoder_fd = eEncoder::getInstance()->allocateEncoder(m_ref.toString(), 8 * 1024 * 1024, 1280, 720, 25000, false, 0);
if (eEncoder::getInstance())
{
int bitrate = eConfigManager::getConfigIntValue("config.hdmirecord.bitrate", 8 * 1024 * 1024);
int width = eConfigManager::getConfigIntValue("config.hdmirecord.width", 1280);
int height = eConfigManager::getConfigIntValue("config.hdmirecord.height", 720);
int framerate = eConfigManager::getConfigIntValue("config.hdmirecord.framerate", 50000);
int interlaced = eConfigManager::getConfigIntValue("config.hdmirecord.interlaced", 0);
int aspectratio = eConfigManager::getConfigIntValue("config.hdmirecord.aspectratio", 0);
m_encoder_fd = eEncoder::getInstance()->allocateEncoder(m_ref.toString(), bitrate, width, height, framerate, interlaced, aspectratio);
}
if (m_encoder_fd < 0) return -1;
}
m_state = statePrepared;
Expand Down
4 changes: 4 additions & 0 deletions mytest.py
Original file line number Diff line number Diff line change
Expand Up @@ -763,6 +763,10 @@ def runNextScreen(session, screensToRun, *result):
Components.AVSwitch.InitAVSwitch()
Components.AVSwitch.InitiVideomodeHotplug()

profile("HdmiRecord")
import Components.HdmiRecord
Components.HdmiRecord.InitHdmiRecord()

profile("RecordingConfig")
import Components.RecordingConfig
Components.RecordingConfig.InitRecordingConfig()
Expand Down
27 changes: 27 additions & 0 deletions po/de.po
Original file line number Diff line number Diff line change
Expand Up @@ -19478,3 +19478,30 @@ msgstr "Sambia"
#: CountryCodes.py:250
msgid "Zimbabwe"
msgstr "Simbabwe"

msgid "HDMI-IN Recording settings"
msgstr "HDMI-IN Aufnahmen"

msgid "Frame rate"
msgstr "Bildwiederholrate"

msgid "Interlaced"
msgstr "Zeilensprungverfahren"

msgid "The bitrate of the video encoder. Larger value improves quality and increases file size."
msgstr "Die Bitrate des Videoencoders. Größerer Wert verbessert die Qualität und erhöht die Dateigröße."

msgid "The width of the picture. The input will be scaled to match this value."
msgstr "Die Breite des Bildes. Die Eingabe wird skaliert, um mit diesem Wert übereinzustimmen."

msgid "The height of the picture. The input will be scaled to match this value."
msgstr "Die Höhe des Bildes. Die Eingabe wird skaliert, um mit diesem Wert übereinzustimmen."

msgid "The frame rate of the recording. Ideally, this will match the frame rate of the source or be an integer multiple. If in doubt, set to 60, which should work with most sources."
msgstr "Die Bildrate der Aufnahme. Idealerweise entspricht dies der Bildrate der Quelle oder einem ganzzahligen Vielfachen. Im Zweifelsfall auf 50 einstellen, welches mit den meisten Quellen funktioniert."

msgid "In most cases this should be set to No. Only enable if you have a very specific need."
msgstr "In den meisten Fällen sollte dies auf Nein eingestellt sein. Nur aktivieren, wenn Sie einen ganz bestimmten Bedarf haben."

msgid "The aspect ratio of the recording."
msgstr "Das Seitenverhältnis der Aufnahme."

0 comments on commit 9ff2375

Please sign in to comment.