Fix bug: Can't use software decoder with VDPAU.

This commit is contained in:
Johns 2012-08-13 16:57:36 +02:00
parent ecb48a5d63
commit c07ec82e6d
5 changed files with 33 additions and 36 deletions

View File

@ -1,6 +1,7 @@
User johns
Date:
Fix bug: Can't use software decoder with VDPAU.
Resume plugin, if suspend control stops.
Removes old audio code (!USE_AUDIORING).
Use -DOSD_DEBUG to debug OSD.

16
codec.c
View File

@ -363,22 +363,6 @@ void CodecVideoOpen(VideoDecoder * decoder, const char *name, int codec_id)
if (decoder->VideoCtx) {
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))) {
Debug(3, "codec: vdpau decoder found\n");

View File

@ -59,9 +59,9 @@ static int H264Dump(const uint8_t * data, int size);
//////////////////////////////////////////////////////////////////////////////
#ifdef USE_VDPAU
static char ConfigVdpauDecoder = 1; ///< use vdpau decoder, if possible
static char VdpauDecoder = 1; ///< vdpau decoder used
#else
#define ConfigVdpauDecoder 0 ///< no vdpau decoder configured
#define VdpauDecoder 0 ///< no vdpau decoder configured
#endif
extern int ConfigAudioBufferTime; ///< config size ms of audio buffer
@ -1533,17 +1533,16 @@ int VideoDecodeInput(void)
case CODEC_ID_MPEG2VIDEO:
if (last_codec_id != CODEC_ID_MPEG2VIDEO) {
last_codec_id = CODEC_ID_MPEG2VIDEO;
CodecVideoOpen(MyVideoDecoder,
ConfigVdpauDecoder ? "mpegvideo_vdpau" : NULL,
CodecVideoOpen(MyVideoDecoder, VideoHardwareDecoder < 0
&& VdpauDecoder ? "mpeg_vdpau" : NULL,
CODEC_ID_MPEG2VIDEO);
}
break;
case CODEC_ID_H264:
if (last_codec_id != CODEC_ID_H264) {
last_codec_id = CODEC_ID_H264;
CodecVideoOpen(MyVideoDecoder,
ConfigVdpauDecoder ? "h264video_vdpau" : NULL,
CODEC_ID_H264);
CodecVideoOpen(MyVideoDecoder, VideoHardwareDecoder
&& VdpauDecoder ? "h264_vdpau" : NULL, CODEC_ID_H264);
}
break;
default:
@ -1587,6 +1586,10 @@ int VideoGetBuffers(void)
static void StartVideo(void)
{
VideoInit(X11DisplayName);
#ifdef USE_VDPAU
VdpauDecoder = !strcasecmp(VideoGetDriverName(), "vdpau");
#endif
if (ConfigFullscreen) {
// FIXME: not good looking, mapped and then resized.
VideoSetFullscreen(1);
@ -2347,10 +2350,6 @@ int ProcessArgs(int argc, char *const argv[])
continue;
case 'v': // video driver
VideoSetDevice(optarg);
#ifdef USE_VDPAU
// FIXME: this is a big hack
ConfigVdpauDecoder = !strcasecmp(optarg, "vdpau");
#endif
continue;
case 'x': // x11 server
ConfigStartX11Server = 1;

26
video.c
View File

@ -5345,7 +5345,7 @@ static void VdpauCreateSurfaces(VdpauDecoder * decoder, int width, int height)
#ifdef DEBUG
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;
}
#endif
@ -7381,14 +7381,8 @@ static void VdpauRenderFrame(VdpauDecoder * decoder,
decoder->InputWidth = video_ctx->width;
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);
decoder->SurfacesNeeded = VIDEO_SURFACES_MAX + 2;
VdpauSetupOutput(decoder);
}
//
@ -7402,6 +7396,7 @@ static void VdpauRenderFrame(VdpauDecoder * decoder,
default:
Fatal(_("video/vdpau: pixel format %d not supported\n"),
video_ctx->pix_fmt);
// FIXME: no fatals!
}
// convert ffmpeg order to vdpau
@ -7421,6 +7416,8 @@ static void VdpauRenderFrame(VdpauDecoder * decoder,
VdpauGetErrorString(status));
}
Debug(4, "video/vdpau: sw render hw surface %#08x\n", surface);
VdpauQueueSurface(decoder, surface, 1);
}
@ -9942,6 +9939,19 @@ void VideoSetDevice(const char *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.
///

View File

@ -82,6 +82,9 @@ extern void VideoDisplayWakeup(void);
/// Set video device.
extern void VideoSetDevice(const char *);
/// Get video driver name.
extern const char *VideoGetDriverName(void);
/// Set video geometry.
extern int VideoSetGeometry(const char *);