All pastes #2092068 Raw Edit

Something

public text v1 · immutable
#2092068 ·published 2011-10-21 02:54 UTC
rendered paste body
diff --git a/mythtv/libs/libmythtv/dtvrecorder.cpp b/mythtv/libs/libmythtv/dtvrecorder.cpp
index e0a5335..f852d5f 100644
--- a/mythtv/libs/libmythtv/dtvrecorder.cpp
+++ b/mythtv/libs/libmythtv/dtvrecorder.cpp
@@ -82,6 +82,10 @@ DTVRecorder::DTVRecorder(TVRec *rec) :
     memset(_stream_id, 0, sizeof(_stream_id));
     memset(_pid_status, 0, sizeof(_pid_status));
     memset(_continuity_counter, 0, sizeof(_continuity_counter));
+    pc = new ParseContext1;
+    memset(pc, 0, sizeof(struct ParseContext1));
+    s = new AVCodecParserContext;
+    memset(s, 0, sizeof(struct AVCodecParserContext));
 }
 
 DTVRecorder::~DTVRecorder()
@@ -101,6 +105,12 @@ DTVRecorder::~DTVRecorder()
         delete _input_pmt;
         _input_pmt = NULL;
     }
+
+    if (pc)
+    {
+        delete pc;
+        pc = NULL;
+    }
 }
 
 void DTVRecorder::SetOption(const QString &name, const QString &value)
@@ -339,7 +349,6 @@ bool DTVRecorder::FindMPEG2Keyframes(const TSPacket* tspacket)
     //   (there are others that we don't care about)
     const uint8_t *bufptr = tspacket->data() + tspacket->AFCOffset();
     const uint8_t *bufend = tspacket->data() + TSPacket::kSize;
-    int progressive_sequence = 0;
     int ext_type, bytes_left;
     int picture_structure, top_field_first, repeat_first_field, progressive_frame;
     int repeat_pict = 0;
@@ -384,7 +393,7 @@ bool DTVRecorder::FindMPEG2Keyframes(const TSPacket* tspacket)
                     case 0x1: /* sequence extension */
                         if (bytes_left >= 6)
                         {
-                            progressive_sequence = bufptr[1] & (1 << 3);
+                            pc->progressive_sequence = bufptr[1] & (1 << 3);
                         }
                         break;
                     case 0x8: /* picture coding extension */
@@ -399,7 +408,7 @@ bool DTVRecorder::FindMPEG2Keyframes(const TSPacket* tspacket)
                             repeat_pict = 1;
                             if (repeat_first_field) 
                             {
-                                if (progressive_sequence)
+                                if (pc->progressive_sequence)
                                 {
                                     if (top_field_first)
                                         repeat_pict = 5;
diff --git a/mythtv/libs/libmythtv/dtvrecorder.h b/mythtv/libs/libmythtv/dtvrecorder.h
index 25b8c7e..721a669 100644
--- a/mythtv/libs/libmythtv/dtvrecorder.h
+++ b/mythtv/libs/libmythtv/dtvrecorder.h
@@ -18,6 +18,10 @@ using namespace std;
 #include "recorderbase.h"
 #include "H264Parser.h"
 
+extern "C" {
+#include "libavcodec/parser.h"
+}
+
 class MPEGStreamData;
 class TSPacket;
 class QTime;
@@ -132,6 +136,10 @@ class DTVRecorder :
     unsigned int _video_bytes_remaining;
     unsigned int _other_bytes_remaining;
 
+    // used for storing sequence header information
+    ParseContext1        *pc;
+    AVCodecParserContext *s;
+
     // H.264 support
     bool _pes_synced;
     bool _seen_sps;