Ticket #5866: hdpvr-livetv.patch
File hdpvr-livetv.patch, 3.7 KB (added by , 15 years ago) |
---|
-
libs/libmythtv/mpegrecorder.cpp
old new void MpegRecorder::StartRecording(void) 1109 1109 1110 1110 if (driver == "hdpvr") 1111 1111 { 1112 if (curRecording->recgroup == "LiveTV") 1113 { 1114 // Don't bother checking resolution, always use best bitrate 1115 int maxbitrate = std::max(high_mpeg4peakbitrate, 1116 high_mpeg4avgbitrate); 1117 SetBitrate(high_mpeg4avgbitrate, maxbitrate, "LiveTV"); 1118 } 1119 1112 1120 int progNum = 1; 1113 1121 MPEGStreamData *sd = new MPEGStreamData(progNum, true); 1114 1122 sd->SetRecordingType(_recording_type); … … bool MpegRecorder::StartEncoding(int fd) 1553 1561 memset(&command, 0, sizeof(struct v4l2_encoder_cmd)); 1554 1562 command.cmd = V4L2_ENC_CMD_START; 1555 1563 1556 if (driver == "hdpvr" )1564 if (driver == "hdpvr" && curRecording->recgroup != "LiveTV") 1557 1565 HandleResolutionChanges(); 1558 1566 1559 1567 VERBOSE(VB_RECORD, LOC + "StartEncoding"); … … bool MpegRecorder::WaitFor_HDPVR(void) 1755 1763 return false; 1756 1764 } 1757 1765 1766 void MpegRecorder::SetBitrate(int bitrate, int maxbitrate, 1767 const QString & reason) 1768 { 1769 if (maxbitrate == bitrate) 1770 { 1771 VERBOSE(VB_RECORD, LOC + QString("%1 bitrate %2 kbps CBR") 1772 .arg(reason).arg(bitrate)); 1773 } 1774 else 1775 { 1776 VERBOSE(VB_RECORD, LOC + QString("%1 bitrate %2/%3 kbps VBR") 1777 .arg(reason).arg(bitrate).arg(maxbitrate)); 1778 } 1779 1780 vector<struct v4l2_ext_control> ext_ctrls; 1781 add_ext_ctrl(ext_ctrls, V4L2_CID_MPEG_VIDEO_BITRATE_MODE, 1782 (maxbitrate == bitrate) ? 1783 V4L2_MPEG_VIDEO_BITRATE_MODE_CBR : 1784 V4L2_MPEG_VIDEO_BITRATE_MODE_VBR); 1785 1786 add_ext_ctrl(ext_ctrls, V4L2_CID_MPEG_VIDEO_BITRATE, 1787 bitrate * 1000); 1788 1789 add_ext_ctrl(ext_ctrls, V4L2_CID_MPEG_VIDEO_BITRATE_PEAK, 1790 maxbitrate * 1000); 1791 1792 set_ctrls(readfd, ext_ctrls); 1793 } 1794 1758 1795 void MpegRecorder::HandleResolutionChanges(void) 1759 1796 { 1760 1797 VERBOSE(VB_RECORD, LOC + "Checking Resolution"); … … void MpegRecorder::HandleResolutionChang 1819 1856 .arg(old_avg).arg(old_max)); 1820 1857 } 1821 1858 1822 if (maxbitrate == bitrate) 1823 { 1824 VERBOSE(VB_RECORD, LOC + QString("New bitrate %1 kbps CBR") 1825 .arg(bitrate)); 1826 } 1827 else 1828 { 1829 VERBOSE(VB_RECORD, LOC + QString("New bitrate %1/%2 kbps VBR") 1830 .arg(bitrate).arg(maxbitrate)); 1831 } 1832 1833 vector<struct v4l2_ext_control> ext_ctrls; 1834 add_ext_ctrl(ext_ctrls, V4L2_CID_MPEG_VIDEO_BITRATE_MODE, 1835 (maxbitrate == bitrate) ? 1836 V4L2_MPEG_VIDEO_BITRATE_MODE_CBR : 1837 V4L2_MPEG_VIDEO_BITRATE_MODE_VBR); 1838 1839 add_ext_ctrl(ext_ctrls, V4L2_CID_MPEG_VIDEO_BITRATE, 1840 bitrate * 1000); 1841 1842 add_ext_ctrl(ext_ctrls, V4L2_CID_MPEG_VIDEO_BITRATE_PEAK, 1843 maxbitrate * 1000); 1844 1845 set_ctrls(readfd, ext_ctrls); 1846 1859 SetBitrate(bitrate, maxbitrate, "New"); 1847 1860 } 1848 1861 } 1862 -
libs/libmythtv/mpegrecorder.h
old new class MpegRecorder : public DTVRecorder, 87 87 void ResetForNewFile(void); 88 88 89 89 bool WaitFor_HDPVR(void); 90 void SetBitrate(int bitrate, int maxbitrate, const QString & reason); 90 91 void HandleResolutionChanges(void); 91 92 92 93 inline bool CheckCC(uint pid, uint cc);