Ticket #1043: mythdvd_v7.patch

File mythdvd_v7.patch, 5.1 KB (added by skamithi@…, 18 years ago)

still frame libmpeg2 support.

  • libs/libmythtv/NuppelVideoPlayer.cpp

     
    552552
    553553    ClearAfterSeek();
    554554
    555     if (ringBuffer->isDVD())
     555    if (ringBuffer->InDVDMenuOrStillFrame())
    556556        ringBuffer->Seek(ringBuffer->DVD()->GetCellStartPos(), SEEK_SET);
    557557
    558558    if (textDisplayMode)
     
    765765int NuppelVideoPlayer::OpenFile(bool skipDsp, uint retries,
    766766                                bool allow_libmpeg2)
    767767{
    768     if (ringBuffer && ringBuffer->isDVD())
    769         allow_libmpeg2 = false;
    770 
    771768    if (!skipDsp)
    772769    {
    773770        if (!ringBuffer)
  • libs/libmythtv/avformatdecoder.cpp

     
    274274      allow_ac3_passthru(false),    allow_dts_passthru(false),
    275275      disable_passthru(false),
    276276      // DVD
    277       lastdvdtitle(0), dvdmenupktseen(false)
     277      lastdvdtitle(0), dvdmenupktseen(false),
     278      dvdvideopause(false)
    278279{
    279280    bzero(&params, sizeof(AVFormatParameters));
    280281    bzero(prvpkt, 3 * sizeof(char));
     
    13221323        }
    13231324    }
    13241325
    1325     // Select a new tracks at the next opportunity.
     1326    // Select a new track at the next opportunity
    13261327    ResetTracks();
    13271328
    13281329    // We have to do this here to avoid the NVP getting stuck
     
    17381739#define PICTURE_START 0x00000100
    17391740#define SLICE_MIN     0x00000101
    17401741#define SLICE_MAX     0x000001af
     1742#define SEQ_END_CODE  0x000001b7
    17411743
    17421744void AvFormatDecoder::MpegPreProcessPkt(AVStream *stream, AVPacket *pkt)
    17431745{
     
    17571759        unsigned int last_state = state;
    17581760        state = ((state << 8) | v) & 0xFFFFFF;
    17591761
     1762        if (ringBuffer->isDVD() && pkt->size == 4
     1763                && state == SEQ_END_CODE && !dvdvideopause)
     1764        {
     1765            dvdvideopause = true;
     1766            d->ResetMPEG2();
     1767            return;
     1768        }
     1769       
    17601770        if (last_state != 0x000001)
    17611771            continue;
    17621772        else if (state >= SLICE_MIN && state <= SLICE_MAX)
     
    22322242
    22332243    bool allowedquit = false;
    22342244    bool storevideoframes = false;
    2235     bool dvdvideopause = false;
    22362245
    22372246    avcodeclock.lock();
    22382247    AutoSelectTracks();
     
    22652274                VERBOSE(VB_PLAYBACK,
    22662275                    QString(LOC + "DVD Title Changed. Update framesPlayed: %1 ")
    22672276                            .arg(framesPlayed));
    2268                 ScanStreams(false);
     2277                ScanStreams(true);
    22692278            }
    22702279            lastdvdtitle = dvdtitle;
    22712280           
     
    22912300            }
    22922301        }
    22932302
    2294         if (ringBuffer->isDVD() && ringBuffer->DVD()->InStillFrame())
    2295         {
    2296             storevideoframes = false;
    2297             dvdvideopause = true;
    2298         }
    2299 
    23002303        if (!storevideoframes && storedPackets.count() > 0)
    23012304        {
    23022305            if (pkt)
     
    23462349        if (pkt->dts != (int64_t)AV_NOPTS_VALUE)
    23472350            pts = (long long)(av_q2d(curstream->time_base) * pkt->dts * 1000);
    23482351
    2349         if (ringBuffer->isDVD() && pkt->size == 4)
     2352        if (ringBuffer->isDVD() &&
     2353                curstream->codec->codec_type == CODEC_TYPE_VIDEO)
    23502354        {
    2351             dvdvideopause = true;
    2352             av_free_packet(pkt);
    2353             continue;
     2355            if (pkt->size == 4)
     2356                MpegPreProcessPkt(curstream,pkt);
     2357            else if (!d->HasMPEG2Dec())
     2358            {
     2359                int current_width = curstream->codec->width;
     2360                int video_width = GetNVP()->GetVideoWidth();
     2361                if (video_width > 0 &&
     2362                    (video_width != current_width))
     2363                {
     2364                    av_free_packet(pkt);
     2365                    av_find_stream_info(ic);
     2366                    ScanStreams(false);
     2367                    allowedquit = true;
     2368                    continue;
     2369                }
     2370            }
    23542371        }
    23552372
    23562373        if (storevideoframes &&
     
    23902407                }
    23912408            }
    23922409
     2410            if (len == 4 && dvdvideopause)
     2411                dvdvideopause = false;
     2412
    23932413            if (framesRead == 0 && !justAfterChange &&
    23942414                !(pkt->flags & PKT_FLAG_KEY))
    23952415            {
     
    25942614                        ret = avcodec_decode_video(context, &mpa_pic,
    25952615                                                   &gotpicture, ptr, len);
    25962616                        // Reparse it to not drop the DVD still frame
    2597                         if (dvdvideopause && storedPackets.count() == 0)
     2617                        if (dvdvideopause)
    25982618                            ret = avcodec_decode_video(context, &mpa_pic,
    25992619                                                        &gotpicture, ptr, len);
    26002620                    }
  • libs/libmythtv/avformatdecoder.h

     
    237237    // DVD
    238238    int lastdvdtitle;
    239239    bool dvdmenupktseen;
     240    bool dvdvideopause;
    240241};
    241242
    242243#endif