Ticket #1822: xvmc_dvd_menu_attempt2.diff
File xvmc_dvd_menu_attempt2.diff, 14.2 KB (added by , 17 years ago) |
---|
-
libs/libmythtv/NuppelVideoPlayer.cpp
254 254 isDummy(false), 255 255 // DVD stuff 256 256 indvdstillframe(false), hidedvdbutton(true), 257 need_change_dvd_track(0), 257 need_change_dvd_track(0), dvd_video_codec_changing(false), 258 258 // Debugging variables 259 259 output_jmeter(NULL) 260 260 { … … 596 596 vidExitLock.lock(); 597 597 videofiltersLock.lock(); 598 598 599 VERBOSE(VB_PLAYBACK, QString("DELETE ME in ReinitVideo")); 599 600 float aspect = (forced_video_aspect > 0) ? forced_video_aspect : video_aspect; 600 601 videoOutput->InputChanged(video_width, video_height, aspect, 601 602 GetDecoder()->GetVideoCodecID()); … … 848 849 849 850 void NuppelVideoPlayer::SetVideoParams(int width, int height, double fps, 850 851 int keyframedistance, float aspect, 851 FrameScanType scan )852 FrameScanType scan, bool video_codec_changed) 852 853 { 854 VERBOSE(VB_PLAYBACK, QString("DELETE ME entered SetVideoParams")); 853 855 if (width == 0 || height == 0 || isnan(aspect) || isnan(fps)) 854 856 return; 855 857 858 VERBOSE(VB_PLAYBACK, QString("DELETE ME passed step 1 in SetVideoParams")); 859 856 860 if ((video_width == width ) && (video_height == height) && 857 861 (video_aspect == aspect) && (video_frame_rate == fps ) && 858 ((keyframedistance <= 0) || (keyframedistance == keyframedist))) 862 ((keyframedistance <= 0) || (keyframedistance == keyframedist)) && 863 !video_codec_changed) 859 864 { 860 865 return; 861 866 } … … 874 879 frame_interval = (int)(1000000.0f / video_frame_rate / temp_speed); 875 880 } 876 881 882 VERBOSE(VB_PLAYBACK, QString("DELETE ME in SetVideoParam about to reinitvideo")); 877 883 if (videoOutput) 878 884 ReinitVideo(); 879 885 … … 2592 2598 2593 2599 if (ringBuffer->isDVD()) 2594 2600 { 2601 if (dvd_video_codec_changing) 2602 continue; 2603 2595 2604 int nbframes = videoOutput->ValidVideoFrames(); 2596 2605 if (nbframes < 2) 2597 2606 { -
libs/libmythtv/avformatdecoder.cpp
278 278 lastccptsu(0), 279 279 using_null_videoout(use_null_videoout), 280 280 video_codec_id(kCodec_NONE), 281 video_codec_changed(false), 281 282 maxkeyframedist(-1), 282 283 // Closed Caption & Teletext decoders 283 284 ccd608(new CC608Decoder(parent)), … … 292 293 disable_passthru(false), 293 294 // DVD 294 295 lastdvdtitle(-1), lastcellstart(0), 295 dvdmenupktseen(false), dvdvideopause(false) 296 dvdmenupktseen(false), dvdvideopause(false), 297 xvmc_enabled(false) 296 298 { 297 299 bzero(¶ms, sizeof(AVFormatParameters)); 298 300 bzero(prvpkt, 3 * sizeof(char)); … … 803 805 av_free_packet(&pkt1); 804 806 ringBuffer->Seek(0,SEEK_SET); 805 807 ringBuffer->DVD()->IgnoreStillOrWait(false); 808 QString dec = gContext->GetSetting("PreferredMPEG2Decoder", "ffmpeg"); 809 if (dec.contains("xvmc")) 810 xvmc_enabled = true; 806 811 } 807 812 else 808 813 { … … 944 949 { 945 950 float aspect_ratio; 946 951 952 directrendering = false; 953 947 954 if (selectedStream) 948 955 { 949 956 fps = normalized_fps(stream, enc); … … 986 993 SetLowBuffers(false); 987 994 } 988 995 996 VERBOSE(VB_PLAYBACK, QString("DELETE ME in initvideocodec codec %1 codec name %2").arg(codec->id). 997 arg(codec->name)); 989 998 if (codec && (codec->id == CODEC_ID_MPEG2VIDEO_XVMC || 990 999 codec->id == CODEC_ID_MPEG2VIDEO_XVMC_VLD)) 991 1000 { 1001 VERBOSE(VB_PLAYBACK, QString("DELETE ME in initvideocodec codec %1..IS XVMC").arg(codec->id)); 992 1002 enc->flags |= CODEC_FLAG_EMU_EDGE; 993 1003 enc->get_buffer = get_avf_buffer_xvmc; 994 1004 enc->release_buffer = release_avf_buffer_xvmc; … … 1027 1037 } 1028 1038 1029 1039 GetNVP()->SetVideoParams(align_width, align_height, fps, 1030 keyframedist, aspect_ratio, kScan_Detect); 1040 keyframedist, aspect_ratio, kScan_Detect, video_codec_changed); 1041 video_codec_changed = false; 1031 1042 } 1032 1043 } 1033 1044 … … 1354 1365 d->DestroyMPEG2(); 1355 1366 h264_kf_seq->Reset(); 1356 1367 #ifdef USING_XVMC 1368 VERBOSE(VB_PLAYBACK, QString("DELETE ME ScanStreams using null %1 stream type %2") 1369 .arg(using_null_videoout).arg(xvmc_stream_type(enc->codec_id))); 1357 1370 if (!using_null_videoout && xvmc_stream_type(enc->codec_id)) 1358 1371 { 1359 1372 // HACK -- begin … … 1365 1378 enc->codec_id = CODEC_ID_MPEG2VIDEO; 1366 1379 // HACK -- end 1367 1380 1381 bool force_xv = false; 1382 if (ringBuffer->InDVDMenuOrStillFrame() && 1383 xvmc_enabled) 1384 { 1385 force_xv = true; 1386 enc->pix_fmt = PIX_FMT_YUV420P; 1387 } 1388 1368 1389 MythCodecID mcid; 1369 1390 mcid = VideoOutputXv::GetBestSupportedCodec( 1370 1391 /* disp dim */ enc->width, enc->height, 1371 1392 /* osd dim */ /*enc->width*/ 0, /*enc->height*/ 0, 1372 1393 /* mpeg type */ xvmc_stream_type(enc->codec_id), 1373 1394 /* xvmc pix fmt */ xvmc_pixel_format(enc->pix_fmt), 1374 /* test surface */ kCodec_NORMAL_END > video_codec_id); 1395 /* test surface */ kCodec_NORMAL_END > video_codec_id, 1396 /* force_xv */ force_xv); 1375 1397 bool vcd, idct, mc; 1376 1398 enc->codec_id = myth2av_codecid(mcid, vcd, idct, mc); 1399 if (mcid != video_codec_id) 1400 video_codec_changed = true; 1401 VERBOSE(VB_PLAYBACK, QString("DELETE ME ScanStreams video_codec_changed %1 mcid %2 force_xv %3 xvmc_enabled %4 in dvdmenuOrStillFrame %5").arg(video_codec_changed).arg(mcid).arg(force_xv).arg(xvmc_enabled).arg(ringBuffer->InDVDMenuOrStillFrame())); 1377 1402 video_codec_id = mcid; 1378 if ( kCodec_NORMAL_END < mcid && kCodec_STD_XVMC_END > mcid)1403 if (!force_xv && kCodec_NORMAL_END < mcid && kCodec_STD_XVMC_END > mcid) 1379 1404 { 1380 1405 enc->pix_fmt = (idct) ? 1381 1406 PIX_FMT_XVMC_MPEG2_IDCT : PIX_FMT_XVMC_MPEG2_MC; … … 2830 2855 { 2831 2856 int current_width = curstream->codec->width; 2832 2857 int video_width = GetNVP()->GetVideoWidth(); 2833 if (video_width > 0 && video_width != current_width) 2858 bool switch_to_xv = false; 2859 bool switch_to_xvmc = false; 2860 if (xvmc_enabled && GetNVP() && GetNVP()->getVideoOutput()) 2834 2861 { 2862 bool xvmc_active = GetNVP()->getVideoOutput()->hasMCAcceleration(); 2863 bool indvdmenu = ringBuffer->InDVDMenuOrStillFrame(); 2864 VERBOSE(VB_PLAYBACK, QString("DELETE ME xvmc_active %1 indvdmenuorstillframe %2").arg(xvmc_active).arg(indvdmenu)); 2865 if (indvdmenu && xvmc_active) 2866 switch_to_xv = true; 2867 else if (!indvdmenu && !xvmc_active) 2868 switch_to_xvmc = true; 2869 VERBOSE(VB_PLAYBACK, QString("DELETE ME switch_to_xv %1 switch_to_xvmc %2").arg(switch_to_xv).arg(switch_to_xvmc)); 2870 } 2871 2872 if ((video_width > 0 && video_width != current_width) || 2873 switch_to_xv || switch_to_xvmc) 2874 { 2875 GetNVP()->DVDVideoCodecChanging(true); 2835 2876 av_free_packet(pkt); 2836 2877 CloseCodecs(); 2837 2878 ScanStreams(false); … … 2841 2882 long long cellstartpos = ringBuffer->DVD()->GetCellStartPos(); 2842 2883 ringBuffer->DVD()->Seek(cellstartpos, SEEK_SET); 2843 2884 } 2885 GetNVP()->DVDVideoCodecChanging(false); 2844 2886 continue; 2845 2887 } 2846 2888 } … … 3140 3182 &gotpicture, ptr, len); 3141 3183 else 3142 3184 { 3185 VERBOSE(VB_PLAYBACK, QString("DELETE ME context codec %1 pixfmt %2") 3186 .arg(context->codec_id).arg(context->pix_fmt)); 3143 3187 ret = avcodec_decode_video(context, &mpa_pic, 3144 3188 &gotpicture, ptr, len); 3145 3189 // Reparse it to not drop the DVD still frame -
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, bool video_codec_changed = false); 155 155 void SetFileLength(int total, int frames); 156 156 void Zoom(int direction); 157 157 void ClearBookmark(void); … … 387 387 { 388 388 hidedvdbutton = hide; 389 389 } 390 390 void DVDVideoCodecChanging(bool setting) { dvd_video_codec_changing = setting; } 391 391 392 protected: 392 393 void DisplayPauseFrame(void); 393 394 void DisplayNormalFrame(void); … … 769 770 bool indvdstillframe; 770 771 bool hidedvdbutton; 771 772 int need_change_dvd_track; 773 bool dvd_video_codec_changing; ///< true if switching from Xv <-->XVMC 772 774 773 775 // Debugging variables 774 776 Jitterometer *output_jmeter; -
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
207 207 208 208 VideoOutput::InputChanged(width, height, aspect, av_codec_id); 209 209 210 VERBOSE(VB_PLAYBACK, QString("DELETE ME InputChanged cid_changed %1 res_changed %2") 211 .arg(cid_changed).arg(res_changed)); 210 212 if (!res_changed && !cid_changed) 211 213 { 212 214 if (VideoOutputSubType() == XVideo) … … 649 651 * 650 652 * \sideeffect sets av_pause_frame. 651 653 */ 652 void VideoOutputXv::CreatePauseFrame( void)654 void VideoOutputXv::CreatePauseFrame(VOSType subtype) 653 655 { 654 656 // All methods but XvMC use a pause frame, create it if needed 655 if (VideoOutputSubType() <= XVideo) 657 VERBOSE(VB_PLAYBACK, QString("DELETE ME CreatePauseFrame Now Video Type %1").arg(subtype); 658 if (subtype <= XVideo) 656 659 { 660 VERBOSE(VB_PLAYBACK, QString("DELETE ME CreatePauseFrame Now ")); 657 661 vbuffers.LockFrame(&av_pause_frame, "CreatePauseFrame"); 658 662 659 663 if (av_pause_frame.buf) … … 992 996 MythCodecID VideoOutputXv::GetBestSupportedCodec( 993 997 uint width, uint height, 994 998 uint osd_width, uint osd_height, 995 uint stream_type, int xvmc_chroma, bool test_surface) 999 uint stream_type, int xvmc_chroma, 1000 bool test_surface, bool force_xv) 996 1001 { 997 1002 (void)width, (void)height, (void)osd_width, (void)osd_height; 998 1003 (void)stream_type, (void)xvmc_chroma, (void)test_surface; 999 1004 1005 if (force_xv) 1006 return (MythCodecID)(kCodec_MPEG1 + (stream_type-1)); 1000 1007 #ifdef USING_XVMC 1001 1008 Display *disp = MythXOpenDisplay(); 1002 1009 … … 1718 1725 1719 1726 } 1720 1727 1728 VERBOSE(VB_PLAYBACK, QString("DELETE ME In CreateBuffers..ok %1 about to CreatePauseFrame").arg(ok)); 1721 1729 if (ok) 1722 CreatePauseFrame( );1730 CreatePauseFrame(subtype); 1723 1731 1724 1732 return ok; 1725 1733 } … … 1772 1780 1773 1781 if (delete_pause_frame) 1774 1782 { 1783 VERBOSE(VB_PLAYBACK, QString("DELETE ME deleting pause frame DeleteBuffers")); 1775 1784 if (av_pause_frame.buf) 1776 1785 { 1777 1786 delete [] av_pause_frame.buf; -
libs/libmythtv/avformatdecoder.h
228 228 229 229 bool using_null_videoout; 230 230 MythCodecID video_codec_id; 231 bool video_codec_changed; 231 232 232 233 int maxkeyframedist; 233 234 … … 255 256 uint lastcellstart; 256 257 bool dvdmenupktseen; 257 258 bool dvdvideopause; 259 bool xvmc_enabled; 260 bool xvmc_active; 258 261 259 262 }; 260 263 -
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