Ticket #1926: h264utils.diff

File h264utils.diff, 2.2 KB (added by anonymous, 18 years ago)
  • mythtv/libs/libmythtv/mpeg/h264utils.h

     
    195195
    196196    bool    saw_AU_delimiter;
    197197    bool    saw_first_VCL_NAL_unit;
     198    bool    saw_sps;
    198199
    199200    bool    did_evaluate_once;
    200201    bool    keyframe;
  • mythtv/libs/libmythtv/mpeg/h264utils.cpp

     
    6262
    6363    saw_AU_delimiter = false;
    6464    saw_first_VCL_NAL_unit = false;
     65    saw_sps = false;
    6566
    6667    did_evaluate_once = false;
    6768    keyframe = false;
     
    113114        }
    114115    }
    115116
    116     // stage 2: determine if it's an IDR AU
    117     if (!saw_first_VCL_NAL_unit && new_NAL_type == NALUnitType::SLICE_IDR)
     117    if (!saw_first_VCL_NAL_unit && !saw_sps && new_NAL_type == NALUnitType::SPS)
    118118    {
    119         keyframe = true;
     119        saw_sps = true;
     120        state_changed = true;
     121        keyframe = false;
    120122    }
    121123
    122     // stage 3: did we see the AU's first VCL NAL unit yet?
    123124    if (!saw_first_VCL_NAL_unit && NALUnitType::IsVCLType(new_NAL_type))
    124125    {
    125126        saw_first_VCL_NAL_unit = true;
    126127        saw_AU_delimiter = false;
     128        state_changed = true;
     129        if (saw_sps)
     130            keyframe = true;
     131        saw_sps = false;
    127132    }
    128133}
    129134
     
    152157                    read_first_NAL_byte = false;
    153158                    keyframe = false;
    154159
    155                     state_changed = true;
    156160                    return local_bytes - bytes;
    157161                }
    158162                else
     
    167171            local_bytes++;
    168172        }
    169173    }
    170 
     174    state_changed = false;
    171175    if (synced && !read_first_NAL_byte && local_bytes < local_bytes_end)
    172176    {
    173177        KeyframePredicate(*local_bytes);
     
    178182        synced = false;
    179183        read_first_NAL_byte = true;
    180184
    181         state_changed = true;
    182185        return local_bytes - bytes;
    183186    }
    184187
    185     state_changed = false;
     188
    186189    return local_bytes - bytes;
    187190}