summaryrefslogtreecommitdiffstats
path: root/abs/core-testing/mythtv/trunk/mythtv/ringbuffer_reset_v2.diff
blob: 7876a2e2fa4a53976c36bb5c7f3205480bcf4a10 (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
Index: libs/libmythtv/recorderbase.cpp
===================================================================
--- libs/libmythtv/recorderbase.cpp	(revision 20635)
+++ libs/libmythtv/recorderbase.cpp	(working copy)
@@ -241,6 +241,8 @@
         rb_changed = true;
 
         StartNewFile();
+
+        ResetStreamParser();
     }
     nextRingBufferLock.unlock();
 
Index: libs/libmythtv/mpegrecorder.h
===================================================================
--- libs/libmythtv/mpegrecorder.h	(revision 20635)
+++ libs/libmythtv/mpegrecorder.h	(working copy)
@@ -63,6 +63,9 @@
     // ReaderPausedCB
     virtual void ReaderPaused(int fd) { pauseWait.wakeAll(); }
 
+    // Reset stream parsers when necessary
+    virtual void ResetStreamParser(void);
+
   private:
     void SetIntOption(RecordingProfile *profile, const QString &name);
     void SetStrOption(RecordingProfile *profile, const QString &name);
Index: libs/libmythtv/recorderbase.h
===================================================================
--- libs/libmythtv/recorderbase.h	(revision 20635)
+++ libs/libmythtv/recorderbase.h	(working copy)
@@ -212,6 +212,11 @@
      */
     virtual void CheckForRingBufferSwitch(void);
 
+    /** \brief Inherited method for the stream parser to be reset after
+               a ringbuffer change. Used mainly in mpegrecorder for H264Parser.
+     */
+    virtual void ResetStreamParser(void) { };
+
     /** \brief Save the seektable to the DB
      */
     void SavePositionMap(bool force = false);
Index: libs/libmythtv/mpegrecorder.cpp
===================================================================
--- libs/libmythtv/mpegrecorder.cpp	(revision 20635)
+++ libs/libmythtv/mpegrecorder.cpp	(working copy)
@@ -1430,12 +1430,7 @@
     {
         VERBOSE(VB_RECORD, LOC + "PauseAndWait unpause");
 
-        if (driver == "hdpvr")
-        {
-            m_h264_parser.Reset();
-            _wait_for_keyframe_option = true;
-            _seen_sps = false;
-        }
+        ResetStreamParser();
 
         // Some drivers require streaming to be disabled before
         // an input switch and other channel format setting.
@@ -1500,12 +1495,7 @@
 
     if (ioctl(fd, VIDIOC_ENCODER_CMD, &command) == 0)
     {
-        if (driver == "hdpvr")
-        {
-            m_h264_parser.Reset();
-            _wait_for_keyframe_option = true;
-            _seen_sps = false;
-        }
+        ResetStreamParser();
 
         VERBOSE(VB_RECORD, LOC + "Encoding started");
         return true;
@@ -1762,3 +1752,15 @@
         SetBitrate(bitrate, maxbitrate, "New");
     }
 }
+
+void MpegRecorder::ResetStreamParser(void)               
+{        
+    if (driver == "hdpvr")      
+    {
+        m_h264_parser.Reset();
+        _wait_for_keyframe_option = true;
+        _seen_sps = false;
+    }
+
+    RecorderBase::ResetStreamParser();
+}