mirror of
https://projects.vdr-developer.org/git/vdr-plugin-softhddevice.git
synced 2023-10-10 19:16:51 +02:00
Fix bug: Can't use software decoder with VDPAU.
This commit is contained in:
parent
ecb48a5d63
commit
c07ec82e6d
@ -1,6 +1,7 @@
|
|||||||
User johns
|
User johns
|
||||||
Date:
|
Date:
|
||||||
|
|
||||||
|
Fix bug: Can't use software decoder with VDPAU.
|
||||||
Resume plugin, if suspend control stops.
|
Resume plugin, if suspend control stops.
|
||||||
Removes old audio code (!USE_AUDIORING).
|
Removes old audio code (!USE_AUDIORING).
|
||||||
Use -DOSD_DEBUG to debug OSD.
|
Use -DOSD_DEBUG to debug OSD.
|
||||||
|
18
codec.c
18
codec.c
@ -363,22 +363,6 @@ void CodecVideoOpen(VideoDecoder * decoder, const char *name, int codec_id)
|
|||||||
if (decoder->VideoCtx) {
|
if (decoder->VideoCtx) {
|
||||||
Error(_("codec: missing close\n"));
|
Error(_("codec: missing close\n"));
|
||||||
}
|
}
|
||||||
//
|
|
||||||
// ffmpeg compatibility hack
|
|
||||||
//
|
|
||||||
#if 1 || (LIBAVCODEC_VERSION_INT <= AV_VERSION_INT(52,96,0))
|
|
||||||
if (name) {
|
|
||||||
if (!strcmp(name, "h264video_vdpau")) {
|
|
||||||
name = "h264_vdpau";
|
|
||||||
} else if (!strcmp(name, "mpeg4video_vdpau")) {
|
|
||||||
name = "mpeg4_vdpau";
|
|
||||||
} else if (!strcmp(name, "vc1video_vdpau")) {
|
|
||||||
name = "vc1_vdpau";
|
|
||||||
} else if (!strcmp(name, "wmv3video_vdpau")) {
|
|
||||||
name = "wmv3_vdpau";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (name && (video_codec = avcodec_find_decoder_by_name(name))) {
|
if (name && (video_codec = avcodec_find_decoder_by_name(name))) {
|
||||||
Debug(3, "codec: vdpau decoder found\n");
|
Debug(3, "codec: vdpau decoder found\n");
|
||||||
@ -939,7 +923,7 @@ static void CodecAudioSetClock(AudioDecoder * audio_decoder, int64_t pts)
|
|||||||
|
|
||||||
if (0) {
|
if (0) {
|
||||||
Debug(3,
|
Debug(3,
|
||||||
"codec/audio: interval P:%5 " PRId64 "ms T:%5" PRId64 "ms D:%4"
|
"codec/audio: interval P:%5" PRId64 "ms T:%5" PRId64 "ms D:%4"
|
||||||
PRId64 "ms %f %d\n", pts_diff / 90, tim_diff / (1000 * 1000),
|
PRId64 "ms %f %d\n", pts_diff / 90, tim_diff / (1000 * 1000),
|
||||||
delay / 90, drift / 90.0, audio_decoder->DriftCorr);
|
delay / 90, drift / 90.0, audio_decoder->DriftCorr);
|
||||||
}
|
}
|
||||||
|
21
softhddev.c
21
softhddev.c
@ -59,9 +59,9 @@ static int H264Dump(const uint8_t * data, int size);
|
|||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef USE_VDPAU
|
#ifdef USE_VDPAU
|
||||||
static char ConfigVdpauDecoder = 1; ///< use vdpau decoder, if possible
|
static char VdpauDecoder = 1; ///< vdpau decoder used
|
||||||
#else
|
#else
|
||||||
#define ConfigVdpauDecoder 0 ///< no vdpau decoder configured
|
#define VdpauDecoder 0 ///< no vdpau decoder configured
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern int ConfigAudioBufferTime; ///< config size ms of audio buffer
|
extern int ConfigAudioBufferTime; ///< config size ms of audio buffer
|
||||||
@ -1533,17 +1533,16 @@ int VideoDecodeInput(void)
|
|||||||
case CODEC_ID_MPEG2VIDEO:
|
case CODEC_ID_MPEG2VIDEO:
|
||||||
if (last_codec_id != CODEC_ID_MPEG2VIDEO) {
|
if (last_codec_id != CODEC_ID_MPEG2VIDEO) {
|
||||||
last_codec_id = CODEC_ID_MPEG2VIDEO;
|
last_codec_id = CODEC_ID_MPEG2VIDEO;
|
||||||
CodecVideoOpen(MyVideoDecoder,
|
CodecVideoOpen(MyVideoDecoder, VideoHardwareDecoder < 0
|
||||||
ConfigVdpauDecoder ? "mpegvideo_vdpau" : NULL,
|
&& VdpauDecoder ? "mpeg_vdpau" : NULL,
|
||||||
CODEC_ID_MPEG2VIDEO);
|
CODEC_ID_MPEG2VIDEO);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case CODEC_ID_H264:
|
case CODEC_ID_H264:
|
||||||
if (last_codec_id != CODEC_ID_H264) {
|
if (last_codec_id != CODEC_ID_H264) {
|
||||||
last_codec_id = CODEC_ID_H264;
|
last_codec_id = CODEC_ID_H264;
|
||||||
CodecVideoOpen(MyVideoDecoder,
|
CodecVideoOpen(MyVideoDecoder, VideoHardwareDecoder
|
||||||
ConfigVdpauDecoder ? "h264video_vdpau" : NULL,
|
&& VdpauDecoder ? "h264_vdpau" : NULL, CODEC_ID_H264);
|
||||||
CODEC_ID_H264);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -1587,6 +1586,10 @@ int VideoGetBuffers(void)
|
|||||||
static void StartVideo(void)
|
static void StartVideo(void)
|
||||||
{
|
{
|
||||||
VideoInit(X11DisplayName);
|
VideoInit(X11DisplayName);
|
||||||
|
#ifdef USE_VDPAU
|
||||||
|
VdpauDecoder = !strcasecmp(VideoGetDriverName(), "vdpau");
|
||||||
|
#endif
|
||||||
|
|
||||||
if (ConfigFullscreen) {
|
if (ConfigFullscreen) {
|
||||||
// FIXME: not good looking, mapped and then resized.
|
// FIXME: not good looking, mapped and then resized.
|
||||||
VideoSetFullscreen(1);
|
VideoSetFullscreen(1);
|
||||||
@ -2347,10 +2350,6 @@ int ProcessArgs(int argc, char *const argv[])
|
|||||||
continue;
|
continue;
|
||||||
case 'v': // video driver
|
case 'v': // video driver
|
||||||
VideoSetDevice(optarg);
|
VideoSetDevice(optarg);
|
||||||
#ifdef USE_VDPAU
|
|
||||||
// FIXME: this is a big hack
|
|
||||||
ConfigVdpauDecoder = !strcasecmp(optarg, "vdpau");
|
|
||||||
#endif
|
|
||||||
continue;
|
continue;
|
||||||
case 'x': // x11 server
|
case 'x': // x11 server
|
||||||
ConfigStartX11Server = 1;
|
ConfigStartX11Server = 1;
|
||||||
|
26
video.c
26
video.c
@ -5345,7 +5345,7 @@ static void VdpauCreateSurfaces(VdpauDecoder * decoder, int width, int height)
|
|||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
if (!decoder->SurfacesNeeded) {
|
if (!decoder->SurfacesNeeded) {
|
||||||
Error(_("video/vaapi: surface needed not set\n"));
|
Error(_("video/vdpau: surface needed not set\n"));
|
||||||
decoder->SurfacesNeeded = 3 + VIDEO_SURFACES_MAX;
|
decoder->SurfacesNeeded = 3 + VIDEO_SURFACES_MAX;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -7381,14 +7381,8 @@ static void VdpauRenderFrame(VdpauDecoder * decoder,
|
|||||||
decoder->InputWidth = video_ctx->width;
|
decoder->InputWidth = video_ctx->width;
|
||||||
decoder->InputHeight = video_ctx->height;
|
decoder->InputHeight = video_ctx->height;
|
||||||
|
|
||||||
//
|
|
||||||
// detect interlaced input
|
|
||||||
//
|
|
||||||
Debug(3, "video/vdpau: interlaced %d top-field-first %d\n",
|
|
||||||
frame->interlaced_frame, frame->top_field_first);
|
|
||||||
// FIXME: I hope this didn't change in the middle of the stream
|
|
||||||
|
|
||||||
VdpauCleanup(decoder);
|
VdpauCleanup(decoder);
|
||||||
|
decoder->SurfacesNeeded = VIDEO_SURFACES_MAX + 2;
|
||||||
VdpauSetupOutput(decoder);
|
VdpauSetupOutput(decoder);
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
@ -7402,6 +7396,7 @@ static void VdpauRenderFrame(VdpauDecoder * decoder,
|
|||||||
default:
|
default:
|
||||||
Fatal(_("video/vdpau: pixel format %d not supported\n"),
|
Fatal(_("video/vdpau: pixel format %d not supported\n"),
|
||||||
video_ctx->pix_fmt);
|
video_ctx->pix_fmt);
|
||||||
|
// FIXME: no fatals!
|
||||||
}
|
}
|
||||||
|
|
||||||
// convert ffmpeg order to vdpau
|
// convert ffmpeg order to vdpau
|
||||||
@ -7421,6 +7416,8 @@ static void VdpauRenderFrame(VdpauDecoder * decoder,
|
|||||||
VdpauGetErrorString(status));
|
VdpauGetErrorString(status));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Debug(4, "video/vdpau: sw render hw surface %#08x\n", surface);
|
||||||
|
|
||||||
VdpauQueueSurface(decoder, surface, 1);
|
VdpauQueueSurface(decoder, surface, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -9942,6 +9939,19 @@ void VideoSetDevice(const char *device)
|
|||||||
VideoDevice = device;
|
VideoDevice = device;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Get video driver name.
|
||||||
|
///
|
||||||
|
/// @returns name of current video driver.
|
||||||
|
///
|
||||||
|
const char *VideoGetDriverName(void)
|
||||||
|
{
|
||||||
|
if (VideoUsedModule) {
|
||||||
|
return VideoUsedModule->Name;
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Set video geometry.
|
/// Set video geometry.
|
||||||
///
|
///
|
||||||
|
3
video.h
3
video.h
@ -82,6 +82,9 @@ extern void VideoDisplayWakeup(void);
|
|||||||
/// Set video device.
|
/// Set video device.
|
||||||
extern void VideoSetDevice(const char *);
|
extern void VideoSetDevice(const char *);
|
||||||
|
|
||||||
|
/// Get video driver name.
|
||||||
|
extern const char *VideoGetDriverName(void);
|
||||||
|
|
||||||
/// Set video geometry.
|
/// Set video geometry.
|
||||||
extern int VideoSetGeometry(const char *);
|
extern int VideoSetGeometry(const char *);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user