Ticket #10080: 0001-firewirerecorder-use-DTVRecorder-for-TS-processing-f.patch

File 0001-firewirerecorder-use-DTVRecorder-for-TS-processing-f.patch, 2.5 KB (added by adamw@…, 6 years ago)

Patch to add MPEG-4 support and re-use DTVRecorder code

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

    From aed81816e73763ac3f8f26d4823d831c2e847fdf Mon Sep 17 00:00:00 2001
    From: Adam Williamson <awilliam@redhat.com>
    Date: Sat, 30 Aug 2014 14:33:08 -0700
    Subject: [PATCH] firewirerecorder: use DTVRecorder for TS processing (fixes
     MPEG-4)
    
    This fixes https://code.mythtv.org/trac/ticket/10080 and reduces
    code duplication into the bargain. I couldn't find a way to
    factor out FirewireRecorder::ProcessTSPacket entirely, but this
    turns it into a fairly thin wrapper around the
    ProcessAudioTSPacket and ProcessVideoTSPacket functions in
    DTVRecorder. ProcessVideoTSPacket handles MPEG-4 just fine. This
    also seems to speed up initial lock. Tested with a DCX3400 on
    Shaw (Vancouver) - both MPEG-2 and MPEG-4 channels work.
    ---
     .../libs/libmythtv/recorders/firewirerecorder.cpp  | 29 ++++++++--------------
     1 file changed, 10 insertions(+), 19 deletions(-)
    
    diff --git a/mythtv/libs/libmythtv/recorders/firewirerecorder.cpp b/mythtv/libs/libmythtv/recorders/firewirerecorder.cpp
    index d7c6ae6..adff37f 100644
    a b bool FirewireRecorder::ProcessTSPacket(const TSPacket &tspacket) 
    154154    if (tspacket.HasAdaptationField())
    155155        GetStreamData()->HandleAdaptationFieldControl(&tspacket);
    156156
    157     if (tspacket.HasPayload())
    158     {
    159         const unsigned int lpid = tspacket.PID();
     157    if (GetStreamData()->IsVideoPID(tspacket.PID()))
     158        return ProcessVideoTSPacket(tspacket);
    160159
    161         // Pass or reject packets based on PID, and parse info from them
    162         if (lpid == GetStreamData()->VideoPIDSingleProgram())
    163         {
    164             _buffer_packets = !FindMPEG2Keyframes(&tspacket);
    165             BufferedWrite(tspacket);
    166         }
    167         else if (GetStreamData()->IsAudioPID(lpid))
    168         {
    169             _buffer_packets = !FindAudioKeyframes(&tspacket);
    170             BufferedWrite(tspacket);
    171         }
    172         else if (GetStreamData()->IsListeningPID(lpid))
    173             GetStreamData()->HandleTSTables(&tspacket);
    174         else if (GetStreamData()->IsWritingPID(lpid))
    175             BufferedWrite(tspacket);
    176     }
     160    if (GetStreamData()->IsAudioPID(tspacket.PID()))
     161        return ProcessAudioTSPacket(tspacket);
     162
     163    if (GetStreamData()->IsWritingPID(tspacket.PID()))
     164        BufferedWrite(tspacket);
     165
     166    if (GetStreamData()->IsListeningPID(tspacket.PID()) && tspacket.HasPayload())
     167        GetStreamData()->HandleTSTables(&tspacket);
    177168
    178169    return true;
    179170}