mirror of
https://github.com/jojo61/vdr-plugin-softhdcuvid.git
synced 2025-12-27 07:21:07 +01:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
618b689bc3 | ||
|
|
40c2152557 | ||
|
|
9682e5f9a3 | ||
|
|
22faf96cf2 | ||
|
|
f902347cc3 | ||
|
|
4c48e91156 |
4
Makefile
4
Makefile
@@ -113,8 +113,8 @@ TMPDIR ?= /tmp
|
|||||||
|
|
||||||
### The compiler options:
|
### The compiler options:
|
||||||
|
|
||||||
export CFLAGS = $(call PKGCFG,cflags) -fpermissive
|
export CFLAGS = $(call PKGCFG,cflags)
|
||||||
export CXXFLAGS = $(call PKGCFG,cxxflags) -fpermissive
|
export CXXFLAGS = $(call PKGCFG,cxxflags)
|
||||||
|
|
||||||
ifeq ($(CFLAGS),)
|
ifeq ($(CFLAGS),)
|
||||||
$(warning CFLAGS not set)
|
$(warning CFLAGS not set)
|
||||||
|
|||||||
7
codec.c
7
codec.c
@@ -488,8 +488,9 @@ void CodecVideoDecode(VideoDecoder *decoder, const AVPacket *avpkt) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (ret >= 0) {
|
if (ret >= 0) {
|
||||||
//printf("Videosize %d:%d ttf %d\n",frame->width,frame->height,frame->interlaced_frame);
|
//printf("Videosize %d:%d interlaced %d Flag %x\n",frame->width,frame->height,frame->interlaced_frame,frame->flags & AV_FRAME_FLAG_INTERLACED);
|
||||||
if ((frame->flags & AV_FRAME_FLAG_INTERLACED) && decoder->filter) {
|
if (((frame->flags & AV_FRAME_FLAG_INTERLACED) || (frame->height == 576)) && decoder->filter) {
|
||||||
|
//if ( decoder->filter) {
|
||||||
if (decoder->filter == 1) {
|
if (decoder->filter == 1) {
|
||||||
if (init_filters(video_ctx, decoder->HwDecoder, frame) < 0) {
|
if (init_filters(video_ctx, decoder->HwDecoder, frame) < 0) {
|
||||||
Debug(3, "video: Init of VAAPI deint Filter failed\n");
|
Debug(3, "video: Init of VAAPI deint Filter failed\n");
|
||||||
@@ -560,7 +561,7 @@ next_part:
|
|||||||
// printf("video frame pts %#012" PRIx64 "
|
// printf("video frame pts %#012" PRIx64 "
|
||||||
//%dms\n",frame->pts,(int)(apts - frame->pts) / 90);
|
//%dms\n",frame->pts,(int)(apts - frame->pts) / 90);
|
||||||
#ifdef YADIF
|
#ifdef YADIF
|
||||||
if ((frame->flags & AV_FRAME_FLAG_INTERLACED) && decoder->filter) {
|
if (((frame->flags & AV_FRAME_FLAG_INTERLACED) || (frame->height == 576)) && decoder->filter) {
|
||||||
if (decoder->filter == 1) {
|
if (decoder->filter == 1) {
|
||||||
if (init_filters(video_ctx, decoder->HwDecoder, frame) < 0) {
|
if (init_filters(video_ctx, decoder->HwDecoder, frame) < 0) {
|
||||||
Debug(3,"video: Init of YADIF Filter failed\n");
|
Debug(3,"video: Init of YADIF Filter failed\n");
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ extern void ToggleLUT();
|
|||||||
/// vdr-plugin version number.
|
/// vdr-plugin version number.
|
||||||
/// Makefile extracts the version number for generating the file name
|
/// Makefile extracts the version number for generating the file name
|
||||||
/// for the distribution archive.
|
/// for the distribution archive.
|
||||||
static const char *const VERSION = "3.30"
|
static const char *const VERSION = "3.34"
|
||||||
#ifdef GIT_REV
|
#ifdef GIT_REV
|
||||||
"-GIT" GIT_REV
|
"-GIT" GIT_REV
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
48
video.c
48
video.c
@@ -2703,7 +2703,9 @@ int init_filters(AVCodecContext *dec_ctx, CuvidDecoder *decoder, AVFrame *frame)
|
|||||||
#endif
|
#endif
|
||||||
#ifdef YADIF
|
#ifdef YADIF
|
||||||
const char *filters_descr = "yadif_cuda=1:0:1"; // mode=send_field,parity=tff,deint=interlaced";
|
const char *filters_descr = "yadif_cuda=1:0:1"; // mode=send_field,parity=tff,deint=interlaced";
|
||||||
|
#if LIBAVUTIL_VERSION_INT < AV_VERSION_INT(59,40,100)
|
||||||
enum AVPixelFormat pix_fmts[] = {format, AV_PIX_FMT_NONE};
|
enum AVPixelFormat pix_fmts[] = {format, AV_PIX_FMT_NONE};
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
char args[512];
|
char args[512];
|
||||||
@@ -2723,16 +2725,25 @@ int init_filters(AVCodecContext *dec_ctx, CuvidDecoder *decoder, AVFrame *frame)
|
|||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* buffer video source: the decoded frames from the decoder will be inserted
|
|
||||||
* here. */
|
|
||||||
snprintf(args, sizeof(args), "video_size=%dx%d:pix_fmt=%d:time_base=%d/%d:pixel_aspect=%d/%d", dec_ctx->width,
|
|
||||||
dec_ctx->height, format, 1, 90000, dec_ctx->sample_aspect_ratio.num, dec_ctx->sample_aspect_ratio.den);
|
|
||||||
|
|
||||||
ret = avfilter_graph_create_filter(&decoder->buffersrc_ctx, buffersrc, "in", args, NULL, decoder->filter_graph);
|
#if LIBAVFILTER_VERSION_INT < AV_VERSION_INT(9,16,100)
|
||||||
if (ret < 0) {
|
snprintf(args, sizeof(args), "video_size=%dx%d:pix_fmt=%d:time_base=%d/%d:pixel_aspect=%d/%d",
|
||||||
Debug(3, "Cannot create buffer source\n");
|
dec_ctx->width,dec_ctx->height, format, 1, 90000,
|
||||||
|
dec_ctx->sample_aspect_ratio.num, dec_ctx->sample_aspect_ratio.den);
|
||||||
|
#else
|
||||||
|
snprintf(args, sizeof(args), "video_size=%dx%d:pix_fmt=%d:time_base=%d/%d:pixel_aspect=%d/%d:colorspace=%d:range=%d",
|
||||||
|
dec_ctx->width,dec_ctx->height, dec_ctx->pix_fmt,
|
||||||
|
dec_ctx->pkt_timebase.num, dec_ctx->pkt_timebase.den,
|
||||||
|
dec_ctx->sample_aspect_ratio.num, dec_ctx->sample_aspect_ratio.den,
|
||||||
|
dec_ctx->colorspace,dec_ctx->color_range);
|
||||||
|
#endif
|
||||||
|
decoder->buffersrc_ctx = avfilter_graph_alloc_filter(decoder->filter_graph, buffersrc, "in");
|
||||||
|
|
||||||
|
if (!decoder->buffersrc_ctx) {
|
||||||
|
Debug(3,"Cannot alloc buffer source %s\n", args);
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
src_params = av_buffersrc_parameters_alloc();
|
src_params = av_buffersrc_parameters_alloc();
|
||||||
src_params->hw_frames_ctx = frame->hw_frames_ctx;
|
src_params->hw_frames_ctx = frame->hw_frames_ctx;
|
||||||
src_params->format = format;
|
src_params->format = format;
|
||||||
@@ -2747,10 +2758,19 @@ int init_filters(AVCodecContext *dec_ctx, CuvidDecoder *decoder, AVFrame *frame)
|
|||||||
// printf("width %d height %d hw_frames_ctx
|
// printf("width %d height %d hw_frames_ctx
|
||||||
// %p\n",dec_ctx->width,dec_ctx->height ,frame->hw_frames_ctx);
|
// %p\n",dec_ctx->width,dec_ctx->height ,frame->hw_frames_ctx);
|
||||||
ret = av_buffersrc_parameters_set(decoder->buffersrc_ctx, src_params);
|
ret = av_buffersrc_parameters_set(decoder->buffersrc_ctx, src_params);
|
||||||
|
av_free(src_params);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
Debug(3, "Cannot set hw_frames_ctx to src\n");
|
Debug(3, "Cannot set hw_frames_ctx to src\n");
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ret = avfilter_init_str(decoder->buffersrc_ctx, args);
|
||||||
|
|
||||||
|
if (ret < 0) {
|
||||||
|
Error(_("Cannot init buffer source %s\n"), args);
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
/* buffer video sink: to terminate the filter chain. */
|
/* buffer video sink: to terminate the filter chain. */
|
||||||
ret = avfilter_graph_create_filter(&decoder->buffersink_ctx, buffersink, "out", NULL, NULL, decoder->filter_graph);
|
ret = avfilter_graph_create_filter(&decoder->buffersink_ctx, buffersink, "out", NULL, NULL, decoder->filter_graph);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
@@ -2758,11 +2778,13 @@ int init_filters(AVCodecContext *dec_ctx, CuvidDecoder *decoder, AVFrame *frame)
|
|||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
#ifdef YADIF
|
#ifdef YADIF
|
||||||
|
#if LIBAVUTIL_VERSION_INT < AV_VERSION_INT(59,40,100)
|
||||||
ret = av_opt_set_int_list(decoder->buffersink_ctx, "pix_fmts", pix_fmts, AV_PIX_FMT_NONE, AV_OPT_SEARCH_CHILDREN);
|
ret = av_opt_set_int_list(decoder->buffersink_ctx, "pix_fmts", pix_fmts, AV_PIX_FMT_NONE, AV_OPT_SEARCH_CHILDREN);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
Debug(3, "Cannot set output pixel format\n");
|
Debug(3, "Cannot set output pixel format\n");
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
/*
|
/*
|
||||||
* Set the endpoints for the filter graph. The filter_graph will
|
* Set the endpoints for the filter graph. The filter_graph will
|
||||||
@@ -2893,7 +2915,11 @@ static enum AVPixelFormat Cuvid_get_format(CuvidDecoder *decoder, AVCodecContext
|
|||||||
bitformat16 = 1;
|
bitformat16 = 1;
|
||||||
}
|
}
|
||||||
#ifdef VAAPI
|
#ifdef VAAPI
|
||||||
|
#if (LIBAVCODEC_VERSION_INT > AV_VERSION_INT(62, 11, 100))
|
||||||
|
if (video_ctx->profile == AV_PROFILE_HEVC_MAIN_10)
|
||||||
|
#else
|
||||||
if (video_ctx->profile == FF_PROFILE_HEVC_MAIN_10)
|
if (video_ctx->profile == FF_PROFILE_HEVC_MAIN_10)
|
||||||
|
#endif
|
||||||
bitformat16 = 1;
|
bitformat16 = 1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -6099,15 +6125,7 @@ void VideoReleaseSurface(VideoHwDecoder *hw_decoder, unsigned surface) {
|
|||||||
///
|
///
|
||||||
enum AVPixelFormat Video_get_format(VideoHwDecoder *hw_decoder, AVCodecContext *video_ctx,
|
enum AVPixelFormat Video_get_format(VideoHwDecoder *hw_decoder, AVCodecContext *video_ctx,
|
||||||
const enum AVPixelFormat *fmt) {
|
const enum AVPixelFormat *fmt) {
|
||||||
#ifdef DEBUG
|
|
||||||
int ms_delay;
|
|
||||||
|
|
||||||
// FIXME: use frame time
|
|
||||||
ms_delay = (1000 * video_ctx->time_base.num * video_ctx->ticks_per_frame) / video_ctx->time_base.den;
|
|
||||||
|
|
||||||
Debug(3, "video: ready %s %2dms/frame %dms\n", Timestamp2String(VideoGetClock(hw_decoder)), ms_delay,
|
|
||||||
GetMsTicks() - VideoSwitch);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return VideoUsedModule->get_format(hw_decoder, video_ctx, fmt);
|
return VideoUsedModule->get_format(hw_decoder, video_ctx, fmt);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user