2 Commits
V3.23 ... V3.24

Author SHA1 Message Date
jojo61
230bb5ca11 Fix dma handling for cuvid with placebo 2024-09-03 09:16:45 +02:00
jojo61
f026e8e86d Silence some compiler warnings 2024-08-05 23:13:05 +02:00
3 changed files with 24 additions and 18 deletions

24
codec.c
View File

@@ -125,7 +125,7 @@ struct _video_decoder_
*/
static enum AVPixelFormat Codec_get_format(AVCodecContext *video_ctx, const enum AVPixelFormat *fmt) {
VideoDecoder *decoder;
enum AVPixelFormat fmt1;
decoder = video_ctx->opaque;
// bug in ffmpeg 1.1.1, called with zero width or height
@@ -389,15 +389,19 @@ void CodecVideoClose(VideoDecoder *video_decoder) {
Debug(3, "CodecVideoClose\n");
if (video_decoder->VideoCtx) {
pthread_mutex_lock(&CodecLockMutex);
#if 1
frame = av_frame_alloc();
avcodec_send_packet(video_decoder->VideoCtx, NULL);
while (avcodec_receive_frame(video_decoder->VideoCtx, frame) >= 0)
;
av_frame_free(&frame);
#if LIBAVUTIL_VERSION_INT < AV_VERSION_INT(55,63,100)
avcodec_close(video_decoder->VideoCtx);
av_freep(&video_decoder->VideoCtx);
#else
avcodec_free_context(&video_decoder->VideoCtx);
#endif
avcodec_close(video_decoder->VideoCtx);
av_freep(&video_decoder->VideoCtx);
pthread_mutex_unlock(&CodecLockMutex);
}
}
@@ -513,7 +517,7 @@ void CodecVideoDecode(VideoDecoder *decoder, const AVPacket *avpkt) {
int ret, ret1;
int got_frame;
int consumed = 0;
static uint64_t first_time = 0;
//static uint64_t first_time = 0;
const AVPacket *pkt;
next_part:
@@ -541,7 +545,7 @@ next_part:
frame = av_frame_alloc();
ret = avcodec_receive_frame(video_ctx, frame); // get new frame
if (ret >= 0) { // one is avail.
first_time = frame->pts;
//first_time = frame->pts;
got_frame = 1;
} else {
got_frame = 0;
@@ -755,8 +759,12 @@ void CodecAudioClose(AudioDecoder *audio_decoder) {
}
if (audio_decoder->AudioCtx) {
pthread_mutex_lock(&CodecLockMutex);
avcodec_close(audio_decoder->AudioCtx);
av_freep(&audio_decoder->AudioCtx);
#if LIBAVUTIL_VERSION_INT < AV_VERSION_INT(55,63,100)
avcodec_close(audio_decoder->AudioCtx);
av_freep(&audio_decoder->AudioCtx);
#else
avcodec_free_context(&audio_decoder->AudioCtx);
#endif
pthread_mutex_unlock(&CodecLockMutex);
}
}

View File

@@ -61,7 +61,7 @@ extern void ToggleLUT();
/// vdr-plugin version number.
/// Makefile extracts the version number for generating the file name
/// for the distribution archive.
static const char *const VERSION = "3.23"
static const char *const VERSION = "3.24"
#ifdef GIT_REV
"-GIT" GIT_REV
#endif

16
video.c
View File

@@ -1258,19 +1258,17 @@ static void EglExit(void) {
EglCheck();
eglSurface = NULL;
}
if (eglContext) {
eglDestroyContext(eglDisplay, eglContext);
EglCheck();
eglContext = NULL;
}
if (eglSharedContext) {
eglDestroyContext(eglDisplay, eglSharedContext);
EglCheck();
eglSharedContext = NULL;
}
if (eglContext) {
eglDestroyContext(eglDisplay, eglContext);
EglCheck();
eglContext = NULL;
}
eglTerminate(eglDisplay);
eglDisplay = NULL;
@@ -2287,7 +2285,7 @@ void createTextureDst(CuvidDecoder *decoder, int anz, unsigned int size_x, unsig
&decoder->pl_frames[i].planes[n].texture); // delete old texture
}
if (p->has_dma_buf == 0) {
//if (p->has_dma_buf == 0) {
decoder->pl_frames[i].planes[n].texture = pl_tex_create(
p->gpu, &(struct pl_tex_params) {
.w = n == 0 ? size_x : size_x / 2, .h = n == 0 ? size_y : size_y / 2, .d = 0, .format = fmt,
@@ -2299,7 +2297,7 @@ void createTextureDst(CuvidDecoder *decoder, int anz, unsigned int size_x, unsig
.export_handle = PL_HANDLE_FD,
#endif
});
}
//}
// make planes for image
pl = &decoder->pl_frames[i].planes[n];