2018-08-19 11:45:46 +02:00
|
|
|
///
|
2019-10-26 18:42:19 +02:00
|
|
|
/// @file video.h @brief Video module header file
|
2018-08-19 11:45:46 +02:00
|
|
|
///
|
2021-12-27 20:02:45 +01:00
|
|
|
/// Copyright (c) 2009 - 2015 by Johns. All Rights Reserved.
|
2018-08-19 11:45:46 +02:00
|
|
|
///
|
2019-10-26 18:42:19 +02:00
|
|
|
/// Contributor(s):
|
2018-08-19 11:45:46 +02:00
|
|
|
///
|
2019-10-26 18:42:19 +02:00
|
|
|
/// License: AGPLv3
|
2018-08-19 11:45:46 +02:00
|
|
|
///
|
2019-10-26 18:42:19 +02:00
|
|
|
/// This program is free software: you can redistribute it and/or modify
|
|
|
|
/// it under the terms of the GNU Affero General Public License as
|
|
|
|
/// published by the Free Software Foundation, either version 3 of the
|
|
|
|
/// License.
|
2018-08-19 11:45:46 +02:00
|
|
|
///
|
2019-10-26 18:42:19 +02:00
|
|
|
/// This program is distributed in the hope that it will be useful,
|
|
|
|
/// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
/// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
/// GNU Affero General Public License for more details.
|
2018-08-19 11:45:46 +02:00
|
|
|
///
|
2019-10-26 18:42:19 +02:00
|
|
|
/// $Id: 83cd827a8744e8c80c8adba6cb87653b0ad58c45 $
|
2018-08-19 11:45:46 +02:00
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
/// @addtogroup Video
|
|
|
|
/// @{
|
|
|
|
|
2018-09-05 20:39:12 +02:00
|
|
|
#include <GL/gl.h>
|
|
|
|
#include <GL/glx.h>
|
|
|
|
|
2018-08-19 11:45:46 +02:00
|
|
|
//----------------------------------------------------------------------------
|
2019-10-26 18:42:19 +02:00
|
|
|
// Typedefs
|
2018-08-19 11:45:46 +02:00
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
2019-10-28 21:43:37 +01:00
|
|
|
/// Video hardware decoder typedef
|
2018-08-19 11:45:46 +02:00
|
|
|
typedef struct _video_hw_decoder_ VideoHwDecoder;
|
|
|
|
|
2019-10-28 21:43:37 +01:00
|
|
|
/// Video output stream typedef
|
2018-08-19 11:45:46 +02:00
|
|
|
typedef struct __video_stream__ VideoStream;
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
2019-10-26 18:42:19 +02:00
|
|
|
// Variables
|
2018-08-19 11:45:46 +02:00
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
2021-12-27 20:02:45 +01:00
|
|
|
extern signed char VideoHardwareDecoder; ///< flag use hardware decoder
|
|
|
|
extern char VideoIgnoreRepeatPict; ///< disable repeat pict warning
|
|
|
|
extern int VideoAudioDelay; ///< audio/video delay
|
|
|
|
extern char ConfigStartX11Server; ///< flag start the x11 server
|
2020-06-16 08:49:03 +02:00
|
|
|
extern char MyConfigDir[];
|
2021-12-27 20:02:45 +01:00
|
|
|
|
2018-08-19 11:45:46 +02:00
|
|
|
//----------------------------------------------------------------------------
|
2019-10-26 18:42:19 +02:00
|
|
|
// Prototypes
|
2018-08-19 11:45:46 +02:00
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
2019-10-28 21:43:37 +01:00
|
|
|
/// Allocate new video hardware decoder.
|
2018-08-19 11:45:46 +02:00
|
|
|
extern VideoHwDecoder *VideoNewHwDecoder(VideoStream *);
|
|
|
|
|
2019-10-28 21:43:37 +01:00
|
|
|
/// Deallocate video hardware decoder.
|
2018-08-19 11:45:46 +02:00
|
|
|
extern void VideoDelHwDecoder(VideoHwDecoder *);
|
|
|
|
|
2019-10-28 21:43:37 +01:00
|
|
|
/// Get and allocate a video hardware surface.
|
2018-08-19 11:45:46 +02:00
|
|
|
extern unsigned VideoGetSurface(VideoHwDecoder *, const AVCodecContext *);
|
|
|
|
|
2019-10-28 21:43:37 +01:00
|
|
|
/// Release a video hardware surface
|
2018-08-19 11:45:46 +02:00
|
|
|
extern void VideoReleaseSurface(VideoHwDecoder *, unsigned);
|
|
|
|
|
2019-10-28 21:43:37 +01:00
|
|
|
/// Callback to negotiate the PixelFormat.
|
2019-10-26 18:42:19 +02:00
|
|
|
extern enum AVPixelFormat Video_get_format(VideoHwDecoder *, AVCodecContext *, const enum AVPixelFormat *);
|
2018-08-19 11:45:46 +02:00
|
|
|
|
2019-10-28 21:43:37 +01:00
|
|
|
/// Render a ffmpeg frame.
|
2019-10-26 18:42:19 +02:00
|
|
|
extern void VideoRenderFrame(VideoHwDecoder *, const AVCodecContext *, const AVFrame *);
|
2018-08-19 11:45:46 +02:00
|
|
|
|
2019-10-28 21:43:37 +01:00
|
|
|
/// Get hwaccel context for ffmpeg.
|
2018-08-19 11:45:46 +02:00
|
|
|
extern void *VideoGetHwAccelContext(VideoHwDecoder *);
|
|
|
|
|
|
|
|
#ifdef AVCODEC_VDPAU_H
|
2019-10-28 21:43:37 +01:00
|
|
|
/// Draw vdpau render state.
|
2019-10-26 18:42:19 +02:00
|
|
|
extern void VideoDrawRenderState(VideoHwDecoder *, struct vdpau_render_state *);
|
2018-08-19 11:45:46 +02:00
|
|
|
#endif
|
2018-09-05 20:39:12 +02:00
|
|
|
|
|
|
|
#ifdef USE_OPENGLOSD
|
2019-10-28 21:43:37 +01:00
|
|
|
/// Set callback funktion to notify VDR about VideoEvents
|
2018-09-05 20:39:12 +02:00
|
|
|
extern void VideoSetVideoEventCallback(void (*)(void));
|
2018-08-19 11:45:46 +02:00
|
|
|
#endif
|
|
|
|
|
2019-10-28 21:43:37 +01:00
|
|
|
/// Poll video events.
|
2018-08-19 11:45:46 +02:00
|
|
|
extern void VideoPollEvent(void);
|
|
|
|
|
2019-10-28 21:43:37 +01:00
|
|
|
/// Wakeup display handler.
|
2018-08-19 11:45:46 +02:00
|
|
|
extern void VideoDisplayWakeup(void);
|
|
|
|
|
2019-10-28 21:43:37 +01:00
|
|
|
/// Set video device.
|
2018-08-19 11:45:46 +02:00
|
|
|
extern void VideoSetDevice(const char *);
|
|
|
|
|
2019-10-28 21:43:37 +01:00
|
|
|
/// Get video driver name.
|
2018-08-19 11:45:46 +02:00
|
|
|
extern const char *VideoGetDriverName(void);
|
|
|
|
|
2019-10-28 21:43:37 +01:00
|
|
|
/// Set video geometry.
|
2018-08-19 11:45:46 +02:00
|
|
|
extern int VideoSetGeometry(const char *);
|
|
|
|
|
2019-10-28 21:43:37 +01:00
|
|
|
/// Set 60Hz display mode.
|
2018-08-19 11:45:46 +02:00
|
|
|
extern void VideoSet60HzMode(int);
|
|
|
|
|
2019-10-28 21:43:37 +01:00
|
|
|
/// Set soft start audio/video sync.
|
2018-08-19 11:45:46 +02:00
|
|
|
extern void VideoSetSoftStartSync(int);
|
|
|
|
|
2019-10-28 21:43:37 +01:00
|
|
|
/// Set show black picture during channel switch.
|
2018-08-19 11:45:46 +02:00
|
|
|
extern void VideoSetBlackPicture(int);
|
|
|
|
|
2019-10-28 21:43:37 +01:00
|
|
|
/// Set brightness adjustment.
|
2018-08-19 11:45:46 +02:00
|
|
|
extern void VideoSetBrightness(int);
|
|
|
|
|
2019-10-28 21:43:37 +01:00
|
|
|
/// Set contrast adjustment.
|
2018-08-19 11:45:46 +02:00
|
|
|
extern void VideoSetContrast(int);
|
|
|
|
|
2019-10-28 21:43:37 +01:00
|
|
|
/// Set saturation adjustment.
|
2018-08-19 11:45:46 +02:00
|
|
|
extern void VideoSetSaturation(int);
|
|
|
|
|
2019-10-28 21:43:37 +01:00
|
|
|
/// Set Gamma.
|
2018-11-17 16:32:55 +01:00
|
|
|
extern void VideoSetGamma(int);
|
|
|
|
|
2021-04-16 13:50:45 +02:00
|
|
|
/// Set Color Temp.
|
|
|
|
extern void VideoSetTemperature(int);
|
|
|
|
|
2019-10-28 21:43:37 +01:00
|
|
|
/// Set ColorSpace.
|
2018-11-17 16:32:55 +01:00
|
|
|
extern void VideoSetTargetColor(int);
|
|
|
|
|
2019-10-28 21:43:37 +01:00
|
|
|
/// Set hue adjustment.
|
2018-08-19 11:45:46 +02:00
|
|
|
extern void VideoSetHue(int);
|
|
|
|
|
2019-10-28 21:43:37 +01:00
|
|
|
/// Set Color Blindness.
|
2018-12-07 13:07:50 +01:00
|
|
|
extern void VideoSetColorBlindness(int);
|
|
|
|
|
2019-10-28 21:43:37 +01:00
|
|
|
/// Set Color Blindness Faktor
|
2018-12-07 13:07:50 +01:00
|
|
|
extern void VideoSetColorBlindnessFaktor(int);
|
|
|
|
|
2019-10-28 21:43:37 +01:00
|
|
|
/// Set video output position.
|
2018-08-19 11:45:46 +02:00
|
|
|
extern void VideoSetOutputPosition(VideoHwDecoder *, int, int, int, int);
|
|
|
|
|
2019-10-28 21:43:37 +01:00
|
|
|
/// Set video mode.
|
2018-08-19 11:45:46 +02:00
|
|
|
extern void VideoSetVideoMode(int, int, int, int);
|
|
|
|
|
2019-10-28 21:43:37 +01:00
|
|
|
/// Set 4:3 display format.
|
2018-08-19 11:45:46 +02:00
|
|
|
extern void VideoSet4to3DisplayFormat(int);
|
|
|
|
|
2019-10-28 21:43:37 +01:00
|
|
|
/// Set other display format.
|
2018-08-19 11:45:46 +02:00
|
|
|
extern void VideoSetOtherDisplayFormat(int);
|
|
|
|
|
2019-10-28 21:43:37 +01:00
|
|
|
/// Set video fullscreen mode.
|
2018-08-19 11:45:46 +02:00
|
|
|
extern void VideoSetFullscreen(int);
|
|
|
|
|
2019-10-28 21:43:37 +01:00
|
|
|
/// Set deinterlace.
|
2018-08-19 11:45:46 +02:00
|
|
|
extern void VideoSetDeinterlace(int[]);
|
|
|
|
|
2019-10-28 21:43:37 +01:00
|
|
|
/// Set skip chroma deinterlace.
|
2018-08-19 11:45:46 +02:00
|
|
|
extern void VideoSetSkipChromaDeinterlace(int[]);
|
|
|
|
|
2019-10-28 21:43:37 +01:00
|
|
|
/// Set inverse telecine.
|
2018-08-19 11:45:46 +02:00
|
|
|
extern void VideoSetInverseTelecine(int[]);
|
|
|
|
|
2019-10-28 21:43:37 +01:00
|
|
|
/// Set scaling.
|
2018-08-19 11:45:46 +02:00
|
|
|
extern void VideoSetScaling(int[]);
|
|
|
|
|
2019-10-28 21:43:37 +01:00
|
|
|
/// Set scaler test.
|
2018-12-07 13:07:50 +01:00
|
|
|
extern void VideoSetScalerTest(int);
|
|
|
|
|
2019-10-28 21:43:37 +01:00
|
|
|
/// Set denoise.
|
2018-08-19 11:45:46 +02:00
|
|
|
extern void VideoSetDenoise(int[]);
|
|
|
|
|
2019-10-28 21:43:37 +01:00
|
|
|
/// Set sharpen.
|
2018-08-19 11:45:46 +02:00
|
|
|
extern void VideoSetSharpen(int[]);
|
|
|
|
|
2019-10-28 21:43:37 +01:00
|
|
|
/// Set cut top and bottom.
|
2018-08-19 11:45:46 +02:00
|
|
|
extern void VideoSetCutTopBottom(int[]);
|
|
|
|
|
2019-10-28 21:43:37 +01:00
|
|
|
/// Set cut left and right.
|
2018-08-19 11:45:46 +02:00
|
|
|
extern void VideoSetCutLeftRight(int[]);
|
|
|
|
|
2019-10-28 21:43:37 +01:00
|
|
|
/// Set studio levels.
|
2018-08-19 11:45:46 +02:00
|
|
|
extern void VideoSetStudioLevels(int);
|
|
|
|
|
2019-10-28 21:43:37 +01:00
|
|
|
/// Set background.
|
2018-08-19 11:45:46 +02:00
|
|
|
extern void VideoSetBackground(uint32_t);
|
|
|
|
|
2019-10-28 21:43:37 +01:00
|
|
|
/// Set audio delay.
|
2018-08-19 11:45:46 +02:00
|
|
|
extern void VideoSetAudioDelay(int);
|
|
|
|
|
2019-10-28 21:43:37 +01:00
|
|
|
/// Clear OSD.
|
2018-08-19 11:45:46 +02:00
|
|
|
extern void VideoOsdClear(void);
|
|
|
|
|
2019-10-28 21:43:37 +01:00
|
|
|
/// Draw an OSD ARGB image.
|
2019-10-26 18:42:19 +02:00
|
|
|
extern void VideoOsdDrawARGB(int, int, int, int, int, const uint8_t *, int, int);
|
2018-08-19 11:45:46 +02:00
|
|
|
|
2019-10-28 21:43:37 +01:00
|
|
|
/// Get OSD size.
|
2018-08-19 11:45:46 +02:00
|
|
|
extern void VideoGetOsdSize(int *, int *);
|
|
|
|
|
2019-10-28 21:43:37 +01:00
|
|
|
/// Set OSD size.
|
2018-08-19 11:45:46 +02:00
|
|
|
extern void VideoSetOsdSize(int, int);
|
|
|
|
|
2019-10-28 21:43:37 +01:00
|
|
|
/// Set Osd 3D Mode
|
2018-08-19 11:45:46 +02:00
|
|
|
extern void VideoSetOsd3DMode(int);
|
|
|
|
|
2019-10-28 21:43:37 +01:00
|
|
|
/// Set video clock.
|
2018-08-19 11:45:46 +02:00
|
|
|
extern void VideoSetClock(VideoHwDecoder *, int64_t);
|
|
|
|
|
2019-10-28 21:43:37 +01:00
|
|
|
/// Get video clock.
|
2018-08-19 11:45:46 +02:00
|
|
|
extern int64_t VideoGetClock(const VideoHwDecoder *);
|
|
|
|
|
2019-10-28 21:43:37 +01:00
|
|
|
/// Set closing flag.
|
2018-08-19 11:45:46 +02:00
|
|
|
extern void VideoSetClosing(VideoHwDecoder *);
|
|
|
|
|
2019-10-28 21:43:37 +01:00
|
|
|
/// Reset start of frame counter
|
2018-08-19 11:45:46 +02:00
|
|
|
extern void VideoResetStart(VideoHwDecoder *);
|
|
|
|
|
2019-10-28 21:43:37 +01:00
|
|
|
/// Set trick play speed.
|
2018-08-19 11:45:46 +02:00
|
|
|
extern void VideoSetTrickSpeed(VideoHwDecoder *, int);
|
|
|
|
|
2019-10-28 21:43:37 +01:00
|
|
|
/// Grab screen.
|
2018-08-19 11:45:46 +02:00
|
|
|
extern uint8_t *VideoGrab(int *, int *, int *, int);
|
|
|
|
|
2019-10-28 21:43:37 +01:00
|
|
|
/// Grab screen raw.
|
2018-08-19 11:45:46 +02:00
|
|
|
extern uint8_t *VideoGrabService(int *, int *, int *);
|
|
|
|
|
2019-10-28 21:43:37 +01:00
|
|
|
/// Get decoder statistics.
|
2020-02-02 13:26:51 +01:00
|
|
|
extern void VideoGetStats(VideoHwDecoder *, int *, int *, int *, int *, float *, int *, int *, int *, int *);
|
2018-08-19 11:45:46 +02:00
|
|
|
|
2019-10-28 21:43:37 +01:00
|
|
|
/// Get video stream size
|
2018-08-19 11:45:46 +02:00
|
|
|
extern void VideoGetVideoSize(VideoHwDecoder *, int *, int *, int *, int *);
|
|
|
|
|
2021-12-27 20:02:45 +01:00
|
|
|
extern void VideoOsdInit(void); ///< Setup osd.
|
|
|
|
extern void VideoOsdExit(void); ///< Cleanup osd.
|
2018-08-19 11:45:46 +02:00
|
|
|
|
2021-12-27 20:02:45 +01:00
|
|
|
extern void VideoInit(const char *); ///< Setup video module.
|
|
|
|
extern void VideoExit(void); ///< Cleanup and exit video module.
|
2018-08-19 11:45:46 +02:00
|
|
|
|
2019-10-28 21:43:37 +01:00
|
|
|
/// Poll video input buffers.
|
2018-08-19 11:45:46 +02:00
|
|
|
extern int VideoPollInput(VideoStream *);
|
|
|
|
|
2019-10-28 21:43:37 +01:00
|
|
|
/// Decode video input buffers.
|
2020-06-09 09:23:38 +02:00
|
|
|
extern int VideoDecodeInput(VideoStream *, int);
|
2018-08-19 11:45:46 +02:00
|
|
|
|
2019-10-28 21:43:37 +01:00
|
|
|
/// Get number of input buffers.
|
2018-08-19 11:45:46 +02:00
|
|
|
extern int VideoGetBuffers(const VideoStream *);
|
|
|
|
|
2019-10-28 21:43:37 +01:00
|
|
|
/// Set DPMS at Blackscreen switch
|
2018-08-19 11:45:46 +02:00
|
|
|
extern void SetDPMSatBlackScreen(int);
|
|
|
|
|
2019-10-28 21:43:37 +01:00
|
|
|
/// Raise the frontend window
|
2018-08-19 11:45:46 +02:00
|
|
|
extern int VideoRaiseWindow(void);
|
2019-10-26 18:42:19 +02:00
|
|
|
|
2020-06-07 12:31:18 +02:00
|
|
|
/// Set Shaders
|
|
|
|
extern int VideoSetShader(char *);
|
|
|
|
|
2018-09-05 20:39:12 +02:00
|
|
|
#ifdef USE_OPENGLOSD
|
2019-10-26 18:42:19 +02:00
|
|
|
extern void ActivateOsd(GLuint, int, int, int, int);
|
2018-09-05 20:39:12 +02:00
|
|
|
#endif
|
2020-02-26 16:52:48 +01:00
|
|
|
|
|
|
|
#ifdef GAMMA
|
|
|
|
extern void Init_Gamma();
|
|
|
|
extern void Exit_Gamma();
|
|
|
|
extern void Set_Gamma(float, int);
|
|
|
|
extern void Get_Gamma();
|
|
|
|
#endif
|
|
|
|
|
2018-08-19 11:45:46 +02:00
|
|
|
#if 0
|
|
|
|
long int gettid()
|
|
|
|
{
|
2019-10-26 18:42:19 +02:00
|
|
|
return (long int)syscall(224);
|
2018-08-19 11:45:46 +02:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/// @}
|