Ticket #11435: SPS-H264Parser-0.26.patch

File SPS-H264Parser-0.26.patch, 22.1 KB (added by jpoet, 11 years ago)

fixes/0.26 version

  • mythtv/libs/libmythtv/avformatdecoder.cpp

    diff --git a/mythtv/libs/libmythtv/avformatdecoder.cpp b/mythtv/libs/libmythtv/avformatdecoder.cpp
    index 1376f5d..1d730ac 100644
    a b int AvFormatDecoder::H264PreProcessPkt(AVStream *stream, AVPacket *pkt) 
    30133013    {
    30143014        buf += m_h264_parser->addBytes(buf, buf_end - buf, 0);
    30153015
    3016         if (m_h264_parser->stateChanged())
     3016        if (m_h264_parser->stateChanged() && m_h264_parser->seen_SPS())
    30173017        {
    30183018            if (m_h264_parser->FieldType() != H264Parser::FIELD_BOTTOM)
    30193019            {
  • mythtv/libs/libmythtv/mpeg/H264Parser.cpp

    diff --git a/mythtv/libs/libmythtv/mpeg/H264Parser.cpp b/mythtv/libs/libmythtv/mpeg/H264Parser.cpp
    index 716b7a1..016217a 100644
    a b void H264Parser::Reset(void) 
    115115    prev_pic_parameter_set_id = pic_parameter_set_id = -1;
    116116    prev_field_pic_flag = field_pic_flag = -1;
    117117    prev_bottom_field_flag = bottom_field_flag = -1;
    118     prev_nal_ref_idc = nal_ref_idc = 0;
     118    prev_nal_ref_idc = nal_ref_idc = 111;  //  != [0|1|2|3]
    119119    prev_pic_order_cnt_type = pic_order_cnt_type =
    120120    prev_pic_order_cnt_lsb = pic_order_cnt_lsb = 0;
    121121    prev_delta_pic_order_cnt_bottom = delta_pic_order_cnt_bottom = 0;
    122122    prev_delta_pic_order_cnt[0] = delta_pic_order_cnt[0] = 0;
    123123    prev_delta_pic_order_cnt[1] = delta_pic_order_cnt[1] = 0;
    124124    prev_nal_unit_type = nal_unit_type = UNKNOWN;
    125     prev_idr_pic_id = idr_pic_id = 0;
     125
     126    // The value of idr_pic_id shall be in the range of 0 to 65535, inclusive.
     127    prev_idr_pic_id = idr_pic_id = 65536;
    126128
    127129    log2_max_frame_num = log2_max_pic_order_cnt_lsb = 0;
    128130    seq_parameter_set_id = 0;
    bool H264Parser::fillRBSP(const uint8_t *byteP, uint32_t byte_count, 
    368370    /* If we've found the next start code then that, plus the first byte of
    369371     * the next NAL, plus the preceding zero bytes will all be in the rbsp
    370372     * buffer. Move rbsp_index++ back to the end of the actual rbsp data. We
    371      * need to know the correct size of the rbsp to decode some NALs. */
     373     * need to know the correct size of the rbsp to decode some NALs.
     374     */
    372375    if (found_start_code)
    373376    {
    374377        if (rbsp_index >= 4)
    uint32_t H264Parser::addBytes(const uint8_t *bytes, 
    399402    const uint8_t *startP = bytes;
    400403    const uint8_t *endP;
    401404    bool           found_start_code;
     405    bool           good_nal_unit;
    402406
    403407    state_changed = false;
    404408    on_frame      = false;
    uint32_t H264Parser::addBytes(const uint8_t *bytes, 
    413417
    414418        /* Between startP and endP we potentially have some more
    415419         * bytes of a NAL that we've been parsing (plus some bytes of
    416          * start code) */
     420         * start code)
     421         */
    417422        if (have_unfinished_NAL)
    418423        {
    419424            if (!fillRBSP(startP, endP - startP, found_start_code))
    uint32_t H264Parser::addBytes(const uint8_t *bytes, 
    447452            /* If we find the start of an AU somewhere from here
    448453             * to the next start code, the offset to associate with
    449454             * it is the one passed in to this call, not any of the
    450              * subsequent calls. */
     455             * subsequent calls.
     456             */
    451457            pkt_offset = stream_offset; // + (startP - bytes);
     458
    452459/*
    453460  nal_unit_type specifies the type of RBSP data structure contained in
    454461  the NAL unit as specified in Table 7-1. VCL NAL units
    uint32_t H264Parser::addBytes(const uint8_t *bytes, 
    472479            nal_unit_type = sync_accumulator & 0x1f;
    473480            nal_ref_idc = (sync_accumulator >> 5) & 0x3;
    474481
    475             if (nal_unit_type == SPS || nal_unit_type == PPS ||
    476                 nal_unit_type == SEI || NALisSlice(nal_unit_type))
     482            good_nal_unit = true;
     483            if (nal_ref_idc)
    477484            {
    478                 /* This is a NAL we need to parse. We may have the body
    479                  * of it in the part of the stream past to us this call,
    480                  * or we may get the rest in subsequent calls to addBytes.
    481                  * Either way, we set have_unfinished_NAL, so that we
    482                  * start filling the rbsp buffer */
    483                 have_unfinished_NAL = true;
     485                /* nal_ref_idc shall be equal to 0 for all NAL units having
     486                 * nal_unit_type equal to 6, 9, 10, 11, or 12.
     487                 */
     488                if (nal_unit_type == SEI ||
     489                    (nal_unit_type >= AU_DELIMITER &&
     490                     nal_unit_type <= FILLER_DATA))
     491                    good_nal_unit = false;
    484492            }
    485             else if (nal_unit_type == AU_DELIMITER ||
    486                     (nal_unit_type > SPS_EXT &&
    487                      nal_unit_type < AUXILIARY_SLICE))
     493            else
    488494            {
    489                 set_AU_pending();
     495                /* nal_ref_idc shall not be equal to 0 for NAL units with
     496                 * nal_unit_type equal to 5
     497                 */
     498                if (nal_unit_type == SLICE_IDR)
     499                    good_nal_unit = false;
    490500            }
    491         }
     501
     502            if (good_nal_unit)
     503            {
     504                if (nal_unit_type == SPS || nal_unit_type == PPS ||
     505                    nal_unit_type == SEI || NALisSlice(nal_unit_type))
     506                {
     507                    /* This is a NAL we need to parse. We may have the body
     508                     * of it in the part of the stream past to us this call,
     509                     * or we may get the rest in subsequent calls to addBytes.
     510                     * Either way, we set have_unfinished_NAL, so that we
     511                     * start filling the rbsp buffer
     512                     */
     513                      have_unfinished_NAL = true;
     514                }
     515                else if (nal_unit_type == AU_DELIMITER ||
     516                        (nal_unit_type > SPS_EXT &&
     517                         nal_unit_type < AUXILIARY_SLICE))
     518                {
     519                    set_AU_pending();
     520                }
     521            }
     522            else
     523                LOG(VB_GENERAL, LOG_ERR,
     524                    "H264Parser::addbytes: malformed NAL units");
     525        } //found start code
    492526    }
    493527
    494528    return startP - bytes;
    void H264Parser::processRBSP(bool rbsp_complete) 
    505539    {
    506540        /* SEI cannot be parsed without knowing its size. If
    507541         * we haven't got the whole rbsp, return and wait for
    508          * the rest */
     542         * the rest
     543         */
    509544        if (!rbsp_complete)
    510545            return;
    511546
    void H264Parser::processRBSP(bool rbsp_complete) 
    521556
    522557        set_AU_pending();
    523558
     559        if (!seen_sps)
     560            SPS_offset = pkt_offset;
     561
    524562        decode_SPS(&gb);
    525563    }
    526564    else if (nal_unit_type == PPS)
    void H264Parser::processRBSP(bool rbsp_complete) 
    553591    if (AU_pending && NALisSlice(nal_unit_type))
    554592    {
    555593        /* Once we know the slice type of a new AU, we can
    556          * determine if it is a keyframe or just a frame */
    557 
     594         * determine if it is a keyframe or just a frame
     595         */
    558596        AU_pending = false;
    559597        state_changed = true;
    560598
    void H264Parser::processRBSP(bool rbsp_complete) 
    574612*/
    575613bool H264Parser::decode_Header(GetBitContext *gb)
    576614{
    577     uint first_mb_in_slice;
     615    // uint first_mb_in_slice;
    578616
    579617    is_keyframe = false;
    580618
    bool H264Parser::decode_Header(GetBitContext *gb) 
    601639      that precedes the current slice in decoding order and has the
    602640      same value of colour_plane_id.
    603641     */
    604     first_mb_in_slice = get_ue_golomb(gb);
     642    /* first_mb_in_slice = */ get_ue_golomb(gb);
    605643
    606644    /*
    607645      slice_type specifies the coding type of the slice according to
    bool H264Parser::decode_Header(GetBitContext *gb) 
    610648      When nal_unit_type is equal to 5 (IDR picture), slice_type shall
    611649      be equal to 2, 4, 7, or 9 (I or SI)
    612650     */
    613     slice_type = get_ue_golomb(gb);
     651    slice_type = get_ue_golomb_31(gb);
     652
     653    /* s->pict_type = golomb_to_pict_type[slice_type % 5];
     654     */
    614655
    615656    /*
    616657      pic_parameter_set_id specifies the picture parameter set in
    bool H264Parser::decode_Header(GetBitContext *gb) 
    641682      bitstream....
    642683
    643684      If the current picture is an IDR picture, frame_num shall be equal to 0.
    644     */
    645685
     686      When max_num_ref_frames is equal to 0, slice_type shall be equal
     687          to 2, 4, 7, or 9.
     688    */
    646689    frame_num = get_bits(gb, log2_max_frame_num);
    647690
    648691    /*
    bool H264Parser::decode_Header(GetBitContext *gb) 
    656699      picture is a coded top field. When this syntax element is not present
    657700      for the current slice, it shall be inferred to be equal to 0.
    658701    */
    659 
    660702    if (!frame_mbs_only_flag)
    661703    {
    662704        field_pic_flag = get_bits1(gb);
    bool H264Parser::decode_Header(GetBitContext *gb) 
    677719      second such IDR access unit. The value of idr_pic_id shall be in
    678720      the range of 0 to 65535, inclusive.
    679721     */
    680 
    681722    if (nal_unit_type == SLICE_IDR)
    682723    {
    683724        idr_pic_id = get_ue_golomb(gb);
    684725        is_keyframe = true;
    685726    }
    686727    else
    687         is_keyframe |= I_is_keyframe && isKeySlice(slice_type);
     728        is_keyframe = (I_is_keyframe && isKeySlice(slice_type));
     729
    688730    /*
    689731      pic_order_cnt_lsb specifies the picture order count modulo
    690732      MaxPicOrderCntLsb for the top field of a coded frame or for a coded
    bool H264Parser::decode_Header(GetBitContext *gb) 
    701743    {
    702744        pic_order_cnt_lsb = get_bits(gb, log2_max_pic_order_cnt_lsb);
    703745
    704         if (pic_order_present_flag && !field_pic_flag)
     746        if ((pic_order_present_flag == 1) && !field_pic_flag)
    705747            delta_pic_order_cnt_bottom = get_se_golomb(gb);
    706748        else
    707749            delta_pic_order_cnt_bottom = 0;
    bool H264Parser::decode_Header(GetBitContext *gb) 
    710752        delta_pic_order_cnt_bottom = 0;
    711753
    712754    /*
    713       delta_pic_order_cnt[ 0 ] specifies the picture order count
    714       difference from the expected picture order count for the top
    715       field of a coded frame or for a coded field as specified in
    716       subclause 8.2.1. The value of delta_pic_order_cnt[ 0 ] shall be
    717       in the range of -231 to 231 - 1, inclusive. When this syntax
    718       element is not present in the bitstream for the current slice,
    719       it shall be inferred to be equal to 0.
    720 
    721       delta_pic_order_cnt[ 1 ] specifies the picture order count
    722       difference from the expected picture order count for the bottom
    723       field of a coded frame specified in subclause 8.2.1. The value
    724       of delta_pic_order_cnt[ 1 ] shall be in the range of -231 to 231
    725       - 1, inclusive. When this syntax element is not present in the
    726       bitstream for the current slice, it shall be inferred to be
    727       equal to 0.
    728      */
    729     if (pic_order_cnt_type == 1 && !delta_pic_order_always_zero_flag)
     755      delta_pic_order_always_zero_flag equal to 1 specifies that
     756      delta_pic_order_cnt[ 0 ] and delta_pic_order_cnt[ 1 ] are not
     757      present in the slice headers of the sequence and shall be
     758      inferred to be equal to 0. delta_pic_order_always_zero_flag
     759      equal to 0 specifies that delta_pic_order_cnt[ 0 ] is present in
     760      the slice headers of the sequence and delta_pic_order_cnt[ 1 ]
     761      may be present in the slice headers of the sequence.
     762    */
     763    if (delta_pic_order_always_zero_flag)
    730764    {
     765        delta_pic_order_cnt[1] = delta_pic_order_cnt[0] = 0;
     766    }
     767    else if (pic_order_cnt_type == 1)
     768    {
     769        /*
     770          delta_pic_order_cnt[ 0 ] specifies the picture order count
     771          difference from the expected picture order count for the top
     772          field of a coded frame or for a coded field as specified in
     773          subclause 8.2.1. The value of delta_pic_order_cnt[ 0 ] shall
     774          be in the range of -2^31 to 2^31 - 1, inclusive. When this
     775          syntax element is not present in the bitstream for the
     776          current slice, it shall be inferred to be equal to 0.
     777
     778          delta_pic_order_cnt[ 1 ] specifies the picture order count
     779          difference from the expected picture order count for the
     780          bottom field of a coded frame specified in subclause
     781          8.2.1. The value of delta_pic_order_cnt[ 1 ] shall be in the
     782          range of -2^31 to 2^31 - 1, inclusive. When this syntax
     783          element is not present in the bitstream for the current
     784          slice, it shall be inferred to be equal to 0.
     785        */
    731786        delta_pic_order_cnt[0] = get_se_golomb(gb);
    732787
    733         if (pic_order_present_flag && !field_pic_flag)
     788        if ((pic_order_present_flag == 1) && !field_pic_flag)
    734789            delta_pic_order_cnt[1] = get_se_golomb(gb);
    735790        else
    736791            delta_pic_order_cnt[1] = 0;
    737     }
    738     else
    739         delta_pic_order_cnt[0] = 0;
     792     }
    740793
    741794    /*
    742795      redundant_pic_cnt shall be equal to 0 for slices and slice data
    bool H264Parser::decode_Header(GetBitContext *gb) 
    747800      be equal to 0. The value of redundant_pic_cnt shall be in the
    748801      range of 0 to 127, inclusive.
    749802    */
    750 
    751803    redundant_pic_cnt = redundant_pic_cnt_present_flag ? get_ue_golomb(gb) : 0;
    752804
    753805    return true;
    bool H264Parser::decode_Header(GetBitContext *gb) 
    759811void H264Parser::decode_SPS(GetBitContext * gb)
    760812{
    761813    int profile_idc, chroma_format_idc;
     814    int lastScale;
     815    int nextScale;
     816    int deltaScale;
    762817
    763818    seen_sps = true;
    764819
    765     profile_idc = get_bits(gb, 8); // profile_idc
     820    profile_idc = get_bits(gb, 8);
    766821    get_bits1(gb);      // constraint_set0_flag
    767822    get_bits1(gb);      // constraint_set1_flag
    768823    get_bits1(gb);      // constraint_set2_flag
    void H264Parser::decode_SPS(GetBitContext * gb) 
    771826    get_bits(gb, 8);    // level_idc
    772827    get_ue_golomb(gb);  // sps_id
    773828
    774     if (profile_idc >= 100)
     829    if (profile_idc == 100 || profile_idc == 110 || profile_idc == 122 ||
     830        profile_idc == 244 || profile_idc == 44  || profile_idc == 83  ||
     831        profile_idc == 86  || profile_idc == 118 || profile_idc == 128 )
    775832    { // high profile
    776         if ((chroma_format_idc = get_ue_golomb(gb)) == 3) // chroma_format_idc
     833        if ((chroma_format_idc = get_ue_golomb(gb)) == 3)
    777834            separate_colour_plane_flag = (get_bits1(gb) == 1);
    778835
    779836        get_ue_golomb(gb);     // bit_depth_luma_minus8
    void H264Parser::decode_SPS(GetBitContext * gb) 
    784841        {
    785842            for (int idx = 0; idx < ((chroma_format_idc != 3) ? 8 : 12); ++idx)
    786843            {
    787                 if (get_bits1(gb)) // Scaling list presnent
     844                if (get_bits1(gb)) // Scaling list present
    788845                {
     846                    lastScale = nextScale = 8;
    789847                    int sl_n = ((idx < 6) ? 16 : 64);
    790                     for(int sl_i = 0; sl_i < sl_n; sl_i++)
     848                    for(int sl_i = 0; sl_i < sl_n; ++sl_i)
    791849                    {
    792                         get_se_golomb(gb);
     850                        if (nextScale != 0)
     851                        {
     852                            deltaScale = get_se_golomb(gb);
     853                            nextScale = (lastScale + deltaScale + 256) % 256;
     854                        }
     855                        lastScale = (nextScale == 0) ? lastScale : nextScale;
    793856                    }
    794857                }
    795858            }
    void H264Parser::decode_SPS(GetBitContext * gb) 
    808871    int  offset_for_non_ref_pic;
    809872    int  offset_for_top_to_bottom_field;
    810873    uint tmp;
    811     bool gaps_in_frame_num_allowed_flag;
     874    // bool gaps_in_frame_num_allowed_flag;
    812875
    813876    /*
    814877      pic_order_cnt_type specifies the method to decode picture order
    void H264Parser::decode_SPS(GetBitContext * gb) 
    841904          0. delta_pic_order_always_zero_flag
    842905         */
    843906        delta_pic_order_always_zero_flag = get_bits1(gb);
     907
    844908        /*
    845909          offset_for_non_ref_pic is used to calculate the picture
    846910          order count of a non-reference picture as specified in
    void H264Parser::decode_SPS(GetBitContext * gb) 
    848912          range of -231 to 231 - 1, inclusive.
    849913         */
    850914        offset_for_non_ref_pic = get_se_golomb(gb);
     915
    851916        /*
    852917          offset_for_top_to_bottom_field is used to calculate the
    853918          picture order count of a bottom field as specified in
    void H264Parser::decode_SPS(GetBitContext * gb) 
    855920          shall be in the range of -231 to 231 - 1, inclusive.
    856921         */
    857922        offset_for_top_to_bottom_field = get_se_golomb(gb);
     923
    858924        /*
    859925          offset_for_ref_frame[ i ] is an element of a list of
    860926          num_ref_frames_in_pic_order_cnt_cycle values used in the
    void H264Parser::decode_SPS(GetBitContext * gb) 
    878944      specified in subclause A.3.1 or A.3.2), inclusive.
    879945     */
    880946    num_ref_frames = get_ue_golomb(gb);
     947
    881948    /*
    882949      gaps_in_frame_num_value_allowed_flag specifies the allowed
    883950      values of frame_num as specified in subclause 7.4.3 and the
    884951      decoding process in case of an inferred gap between values of
    885952      frame_num as specified in subclause 8.2.5.2.
    886953     */
    887     gaps_in_frame_num_allowed_flag = get_bits1(gb);
     954    /* gaps_in_frame_num_allowed_flag = */ get_bits1(gb);
    888955
    889956    /*
    890957      pic_width_in_mbs_minus1 plus 1 specifies the width of each
    891958      decoded picture in units of macroblocks.  16 macroblocks in a row
    892959     */
    893960    pic_width = (get_ue_golomb(gb) + 1) * 16;
     961
    894962    /*
    895963      pic_height_in_map_units_minus1 plus 1 specifies the height in
    896964      slice group map units of a decoded frame or field.  16
    void H264Parser::decode_SPS(GetBitContext * gb) 
    909977    if (!frame_mbs_only_flag)
    910978    {
    911979        pic_height *= 2;
     980
    912981        /*
    913982          mb_adaptive_frame_field_flag equal to 0 specifies no
    914983          switching between frame and field macroblocks within a
    void H264Parser::decode_PPS(GetBitContext * gb) 
    9661035      inclusive.
    9671036     */
    9681037    pic_parameter_set_id = get_ue_golomb(gb);
     1038
    9691039    /*
    9701040      seq_parameter_set_id refers to the active sequence parameter
    9711041      set. The value of seq_parameter_set_id shall be in the range of
    void H264Parser::decode_PPS(GetBitContext * gb) 
    9731043     */
    9741044    seq_parameter_set_id = get_ue_golomb(gb);
    9751045    get_bits1(gb); // entropy_coding_mode_flag;
     1046
    9761047    /*
    9771048      pic_order_present_flag equal to 1 specifies that the picture
    9781049      order count related syntax elements are present in the slice
    void H264Parser::decode_SEI(GetBitContext *gb) 
    10461117    {
    10471118        do {
    10481119            type += show_bits(gb, 8);
    1049         } while (get_bits(gb, 8) == 255);
     1120        } while (get_bits(gb, 8) == 0xFF);
    10501121
    10511122        do {
    10521123            size += show_bits(gb, 8);
    1053         } while (get_bits(gb, 8) == 255);
     1124        } while (get_bits(gb, 8) == 0xFF);
    10541125
    10551126        switch (type)
    10561127        {
    1057             case SEI_TYPE_RECOVERY_POINT:
    1058                 recovery_frame_cnt = get_ue_golomb(gb);
    1059                 exact_match_flag = get_bits1(gb);
    1060                 broken_link_flag = get_bits1(gb);
    1061                 changing_group_slice_idc = get_bits(gb, 2);
    1062                 au_contains_keyframe_message = (recovery_frame_cnt == 0);
    1063                 return;
    1064 
    1065             default:
    1066                 skip_bits(gb, size * 8);
    1067                 break;
     1128          case SEI_TYPE_RECOVERY_POINT:
     1129            recovery_frame_cnt = get_ue_golomb(gb);
     1130            exact_match_flag = get_bits1(gb);
     1131            broken_link_flag = get_bits1(gb);
     1132            changing_group_slice_idc = get_bits(gb, 2);
     1133            au_contains_keyframe_message = (recovery_frame_cnt == 0);
     1134            if ((size - 12) > 0)
     1135                skip_bits(gb, (size - 12) * 8);
     1136            return;
     1137
     1138          default:
     1139            skip_bits(gb, size * 8);
     1140            break;
    10681141        }
    10691142    }
    10701143}
  • mythtv/libs/libmythtv/mpeg/H264Parser.h

    diff --git a/mythtv/libs/libmythtv/mpeg/H264Parser.h b/mythtv/libs/libmythtv/mpeg/H264Parser.h
    index 3d8ffaa..21a0b68 100644
    a b class H264Parser { 
    5858    // ITU-T Rec. H.264 table 7-1
    5959    enum NAL_unit_type {
    6060        UNKNOWN         = 0,
    61         SLICE           = 1,
     61        SLICE           = 1,   // 1 - 5 are VCL NAL units
    6262        SLICE_DPA       = 2,
    6363        SLICE_DPB       = 3,
    6464        SLICE_DPC       = 4,
    class H264Parser { 
    7171        END_STREAM      = 11,
    7272        FILLER_DATA     = 12,
    7373        SPS_EXT         = 13,
    74         AUXILIARY_SLICE = 19
     74        NALU_prefix     = 14,
     75        SPS_subset      = 15,
     76        AUXILIARY_SLICE = 19,
     77        SLICE_EXTENSION = 20
    7578    };
    7679
    7780    enum SEI_type {
    7881        SEI_TYPE_PIC_TIMING             = 1,
     82        SEI_FILLER_PAYLOAD              = 3,
    7983        SEI_TYPE_USER_DATA_UNREGISTERED = 5,
    8084        SEI_TYPE_RECOVERY_POINT         = 6
    8185    };
    class H264Parser { 
    130134        }
    131135
    132136    bool onFrameStart(void) const { return on_frame; }
    133     bool onKeyFrameStart(void) const { return on_key_frame; }
     137    bool onKeyFrameStart(void) const { return seen_sps && on_key_frame; }
    134138
    135139    uint pictureWidth(void) const { return pic_width; }
    136140    uint pictureHeight(void) const { return pic_height; }
    class H264Parser { 
    142146
    143147    uint64_t frameAUstreamOffset(void) const {return frame_start_offset;}
    144148    uint64_t keyframeAUstreamOffset(void) const {return keyframe_start_offset;}
     149    uint64_t SPSstreamOffset(void) const {return SPS_offset;}
    145150
     151    // == NAL_type AU_delimiter: primary_pic_type = 5
    146152    static int isKeySlice(uint slice_type)
    147153        {
    148154            return (slice_type == SLICE_I   ||
    class H264Parser { 
    159165        }
    160166
    161167    void use_I_forKeyframes(bool val) { I_is_keyframe = val; }
     168    bool using_I_forKeyframes(void) const { return I_is_keyframe; }
    162169
    163170    uint32_t GetTimeScale(void) const { return timeScale; }
    164171
    class H264Parser { 
    167174    void parse_SPS(uint8_t *sps, uint32_t sps_size,
    168175                   bool& interlaced, int32_t& max_ref_frames);
    169176
     177    bool seen_SPS(void) const { return seen_sps; }
     178
     179    bool found_AU(void) const { return AU_pending; }
     180
    170181  private:
    171182    enum constants {EXTENDED_SAR = 255};
    172183
    class H264Parser { 
    241252    bool       fixedRate;
    242253
    243254    uint64_t   pkt_offset, AU_offset, frame_start_offset, keyframe_start_offset;
     255    uint64_t   SPS_offset;
    244256    bool       on_frame, on_key_frame;
    245257};
    246258