Ticket #6922: vdpauh264_stream_check.diff
File vdpauh264_stream_check.diff, 3.1 KB (added by , 15 years ago) |
---|
-
libs/libmythtv/util-vdpau.cpp
86 86 pipOutputSurface(0), pipAlpha(0), pipBorder(0), 87 87 pipClear(0), pipReady(0), pipNeedsClear(false), 88 88 vdp_flip_target(0), vdp_flip_queue(0), vdpauDecode(false), 89 vdp_device(0), errorCount(0), errorState(kError_None), 89 vdp_device(0), decoderDescription(0), 90 errorCount(0), errorState(kError_None), 90 91 vdp_get_proc_address(NULL), vdp_device_destroy(NULL), 91 92 vdp_get_error_string(NULL), vdp_get_api_version(NULL), 92 93 vdp_get_information_string(NULL), vdp_video_surface_create(NULL), … … 161 162 return ok; 162 163 } 163 164 164 void VDPAUContext::De init(void)165 void VDPAUContext::DestroyDecoder(void) 165 166 { 166 167 if (decoder) 167 {168 168 vdp_decoder_destroy(decoder); 169 decoder = NULL; 170 pix_fmt = -1; 171 } 169 decoder = NULL; 170 pix_fmt = -1; 171 decoderDescription = 0; 172 } 173 174 void VDPAUContext::Deinit(void) 175 { 176 DestroyDecoder(); 172 177 ClearReferenceFrames(); 173 178 DeinitOSD(); 174 179 FreeOutput(); … … 910 915 checkOutputSurfaces = false; 911 916 } 912 917 918 #define HASH_H264(arg) \ 919 ((uint64_t)arg.num_ref_frames << 56) + \ 920 ((uint64_t)arg.mb_adaptive_frame_field_flag << 48) 921 913 922 void VDPAUContext::Decode(VideoFrame *frame) 914 923 { 915 924 if (!vdpauDecode) … … 932 941 return; 933 942 } 934 943 944 if (decoder && frame->pix_fmt == PIX_FMT_VDPAU_H264) 945 { 946 if (HASH_H264(render->info.h264) != decoderDescription) 947 { 948 VERBOSE(VB_IMPORTANT, LOC + 949 QString("h264 stream type has changed. Re-creating decoder.")); 950 VERBOSE(VB_PLAYBACK, LOC + QString("Old desc '%1'") 951 .arg(HASH_H264(decoderDescription), 16, 16, QChar(48))); 952 VERBOSE(VB_PLAYBACK, LOC + QString("New desc '%1'") 953 .arg(HASH_H264(render->info.h264), 16, 16, QChar(48))); 954 DestroyDecoder(); 955 } 956 } 957 935 958 if (frame->pix_fmt != pix_fmt) 936 959 { 937 960 if (decoder) … … 944 967 945 968 if (frame->pix_fmt == PIX_FMT_VDPAU_H264) 946 969 { 970 decoderDescription = HASH_H264(render->info.h264); 947 971 maxReferences = render->info.h264.num_ref_frames; 948 972 if (maxReferences < 1 || maxReferences > 16) 949 973 { -
libs/libmythtv/util-vdpau.h
52 52 QSize screen_size, bool color_control, 53 53 int color_key, MythCodecID mcodecid, 54 54 QString options); 55 void DestroyDecoder(void); 55 56 void Deinit(void); 56 57 VideoErrorState GetError(void) { return errorState; } 57 58 bool IsErrored(void) … … 190 191 191 192 bool vdpauDecode; 192 193 VdpDevice vdp_device; 194 uint64_t decoderDescription; 193 195 194 196 int errorCount; 195 197 VideoErrorState errorState;