mirror of
https://github.com/jojo61/vdr-plugin-softhdcuvid.git
synced 2025-03-01 10:39:28 +00:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
230bb5ca11 | ||
|
|
f026e8e86d |
24
codec.c
24
codec.c
@@ -125,7 +125,7 @@ struct _video_decoder_
|
|||||||
*/
|
*/
|
||||||
static enum AVPixelFormat Codec_get_format(AVCodecContext *video_ctx, const enum AVPixelFormat *fmt) {
|
static enum AVPixelFormat Codec_get_format(AVCodecContext *video_ctx, const enum AVPixelFormat *fmt) {
|
||||||
VideoDecoder *decoder;
|
VideoDecoder *decoder;
|
||||||
enum AVPixelFormat fmt1;
|
|
||||||
|
|
||||||
decoder = video_ctx->opaque;
|
decoder = video_ctx->opaque;
|
||||||
// bug in ffmpeg 1.1.1, called with zero width or height
|
// 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");
|
Debug(3, "CodecVideoClose\n");
|
||||||
if (video_decoder->VideoCtx) {
|
if (video_decoder->VideoCtx) {
|
||||||
pthread_mutex_lock(&CodecLockMutex);
|
pthread_mutex_lock(&CodecLockMutex);
|
||||||
#if 1
|
|
||||||
frame = av_frame_alloc();
|
frame = av_frame_alloc();
|
||||||
avcodec_send_packet(video_decoder->VideoCtx, NULL);
|
avcodec_send_packet(video_decoder->VideoCtx, NULL);
|
||||||
while (avcodec_receive_frame(video_decoder->VideoCtx, frame) >= 0)
|
while (avcodec_receive_frame(video_decoder->VideoCtx, frame) >= 0)
|
||||||
;
|
;
|
||||||
av_frame_free(&frame);
|
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
|
#endif
|
||||||
avcodec_close(video_decoder->VideoCtx);
|
|
||||||
av_freep(&video_decoder->VideoCtx);
|
|
||||||
pthread_mutex_unlock(&CodecLockMutex);
|
pthread_mutex_unlock(&CodecLockMutex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -513,7 +517,7 @@ void CodecVideoDecode(VideoDecoder *decoder, const AVPacket *avpkt) {
|
|||||||
int ret, ret1;
|
int ret, ret1;
|
||||||
int got_frame;
|
int got_frame;
|
||||||
int consumed = 0;
|
int consumed = 0;
|
||||||
static uint64_t first_time = 0;
|
//static uint64_t first_time = 0;
|
||||||
const AVPacket *pkt;
|
const AVPacket *pkt;
|
||||||
|
|
||||||
next_part:
|
next_part:
|
||||||
@@ -541,7 +545,7 @@ next_part:
|
|||||||
frame = av_frame_alloc();
|
frame = av_frame_alloc();
|
||||||
ret = avcodec_receive_frame(video_ctx, frame); // get new frame
|
ret = avcodec_receive_frame(video_ctx, frame); // get new frame
|
||||||
if (ret >= 0) { // one is avail.
|
if (ret >= 0) { // one is avail.
|
||||||
first_time = frame->pts;
|
//first_time = frame->pts;
|
||||||
got_frame = 1;
|
got_frame = 1;
|
||||||
} else {
|
} else {
|
||||||
got_frame = 0;
|
got_frame = 0;
|
||||||
@@ -755,8 +759,12 @@ void CodecAudioClose(AudioDecoder *audio_decoder) {
|
|||||||
}
|
}
|
||||||
if (audio_decoder->AudioCtx) {
|
if (audio_decoder->AudioCtx) {
|
||||||
pthread_mutex_lock(&CodecLockMutex);
|
pthread_mutex_lock(&CodecLockMutex);
|
||||||
avcodec_close(audio_decoder->AudioCtx);
|
#if LIBAVUTIL_VERSION_INT < AV_VERSION_INT(55,63,100)
|
||||||
av_freep(&audio_decoder->AudioCtx);
|
avcodec_close(audio_decoder->AudioCtx);
|
||||||
|
av_freep(&audio_decoder->AudioCtx);
|
||||||
|
#else
|
||||||
|
avcodec_free_context(&audio_decoder->AudioCtx);
|
||||||
|
#endif
|
||||||
pthread_mutex_unlock(&CodecLockMutex);
|
pthread_mutex_unlock(&CodecLockMutex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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.23"
|
static const char *const VERSION = "3.24"
|
||||||
#ifdef GIT_REV
|
#ifdef GIT_REV
|
||||||
"-GIT" GIT_REV
|
"-GIT" GIT_REV
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
16
video.c
16
video.c
@@ -1258,19 +1258,17 @@ static void EglExit(void) {
|
|||||||
EglCheck();
|
EglCheck();
|
||||||
eglSurface = NULL;
|
eglSurface = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (eglContext) {
|
|
||||||
eglDestroyContext(eglDisplay, eglContext);
|
|
||||||
EglCheck();
|
|
||||||
eglContext = NULL;
|
|
||||||
}
|
|
||||||
if (eglSharedContext) {
|
if (eglSharedContext) {
|
||||||
eglDestroyContext(eglDisplay, eglSharedContext);
|
eglDestroyContext(eglDisplay, eglSharedContext);
|
||||||
EglCheck();
|
EglCheck();
|
||||||
eglSharedContext = NULL;
|
eglSharedContext = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (eglContext) {
|
||||||
|
eglDestroyContext(eglDisplay, eglContext);
|
||||||
|
EglCheck();
|
||||||
|
eglContext = NULL;
|
||||||
|
}
|
||||||
eglTerminate(eglDisplay);
|
eglTerminate(eglDisplay);
|
||||||
eglDisplay = NULL;
|
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
|
&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(
|
decoder->pl_frames[i].planes[n].texture = pl_tex_create(
|
||||||
p->gpu, &(struct pl_tex_params) {
|
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,
|
.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,
|
.export_handle = PL_HANDLE_FD,
|
||||||
#endif
|
#endif
|
||||||
});
|
});
|
||||||
}
|
//}
|
||||||
|
|
||||||
// make planes for image
|
// make planes for image
|
||||||
pl = &decoder->pl_frames[i].planes[n];
|
pl = &decoder->pl_frames[i].planes[n];
|
||||||
|
|||||||
Reference in New Issue
Block a user