Ticket #1822: xvmc_dvd_menu_attempt3.diff
| File xvmc_dvd_menu_attempt3.diff, 12.3 KB (added by , 20 years ago) |
|---|
-
libs/libmythtv/NuppelVideoPlayer.cpp
848 848 849 849 void NuppelVideoPlayer::SetVideoParams(int width, int height, double fps, 850 850 int keyframedistance, float aspect, 851 FrameScanType scan )851 FrameScanType scan, bool video_codec_changed) 852 852 { 853 853 if (width == 0 || height == 0 || isnan(aspect) || isnan(fps)) 854 854 return; 855 855 856 856 if ((video_width == width ) && (video_height == height) && 857 857 (video_aspect == aspect) && (video_frame_rate == fps ) && 858 ((keyframedistance <= 0) || (keyframedistance == keyframedist))) 858 ((keyframedistance <= 0) || (keyframedistance == keyframedist)) && 859 !video_codec_changed) 859 860 { 860 861 return; 861 862 } -
libs/libmythtv/avformatdecoder.cpp
292 292 disable_passthru(false), 293 293 // DVD 294 294 lastdvdtitle(-1), lastcellstart(0), 295 dvdmenupktseen(false), dvdvideopause(false) 295 dvdmenupktseen(false), dvdvideopause(false), 296 dvd_xvmc_enabled(false), dvd_video_codec_changed(false) 296 297 { 297 298 bzero(¶ms, sizeof(AVFormatParameters)); 298 299 bzero(prvpkt, 3 * sizeof(char)); … … 803 804 av_free_packet(&pkt1); 804 805 ringBuffer->Seek(0,SEEK_SET); 805 806 ringBuffer->DVD()->IgnoreStillOrWait(false); 807 QString dec = gContext->GetSetting("PreferredMPEG2Decoder", "ffmpeg"); 808 if (dec.contains("xvmc")) 809 dvd_xvmc_enabled = true; 806 810 } 807 811 else 808 812 { … … 944 948 { 945 949 float aspect_ratio; 946 950 951 directrendering = false; 952 947 953 if (selectedStream) 948 954 { 949 955 fps = normalized_fps(stream, enc); … … 1027 1033 } 1028 1034 1029 1035 GetNVP()->SetVideoParams(align_width, align_height, fps, 1030 keyframedist, aspect_ratio, kScan_Detect); 1036 keyframedist, aspect_ratio, kScan_Detect, 1037 dvd_video_codec_changed); 1038 dvd_video_codec_changed = false; 1031 1039 } 1032 1040 } 1033 1041 … … 1365 1373 enc->codec_id = CODEC_ID_MPEG2VIDEO; 1366 1374 // HACK -- end 1367 1375 1376 bool force_xv = false; 1377 if (ringBuffer->InDVDMenuOrStillFrame() && 1378 dvd_xvmc_enabled) 1379 { 1380 force_xv = true; 1381 enc->pix_fmt = PIX_FMT_YUV420P; 1382 } 1383 1368 1384 MythCodecID mcid; 1369 1385 mcid = VideoOutputXv::GetBestSupportedCodec( 1370 1386 /* disp dim */ enc->width, enc->height, 1371 1387 /* osd dim */ /*enc->width*/ 0, /*enc->height*/ 0, 1372 1388 /* mpeg type */ xvmc_stream_type(enc->codec_id), 1373 1389 /* xvmc pix fmt */ xvmc_pixel_format(enc->pix_fmt), 1374 /* test surface */ kCodec_NORMAL_END > video_codec_id); 1390 /* test surface */ kCodec_NORMAL_END > video_codec_id, 1391 /* force_xv */ force_xv); 1375 1392 bool vcd, idct, mc; 1376 1393 enc->codec_id = myth2av_codecid(mcid, vcd, idct, mc); 1394 if (mcid != video_codec_id) 1395 dvd_video_codec_changed = true; 1377 1396 video_codec_id = mcid; 1378 if ( kCodec_NORMAL_END < mcid && kCodec_STD_XVMC_END > mcid)1397 if (!force_xv && kCodec_NORMAL_END < mcid && kCodec_STD_XVMC_END > mcid) 1379 1398 { 1380 1399 enc->pix_fmt = (idct) ? 1381 1400 PIX_FMT_XVMC_MPEG2_IDCT : PIX_FMT_XVMC_MPEG2_MC; … … 2830 2849 { 2831 2850 int current_width = curstream->codec->width; 2832 2851 int video_width = GetNVP()->GetVideoWidth(); 2833 if (video_width > 0 && video_width != current_width) 2852 bool switch_to_xv = false; 2853 bool switch_to_xvmc = false; 2854 if (dvd_xvmc_enabled && GetNVP() && GetNVP()->getVideoOutput()) 2834 2855 { 2856 bool dvd_xvmc_active = GetNVP()->getVideoOutput()->hasMCAcceleration(); 2857 bool indvdmenu = ringBuffer->InDVDMenuOrStillFrame(); 2858 if (indvdmenu && dvd_xvmc_active) 2859 switch_to_xv = true; 2860 else if (!indvdmenu && !dvd_xvmc_active) 2861 switch_to_xvmc = true; 2862 } 2863 2864 if ((video_width > 0 && video_width != current_width) || 2865 switch_to_xv || switch_to_xvmc) 2866 { 2835 2867 av_free_packet(pkt); 2836 2868 CloseCodecs(); 2837 2869 ScanStreams(false); 2870 QMutexLocker locker(&avcodeclock); 2838 2871 allowedquit = true; 2839 2872 if (ringBuffer->DVD()->InStillFrame()) 2840 { 2841 long long cellstartpos = ringBuffer->DVD()->GetCellStartPos(); 2842 ringBuffer->DVD()->Seek(cellstartpos, SEEK_SET); 2843 } 2873 ringBuffer->DVD()->SeekCellStart(); 2844 2874 continue; 2845 2875 } 2846 2876 } -
libs/libmythtv/DVDRingBuffer.cpp
69 69 (NumMenuButtons() > 0)); 70 70 } 71 71 72 long long DVDRingBufferPriv::NormalSeek(long long pos, int whence) 73 { 74 QMutexLocker lock(&seekLock); 75 return Seek(pos, whence); 76 } 77 72 78 long long DVDRingBufferPriv::Seek(long long pos, int whence) 73 79 { 74 80 dvdnav_status_t dvdRet = dvdnav_sector_search(this->dvdnav, pos / DVD_BLOCK_SIZE , whence); … … 900 906 return currentTime; 901 907 } 902 908 903 long long DVDRingBufferPriv::GetCellStartPos(void)904 {905 gotoCellStart = true;906 return cellstartPos;907 }908 909 909 uint DVDRingBufferPriv::GetAudioLanguage(int id) 910 910 { 911 911 int8_t channel = dvdnav_get_audio_logical_stream(dvdnav,id); … … 1020 1020 return false; 1021 1021 } 1022 1022 1023 void DVDRingBufferPriv::SeekCellStart(void) 1024 { 1025 QMutexLocker lock(&seekLock); 1026 gotoCellStart = true; 1027 Seek(cellstartPos, SEEK_SET); 1028 } 1029 1023 1030 /** 1024 1031 * \brief converts palette values from YUV to RGB 1025 1032 */ -
libs/libmythtv/NuppelVideoPlayer.h
151 151 void SetBookmark(void); 152 152 void SetKeyframeDistance(int keyframedistance); 153 153 void SetVideoParams(int w, int h, double fps, int keydist, 154 float a = 1.33333, FrameScanType scan = kScan_Ignore); 154 float a = 1.33333, FrameScanType scan = kScan_Ignore, 155 bool video_codec_changed = false); 155 156 void SetFileLength(int total, int frames); 156 157 void Zoom(int direction); 157 158 void ClearBookmark(void); -
libs/libmythtv/RingBuffer.cpp
1160 1160 #ifdef USING_FRONTEND 1161 1161 else if (dvdPriv) 1162 1162 { 1163 dvdPriv-> Seek(pos, whence);1163 dvdPriv->NormalSeek(pos, whence); 1164 1164 } 1165 1165 #endif // USING_FRONTEND 1166 1166 else -
libs/libmythtv/DVDRingBuffer.h
50 50 void ReleaseMenuButton(void); 51 51 52 52 bool IgnoringStillorWait(void) { return skipstillorwait; } 53 long long GetCellStartPos(void);54 53 uint ButtonPosX(void) { return hl_startx; } 55 54 uint ButtonPosY(void) { return hl_starty; } 56 55 uint GetAudioLanguage(int id); … … 80 79 bool nextTrack(void); 81 80 void prevTrack(void); 82 81 int safe_read(void *data, unsigned sz); 83 long long Seek(long long pos, int whence);82 long long NormalSeek(long long pos, int whence); 84 83 void SkipStillFrame(void); 85 84 void WaitSkip(void); 86 85 void GoToMenu(const QString str); … … 98 97 int GetTrack(uint type); 99 98 uint8_t GetNumAudioChannels(int id); 100 99 void JumpToTitle(bool change) { jumptotitle = change; } 101 100 void SeekCellStart(void); 101 102 102 void SetParent(NuppelVideoPlayer *p) { parent = p; } 103 104 103 105 104 106 protected: 105 107 dvdnav_t *dvdnav; … … 160 162 NuppelVideoPlayer *parent; 161 163 162 164 QMutex menuBtnLock; 165 QMutex seekLock; 163 166 167 long long Seek(long long pos, int whence); 164 168 bool DrawMenuButton(uint8_t *spu_pkt, int buf_size); 165 169 bool DVDButtonUpdate(bool b_mode); 166 170 void ClearMenuSPUParameters(void); -
libs/libmythtv/videoout_xv.h
94 94 static MythCodecID GetBestSupportedCodec(uint width, uint height, 95 95 uint osd_width, uint osd_height, 96 96 uint stream_type, int xvmc_chroma, 97 bool test_surface );97 bool test_surface, bool force_xv); 98 98 99 99 static int GrabSuitableXvPort(Display* disp, Window root, 100 100 MythCodecID type, … … 144 144 bool CreateBuffers(VOSType subtype); 145 145 vector<void*> CreateXvMCSurfaces(uint num, bool create_xvmc_blocks); 146 146 vector<unsigned char*> CreateShmImages(uint num, bool use_xv); 147 void CreatePauseFrame( void);147 void CreatePauseFrame(VOSType subtype); 148 148 void CopyFrame(VideoFrame *to, const VideoFrame *from); 149 149 150 150 void DeleteBuffers(VOSType subtype, bool delete_pause_frame); -
libs/libmythtv/videoout_xv.cpp
649 649 * 650 650 * \sideeffect sets av_pause_frame. 651 651 */ 652 void VideoOutputXv::CreatePauseFrame( void)652 void VideoOutputXv::CreatePauseFrame(VOSType subtype) 653 653 { 654 654 // All methods but XvMC use a pause frame, create it if needed 655 if ( VideoOutputSubType()<= XVideo)655 if (subtype <= XVideo) 656 656 { 657 657 vbuffers.LockFrame(&av_pause_frame, "CreatePauseFrame"); 658 658 … … 992 992 MythCodecID VideoOutputXv::GetBestSupportedCodec( 993 993 uint width, uint height, 994 994 uint osd_width, uint osd_height, 995 uint stream_type, int xvmc_chroma, bool test_surface) 995 uint stream_type, int xvmc_chroma, 996 bool test_surface, bool force_xv) 996 997 { 997 998 (void)width, (void)height, (void)osd_width, (void)osd_height; 998 999 (void)stream_type, (void)xvmc_chroma, (void)test_surface; 999 1000 1001 if (force_xv) 1002 return (MythCodecID)(kCodec_MPEG1 + (stream_type-1)); 1000 1003 #ifdef USING_XVMC 1001 1004 Display *disp = MythXOpenDisplay(); 1002 1005 … … 1719 1722 } 1720 1723 1721 1724 if (ok) 1722 CreatePauseFrame( );1725 CreatePauseFrame(subtype); 1723 1726 1724 1727 return ok; 1725 1728 } -
libs/libmythtv/avformatdecoder.h
255 255 uint lastcellstart; 256 256 bool dvdmenupktseen; 257 257 bool dvdvideopause; 258 bool dvd_xvmc_enabled; 259 bool dvd_video_codec_changed; 258 260 259 261 }; 260 262 -
libs/libavcodec/mpeg12.c
2078 2078 s->mpeg_enc_ctx.picture_number = 0; 2079 2079 s->repeat_field = 0; 2080 2080 s->mpeg_enc_ctx.codec_id= avctx->codec->id; 2081 avctx->xvmc_acceleration = 0; 2082 avctx->xvmc_vld_hwslice = 0; 2081 2083 return 0; 2082 2084 } 2083 2085
