Ticket #1043: mythdvd_v8.patch
File mythdvd_v8.patch, 12.2 KB (added by , 18 years ago) |
---|
-
libs/libmythtv/NuppelVideoPlayer.cpp
227 227 livetvchain(NULL), m_tv(NULL), 228 228 // DVD stuff 229 229 indvdstillframe(false), hidedvdbutton(true), 230 delaydvdbutton(0), 230 231 // Debugging variables 231 232 output_jmeter(NULL) 232 233 { … … 554 555 555 556 ClearAfterSeek(); 556 557 557 if (ringBuffer->isDVD())558 ringBuffer->Seek(ringBuffer->DVD()->GetCellStartPos(), SEEK_SET);559 560 558 if (textDisplayMode) 561 559 { 562 560 DisableCaptions(textDisplayMode); … … 829 827 int NuppelVideoPlayer::OpenFile(bool skipDsp, uint retries, 830 828 bool allow_libmpeg2) 831 829 { 832 if (ringBuffer && ringBuffer->isDVD())833 allow_libmpeg2 = false;834 835 830 if (!skipDsp) 836 831 { 837 832 if (!ringBuffer) … … 2861 2856 decoder_thread = pthread_self(); 2862 2857 pthread_create(&output_video, NULL, kickoffOutputVideoLoop, this); 2863 2858 2864 if (!using_null_videoout )2859 if (!using_null_videoout && !ringBuffer->isDVD()) 2865 2860 { 2866 2861 // Request that the video output thread run with realtime priority. 2867 2862 // If mythyv/mythfrontend was installed SUID root, this will work. … … 5722 5717 int numbuttons = ringBuffer->DVD()->NumMenuButtons(); 5723 5718 bool osdshown = osd->IsSetDisplaying("subtitles"); 5724 5719 long long menupktpts = ringBuffer->DVD()->GetMenuPktPts(); 5720 bool instillframe = ringBuffer->DVD()->InStillFrame(); 5725 5721 5726 if ((numbuttons == 0) || (osdshown) || 5727 ((!osdshown) && (hidedvdbutton) && 5728 (buffer->timecode > 0) && (menupktpts != buffer->timecode))) 5722 if ((numbuttons == 0) || 5723 (osdshown) || 5724 (instillframe && buffer->timecode > 0) || 5725 ((!osdshown) && 5726 (!indvdstillframe) && 5727 (hidedvdbutton) && 5728 (buffer->timecode > 0) && 5729 (menupktpts != buffer->timecode))) 5729 5730 { 5730 5731 return; 5731 5732 } 5732 5733 5733 hidedvdbutton = false;5734 AVSubtitleRect *highlightButton;5735 5734 OSDSet *subtitleOSD = NULL; 5736 highlightButton = ringBuffer->DVD()->GetMenuButton();5735 AVSubtitleRect *highlightButton = ringBuffer->DVD()->GetMenuButton(); 5737 5736 5738 subtitleLock.lock();5739 5737 if (highlightButton != NULL) 5740 5738 { 5741 5739 osd->HideSet("subtitles"); 5742 5740 osd->ClearAll("subtitles"); 5741 if (indvdstillframe) 5742 { 5743 delaydvdbutton++; 5744 if (delaydvdbutton < 5) 5745 return; 5746 } 5747 subtitleLock.lock(); 5743 5748 int h = highlightButton->h; 5744 5749 int w = highlightButton->w; 5745 5750 int linesize = highlightButton->linesize; … … 5770 5775 5771 5776 subtitleOSD->AddType(image); 5772 5777 osd->SetVisible(subtitleOSD, 0); 5778 hidedvdbutton = false; 5779 subtitleLock.unlock(); 5773 5780 } 5774 5775 subtitleLock.unlock();5776 5781 } 5777 5782 5778 5783 void NuppelVideoPlayer::ActivateDVDButton(void) -
libs/libmythtv/avformatdecoder.cpp
274 274 allow_ac3_passthru(false), allow_dts_passthru(false), 275 275 disable_passthru(false), 276 276 // DVD 277 lastdvdtitle(0), dvdmenupktseen(false) 277 lastdvdtitle(0), lastcellstart(0), 278 dvdmenupktseen(false), dvdvideopause(false) 278 279 { 279 280 bzero(¶ms, sizeof(AVFormatParameters)); 280 281 bzero(prvpkt, 3 * sizeof(char)); … … 493 494 // Skip all the desired number of skipFrames 494 495 for (;skipFrames > 0 && !ateof; skipFrames--) 495 496 { 496 497 GetFrame(0); 497 498 if (decoded_video_frame) 498 499 GetNVP()->DiscardVideoFrame(decoded_video_frame); 499 500 } … … 1321 1322 } 1322 1323 } 1323 1324 1324 // Select a new track s at the next opportunity.1325 // Select a new track at the next opportunity 1325 1326 ResetTracks(); 1326 1327 1327 1328 // We have to do this here to avoid the NVP getting stuck … … 1665 1666 #define PICTURE_START 0x00000100 1666 1667 #define SLICE_MIN 0x00000101 1667 1668 #define SLICE_MAX 0x000001af 1669 #define SEQ_END_CODE 0x000001b7 1668 1670 1669 1671 void AvFormatDecoder::MpegPreProcessPkt(AVStream *stream, AVPacket *pkt) 1670 1672 { … … 1684 1686 unsigned int last_state = state; 1685 1687 state = ((state << 8) | v) & 0xFFFFFF; 1686 1688 1689 if (ringBuffer->isDVD() && pkt->size == 4 1690 && state == SEQ_END_CODE && !dvdvideopause) 1691 { 1692 dvdvideopause = true; 1693 d->ResetMPEG2(); 1694 return; 1695 } 1696 1687 1697 if (last_state != 0x000001) 1688 1698 continue; 1689 1699 else if (state >= SLICE_MIN && state <= SLICE_MAX) … … 1713 1723 keyframedist, aspect, 1714 1724 kScan_Detect); 1715 1725 1726 if (ringBuffer->InDVDMenuOrStillFrame()) 1727 { 1728 ScanStreams(true); 1729 ringBuffer->Seek(ringBuffer->DVD()->GetCellStartPos(), 1730 SEEK_SET); 1731 } 1732 1716 1733 current_width = width; 1717 1734 current_height = height; 1718 1735 current_aspect = aspect; … … 2159 2176 2160 2177 bool allowedquit = false; 2161 2178 bool storevideoframes = false; 2162 bool dvdvideopause = false;2163 2179 2164 2180 avcodeclock.lock(); 2165 2181 AutoSelectTracks(); … … 2178 2194 } 2179 2195 2180 2196 if (ringBuffer->isDVD()) 2181 { 2197 { 2182 2198 int dvdtitle = 0; 2183 2199 int dvdpart = 0; 2184 2200 ringBuffer->DVD()->GetPartAndTitle(dvdtitle,dvdpart); 2185 if (dvdtitle != lastdvdtitle) 2201 uint cellstart = ringBuffer->DVD()->GetCellStart(); 2202 if (GetNVP()->AtNormalSpeed() && 2203 ((lastcellstart != cellstart) || 2204 (lastdvdtitle != dvdtitle))) 2186 2205 { 2187 posmapStarted = false; 2188 m_positionMap.clear(); 2189 SyncPositionMap(); 2206 if (dvdtitle != lastdvdtitle) 2207 { 2208 posmapStarted = false; 2209 m_positionMap.clear(); 2210 SyncPositionMap(); 2211 VERBOSE(VB_PLAYBACK, LOC + "DVD Title Changed"); 2212 ScanStreams(true); 2213 lastdvdtitle = dvdtitle; 2214 } 2190 2215 framesPlayed = DVDCurrentFrameNumber(); 2191 2216 framesRead = framesPlayed; 2192 VERBOSE(VB_PLAYBACK, 2193 QString(LOC + "DVD Title Changed. Update framesPlayed: %1 ") 2194 .arg(framesPlayed)); 2195 ScanStreams(false); 2217 VERBOSE(VB_PLAYBACK, QString(LOC + "DVD Cell Changed. Update framesPlayed: %1 ") 2218 .arg(framesPlayed)); 2219 lastcellstart = cellstart; 2196 2220 } 2197 lastdvdtitle = dvdtitle; 2198 2221 2199 2222 if (storedPackets.count() < 2 && !dvdvideopause) 2200 2223 storevideoframes = true; 2201 2224 else … … 2218 2241 } 2219 2242 } 2220 2243 2221 if (ringBuffer->isDVD() && ringBuffer->DVD()->InStillFrame())2222 {2223 storevideoframes = false;2224 dvdvideopause = true;2225 }2226 2227 2244 if (!storevideoframes && storedPackets.count() > 0) 2228 2245 { 2229 2246 if (pkt) … … 2273 2290 if (pkt->dts != (int64_t)AV_NOPTS_VALUE) 2274 2291 pts = (long long)(av_q2d(curstream->time_base) * pkt->dts * 1000); 2275 2292 2276 if (ringBuffer->isDVD() && pkt->size == 4) 2293 if (ringBuffer->isDVD() && 2294 curstream->codec->codec_type == CODEC_TYPE_VIDEO) 2277 2295 { 2278 dvdvideopause = true; 2279 av_free_packet(pkt); 2280 continue; 2296 if (pkt->size == 4) 2297 MpegPreProcessPkt(curstream,pkt); 2298 else if (!d->HasMPEG2Dec()) 2299 { 2300 int current_width = curstream->codec->width; 2301 int video_width = GetNVP()->GetVideoWidth(); 2302 if (video_width > 0 && 2303 (video_width != current_width)) 2304 { 2305 av_free_packet(pkt); 2306 av_find_stream_info(ic); 2307 ScanStreams(false); 2308 allowedquit = true; 2309 continue; 2310 } 2311 } 2281 2312 } 2282 2313 2283 2314 if (storevideoframes && … … 2317 2348 } 2318 2349 } 2319 2350 2351 if (len == 4 && dvdvideopause) 2352 dvdvideopause = false; 2353 2320 2354 if (framesRead == 0 && !justAfterChange && 2321 2355 !(pkt->flags & PKT_FLAG_KEY)) 2322 2356 { … … 2521 2555 ret = avcodec_decode_video(context, &mpa_pic, 2522 2556 &gotpicture, ptr, len); 2523 2557 // Reparse it to not drop the DVD still frame 2524 if (dvdvideopause && storedPackets.count() == 0)2558 if (dvdvideopause) 2525 2559 ret = avcodec_decode_video(context, &mpa_pic, 2526 2560 &gotpicture, ptr, len); 2527 2561 } -
libs/libmythtv/DVDRingBuffer.cpp
811 811 812 812 uint DVDRingBufferPriv::GetCurrentTime(void) 813 813 { 814 // Macro to convert Binary Coded Decimal to Decimal815 // Obtained from VLC Code.816 #define BCD2D(__x__) (((__x__ & 0xf0) >> 4) * 10 + (__x__ & 0x0f))817 818 814 dsi_t *dvdnavDsi = dvdnav_get_current_nav_dsi(dvdnav); 819 815 dvd_time_t timeFromCellStart = dvdnavDsi->dsi_gi.c_eltm; 820 uint8_t hours = BCD2D(timeFromCellStart.hour); 821 uint8_t minutes = BCD2D(timeFromCellStart.minute); 822 uint8_t seconds = BCD2D(timeFromCellStart.second); 823 uint currentTime = GetCellStart() + (hours * 3600) + (minutes * 60) + seconds; 816 uint currentTime = GetCellStart() + 817 (uint)(dvdnav_convert_time(&timeFromCellStart) / 90000); 824 818 return currentTime; 825 819 } 826 820 -
libs/libmythtv/NuppelVideoPlayer.h
354 354 void ActivateDVDButton(void); 355 355 void GoToDVDMenu(QString str); 356 356 void GoToDVDProgram(bool direction); 357 void HideDVDButton(bool hide) { hidedvdbutton = hide; } 357 void HideDVDButton(bool hide) 358 { 359 hidedvdbutton = hide; 360 if (hide) 361 delaydvdbutton = 0; 362 } 358 363 void SetSubtitleMode(bool setting) 359 364 { 360 365 if (setting) … … 716 721 // DVD 717 722 bool indvdstillframe; 718 723 bool hidedvdbutton; 724 int delaydvdbutton; 719 725 720 726 // Debugging variables 721 727 Jitterometer *output_jmeter; -
libs/libmythtv/tv_play.cpp
2675 2675 QString action = actions[i]; 2676 2676 handled = true; 2677 2677 2678 if (prbuffer-> isDVD() && prbuffer->DVD()->IsInMenu())2678 if (prbuffer->InDVDMenuOrStillFrame()) 2679 2679 { 2680 2680 int nb_buttons = prbuffer->DVD()->NumMenuButtons(); 2681 2681 if (nb_buttons > 0) -
libs/libmythtv/decoderbase.cpp
713 713 SeekReset(framesPlayed, 0, true, true); 714 714 715 715 // update frames played 716 long long played = (int)(elapsed * fps);716 long long played = DVDCurrentFrameNumber(); 717 717 718 718 framesPlayed = played; 719 719 GetNVP()->getVideoOutput()->SetFramesPlayed(played + 1); -
libs/libmythtv/avformatdecoder.h
232 232 233 233 // DVD 234 234 int lastdvdtitle; 235 uint lastcellstart; 235 236 bool dvdmenupktseen; 237 bool dvdvideopause; 236 238 }; 237 239 238 240 #endif