summaryrefslogtreecommitdiff
path: root/setup.c
diff options
context:
space:
mode:
authorThomas Reufer <thomas@reufer.ch>2014-02-10 21:53:25 +0100
committerThomas Reufer <thomas@reufer.ch>2014-02-10 21:53:25 +0100
commit0094472cda6eefa9b5363ad844daf0fcfd00c326 (patch)
treeb577f931820ef3899da856f9ccd0de04f4c8ffa8 /setup.c
parent88f137d194b1768344e954a1b1d35fb1fce03df9 (diff)
downloadvdr-plugin-rpihddevice-0.0.8.tar.gz
vdr-plugin-rpihddevice-0.0.8.tar.bz2
2014-02-10: Version 0.0.80.0.8
------------------------- - new: - image grabbing - implemented proper handling in case of buffer stall - reporting video size - support letter box and center cut out set by VDR - support video scaling - fixed: - increased number of audio buffer to fix replay issues with PES recordings - return correct number of audio bytes written from PlayAudio() - fixed start up in audio only mode - fixed still image with deinterlacer - fixed crash during deinitialization - fixed crash when copying 5.1 PCM audio - use cThread::mutex for locking - implement cOvgOsd::SetAreas() and cOvgOsd::SetActive() - audio codec clean up, drop AAC-LATM and rename ADTS to AAC - audio decoding thread clean up - known issues - StillImage() will cause buffer stall - artifacts with StillImage() and PES recordings - speed to fast when fast replaying audio only recordings
Diffstat (limited to 'setup.c')
-rw-r--r--setup.c105
1 files changed, 43 insertions, 62 deletions
diff --git a/setup.c b/setup.c
index de2a4af..8a1697f 100644
--- a/setup.c
+++ b/setup.c
@@ -27,6 +27,8 @@ void cRpiSetup::DropInstance(void)
{
delete s_instance;
s_instance = 0;
+
+ bcm_host_deinit();
}
class cRpiSetupPage : public cMenuSetupPage
@@ -77,25 +79,6 @@ private:
bool cRpiSetup::HwInit(void)
{
bcm_host_init();
- vcos_init();
-
- VCHI_INSTANCE_T vchiInstance;
- VCHI_CONNECTION_T *vchiConnections;
- if (vchi_initialise(&vchiInstance) != VCHIQ_SUCCESS)
- {
- esyslog("rpihddevice: failed to open vchiq instance!");
- return false;
- }
- if (vchi_connect(NULL, 0, vchiInstance) != 0)
- {
- esyslog("rpihddevice: failed to connect to vchi!");
- return false;
- }
- if (vc_vchi_tv_init(vchiInstance, &vchiConnections, 1) != 0)
- {
- esyslog("rpihddevice: failed to connect to tvservice!");
- return false;
- }
if (!vc_gencmd_send("codec_enabled MPG2"))
{
@@ -107,23 +90,52 @@ bool cRpiSetup::HwInit(void)
}
}
+ int height = 0, width = 0;
+ bool progressive = false;
+ cVideoPort::ePort port = cVideoPort::eComposite;
+
+ TV_DISPLAY_STATE_T tvstate;
+ memset(&tvstate, 0, sizeof(TV_DISPLAY_STATE_T));
+ if (!vc_tv_get_display_state(&tvstate))
+ {
+ // HDMI
+ if ((tvstate.state & (VC_HDMI_HDMI | VC_HDMI_DVI)))
+ {
+ progressive = tvstate.display.hdmi.scan_mode == 0;
+ height = tvstate.display.hdmi.height;
+ width = tvstate.display.hdmi.width;
+ port = cVideoPort::eHDMI;
+ }
+ else
+ {
+ height = tvstate.display.sdtv.height;
+ width = tvstate.display.sdtv.width;
+ }
+
+ ILOG("using %s video output at %dx%d%s",
+ cVideoPort::Str(port), width, height, progressive ? "p" : "i");
+
+ GetInstance()->m_isProgressive = progressive;
+ GetInstance()->m_displayHeight = height;
+ GetInstance()->m_displayWidth = width;
+ }
+ else
+ {
+ ELOG("failed to get display parameters!");
+ return false;
+ }
+
return true;
}
bool cRpiSetup::IsAudioFormatSupported(cAudioCodec::eCodec codec,
int channels, int samplingRate)
{
- // AAC-LATM and AAC pass-through currently not supported
-// if (codec == cAudioCodec::eAAC ||
-// codec == cAudioCodec::eADTS)
-// return false;
-
if (vc_tv_hdmi_audio_supported(
codec == cAudioCodec::eMPG ? EDID_AudioFormat_eMPEG1 :
codec == cAudioCodec::eAC3 ? EDID_AudioFormat_eAC3 :
codec == cAudioCodec::eEAC3 ? EDID_AudioFormat_eEAC3 :
- codec == cAudioCodec::eAAC ? EDID_AudioFormat_eAAC :
- codec == cAudioCodec::eADTS ? EDID_AudioFormat_eAAC :
+ codec == cAudioCodec::eAAC ? EDID_AudioFormat_eAAC :
EDID_AudioFormat_ePCM, channels,
samplingRate == 32000 ? EDID_AudioSampleRate_e32KHz :
samplingRate == 44100 ? EDID_AudioSampleRate_e44KHz :
@@ -135,7 +147,7 @@ bool cRpiSetup::IsAudioFormatSupported(cAudioCodec::eCodec codec,
EDID_AudioSampleSize_16bit) == 0)
return true;
- dsyslog("rpihddevice: %dch %s, %d.%dkHz not supported by HDMI device",
+ DLOG("%dch %s, %d.%dkHz not supported by HDMI device",
channels, cAudioCodec::Str(codec),
samplingRate / 1000, (samplingRate % 1000) / 100);
@@ -144,41 +156,10 @@ bool cRpiSetup::IsAudioFormatSupported(cAudioCodec::eCodec codec,
int cRpiSetup::GetDisplaySize(int &width, int &height, double &aspect)
{
- uint32_t screenWidth;
- uint32_t screenHeight;
-
- if (graphics_get_display_size(0 /* LCD */, &screenWidth, &screenHeight) < 0)
- esyslog("rpihddevice: failed to get display size!");
- else
- {
- width = (int)screenWidth;
- height = (int)screenHeight;
- aspect = 1;
- return 0;
- }
-
- return -1;
-}
-
-bool cRpiSetup::IsDisplayProgressive(void)
-{
- bool progressive = false;
-
- TV_DISPLAY_STATE_T tvstate;
- memset(&tvstate, 0, sizeof(TV_DISPLAY_STATE_T));
- if (!vc_tv_get_display_state(&tvstate))
- {
- // HDMI
- if ((tvstate.state & (VC_HDMI_HDMI | VC_HDMI_DVI)))
- progressive = tvstate.display.hdmi.scan_mode == 0;
- // composite
- else
- progressive = false;
- }
- else
- esyslog("rpihddevice: failed to get display state!");
-
- return progressive;
+ height = GetInstance()->m_displayHeight;
+ width = GetInstance()->m_displayWidth;
+ aspect = (double)width / height;
+ return 0;
}
bool cRpiSetup::HasAudioSetupChanged(void)