mirror of
				https://projects.vdr-developer.org/git/vdr-plugin-softhddevice.git
				synced 2023-10-10 17:16:51 +00:00 
			
		
		
		
	Workaround for ffmpeg 1.1.x get_format bug.
This commit is contained in:
		
							
								
								
									
										17
									
								
								video.c
									
									
									
									
									
								
							
							
						
						
									
										17
									
								
								video.c
									
									
									
									
									
								
							@@ -152,6 +152,15 @@ typedef enum
 | 
			
		||||
#include <libavcodec/vaapi.h>
 | 
			
		||||
#include <libavutil/pixdesc.h>
 | 
			
		||||
 | 
			
		||||
#if LIBAVCODEC_VERSION_INT == AV_VERSION_INT(54,86,100)
 | 
			
		||||
    ///
 | 
			
		||||
    /// ffmpeg version 1.1.1 calls get_format with zero width and height
 | 
			
		||||
    /// for H264 codecs.
 | 
			
		||||
    /// since version 1.1.3 get_format is called twice.
 | 
			
		||||
    ///
 | 
			
		||||
#define FFMPEG_BUG1_WORKAROUND		///< get_format bug workaround
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#include "misc.h"
 | 
			
		||||
#include "video.h"
 | 
			
		||||
#include "audio.h"
 | 
			
		||||
@@ -2429,6 +2438,7 @@ static void VaapiSetup(VaapiDecoder * decoder,
 | 
			
		||||
static VASurfaceID VaapiGetSurface(VaapiDecoder * decoder,
 | 
			
		||||
    const AVCodecContext * video_ctx)
 | 
			
		||||
{
 | 
			
		||||
#ifdef FFMPEG_BUG1_WORKAROUND
 | 
			
		||||
    // get_format not called with valid informations.
 | 
			
		||||
    if (video_ctx->width != decoder->InputWidth
 | 
			
		||||
	|| video_ctx->height != decoder->InputHeight) {
 | 
			
		||||
@@ -2459,6 +2469,7 @@ static VASurfaceID VaapiGetSurface(VaapiDecoder * decoder,
 | 
			
		||||
	}
 | 
			
		||||
	// FIXME: too late to switch to software rending on failures
 | 
			
		||||
    }
 | 
			
		||||
#endif
 | 
			
		||||
    return VaapiGetSurface0(decoder);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -2659,7 +2670,7 @@ static enum PixelFormat Vaapi_get_format(VaapiDecoder * decoder,
 | 
			
		||||
    decoder->InputWidth = 0;
 | 
			
		||||
    decoder->InputHeight = 0;
 | 
			
		||||
 | 
			
		||||
#if 0
 | 
			
		||||
#ifndef FFMPEG_BUG1_WORKAROUND
 | 
			
		||||
    if (video_ctx->width && video_ctx->height) {
 | 
			
		||||
	VAStatus status;
 | 
			
		||||
 | 
			
		||||
@@ -6743,6 +6754,7 @@ static void VdpauSetupOutput(VdpauDecoder * decoder)
 | 
			
		||||
static unsigned VdpauGetSurface(VdpauDecoder * decoder,
 | 
			
		||||
    const AVCodecContext * video_ctx)
 | 
			
		||||
{
 | 
			
		||||
#ifdef FFMPEG_BUG1_WORKAROUND
 | 
			
		||||
    // get_format not called with valid informations.
 | 
			
		||||
    if (video_ctx->width != decoder->InputWidth
 | 
			
		||||
	|| video_ctx->height != decoder->InputHeight) {
 | 
			
		||||
@@ -6766,6 +6778,7 @@ static unsigned VdpauGetSurface(VdpauDecoder * decoder,
 | 
			
		||||
 | 
			
		||||
	VdpauSetupOutput(decoder);
 | 
			
		||||
    }
 | 
			
		||||
#endif
 | 
			
		||||
    return VdpauGetSurface0(decoder);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -6925,7 +6938,7 @@ static enum PixelFormat Vdpau_get_format(VdpauDecoder * decoder,
 | 
			
		||||
    decoder->InputWidth = 0;
 | 
			
		||||
    decoder->InputHeight = 0;
 | 
			
		||||
 | 
			
		||||
#if 0
 | 
			
		||||
#ifndef FFMPEG_BUG1_WORKAROUND
 | 
			
		||||
    if (video_ctx->width && video_ctx->height) {
 | 
			
		||||
	VdpStatus status;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user