mirror of
https://projects.vdr-developer.org/git/vdr-plugin-softhddevice.git
synced 2023-10-10 19:16:51 +02:00
Generalize GetVaapiContext to GetHwAccelContext.
This commit is contained in:
parent
8ff65a011a
commit
d8e96c7871
@ -1,6 +1,7 @@
|
||||
User johns
|
||||
Date:
|
||||
|
||||
Generalize GetVaapiContext to GetHwAccelContext.
|
||||
Add compile time configurable trickspeed packets dump.
|
||||
Fix bug #1410: wrong spelled AC-3 and E-AC-3.
|
||||
Add compile time selectable h264 trickspeed workaround.
|
||||
|
2
codec.c
2
codec.c
@ -483,7 +483,7 @@ void CodecVideoOpen(VideoDecoder * decoder, const char *name, int codec_id)
|
||||
} else {
|
||||
decoder->VideoCtx->get_format = Codec_get_format;
|
||||
decoder->VideoCtx->hwaccel_context =
|
||||
VideoGetVaapiContext(decoder->HwDecoder);
|
||||
VideoGetHwAccelContext(decoder->HwDecoder);
|
||||
}
|
||||
|
||||
// our pixel format video hardware decoder hook
|
||||
|
@ -7,7 +7,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: VDR \n"
|
||||
"Report-Msgid-Bugs-To: <see README>\n"
|
||||
"POT-Creation-Date: 2013-07-25 13:22+0200\n"
|
||||
"POT-Creation-Date: 2013-08-03 17:21+0200\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
@ -1272,6 +1272,9 @@ msgstr ""
|
||||
msgid "video/vdpau: can't put video surface bits: %s\n"
|
||||
msgstr ""
|
||||
|
||||
msgid "video: get hwaccel context, not supported\n"
|
||||
msgstr ""
|
||||
|
||||
#, c-format
|
||||
msgid "video/vdpau: can't render bitmap surface: %s\n"
|
||||
msgstr ""
|
||||
@ -1338,9 +1341,6 @@ msgstr ""
|
||||
msgid "video: repeated pict %d found, but not handled\n"
|
||||
msgstr ""
|
||||
|
||||
msgid "video/vaapi: get vaapi context, without vaapi enabled\n"
|
||||
msgstr ""
|
||||
|
||||
#, c-format
|
||||
msgid "video/vdpau: decoder rendering failed: %s\n"
|
||||
msgstr ""
|
||||
|
@ -22,7 +22,7 @@
|
||||
|
||||
#define noUSE_SOFTLIMIT ///< add soft buffer limits to Play..
|
||||
#define noUSE_PIP ///< include PIP support + new API
|
||||
#define DUMP_TRICKSPEED ///< dump raw trickspeed packets
|
||||
#define noDUMP_TRICKSPEED ///< dump raw trickspeed packets
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
@ -2448,7 +2448,8 @@ uint8_t *GrabImage(int *size, int jpeg, int quality, int width, int height)
|
||||
int SetPlayMode(int play_mode)
|
||||
{
|
||||
VideoDisplayWakeup();
|
||||
if (MyVideoStream->Decoder) { // tell video parser we have new stream
|
||||
// tell video parser we have new stream
|
||||
if (MyVideoStream->Decoder && !MyVideoStream->SkipStream) {
|
||||
if (MyVideoStream->ClearClose) { // replay clear buffers on close
|
||||
Clear(); // flush all buffers
|
||||
MyVideoStream->ClearClose = 0;
|
||||
|
51
video.c
51
video.c
@ -260,6 +260,7 @@ typedef struct _video_module_
|
||||
const enum PixelFormat *);
|
||||
void (*const RenderFrame) (VideoHwDecoder *, const AVCodecContext *,
|
||||
const AVFrame *);
|
||||
void *(*const GetHwAccelContext)(VideoHwDecoder *);
|
||||
void (*const SetClock) (VideoHwDecoder *, int64_t);
|
||||
int64_t(*const GetClock) (const VideoHwDecoder *);
|
||||
void (*const SetTrickSpeed) (const VideoHwDecoder *, int);
|
||||
@ -4575,6 +4576,16 @@ static void VaapiRenderFrame(VaapiDecoder * decoder,
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
/// Get hwaccel context for ffmpeg.
|
||||
///
|
||||
/// @param decoder VA-API hw decoder
|
||||
///
|
||||
static void *VaapiGetHwAccelContext(VaapiDecoder * decoder)
|
||||
{
|
||||
return decoder->Vaapi.VaapiContext;
|
||||
}
|
||||
|
||||
///
|
||||
/// Advance displayed frame of decoder.
|
||||
///
|
||||
@ -5363,6 +5374,8 @@ static const VideoModule VaapiModule = {
|
||||
AVCodecContext *, const enum PixelFormat *))Vaapi_get_format,
|
||||
.RenderFrame = (void (*const) (VideoHwDecoder *,
|
||||
const AVCodecContext *, const AVFrame *))VaapiSyncRenderFrame,
|
||||
.GetHwAccelContext = (void *(*const)(VideoHwDecoder *))
|
||||
VaapiGetHwAccelContext,
|
||||
.SetClock = (void (*const) (VideoHwDecoder *, int64_t))VaapiSetClock,
|
||||
.GetClock = (int64_t(*const) (const VideoHwDecoder *))VaapiGetClock,
|
||||
.SetTrickSpeed =
|
||||
@ -5399,6 +5412,8 @@ static const VideoModule VaapiGlxModule = {
|
||||
AVCodecContext *, const enum PixelFormat *))Vaapi_get_format,
|
||||
.RenderFrame = (void (*const) (VideoHwDecoder *,
|
||||
const AVCodecContext *, const AVFrame *))VaapiSyncRenderFrame,
|
||||
.GetHwAccelContext = (void *(*const)(VideoHwDecoder *))
|
||||
VaapiGetHwAccelContext,
|
||||
.SetClock = (void (*const) (VideoHwDecoder *, int64_t))VaapiSetClock,
|
||||
.GetClock = (int64_t(*const) (const VideoHwDecoder *))VaapiGetClock,
|
||||
.SetTrickSpeed =
|
||||
@ -7842,6 +7857,20 @@ static void VdpauRenderFrame(VdpauDecoder * decoder,
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
/// Get hwaccel context for ffmpeg.
|
||||
///
|
||||
/// @param decoder VDPAU hw decoder
|
||||
///
|
||||
static void *VdpauGetHwAccelContext(VdpauDecoder * decoder)
|
||||
{
|
||||
(void)decoder;
|
||||
|
||||
// FIXME: new ffmpeg versions supports struct AVVDPAUContext
|
||||
Error(_("video: get hwaccel context, not supported\n"));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
///
|
||||
/// Render osd surface to output surface.
|
||||
///
|
||||
@ -9064,6 +9093,8 @@ static const VideoModule VdpauModule = {
|
||||
AVCodecContext *, const enum PixelFormat *))Vdpau_get_format,
|
||||
.RenderFrame = (void (*const) (VideoHwDecoder *,
|
||||
const AVCodecContext *, const AVFrame *))VdpauSyncRenderFrame,
|
||||
.GetHwAccelContext = (void *(*const)(VideoHwDecoder *))
|
||||
VdpauGetHwAccelContext,
|
||||
.SetClock = (void (*const) (VideoHwDecoder *, int64_t))VdpauSetClock,
|
||||
.GetClock = (int64_t(*const) (const VideoHwDecoder *))VdpauGetClock,
|
||||
.SetTrickSpeed =
|
||||
@ -9219,6 +9250,8 @@ static const VideoModule NoopModule = {
|
||||
AVCodecContext *, const enum PixelFormat *))Noop_get_format,
|
||||
.RenderFrame = (void (*const) (VideoHwDecoder *,
|
||||
const AVCodecContext *, const AVFrame *))NoopSyncRenderFrame,
|
||||
.GetHwAccelContext = (void *(*const)(VideoHwDecoder *))
|
||||
DummyGetHwAccelContext,
|
||||
.SetClock = (void (*const) (VideoHwDecoder *, int64_t))NoopSetClock,
|
||||
.GetClock = (int64_t(*const) (const VideoHwDecoder *))NoopGetClock,
|
||||
.SetTrickSpeed =
|
||||
@ -9817,27 +9850,15 @@ void VideoRenderFrame(VideoHwDecoder * hw_decoder,
|
||||
}
|
||||
|
||||
///
|
||||
/// Get VA-API ffmpeg context
|
||||
/// Get hwaccel context for ffmpeg.
|
||||
///
|
||||
/// FIXME: new ffmpeg supports vdpau hw context
|
||||
///
|
||||
/// @param hw_decoder video hardware decoder (must be VA-API)
|
||||
///
|
||||
struct vaapi_context *VideoGetVaapiContext(VideoHwDecoder * hw_decoder)
|
||||
void *VideoGetHwAccelContext(VideoHwDecoder * hw_decoder)
|
||||
{
|
||||
#ifdef USE_VAAPI
|
||||
if (VideoUsedModule == &VaapiModule) {
|
||||
return hw_decoder->Vaapi.VaapiContext;
|
||||
}
|
||||
#ifdef USE_GLX
|
||||
if (VideoUsedModule == &VaapiGlxModule) {
|
||||
return hw_decoder->Vaapi.VaapiContext;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
(void)hw_decoder;
|
||||
Error(_("video/vaapi: get vaapi context, without vaapi enabled\n"));
|
||||
return NULL;
|
||||
return VideoUsedModule->GetHwAccelContext(hw_decoder);
|
||||
}
|
||||
|
||||
#ifdef USE_VDPAU
|
||||
|
4
video.h
4
video.h
@ -67,8 +67,8 @@ extern enum PixelFormat Video_get_format(VideoHwDecoder *, AVCodecContext *,
|
||||
extern void VideoRenderFrame(VideoHwDecoder *, const AVCodecContext *,
|
||||
const AVFrame *);
|
||||
|
||||
/// Get ffmpeg vaapi context.
|
||||
extern struct vaapi_context *VideoGetVaapiContext(VideoHwDecoder *);
|
||||
/// Get hwaccel context for ffmpeg.
|
||||
extern void *VideoGetHwAccelContext(VideoHwDecoder *);
|
||||
|
||||
#ifdef AVCODEC_VDPAU_H
|
||||
/// Draw vdpau render state.
|
||||
|
Loading…
Reference in New Issue
Block a user