mirror of
https://projects.vdr-developer.org/git/vdr-plugin-softhddevice.git
synced 2023-10-10 19:16:51 +02:00
Workaround for ffmpeg 2.6 artifacts.
This commit is contained in:
parent
a1939eb6cb
commit
e0f4a99b99
@ -1,6 +1,7 @@
|
|||||||
User johns
|
User johns
|
||||||
Date:
|
Date:
|
||||||
|
|
||||||
|
Workaround for ffmpeg 2.6 artifacts.
|
||||||
Fix bug: brightness and .. are calculated wrong.
|
Fix bug: brightness and .. are calculated wrong.
|
||||||
Add automatic frame rate detection for older ffmpeg versions.
|
Add automatic frame rate detection for older ffmpeg versions.
|
||||||
Fix bug: destroyed vdpau surfaces still used in queue.
|
Fix bug: destroyed vdpau surfaces still used in queue.
|
||||||
|
35
codec.c
35
codec.c
@ -1,7 +1,7 @@
|
|||||||
///
|
///
|
||||||
/// @file codec.c @brief Codec functions
|
/// @file codec.c @brief Codec functions
|
||||||
///
|
///
|
||||||
/// Copyright (c) 2009 - 2014 by Johns. All Rights Reserved.
|
/// Copyright (c) 2009 - 2015 by Johns. All Rights Reserved.
|
||||||
///
|
///
|
||||||
/// Contributor(s):
|
/// Contributor(s):
|
||||||
///
|
///
|
||||||
@ -93,6 +93,16 @@
|
|||||||
#include "audio.h"
|
#include "audio.h"
|
||||||
#include "codec.h"
|
#include "codec.h"
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// correct is AV_VERSION_INT(56,35,101) but some gentoo i* think
|
||||||
|
// they must change it.
|
||||||
|
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(56,26,100)
|
||||||
|
/// ffmpeg 2.6 started to show artifacts after channel switch
|
||||||
|
/// to SDTV channels
|
||||||
|
#define FFMPEG_WORKAROUND_ARTIFACTS 1
|
||||||
|
#endif
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// Global
|
// Global
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
@ -105,6 +115,9 @@
|
|||||||
///
|
///
|
||||||
static pthread_mutex_t CodecLockMutex;
|
static pthread_mutex_t CodecLockMutex;
|
||||||
|
|
||||||
|
/// Flag prefer fast xhannel switch
|
||||||
|
char CodecUsePossibleDefectFrames;
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// Video
|
// Video
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
@ -126,6 +139,9 @@ struct _video_decoder_
|
|||||||
int GetFormatDone; ///< flag get format called!
|
int GetFormatDone; ///< flag get format called!
|
||||||
AVCodec *VideoCodec; ///< video codec
|
AVCodec *VideoCodec; ///< video codec
|
||||||
AVCodecContext *VideoCtx; ///< video codec context
|
AVCodecContext *VideoCtx; ///< video codec context
|
||||||
|
#ifdef FFMPEG_WORKAROUND_ARTIFACTS
|
||||||
|
int FirstKeyFrame; ///< flag first frame
|
||||||
|
#endif
|
||||||
AVFrame *Frame; ///< decoded video frame
|
AVFrame *Frame; ///< decoded video frame
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -525,6 +541,9 @@ void CodecVideoOpen(VideoDecoder * decoder, const char *name, int codec_id)
|
|||||||
}
|
}
|
||||||
// reset buggy ffmpeg/libav flag
|
// reset buggy ffmpeg/libav flag
|
||||||
decoder->GetFormatDone = 0;
|
decoder->GetFormatDone = 0;
|
||||||
|
#ifdef FFMPEG_WORKAROUND_ARTIFACTS
|
||||||
|
decoder->FirstKeyFrame = 1;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -611,8 +630,22 @@ void CodecVideoDecode(VideoDecoder * decoder, const AVPacket * avpkt)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (got_frame) { // frame completed
|
if (got_frame) { // frame completed
|
||||||
|
#ifdef FFMPEG_WORKAROUND_ARTIFACTS
|
||||||
|
if (!CodecUsePossibleDefectFrames && decoder->FirstKeyFrame) {
|
||||||
|
decoder->FirstKeyFrame++;
|
||||||
|
if (frame->key_frame) {
|
||||||
|
Debug((3, "codec: key frame after %d frames\n",
|
||||||
|
decoder->FirstKeyFrame);
|
||||||
|
decoder->FirstKeyFrame = 0;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
//DisplayPts(video_ctx, frame);
|
//DisplayPts(video_ctx, frame);
|
||||||
VideoRenderFrame(decoder->HwDecoder, video_ctx, frame);
|
VideoRenderFrame(decoder->HwDecoder, video_ctx, frame);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
//DisplayPts(video_ctx, frame);
|
||||||
|
VideoRenderFrame(decoder->HwDecoder, video_ctx, frame);
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
// some frames are needed for references, interlaced frames ...
|
// some frames are needed for references, interlaced frames ...
|
||||||
// could happen with h264 dvb streams, just drop data.
|
// could happen with h264 dvb streams, just drop data.
|
||||||
|
9
codec.h
9
codec.h
@ -1,7 +1,7 @@
|
|||||||
///
|
///
|
||||||
/// @file codec.h @brief Codec module headerfile
|
/// @file codec.h @brief Codec module headerfile
|
||||||
///
|
///
|
||||||
/// Copyright (c) 2009 - 2013 by Johns. All Rights Reserved.
|
/// Copyright (c) 2009 - 2013, 2015 by Johns. All Rights Reserved.
|
||||||
///
|
///
|
||||||
/// Contributor(s):
|
/// Contributor(s):
|
||||||
///
|
///
|
||||||
@ -43,6 +43,13 @@ typedef struct _video_decoder_ VideoDecoder;
|
|||||||
/// Audio decoder typedef.
|
/// Audio decoder typedef.
|
||||||
typedef struct _audio_decoder_ AudioDecoder;
|
typedef struct _audio_decoder_ AudioDecoder;
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
// Variables
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/// Flag prefer fast xhannel switch
|
||||||
|
extern char CodecUsePossibleDefectFrames;
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// Prototypes
|
// Prototypes
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
///
|
///
|
||||||
/// @file softhddev.c @brief A software HD device plugin for VDR.
|
/// @file softhddev.c @brief A software HD device plugin for VDR.
|
||||||
///
|
///
|
||||||
/// Copyright (c) 2011 - 2014 by Johns. All Rights Reserved.
|
/// Copyright (c) 2011 - 2015 by Johns. All Rights Reserved.
|
||||||
///
|
///
|
||||||
/// Contributor(s):
|
/// Contributor(s):
|
||||||
///
|
///
|
||||||
@ -2905,6 +2905,7 @@ const char *CommandLineHelp(void)
|
|||||||
"\talsa-no-close-open\tdisable close open to fix alsa no sound bug\n"
|
"\talsa-no-close-open\tdisable close open to fix alsa no sound bug\n"
|
||||||
"\talsa-close-open-delay\tenable close open delay to fix no sound bug\n"
|
"\talsa-close-open-delay\tenable close open delay to fix no sound bug\n"
|
||||||
"\tignore-repeat-pict\tdisable repeat pict message\n"
|
"\tignore-repeat-pict\tdisable repeat pict message\n"
|
||||||
|
"\tuse-possible-defect-frames prefer faster channel switch\n"
|
||||||
" -D\t\tstart in detached mode\n";
|
" -D\t\tstart in detached mode\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2986,6 +2987,8 @@ int ProcessArgs(int argc, char *const argv[])
|
|||||||
AudioAlsaCloseOpenDelay = 1;
|
AudioAlsaCloseOpenDelay = 1;
|
||||||
} else if (!strcasecmp("ignore-repeat-pict", optarg)) {
|
} else if (!strcasecmp("ignore-repeat-pict", optarg)) {
|
||||||
VideoIgnoreRepeatPict = 1;
|
VideoIgnoreRepeatPict = 1;
|
||||||
|
} else if (!strcasecmp("use-possible-defect-frames", optarg)) {
|
||||||
|
CodecUsePossibleDefectFrames = 1;
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, _("Workaround '%s' unsupported\n"),
|
fprintf(stderr, _("Workaround '%s' unsupported\n"),
|
||||||
optarg);
|
optarg);
|
||||||
|
Loading…
Reference in New Issue
Block a user