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 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.

16
codec.c
View File

@ -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");

View File

@ -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
View File

@ -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.
/// ///

View File

@ -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 *);