summaryrefslogtreecommitdiffstats
path: root/abs/core-testing/mythtv/trunk/mythtv/hdpvr_audio_codec_selection-v1.1.diff
blob: 7589dd319f2186459241df72becc3388833a887f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
Index: libs/libmythtv/mpegrecorder.cpp
===================================================================
--- libs/libmythtv/mpegrecorder.cpp	(revision 19989)
+++ libs/libmythtv/mpegrecorder.cpp	(working copy)
@@ -285,6 +285,13 @@
                     QString("%1 is invalid").arg(value));
         }
     }
+    else if (opt == "audiocodec")
+    {
+        if (value == "AAC Hardware Encoder")
+            audtype = 4;
+        else if (value == "AC3 Hardware Encoder")
+            audtype = 5;
+    }
     else
     {
         RecorderBase::SetOption(opt, value);
@@ -340,6 +347,8 @@
     SetIntOption(profile, "medium_mpeg4peakbitrate");
     SetIntOption(profile, "high_mpeg4avgbitrate");
     SetIntOption(profile, "high_mpeg4peakbitrate");
+
+    SetStrOption(profile, "audiocodec");
 }
 
 // same as the base class, it just doesn't complain if an option is missing
@@ -829,6 +838,22 @@
     {
         maxbitrate = high_mpeg4peakbitrate;
         bitrate    = high_mpeg4avgbitrate;
+
+        // query supported audio codecs
+        struct v4l2_queryctrl qctrl;
+        qctrl.id = V4L2_CID_MPEG_AUDIO_ENCODING;
+
+        if (ioctl(chanfd, VIDIOC_QUERYCTRL, &qctrl) < 0)
+        {
+            VERBOSE(VB_IMPORTANT, LOC_WARN +
+                    "Unable to get supported audio codecs." + ENO);
+        }
+        else
+        {
+            uint audio_encoding = max(min(audtype-1, qctrl.maximum), qctrl.minimum);
+            add_ext_ctrl(ext_ctrls, V4L2_CID_MPEG_AUDIO_ENCODING,
+                         audio_encoding);
+        }
     }
     maxbitrate = std::max(maxbitrate, bitrate);
 
Index: libs/libmythtv/recordingprofile.cpp
===================================================================
--- libs/libmythtv/recordingprofile.cpp	(revision 19988)
+++ libs/libmythtv/recordingprofile.cpp	(working copy)
@@ -424,6 +424,15 @@
         params->addChild(new SampleRate(parent));
         params->addChild(new BTTVVolume(parent));
         addTarget("Uncompressed", params);
+
+        params = new VerticalConfigurationGroup(false);
+        params->setLabel("AC3 Hardware Encoder");
+        addTarget("AC3 Hardware Encoder", params);
+
+        params = new VerticalConfigurationGroup(false);
+        params->setLabel("AAC Hardware Encoder");
+        addTarget("AAC Hardware Encoder", params);
+
     };
 
     void selectCodecs(QString groupType)
@@ -432,6 +441,11 @@
         {
             if (groupType == "MPEG")
                codecName->addSelection("MPEG-2 Hardware Encoder");
+            else if (groupType == "HDPVR")
+            {
+                codecName->addSelection("AC3 Hardware Encoder");
+                codecName->addSelection("AAC Hardware Encoder");
+            }
             else
             {
                 // V4L, TRANSCODE (and any undefined types)
@@ -1260,11 +1274,8 @@
         videoSettings = new VideoCompressionSettings(*this, profileName);
         addChild(videoSettings);
 
-        if (type.toUpper() != "HDPVR")
-        {
-            audioSettings = new AudioCompressionSettings(*this, profileName);
-            addChild(audioSettings);
-        }
+        audioSettings = new AudioCompressionSettings(*this, profileName);
+        addChild(audioSettings);
 
         if (!profileName.isEmpty() && profileName.left(11) == "Transcoders")
         {