Ticket #10080: firewire-h264.patch

File firewire-h264.patch, 2.4 KB (added by Andrew Phillips <theasp@…>, 13 years ago)
  • mythtv/libs/libmythtv/firewirerecorder.cpp

    diff -ruN mythtv-0.24.1+fixes.20111005.c8c1582//mythtv/libs/libmythtv/firewirerecorder.cpp mythtv-0.24.1+fixes.20111005.c8c1582-asp1//mythtv/libs/libmythtv/firewirerecorder.cpp
    old new  
    3131    if (!isopen)
    3232        isopen = channel->GetFirewireDevice()->OpenPort();
    3333
     34    memset(_stream_id,  0, sizeof(_stream_id));
     35
    3436    return isopen;
    3537}
    3638
     
    140142        // Pass or reject packets based on PID, and parse info from them
    141143        if (lpid == GetStreamData()->VideoPIDSingleProgram())
    142144        {
    143             _buffer_packets = !FindMPEG2Keyframes(&tspacket);
     145            uint streamType = _stream_id[tspacket.PID()];
     146
     147            // Check for keyframes and count frames
     148            if (streamType == StreamID::H264Video)
     149            {
     150                _buffer_packets = !FindH264Keyframes(&tspacket);
     151                if (!_seen_sps)
     152                    return;
     153            }
     154            else
     155            {
     156                _buffer_packets = !FindMPEG2Keyframes(&tspacket);
     157            }
    144158            BufferedWrite(tspacket);
    145159        }
    146160        else if (GetStreamData()->IsAudioPID(lpid))
     
    216230    if (!pmt)
    217231        return;
    218232
     233    // collect stream types for H.264 (MPEG-4 AVC) keyframe detection
     234    for (uint i = 0; i < pmt->StreamCount(); i++)
     235        _stream_id[pmt->StreamPID(i)] = pmt->StreamType(i);
     236
    219237    int next = (pmt->tsheader()->ContinuityCounter()+1)&0xf;
    220238    pmt->tsheader()->SetContinuityCounter(next);
    221239    BufferedWrite(*(reinterpret_cast<const TSPacket*>(pmt->tsheader())));
  • mythtv/libs/libmythtv/firewirerecorder.h

    diff -ruN mythtv-0.24.1+fixes.20111005.c8c1582//mythtv/libs/libmythtv/firewirerecorder.h mythtv-0.24.1+fixes.20111005.c8c1582-asp1//mythtv/libs/libmythtv/firewirerecorder.h
    old new  
    6363    FirewireChannel       *channel;
    6464    bool                   isopen;
    6565    vector<unsigned char>  buffer;
     66
     67    unsigned char _stream_id[0x1fff + 1];
    6668};
    6769
    6870#endif //  _FIREWIRERECORDER_H_