Part of Slepp's ProjectsPastebinTURLImagebinFilebin
Feedback -- English French German Japanese
Create Upload Newest Tools Donate
Sign In | Create Account

Mine
Thursday, October 6th, 2011 at 7:29:11pm MDT 

  1. diff --git a/mythtv/libs/libmyth/programinfo.cpp b/mythtv/libs/libmyth/programinfo.cpp
  2. index 8793940..e09f5fb 100644
  3. --- a/mythtv/libs/libmyth/programinfo.cpp
  4. +++ b/mythtv/libs/libmyth/programinfo.cpp
  5. @@ -3559,7 +3559,7 @@ void ProgramInfo::SaveTotalFrames(int64_t frames)
  6.      query.bindValue(":DATA", (uint)(frames));
  7.  
  8.      if (!query.exec())
  9. -        MythDB::DBError("Frames insert", query);
  10. +        MythDB::DBError("Total Frames insert", query);
  11.  }
  12.  
  13.  /// \brief Store the Resolution at frame in the recordedmarkup table
  14. diff --git a/mythtv/libs/libmythtv/dtvrecorder.cpp b/mythtv/libs/libmythtv/dtvrecorder.cpp
  15. index e0a5335..4ea842a 100644
  16. --- a/mythtv/libs/libmythtv/dtvrecorder.cpp
  17. +++ b/mythtv/libs/libmythtv/dtvrecorder.cpp
  18. @@ -75,13 +75,18 @@ DTVRecorder::DTVRecorder(TVRec *rec) :
  19.      // statistics
  20.      _packet_count(0),
  21.      _continuity_error_count(0),
  22. -    _frames_seen_count(0),          _frames_written_count(0)
  23. +    _frames_seen_count(0),          _frames_written_count(0),
  24. +    _duration(0)
  25.  {
  26.      SetPositionMapType(MARK_GOP_BYFRAME);
  27.      _payload_buffer.reserve(TSPacket::kSize * (50 + 1));
  28.      memset(_stream_id, 0, sizeof(_stream_id));
  29.      memset(_pid_status, 0, sizeof(_pid_status));
  30.      memset(_continuity_counter, 0, sizeof(_continuity_counter));
  31. +    pc = new ParseContext1;
  32. +    memset(pc, 0, sizeof(struct ParseContext1));
  33. +    s = new AVCodecParserContext;
  34. +    memset(s, 0, sizeof(struct AVCodecParserContext));
  35.  }
  36.  
  37.  DTVRecorder::~DTVRecorder()
  38. @@ -101,6 +106,12 @@ DTVRecorder::~DTVRecorder()
  39.          delete _input_pmt;
  40.          _input_pmt = NULL;
  41.      }
  42. +
  43. +    if (pc)
  44. +    {
  45. +        delete pc;
  46. +        pc = NULL;
  47. +    }
  48.  }
  49.  
  50.  void DTVRecorder::SetOption(const QString &name, const QString &value)
  51. @@ -155,6 +166,9 @@ void DTVRecorder::FinishRecording(void)
  52.          if (ringBuffer)
  53.              curRecording->SaveFilesize(ringBuffer->GetRealFileSize());
  54.          SavePositionMap(true);
  55. +        LOG(VB_RECORD, LOG_INFO, LOC + "Storing duration and total frames");
  56. +        SetDuration(_duration);
  57. +        SetTotalFrames(_frames_written_count);
  58.      }
  59.  //     positionMapLock.lock();
  60.  //     positionMap.clear();
  61. @@ -339,7 +353,6 @@ bool DTVRecorder::FindMPEG2Keyframes(const TSPacket* tspacket)
  62.      //   (there are others that we don't care about)
  63.      const uint8_t *bufptr = tspacket->data() + tspacket->AFCOffset();
  64.      const uint8_t *bufend = tspacket->data() + TSPacket::kSize;
  65. -    int progressive_sequence = 0;
  66.      int ext_type, bytes_left;
  67.      int picture_structure, top_field_first, repeat_first_field, progressive_frame;
  68.      int repeat_pict = 0;
  69. @@ -384,7 +397,7 @@ bool DTVRecorder::FindMPEG2Keyframes(const TSPacket* tspacket)
  70.                      case 0x1: /* sequence extension */
  71.                          if (bytes_left >= 6)
  72.                          {
  73. -                            progressive_sequence = bufptr[1] & (1 << 3);
  74. +                            pc->progressive_sequence = bufptr[1] & (1 << 3);
  75.                          }
  76.                          break;
  77.                      case 0x8: /* picture coding extension */
  78. @@ -399,7 +412,7 @@ bool DTVRecorder::FindMPEG2Keyframes(const TSPacket* tspacket)
  79.                              repeat_pict = 1;
  80.                              if (repeat_first_field)
  81.                              {
  82. -                                if (progressive_sequence)
  83. +                                if (pc->progressive_sequence)
  84.                                  {
  85.                                      if (top_field_first)
  86.                                          repeat_pict = 5;
  87. @@ -441,6 +454,11 @@ bool DTVRecorder::FindMPEG2Keyframes(const TSPacket* tspacket)
  88.          _frames_seen_count++;
  89.          if (!_wait_for_keyframe_option || _first_keyframe>=0)
  90.              _frames_written_count++;
  91. +            _duration += (int64_t)((1.0f / frameRate / 1000.0f) +
  92. +                                   (repeat_pict * 0.5) / (frameRate / 1000.0f)
  93. +                                   * 1000000);
  94. +            LOG(VB_RECORD, LOG_INFO, LOC + QString("Duration = %1 (%2 %3)")
  95. +                .arg(_duration).arg(_frames_written_count).arg(frameRate));
  96.      }
  97.  
  98.      if ((aspectRatio > 0) && (aspectRatio != m_videoAspect))
  99. diff --git a/mythtv/libs/libmythtv/dtvrecorder.h b/mythtv/libs/libmythtv/dtvrecorder.h
  100. index 25b8c7e..64d66df 100644
  101. --- a/mythtv/libs/libmythtv/dtvrecorder.h
  102. +++ b/mythtv/libs/libmythtv/dtvrecorder.h
  103. @@ -18,6 +18,10 @@ using namespace std;
  104.  #include "recorderbase.h"
  105.  #include "H264Parser.h"
  106.  
  107. +extern "C" {
  108. +#include "libavcodec/parser.h"
  109. +}
  110. +
  111.  class MPEGStreamData;
  112.  class TSPacket;
  113.  class QTime;
  114. @@ -132,6 +136,10 @@ class DTVRecorder :
  115.      unsigned int _video_bytes_remaining;
  116.      unsigned int _other_bytes_remaining;
  117.  
  118. +    // used for storing sequence header information
  119. +    ParseContext1        *pc;
  120. +    AVCodecParserContext *s;
  121. +
  122.      // H.264 support
  123.      bool _pes_synced;
  124.      bool _seen_sps;
  125. @@ -169,6 +177,7 @@ class DTVRecorder :
  126.      mutable unsigned long long _continuity_error_count;
  127.      unsigned long long _frames_seen_count;
  128.      unsigned long long _frames_written_count;
  129. +    unsigned long long _duration;
  130.  
  131.      // constants
  132.      /// If the number of regular frames detected since the last
  133. diff --git a/mythtv/libs/libmythtv/mythcommflagplayer.cpp b/mythtv/libs/libmythtv/mythcommflagplayer.cpp
  134. index 4f104b4..dc1a1b7 100644
  135. --- a/mythtv/libs/libmythtv/mythcommflagplayer.cpp
  136. +++ b/mythtv/libs/libmythtv/mythcommflagplayer.cpp
  137. @@ -186,6 +186,7 @@ bool MythCommFlagPlayer::RebuildSeekTable(
  138.          cout << "\r                         \r" << flush;
  139.  
  140.      SaveTotalDuration();
  141. +    SaveTotalFrames();
  142.  
  143.      SetPlaying(false);
  144.      killdecoder = true;
  145. diff --git a/mythtv/libs/libmythtv/mythplayer.cpp b/mythtv/libs/libmythtv/mythplayer.cpp
  146. index 99fd103..297b478 100644
  147. --- a/mythtv/libs/libmythtv/mythplayer.cpp
  148. +++ b/mythtv/libs/libmythtv/mythplayer.cpp
  149. @@ -4808,6 +4808,14 @@ void MythPlayer::ResetTotalDuration(void)
  150.      decoder->ResetTotalDuration();
  151.  }
  152.  
  153. +void MythPlayer::SaveTotalFrames(void)
  154. +{
  155. +    if (!decoder)
  156. +        return;
  157. +
  158. +    decoder->SaveTotalFrames();
  159. +}
  160. +
  161.  static unsigned dbg_ident(const MythPlayer *player)
  162.  {
  163.      static QMutex   dbg_lock;
  164. diff --git a/mythtv/libs/libmythtv/mythplayer.h b/mythtv/libs/libmythtv/mythplayer.h
  165. index 9434d7e..3cd8783 100644
  166. --- a/mythtv/libs/libmythtv/mythplayer.h
  167. +++ b/mythtv/libs/libmythtv/mythplayer.h
  168. @@ -304,6 +304,8 @@ class MTV_PUBLIC MythPlayer
  169.      void SaveTotalDuration(void);
  170.      void ResetTotalDuration(void);
  171.  
  172. +    void SaveTotalFrames(void);
  173. +
  174.    protected:
  175.      // Initialization
  176.      void OpenDummy(void);
  177. diff --git a/mythtv/libs/libmythtv/recorderbase.cpp b/mythtv/libs/libmythtv/recorderbase.cpp
  178. index ed7c0e0..90a95be 100644
  179. --- a/mythtv/libs/libmythtv/recorderbase.cpp
  180. +++ b/mythtv/libs/libmythtv/recorderbase.cpp
  181. @@ -454,6 +454,13 @@ void RecorderBase::SetDuration(uint64_t duration)
  182.          curRecording->SaveTotalDuration(duration);
  183.  }
  184.  
  185. +void RecorderBase::SetTotalFrames(uint64_t total_frames)
  186. +{
  187. +    if (curRecording)
  188. +        curRecording->SaveTotalFrames(total_frames);
  189. +}
  190. +
  191. +
  192.  
  193.  
  194.  RecorderBase *RecorderBase::CreateRecorder(
  195. diff --git a/mythtv/libs/libmythtv/recorderbase.h b/mythtv/libs/libmythtv/recorderbase.h
  196. index 34a444d..c2f8635 100644
  197. --- a/mythtv/libs/libmythtv/recorderbase.h
  198. +++ b/mythtv/libs/libmythtv/recorderbase.h
  199. @@ -248,6 +248,10 @@ class MTV_PUBLIC RecorderBase : public QRunnable
  200.       */
  201.      void SetDuration(uint64_t duration);
  202.  
  203. +    /** \brief Note the total frames in the recordedmark table
  204. +     */
  205. +    void SetTotalFrames(uint64_t total_frames);
  206. +
  207.      TVRec         *tvrec;
  208.      RingBuffer    *ringBuffer;
  209.      bool           weMadeBuffer;

advertising

Update the Post

Either update this post and resubmit it with changes, or make a new post.

You may also comment on this post.

update paste below
details of the post (optional)

Note: Only the paste content is required, though the following information can be useful to others.

Save name / title?

(space separated, optional)



Please note that information posted here will expire by default in one month. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.

worth-right
worth-right fantasy-obligation