Ticket #11334: StartNewFile.patch

File StartNewFile.patch, 10.1 KB (added by jpoet, 11 years ago)

Make sure the first things in the file are a PAT & PMT

  • mythtv/libs/libmythtv/recorders/asirecorder.cpp

    diff --git a/mythtv/libs/libmythtv/recorders/asirecorder.cpp b/mythtv/libs/libmythtv/recorders/asirecorder.cpp
    index b6cb4df..44e445f 100644
    a b void ASIRecorder::SetOption(const QString &name, int value) 
    6262        DTVRecorder::SetOption(name, value);
    6363}
    6464
     65void ASIRecorder::StartNewFile(void)
     66{
     67    // Make sure the first things in the file are a PAT & PMT
     68    bool tmp = _wait_for_keyframe_option;
     69    _wait_for_keyframe_option = false;
     70    HandleSingleProgramPAT(_stream_data->PATSingleProgram());
     71    HandleSingleProgramPMT(_stream_data->PMTSingleProgram());
     72    _wait_for_keyframe_option = tmp;
     73}
     74
     75
    6576void ASIRecorder::run(void)
    6677{
    6778    if (!Open())
    void ASIRecorder::run(void) 
    99110    if (m_channel && (m_channel->GetSIStandard() == "dvb"))
    100111        _stream_data->AddListeningPID(DVB_TDT_PID);
    101112
    102     // Make sure the first things in the file are a PAT & PMT
    103     bool tmp = _wait_for_keyframe_option;
    104     _wait_for_keyframe_option = false;
    105     HandleSingleProgramPAT(_stream_data->PATSingleProgram());
    106     HandleSingleProgramPMT(_stream_data->PMTSingleProgram());
    107     _wait_for_keyframe_option = tmp;
     113    StartNewFile();
    108114
    109115    _stream_data->AddAVListener(this);
    110116    _stream_data->AddWritingListener(this);
  • mythtv/libs/libmythtv/recorders/asirecorder.h

    diff --git a/mythtv/libs/libmythtv/recorders/asirecorder.h b/mythtv/libs/libmythtv/recorders/asirecorder.h
    index a973f9d..22d52b9 100644
    a b class ASIRecorder : public DTVRecorder 
    6969    bool Open(void);
    7070    bool IsOpen(void) const;
    7171    void Close(void);
     72    void StartNewFile(void);
    7273
    7374  private:
    7475    ASIChannel       *m_channel;
  • mythtv/libs/libmythtv/recorders/cetonrecorder.cpp

    diff --git a/mythtv/libs/libmythtv/recorders/cetonrecorder.cpp b/mythtv/libs/libmythtv/recorders/cetonrecorder.cpp
    index f7aacf4..918c2fe 100644
    a b void CetonRecorder::Close(void) 
    4646    LOG(VB_RECORD, LOG_INFO, LOC + "Close() -- end");
    4747}
    4848
     49void CetonRecorder::StartNewFile(void)
     50{
     51    // Make sure the first things in the file are a PAT & PMT
     52    bool tmp = _wait_for_keyframe_option;
     53    _wait_for_keyframe_option = false;
     54    HandleSingleProgramPAT(_stream_data->PATSingleProgram());
     55    HandleSingleProgramPMT(_stream_data->PMTSingleProgram());
     56    _wait_for_keyframe_option = tmp;
     57}
     58
    4959void CetonRecorder::run(void)
    5060{
    5161    LOG(VB_RECORD, LOG_INFO, LOC + "run -- begin");
    void CetonRecorder::run(void) 
    6575        recordingWait.wakeAll();
    6676    }
    6777
    68     // Make sure the first things in the file are a PAT & PMT
    69     bool tmp = _wait_for_keyframe_option;
    70     _wait_for_keyframe_option = false;
    71     HandleSingleProgramPAT(_stream_data->PATSingleProgram());
    72     HandleSingleProgramPMT(_stream_data->PMTSingleProgram());
    73     _wait_for_keyframe_option = tmp;
     78    StartNewFile();
    7479
    7580    _stream_data->AddAVListener(this);
    7681    _stream_data->AddWritingListener(this);
  • mythtv/libs/libmythtv/recorders/cetonrecorder.h

    diff --git a/mythtv/libs/libmythtv/recorders/cetonrecorder.h b/mythtv/libs/libmythtv/recorders/cetonrecorder.h
    index fe2d176..8233d46 100644
    a b class CetonRecorder : public DTVRecorder 
    2626
    2727    bool Open(void);
    2828    void Close(void);
     29    void StartNewFile(void);
    2930
    3031    bool IsOpen(void) const { return _stream_handler; }
    3132
  • mythtv/libs/libmythtv/recorders/dtvrecorder.cpp

    diff --git a/mythtv/libs/libmythtv/recorders/dtvrecorder.cpp b/mythtv/libs/libmythtv/recorders/dtvrecorder.cpp
    index 0c30b10..2b26342 100644
    a b DTVRecorder::DTVRecorder(TVRec *rec) : 
    8787{
    8888    SetPositionMapType(MARK_GOP_BYFRAME);
    8989    _payload_buffer.reserve(TSPacket::kSize * (50 + 1));
     90
     91    memset(_stream_id,  0, sizeof(_stream_id));
     92    memset(_pid_status, 0, sizeof(_pid_status));
     93    memset(_continuity_counter, 0xff, sizeof(_continuity_counter));
     94
    9095    ResetForNewFile();
    9196}
    9297
    void DTVRecorder::ResetForNewFile(void) 
    191196    //_recording
    192197    _error                      = QString();
    193198
    194     memset(_stream_id,  0, sizeof(_stream_id));
    195     memset(_pid_status, 0, sizeof(_pid_status));
    196     memset(_continuity_counter, 0xff, sizeof(_continuity_counter));
    197 
    198199    _progressive_sequence       = 0;
    199200    _repeat_pict                = 0;
    200201
    void DTVRecorder::ResetForNewFile(void) 
    204205    positionMapDelta.clear();
    205206    durationMap.clear();
    206207    durationMapDelta.clear();
    207     _payload_buffer.clear();
    208208
    209209    locker.unlock();
    210210    ClearStatistics();
  • mythtv/libs/libmythtv/recorders/dvbrecorder.cpp

    diff --git a/mythtv/libs/libmythtv/recorders/dvbrecorder.cpp b/mythtv/libs/libmythtv/recorders/dvbrecorder.cpp
    index c1b66d5..92a05e0 100644
    a b void DVBRecorder::Close(void) 
    7272    LOG(VB_RECORD, LOG_INFO, LOC + "Close() -- end");
    7373}
    7474
     75void DVBRecorder::StartNewFile(void)
     76{
     77    // Make sure the first things in the file are a PAT & PMT
     78    bool tmp = _wait_for_keyframe_option;
     79    _wait_for_keyframe_option = false;
     80    HandleSingleProgramPAT(_stream_data->PATSingleProgram());
     81    HandleSingleProgramPMT(_stream_data->PMTSingleProgram());
     82    _wait_for_keyframe_option = tmp;
     83}
     84
    7585void DVBRecorder::run(void)
    7686{
    7787    if (!Open())
    void DVBRecorder::run(void) 
    92102    if (_channel && (_channel->GetSIStandard() == "dvb"))
    93103        _stream_data->AddListeningPID(DVB_TDT_PID);
    94104
    95     // Make sure the first things in the file are a PAT & PMT
    96     bool tmp = _wait_for_keyframe_option;
    97     _wait_for_keyframe_option = false;
    98     HandleSingleProgramPAT(_stream_data->PATSingleProgram());
    99     HandleSingleProgramPMT(_stream_data->PMTSingleProgram());
    100     _wait_for_keyframe_option = tmp;
     105    StartNewFile();
    101106
    102107    _stream_data->AddAVListener(this);
    103108    _stream_data->AddWritingListener(this);
  • mythtv/libs/libmythtv/recorders/dvbrecorder.h

    diff --git a/mythtv/libs/libmythtv/recorders/dvbrecorder.h b/mythtv/libs/libmythtv/recorders/dvbrecorder.h
    index eb0b5f8..e82c2fe 100644
    a b class DVBRecorder : public DTVRecorder 
    2828    bool Open(void);
    2929    bool IsOpen(void) const;
    3030    void Close(void);
     31    void StartNewFile(void);
    3132
    3233  private:
    3334    bool PauseAndWait(int timeout = 100);
  • mythtv/libs/libmythtv/recorders/hdhrrecorder.cpp

    diff --git a/mythtv/libs/libmythtv/recorders/hdhrrecorder.cpp b/mythtv/libs/libmythtv/recorders/hdhrrecorder.cpp
    index c8e1436..f84ac1e 100644
    a b void HDHRRecorder::Close(void) 
    4747    LOG(VB_RECORD, LOG_INFO, LOC + "Close() -- end");
    4848}
    4949
     50void HDHRRecorder::StartNewFile(void)
     51{
     52    // Make sure the first things in the file are a PAT & PMT
     53    bool tmp = _wait_for_keyframe_option;
     54    _wait_for_keyframe_option = false;
     55    HandleSingleProgramPAT(_stream_data->PATSingleProgram());
     56    HandleSingleProgramPMT(_stream_data->PMTSingleProgram());
     57    _wait_for_keyframe_option = tmp;
     58}
     59
    5060void HDHRRecorder::run(void)
    5161{
    5262    LOG(VB_RECORD, LOG_INFO, LOC + "run -- begin");
    void HDHRRecorder::run(void) 
    6676        recordingWait.wakeAll();
    6777    }
    6878
    69     // Make sure the first things in the file are a PAT & PMT
    70     bool tmp = _wait_for_keyframe_option;
    71     _wait_for_keyframe_option = false;
    72     HandleSingleProgramPAT(_stream_data->PATSingleProgram());
    73     HandleSingleProgramPMT(_stream_data->PMTSingleProgram());
    74     _wait_for_keyframe_option = tmp;
     79    StartNewFile();
    7580
    7681    _stream_data->AddAVListener(this);
    7782    _stream_data->AddWritingListener(this);
  • mythtv/libs/libmythtv/recorders/hdhrrecorder.h

    diff --git a/mythtv/libs/libmythtv/recorders/hdhrrecorder.h b/mythtv/libs/libmythtv/recorders/hdhrrecorder.h
    index 44b3fc1..7523e37 100644
    a b class HDHRRecorder : public DTVRecorder 
    2626    bool Open(void);
    2727    bool IsOpen(void) const { return _stream_handler; }
    2828    void Close(void);
     29    void StartNewFile(void);
    2930
    3031    QString GetSIStandard(void) const;
    3132
  • mythtv/libs/libmythtv/recorders/iptvrecorder.cpp

    diff --git a/mythtv/libs/libmythtv/recorders/iptvrecorder.cpp b/mythtv/libs/libmythtv/recorders/iptvrecorder.cpp
    index 39a35b1..d9be192 100644
    a b bool IPTVRecorder::PauseAndWait(int timeout) 
    9191    return IsPaused(true);
    9292}
    9393
     94void IPTVRecorder::StartNewFile(void)
     95{
     96    // Make sure the first things in the file are a PAT & PMT
     97    bool tmp = _wait_for_keyframe_option;
     98    _wait_for_keyframe_option = false;
     99    HandleSingleProgramPAT(_stream_data->PATSingleProgram());
     100    HandleSingleProgramPMT(_stream_data->PMTSingleProgram());
     101    _wait_for_keyframe_option = tmp;
     102}
     103
    94104void IPTVRecorder::run(void)
    95105{
    96106    LOG(VB_RECORD, LOG_INFO, LOC + "run -- begin");
    void IPTVRecorder::run(void) 
    109119        recordingWait.wakeAll();
    110120    }
    111121
    112     // Make sure the first things in the file are a PAT & PMT
    113     bool tmp = _wait_for_keyframe_option;
    114     _wait_for_keyframe_option = false;
    115     HandleSingleProgramPAT(_stream_data->PATSingleProgram());
    116     HandleSingleProgramPMT(_stream_data->PMTSingleProgram());
    117     _wait_for_keyframe_option = tmp;
     122    StartNewFile();
    118123
    119124    _stream_data->AddAVListener(this);
    120125    _stream_data->AddWritingListener(this);
  • mythtv/libs/libmythtv/recorders/iptvrecorder.h

    diff --git a/mythtv/libs/libmythtv/recorders/iptvrecorder.h b/mythtv/libs/libmythtv/recorders/iptvrecorder.h
    index d68c1e6..cbcd041 100644
    a b class IPTVRecorder : public DTVRecorder 
    2424    virtual bool Open(void); // RecorderBase
    2525    virtual void Close(void); // RecorderBase
    2626    bool IsOpen(void) const;
     27    void StartNewFile(void);
    2728
    2829    virtual void SetStreamData(MPEGStreamData*); // DTVRecorder
    2930    virtual bool PauseAndWait(int timeout = 100); // RecorderBase