Ticket #7849: t7849_mythtv_avi_seektable_fix.diff

File t7849_mythtv_avi_seektable_fix.diff, 1.3 KB (added by taylor.ralph@…, 14 years ago)

for avi container seek to previous frame byte position + 1 to make sure the key frame is decoded

  • programs/mythtranscode/mpeg2fix.cpp

     
    732732    if (type)
    733733        fmt = av_find_input_format(type);
    734734
     735    avifile = (strcmp(fmt->name, "avi")) ? 1 : 0;
     736
    735737    // Open recording
    736738    VERBOSE(MPF_GENERAL, QString("Opening %1").arg(inputfile));
    737739
     
    25702572
    25712573    AVPacket pkt;
    25722574    int count = 0;
     2575    int prevpos = 0;
    25732576
    25742577    /*============ initialise AV ===============*/
    25752578    QByteArray fname = file.toLocal8Bit();
     
    25832586        if (pkt.stream_index == vid_id)
    25842587        {
    25852588            if (pkt.flags & PKT_FLAG_KEY)
    2586                 posMap[count] = pkt.pos;
     2589                posMap[count] = avifile ? prevpos + 1 : pkt.pos;
    25872590            count++;
    25882591        }
     2592        prevpos = pkt.pos;
     2593
    25892594        av_free_packet(&pkt);
    25902595    }
    25912596
  • programs/mythtranscode/mpeg2fix.h

     
    244244    int aud_stream_count;
    245245    int64_t ptsIncrement;
    246246    int64_t ptsOffset;  //was initPTS
     247    bool avifile;
    247248
    248249    int discard;
    249250    //control options