mirror of
https://github.com/jojo61/vdr-plugin-softhdcuvid.git
synced 2023-10-10 13:37:41 +02:00
Fix indentation.
This commit is contained in:
parent
695a6495dd
commit
1a56d620ac
184
codec.c
184
codec.c
@ -129,13 +129,13 @@ struct _video_decoder_
|
|||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Callback to negotiate the PixelFormat.
|
** Callback to negotiate the PixelFormat.
|
||||||
**
|
**
|
||||||
** @param video_ctx codec context
|
** @param video_ctx codec context
|
||||||
** @param fmt is the list of formats which are supported by
|
** @param fmt is the list of formats which are supported by
|
||||||
** the codec, it is terminated by -1 as 0 is a
|
** the codec, it is terminated by -1 as 0 is a
|
||||||
** valid format, the formats are ordered by
|
** valid format, the formats are ordered by
|
||||||
** quality.
|
** quality.
|
||||||
*/
|
*/
|
||||||
static enum AVPixelFormat Codec_get_format(AVCodecContext * video_ctx, const enum AVPixelFormat *fmt)
|
static enum AVPixelFormat Codec_get_format(AVCodecContext * video_ctx, const enum AVPixelFormat *fmt)
|
||||||
{
|
{
|
||||||
@ -157,12 +157,12 @@ static enum AVPixelFormat Codec_get_format(AVCodecContext * video_ctx, const enu
|
|||||||
// static void Codec_free_buffer(void *opaque, uint8_t *data);
|
// static void Codec_free_buffer(void *opaque, uint8_t *data);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Video buffer management, get buffer for frame.
|
** Video buffer management, get buffer for frame.
|
||||||
**
|
**
|
||||||
** Called at the beginning of each frame to get a buffer for it.
|
** Called at the beginning of each frame to get a buffer for it.
|
||||||
**
|
**
|
||||||
** @param video_ctx Codec context
|
** @param video_ctx Codec context
|
||||||
** @param frame Get buffer for this frame
|
** @param frame Get buffer for this frame
|
||||||
*/
|
*/
|
||||||
static int Codec_get_buffer2(AVCodecContext * video_ctx, AVFrame * frame, int flags)
|
static int Codec_get_buffer2(AVCodecContext * video_ctx, AVFrame * frame, int flags)
|
||||||
{
|
{
|
||||||
@ -195,11 +195,11 @@ static int Codec_get_buffer2(AVCodecContext * video_ctx, AVFrame * frame, int fl
|
|||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Allocate a new video decoder context.
|
** Allocate a new video decoder context.
|
||||||
**
|
**
|
||||||
** @param hw_decoder video hardware decoder
|
** @param hw_decoder video hardware decoder
|
||||||
**
|
**
|
||||||
** @returns private decoder pointer for video decoder.
|
** @returns private decoder pointer for video decoder.
|
||||||
*/
|
*/
|
||||||
VideoDecoder *CodecVideoNewDecoder(VideoHwDecoder * hw_decoder)
|
VideoDecoder *CodecVideoNewDecoder(VideoHwDecoder * hw_decoder)
|
||||||
{
|
{
|
||||||
@ -214,9 +214,9 @@ VideoDecoder *CodecVideoNewDecoder(VideoHwDecoder * hw_decoder)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Deallocate a video decoder context.
|
** Deallocate a video decoder context.
|
||||||
**
|
**
|
||||||
** @param decoder private video decoder
|
** @param decoder private video decoder
|
||||||
*/
|
*/
|
||||||
void CodecVideoDelDecoder(VideoDecoder * decoder)
|
void CodecVideoDelDecoder(VideoDecoder * decoder)
|
||||||
{
|
{
|
||||||
@ -224,10 +224,10 @@ void CodecVideoDelDecoder(VideoDecoder * decoder)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Open video decoder.
|
** Open video decoder.
|
||||||
**
|
**
|
||||||
** @param decoder private video decoder
|
** @param decoder private video decoder
|
||||||
** @param codec_id video codec id
|
** @param codec_id video codec id
|
||||||
*/
|
*/
|
||||||
void CodecVideoOpen(VideoDecoder * decoder, int codec_id)
|
void CodecVideoOpen(VideoDecoder * decoder, int codec_id)
|
||||||
{
|
{
|
||||||
@ -393,9 +393,9 @@ void CodecVideoOpen(VideoDecoder * decoder, int codec_id)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Close video decoder.
|
** Close video decoder.
|
||||||
**
|
**
|
||||||
** @param video_decoder private video decoder
|
** @param video_decoder private video decoder
|
||||||
*/
|
*/
|
||||||
void CodecVideoClose(VideoDecoder * video_decoder)
|
void CodecVideoClose(VideoDecoder * video_decoder)
|
||||||
{
|
{
|
||||||
@ -423,15 +423,15 @@ void CodecVideoClose(VideoDecoder * video_decoder)
|
|||||||
#if 0
|
#if 0
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Display pts...
|
** Display pts...
|
||||||
**
|
**
|
||||||
** ffmpeg-0.9 pts always AV_NOPTS_VALUE
|
** ffmpeg-0.9 pts always AV_NOPTS_VALUE
|
||||||
** ffmpeg-0.9 pkt_pts nice monotonic (only with HD)
|
** ffmpeg-0.9 pkt_pts nice monotonic (only with HD)
|
||||||
** ffmpeg-0.9 pkt_dts wild jumping -160 - 340 ms
|
** ffmpeg-0.9 pkt_dts wild jumping -160 - 340 ms
|
||||||
**
|
**
|
||||||
** libav 0.8_pre20111116 pts always AV_NOPTS_VALUE
|
** libav 0.8_pre20111116 pts always AV_NOPTS_VALUE
|
||||||
** libav 0.8_pre20111116 pkt_pts always 0 (could be fixed?)
|
** libav 0.8_pre20111116 pkt_pts always 0 (could be fixed?)
|
||||||
** libav 0.8_pre20111116 pkt_dts wild jumping -160 - 340 ms
|
** libav 0.8_pre20111116 pkt_dts wild jumping -160 - 340 ms
|
||||||
*/
|
*/
|
||||||
void DisplayPts(AVCodecContext * video_ctx, AVFrame * frame)
|
void DisplayPts(AVCodecContext * video_ctx, AVFrame * frame)
|
||||||
{
|
{
|
||||||
@ -445,7 +445,7 @@ void DisplayPts(AVCodecContext * video_ctx, AVFrame * frame)
|
|||||||
}
|
}
|
||||||
ms_delay = (1000 * video_ctx->time_base.num) / video_ctx->time_base.den;
|
ms_delay = (1000 * video_ctx->time_base.num) / video_ctx->time_base.den;
|
||||||
ms_delay += frame->repeat_pict * ms_delay / 2;
|
ms_delay += frame->repeat_pict * ms_delay / 2;
|
||||||
printf("codec: PTS %s%s %" PRId64 " %d %d/%d %d/%d %dms\n", frame->repeat_pict ? "r" : " ",
|
printf("codec: PTS %s%s %" PRId64 " %d %d/%d %d/%d %dms\n", frame->repeat_pict ? "r" : " ",
|
||||||
frame->interlaced_frame ? "I" : " ", pts, (int)(pts - last_pts) / 90, video_ctx->time_base.num,
|
frame->interlaced_frame ? "I" : " ", pts, (int)(pts - last_pts) / 90, video_ctx->time_base.num,
|
||||||
video_ctx->time_base.den, video_ctx->framerate.num, video_ctx->framerate.den, ms_delay);
|
video_ctx->time_base.den, video_ctx->framerate.num, video_ctx->framerate.den, ms_delay);
|
||||||
|
|
||||||
@ -457,10 +457,10 @@ void DisplayPts(AVCodecContext * video_ctx, AVFrame * frame)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Decode a video packet.
|
** Decode a video packet.
|
||||||
**
|
**
|
||||||
** @param decoder video decoder data
|
** @param decoder video decoder data
|
||||||
** @param avpkt video packet
|
** @param avpkt video packet
|
||||||
*/
|
*/
|
||||||
extern int CuvidTestSurfaces();
|
extern int CuvidTestSurfaces();
|
||||||
|
|
||||||
@ -599,9 +599,9 @@ void CodecVideoDecode(VideoDecoder * decoder, const AVPacket * avpkt)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Flush the video decoder.
|
** Flush the video decoder.
|
||||||
**
|
**
|
||||||
** @param decoder video decoder data
|
** @param decoder video decoder data
|
||||||
*/
|
*/
|
||||||
void CodecVideoFlushBuffers(VideoDecoder * decoder)
|
void CodecVideoFlushBuffers(VideoDecoder * decoder)
|
||||||
{
|
{
|
||||||
@ -686,8 +686,8 @@ enum IEC61937
|
|||||||
};
|
};
|
||||||
|
|
||||||
#ifdef USE_AUDIO_DRIFT_CORRECTION
|
#ifdef USE_AUDIO_DRIFT_CORRECTION
|
||||||
#define CORRECT_PCM 1 ///< do PCM audio-drift correction
|
#define CORRECT_PCM 1 ///< do PCM audio-drift correction
|
||||||
#define CORRECT_AC3 2 ///< do AC-3 audio-drift correction
|
#define CORRECT_AC3 2 ///< do AC-3 audio-drift correction
|
||||||
static char CodecAudioDrift; ///< flag: enable audio-drift correction
|
static char CodecAudioDrift; ///< flag: enable audio-drift correction
|
||||||
#else
|
#else
|
||||||
static const int CodecAudioDrift = 0;
|
static const int CodecAudioDrift = 0;
|
||||||
@ -703,9 +703,9 @@ static const int CodecPassthrough = 0;
|
|||||||
static char CodecDownmix; ///< enable AC-3 decoder downmix
|
static char CodecDownmix; ///< enable AC-3 decoder downmix
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Allocate a new audio decoder context.
|
** Allocate a new audio decoder context.
|
||||||
**
|
**
|
||||||
** @returns private decoder pointer for audio decoder.
|
** @returns private decoder pointer for audio decoder.
|
||||||
*/
|
*/
|
||||||
AudioDecoder *CodecAudioNewDecoder(void)
|
AudioDecoder *CodecAudioNewDecoder(void)
|
||||||
{
|
{
|
||||||
@ -722,9 +722,9 @@ AudioDecoder *CodecAudioNewDecoder(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Deallocate an audio decoder context.
|
** Deallocate an audio decoder context.
|
||||||
**
|
**
|
||||||
** @param decoder private audio decoder
|
** @param decoder private audio decoder
|
||||||
*/
|
*/
|
||||||
void CodecAudioDelDecoder(AudioDecoder * decoder)
|
void CodecAudioDelDecoder(AudioDecoder * decoder)
|
||||||
{
|
{
|
||||||
@ -733,10 +733,10 @@ void CodecAudioDelDecoder(AudioDecoder * decoder)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Open audio decoder.
|
** Open audio decoder.
|
||||||
**
|
**
|
||||||
** @param audio_decoder private audio decoder
|
** @param audio_decoder private audio decoder
|
||||||
** @param codec_id audio codec id
|
** @param codec_id audio codec id
|
||||||
*/
|
*/
|
||||||
void CodecAudioOpen(AudioDecoder * audio_decoder, int codec_id)
|
void CodecAudioOpen(AudioDecoder * audio_decoder, int codec_id)
|
||||||
{
|
{
|
||||||
@ -784,9 +784,9 @@ void CodecAudioOpen(AudioDecoder * audio_decoder, int codec_id)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Close audio decoder.
|
** Close audio decoder.
|
||||||
**
|
**
|
||||||
** @param audio_decoder private audio decoder
|
** @param audio_decoder private audio decoder
|
||||||
*/
|
*/
|
||||||
void CodecAudioClose(AudioDecoder * audio_decoder)
|
void CodecAudioClose(AudioDecoder * audio_decoder)
|
||||||
{
|
{
|
||||||
@ -831,9 +831,9 @@ void CodecAudioClose(AudioDecoder * audio_decoder)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Set audio drift correction.
|
** Set audio drift correction.
|
||||||
**
|
**
|
||||||
** @param mask enable mask (PCM, AC-3)
|
** @param mask enable mask (PCM, AC-3)
|
||||||
*/
|
*/
|
||||||
void CodecSetAudioDrift(int mask)
|
void CodecSetAudioDrift(int mask)
|
||||||
{
|
{
|
||||||
@ -844,9 +844,9 @@ void CodecSetAudioDrift(int mask)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Set audio pass-through.
|
** Set audio pass-through.
|
||||||
**
|
**
|
||||||
** @param mask enable mask (PCM, AC-3, E-AC-3)
|
** @param mask enable mask (PCM, AC-3, E-AC-3)
|
||||||
*/
|
*/
|
||||||
void CodecSetAudioPassthrough(int mask)
|
void CodecSetAudioPassthrough(int mask)
|
||||||
{
|
{
|
||||||
@ -857,9 +857,9 @@ void CodecSetAudioPassthrough(int mask)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Set audio downmix.
|
** Set audio downmix.
|
||||||
**
|
**
|
||||||
** @param onoff enable/disable downmix.
|
** @param onoff enable/disable downmix.
|
||||||
*/
|
*/
|
||||||
void CodecSetAudioDownmix(int onoff)
|
void CodecSetAudioDownmix(int onoff)
|
||||||
{
|
{
|
||||||
@ -871,15 +871,15 @@ void CodecSetAudioDownmix(int onoff)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Reorder audio frame.
|
** Reorder audio frame.
|
||||||
**
|
**
|
||||||
** ffmpeg L R C Ls Rs -> alsa L R Ls Rs C
|
** ffmpeg L R C Ls Rs -> alsa L R Ls Rs C
|
||||||
** ffmpeg L R C LFE Ls Rs -> alsa L R Ls Rs C LFE
|
** ffmpeg L R C LFE Ls Rs -> alsa L R Ls Rs C LFE
|
||||||
** ffmpeg L R C LFE Ls Rs Rl Rr -> alsa L R Ls Rs C LFE Rl Rr
|
** ffmpeg L R C LFE Ls Rs Rl Rr -> alsa L R Ls Rs C LFE Rl Rr
|
||||||
**
|
**
|
||||||
** @param buf[IN,OUT] sample buffer
|
** @param buf[IN,OUT] sample buffer
|
||||||
** @param size size of sample buffer in bytes
|
** @param size size of sample buffer in bytes
|
||||||
** @param channels number of channels interleaved in sample buffer
|
** @param channels number of channels interleaved in sample buffer
|
||||||
*/
|
*/
|
||||||
static void CodecReorderAudioFrame(int16_t * buf, int size, int channels)
|
static void CodecReorderAudioFrame(int16_t * buf, int size, int channels)
|
||||||
{
|
{
|
||||||
@ -931,10 +931,10 @@ static void CodecReorderAudioFrame(int16_t * buf, int size, int channels)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Handle audio format changes helper.
|
** Handle audio format changes helper.
|
||||||
**
|
**
|
||||||
** @param audio_decoder audio decoder data
|
** @param audio_decoder audio decoder data
|
||||||
** @param[out] passthrough pass-through output
|
** @param[out] passthrough pass-through output
|
||||||
*/
|
*/
|
||||||
static int CodecAudioUpdateHelper(AudioDecoder * audio_decoder, int *passthrough)
|
static int CodecAudioUpdateHelper(AudioDecoder * audio_decoder, int *passthrough)
|
||||||
{
|
{
|
||||||
@ -991,10 +991,10 @@ static int CodecAudioUpdateHelper(AudioDecoder * audio_decoder, int *passthrough
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Audio pass-through decoder helper.
|
** Audio pass-through decoder helper.
|
||||||
**
|
**
|
||||||
** @param audio_decoder audio decoder data
|
** @param audio_decoder audio decoder data
|
||||||
** @param avpkt undecoded audio packet
|
** @param avpkt undecoded audio packet
|
||||||
*/
|
*/
|
||||||
static int CodecAudioPassthroughHelper(AudioDecoder * audio_decoder, const AVPacket * avpkt)
|
static int CodecAudioPassthroughHelper(AudioDecoder * audio_decoder, const AVPacket * avpkt)
|
||||||
{
|
{
|
||||||
@ -1106,10 +1106,10 @@ static int CodecAudioPassthroughHelper(AudioDecoder * audio_decoder, const AVPac
|
|||||||
#if !defined(USE_SWRESAMPLE) && !defined(USE_AVRESAMPLE)
|
#if !defined(USE_SWRESAMPLE) && !defined(USE_AVRESAMPLE)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Set/update audio pts clock.
|
** Set/update audio pts clock.
|
||||||
**
|
**
|
||||||
** @param audio_decoder audio decoder data
|
** @param audio_decoder audio decoder data
|
||||||
** @param pts presentation timestamp
|
** @param pts presentation timestamp
|
||||||
*/
|
*/
|
||||||
static void CodecAudioSetClock(AudioDecoder * audio_decoder, int64_t pts)
|
static void CodecAudioSetClock(AudioDecoder * audio_decoder, int64_t pts)
|
||||||
{
|
{
|
||||||
@ -1206,11 +1206,11 @@ static void CodecAudioSetClock(AudioDecoder * audio_decoder, int64_t pts)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Handle audio format changes.
|
** Handle audio format changes.
|
||||||
**
|
**
|
||||||
** @param audio_decoder audio decoder data
|
** @param audio_decoder audio decoder data
|
||||||
**
|
**
|
||||||
** @note this is the old not good supported version
|
** @note this is the old not good supported version
|
||||||
*/
|
*/
|
||||||
static void CodecAudioUpdateFormat(AudioDecoder * audio_decoder)
|
static void CodecAudioUpdateFormat(AudioDecoder * audio_decoder)
|
||||||
{
|
{
|
||||||
@ -1277,11 +1277,11 @@ static void CodecAudioUpdateFormat(AudioDecoder * audio_decoder)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Codec enqueue audio samples.
|
** Codec enqueue audio samples.
|
||||||
**
|
**
|
||||||
** @param audio_decoder audio decoder data
|
** @param audio_decoder audio decoder data
|
||||||
** @param data samples data
|
** @param data samples data
|
||||||
** @param count number of bytes in sample data
|
** @param count number of bytes in sample data
|
||||||
*/
|
*/
|
||||||
void CodecAudioEnqueue(AudioDecoder * audio_decoder, int16_t * data, int count)
|
void CodecAudioEnqueue(AudioDecoder * audio_decoder, int16_t * data, int count)
|
||||||
{
|
{
|
||||||
@ -1410,12 +1410,12 @@ int myavcodec_decode_audio3(AVCodecContext * avctx, int16_t * samples, int *fram
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Decode an audio packet.
|
** Decode an audio packet.
|
||||||
**
|
**
|
||||||
** PTS must be handled self.
|
** PTS must be handled self.
|
||||||
**
|
**
|
||||||
** @param audio_decoder audio decoder data
|
** @param audio_decoder audio decoder data
|
||||||
** @param avpkt audio packet
|
** @param avpkt audio packet
|
||||||
*/
|
*/
|
||||||
void CodecAudioDecode(AudioDecoder * audio_decoder, const AVPacket * avpkt)
|
void CodecAudioDecode(AudioDecoder * audio_decoder, const AVPacket * avpkt)
|
||||||
{
|
{
|
||||||
@ -1486,10 +1486,10 @@ void CodecAudioDecode(AudioDecoder * audio_decoder, const AVPacket * avpkt)
|
|||||||
#if defined(USE_SWRESAMPLE) || defined(USE_AVRESAMPLE)
|
#if defined(USE_SWRESAMPLE) || defined(USE_AVRESAMPLE)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Set/update audio pts clock.
|
** Set/update audio pts clock.
|
||||||
**
|
**
|
||||||
** @param audio_decoder audio decoder data
|
** @param audio_decoder audio decoder data
|
||||||
** @param pts presentation timestamp
|
** @param pts presentation timestamp
|
||||||
*/
|
*/
|
||||||
static void CodecAudioSetClock(AudioDecoder * audio_decoder, int64_t pts)
|
static void CodecAudioSetClock(AudioDecoder * audio_decoder, int64_t pts)
|
||||||
{
|
{
|
||||||
@ -1604,9 +1604,9 @@ static void CodecAudioSetClock(AudioDecoder * audio_decoder, int64_t pts)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Handle audio format changes.
|
** Handle audio format changes.
|
||||||
**
|
**
|
||||||
** @param audio_decoder audio decoder data
|
** @param audio_decoder audio decoder data
|
||||||
*/
|
*/
|
||||||
static void CodecAudioUpdateFormat(AudioDecoder * audio_decoder)
|
static void CodecAudioUpdateFormat(AudioDecoder * audio_decoder)
|
||||||
{
|
{
|
||||||
@ -1665,14 +1665,14 @@ static void CodecAudioUpdateFormat(AudioDecoder * audio_decoder)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Decode an audio packet.
|
** Decode an audio packet.
|
||||||
**
|
**
|
||||||
** PTS must be handled self.
|
** PTS must be handled self.
|
||||||
**
|
**
|
||||||
** @note the caller has not aligned avpkt and not cleared the end.
|
** @note the caller has not aligned avpkt and not cleared the end.
|
||||||
**
|
**
|
||||||
** @param audio_decoder audio decoder data
|
** @param audio_decoder audio decoder data
|
||||||
** @param avpkt audio packet
|
** @param avpkt audio packet
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void CodecAudioDecode(AudioDecoder * audio_decoder, const AVPacket * avpkt)
|
void CodecAudioDecode(AudioDecoder * audio_decoder, const AVPacket * avpkt)
|
||||||
@ -1737,9 +1737,9 @@ void CodecAudioDecode(AudioDecoder * audio_decoder, const AVPacket * avpkt)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Flush the audio decoder.
|
** Flush the audio decoder.
|
||||||
**
|
**
|
||||||
** @param decoder audio decoder data
|
** @param decoder audio decoder data
|
||||||
*/
|
*/
|
||||||
void CodecAudioFlushBuffers(AudioDecoder * decoder)
|
void CodecAudioFlushBuffers(AudioDecoder * decoder)
|
||||||
{
|
{
|
||||||
@ -1751,7 +1751,7 @@ void CodecAudioFlushBuffers(AudioDecoder * decoder)
|
|||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Empty log callback
|
** Empty log callback
|
||||||
*/
|
*/
|
||||||
static void CodecNoopCallback( __attribute__((unused))
|
static void CodecNoopCallback( __attribute__((unused))
|
||||||
void *ptr, __attribute__((unused))
|
void *ptr, __attribute__((unused))
|
||||||
@ -1761,7 +1761,7 @@ static void CodecNoopCallback( __attribute__((unused))
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Codec init
|
** Codec init
|
||||||
*/
|
*/
|
||||||
void CodecInit(void)
|
void CodecInit(void)
|
||||||
{
|
{
|
||||||
@ -1776,7 +1776,7 @@ void CodecInit(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Codec exit.
|
** Codec exit.
|
||||||
*/
|
*/
|
||||||
void CodecExit(void)
|
void CodecExit(void)
|
||||||
{
|
{
|
||||||
|
150
softhdcuvid.cpp
150
softhdcuvid.cpp
@ -213,109 +213,108 @@ class cSoftRemote:public cRemote, private cThread
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Soft device remote class constructor.
|
** Soft device remote class constructor.
|
||||||
**
|
**
|
||||||
** @param name remote name
|
** @param name remote name
|
||||||
*/
|
*/
|
||||||
cSoftRemote(void) : cRemote("XKeySym")
|
cSoftRemote(void):cRemote("XKeySym")
|
||||||
{
|
{
|
||||||
Start();
|
Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ~cSoftRemote()
|
virtual ~ cSoftRemote()
|
||||||
{
|
{
|
||||||
Cancel(3);
|
Cancel(3);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Receive keycode.
|
** Receive keycode.
|
||||||
**
|
**
|
||||||
** @param code key code
|
** @param code key code
|
||||||
*/
|
*/
|
||||||
void Receive(const char *code) {
|
void Receive(const char *code)
|
||||||
cMutexLock MutexLock(&mutex);
|
{
|
||||||
Command = code;
|
cMutexLock MutexLock(&mutex);
|
||||||
keyReceived.Broadcast();
|
|
||||||
|
Command = code;
|
||||||
|
keyReceived.Broadcast();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void cSoftRemote::Action(void)
|
void cSoftRemote::Action(void)
|
||||||
{
|
{
|
||||||
// see also VDR's cKbdRemote::Action()
|
// see also VDR's cKbdRemote::Action()
|
||||||
cTimeMs FirstTime;
|
cTimeMs FirstTime;
|
||||||
cTimeMs LastTime;
|
cTimeMs LastTime;
|
||||||
cString FirstCommand = "";
|
cString FirstCommand = "";
|
||||||
cString LastCommand = "";
|
cString LastCommand = "";
|
||||||
bool Delayed = false;
|
bool Delayed = false;
|
||||||
bool Repeat = false;
|
bool Repeat = false;
|
||||||
|
|
||||||
while (Running()) {
|
while (Running()) {
|
||||||
cMutexLock MutexLock(&mutex);
|
cMutexLock MutexLock(&mutex);
|
||||||
|
|
||||||
if (keyReceived.TimedWait(mutex, Setup.RcRepeatDelta * 3 / 2) && **Command) {
|
if (keyReceived.TimedWait(mutex, Setup.RcRepeatDelta * 3 / 2) && **Command) {
|
||||||
if (strcmp(Command, LastCommand) == 0) {
|
if (strcmp(Command, LastCommand) == 0) {
|
||||||
// If two keyboard events with the same command come in without an intermediate
|
// If two keyboard events with the same command come in without an intermediate
|
||||||
// timeout, this is a long key press that caused the repeat function to kick in:
|
// timeout, this is a long key press that caused the repeat function to kick in:
|
||||||
Delayed = false;
|
Delayed = false;
|
||||||
FirstCommand = "";
|
FirstCommand = "";
|
||||||
if (FirstTime.Elapsed() < (uint)Setup.RcRepeatDelay)
|
if (FirstTime.Elapsed() < (uint) Setup.RcRepeatDelay)
|
||||||
continue; // repeat function kicks in after a short delay
|
continue; // repeat function kicks in after a short delay
|
||||||
if (LastTime.Elapsed() < (uint)Setup.RcRepeatDelta)
|
if (LastTime.Elapsed() < (uint) Setup.RcRepeatDelta)
|
||||||
continue; // skip same keys coming in too fast
|
continue; // skip same keys coming in too fast
|
||||||
cRemote::Put(Command, true);
|
cRemote::Put(Command, true);
|
||||||
Repeat = true;
|
Repeat = true;
|
||||||
LastTime.Set();
|
LastTime.Set();
|
||||||
}
|
} else if (strcmp(Command, FirstCommand) == 0) {
|
||||||
else if (strcmp(Command, FirstCommand) == 0) {
|
// If the same command comes in twice with an intermediate timeout, we
|
||||||
// If the same command comes in twice with an intermediate timeout, we
|
// need to delay the second command to see whether it is going to be
|
||||||
// need to delay the second command to see whether it is going to be
|
// a repeat function or a separate key press:
|
||||||
// a repeat function or a separate key press:
|
Delayed = true;
|
||||||
Delayed = true;
|
} else {
|
||||||
}
|
// This is a totally new key press, so we accept it immediately:
|
||||||
else {
|
cRemote::Put(Command);
|
||||||
// This is a totally new key press, so we accept it immediately:
|
Delayed = false;
|
||||||
cRemote::Put(Command);
|
FirstCommand = Command;
|
||||||
Delayed = false;
|
FirstTime.Set();
|
||||||
FirstCommand = Command;
|
}
|
||||||
FirstTime.Set();
|
} else if (Repeat) {
|
||||||
}
|
// Timeout after a repeat function, so we generate a 'release':
|
||||||
}
|
cRemote::Put(LastCommand, false, true);
|
||||||
else if (Repeat) {
|
Repeat = false;
|
||||||
// Timeout after a repeat function, so we generate a 'release':
|
} else if (Delayed && *FirstCommand) {
|
||||||
cRemote::Put(LastCommand, false, true);
|
// Timeout after two normal key presses of the same key, so accept the
|
||||||
Repeat = false;
|
// delayed key:
|
||||||
}
|
cRemote::Put(FirstCommand);
|
||||||
else if (Delayed && *FirstCommand) {
|
Delayed = false;
|
||||||
// Timeout after two normal key presses of the same key, so accept the
|
FirstCommand = "";
|
||||||
// delayed key:
|
FirstTime.Set();
|
||||||
cRemote::Put(FirstCommand);
|
} else if (**FirstCommand && FirstTime.Elapsed() > (uint) Setup.RcRepeatDelay) {
|
||||||
Delayed = false;
|
Delayed = false;
|
||||||
FirstCommand = "";
|
FirstCommand = "";
|
||||||
FirstTime.Set();
|
FirstTime.Set();
|
||||||
}
|
}
|
||||||
else if (**FirstCommand && FirstTime.Elapsed() > (uint)Setup.RcRepeatDelay) {
|
|
||||||
Delayed = false;
|
|
||||||
FirstCommand = "";
|
|
||||||
FirstTime.Set();
|
|
||||||
}
|
|
||||||
LastCommand = Command;
|
LastCommand = Command;
|
||||||
Command = "";
|
Command = "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static cSoftRemote *csoft = NULL;
|
static cSoftRemote *csoft = NULL;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Feed key press as remote input (called from C part).
|
** Feed key press as remote input (called from C part).
|
||||||
**
|
**
|
||||||
** @param keymap target keymap "XKeymap" name (obsolete, ignored)
|
** @param keymap target keymap "XKeymap" name (obsolete, ignored)
|
||||||
** @param key pressed/released key name
|
** @param key pressed/released key name
|
||||||
** @param repeat repeated key flag (obsolete, ignored)
|
** @param repeat repeated key flag (obsolete, ignored)
|
||||||
** @param release released key flag (obsolete, ignored)
|
** @param release released key flag (obsolete, ignored)
|
||||||
** @param letter x11 character string (system setting locale)
|
** @param letter x11 character string (system setting locale)
|
||||||
*/
|
*/
|
||||||
extern "C" void FeedKeyPress(const char *keymap, const char *key, int repeat, int release, const char *letter)
|
extern "C" void FeedKeyPress(const char *keymap, const char *key, int repeat, int release, const char *letter)
|
||||||
{
|
{
|
||||||
if (!csoft || !keymap || !key) {
|
if (!csoft || !keymap || !key) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
csoft->Receive(key);
|
csoft->Receive(key);
|
||||||
@ -3115,7 +3114,7 @@ bool cPluginSoftHdDevice::Start(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
csoft = new cSoftRemote;
|
csoft = new cSoftRemote;
|
||||||
|
|
||||||
switch (::Start()) {
|
switch (::Start()) {
|
||||||
case 1:
|
case 1:
|
||||||
@ -3144,7 +3143,8 @@ void cPluginSoftHdDevice::Stop(void)
|
|||||||
// dsyslog("[softhddev]%s:\n", __FUNCTION__);
|
// dsyslog("[softhddev]%s:\n", __FUNCTION__);
|
||||||
|
|
||||||
::Stop();
|
::Stop();
|
||||||
delete csoft;
|
delete csoft;
|
||||||
|
|
||||||
csoft = NULL;
|
csoft = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
414
softhddev.c
414
softhddev.c
@ -515,7 +515,7 @@ enum
|
|||||||
#define PES_START_CODE_SIZE 6 ///< size of pes start code with length
|
#define PES_START_CODE_SIZE 6 ///< size of pes start code with length
|
||||||
#define PES_HEADER_SIZE 9 ///< size of pes header
|
#define PES_HEADER_SIZE 9 ///< size of pes header
|
||||||
#define PES_MAX_HEADER_SIZE (PES_HEADER_SIZE + 256) ///< maximal header size
|
#define PES_MAX_HEADER_SIZE (PES_HEADER_SIZE + 256) ///< maximal header size
|
||||||
#define PES_MAX_PAYLOAD (512 * 1024) ///< max pay load size
|
#define PES_MAX_PAYLOAD (512 * 1024) ///< max pay load size
|
||||||
|
|
||||||
///
|
///
|
||||||
/// PES demuxer.
|
/// PES demuxer.
|
||||||
@ -885,9 +885,9 @@ static void PesParse(PesDemux * pesdx, const uint8_t * data, int size, int is_st
|
|||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
/// Transport stream packet size
|
/// Transport stream packet size
|
||||||
#define TS_PACKET_SIZE 188
|
#define TS_PACKET_SIZE 188
|
||||||
/// Transport stream packet sync byte
|
/// Transport stream packet sync byte
|
||||||
#define TS_PACKET_SYNC 0x47
|
#define TS_PACKET_SYNC 0x47
|
||||||
|
|
||||||
///
|
///
|
||||||
/// transport stream demuxer typedef.
|
/// transport stream demuxer typedef.
|
||||||
@ -982,11 +982,11 @@ static int TsDemuxer(TsDemux * tsdx, const uint8_t * data, int size)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Play audio packet.
|
** Play audio packet.
|
||||||
**
|
**
|
||||||
** @param data data of exactly one complete PES packet
|
** @param data data of exactly one complete PES packet
|
||||||
** @param size size of PES packet
|
** @param size size of PES packet
|
||||||
** @param id PES packet type
|
** @param id PES packet type
|
||||||
*/
|
*/
|
||||||
int PlayAudio(const uint8_t * data, int size, uint8_t id)
|
int PlayAudio(const uint8_t * data, int size, uint8_t id)
|
||||||
{
|
{
|
||||||
@ -1211,14 +1211,14 @@ int PlayAudio(const uint8_t * data, int size, uint8_t id)
|
|||||||
#ifndef NO_TS_AUDIO
|
#ifndef NO_TS_AUDIO
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Play transport stream audio packet.
|
** Play transport stream audio packet.
|
||||||
**
|
**
|
||||||
** VDR can have buffered data belonging to previous channel!
|
** VDR can have buffered data belonging to previous channel!
|
||||||
**
|
**
|
||||||
** @param data data of exactly one complete TS packet
|
** @param data data of exactly one complete TS packet
|
||||||
** @param size size of TS packet (always TS_PACKET_SIZE)
|
** @param size size of TS packet (always TS_PACKET_SIZE)
|
||||||
**
|
**
|
||||||
** @returns number of bytes consumed;
|
** @returns number of bytes consumed;
|
||||||
*/
|
*/
|
||||||
int PlayTsAudio(const uint8_t * data, int size)
|
int PlayTsAudio(const uint8_t * data, int size)
|
||||||
{
|
{
|
||||||
@ -1265,9 +1265,9 @@ int PlayTsAudio(const uint8_t * data, int size)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Set volume of audio device.
|
** Set volume of audio device.
|
||||||
**
|
**
|
||||||
** @param volume VDR volume (0 .. 255)
|
** @param volume VDR volume (0 .. 255)
|
||||||
*/
|
*/
|
||||||
void SetVolumeDevice(int volume)
|
void SetVolumeDevice(int volume)
|
||||||
{
|
{
|
||||||
@ -1275,7 +1275,7 @@ void SetVolumeDevice(int volume)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*** Resets channel ID (restarts audio).
|
*** Resets channel ID (restarts audio).
|
||||||
**/
|
**/
|
||||||
void ResetChannelId(void)
|
void ResetChannelId(void)
|
||||||
{
|
{
|
||||||
@ -1291,7 +1291,7 @@ void ResetChannelId(void)
|
|||||||
#define VIDEO_PACKET_MAX 256 ///< max number of video packets 192
|
#define VIDEO_PACKET_MAX 256 ///< max number of video packets 192
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Video output stream device structure. Parser, decoder, display.
|
** Video output stream device structure. Parser, decoder, display.
|
||||||
*/
|
*/
|
||||||
struct __video_stream__
|
struct __video_stream__
|
||||||
{
|
{
|
||||||
@ -1344,9 +1344,9 @@ static volatile char Usr1Signal; ///< true got usr1 signal
|
|||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Initialize video packet ringbuffer.
|
** Initialize video packet ringbuffer.
|
||||||
**
|
**
|
||||||
** @param stream video stream
|
** @param stream video stream
|
||||||
*/
|
*/
|
||||||
static void VideoPacketInit(VideoStream * stream)
|
static void VideoPacketInit(VideoStream * stream)
|
||||||
{
|
{
|
||||||
@ -1367,9 +1367,9 @@ static void VideoPacketInit(VideoStream * stream)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Cleanup video packet ringbuffer.
|
** Cleanup video packet ringbuffer.
|
||||||
**
|
**
|
||||||
** @param stream video stream
|
** @param stream video stream
|
||||||
*/
|
*/
|
||||||
static void VideoPacketExit(VideoStream * stream)
|
static void VideoPacketExit(VideoStream * stream)
|
||||||
{
|
{
|
||||||
@ -1383,12 +1383,12 @@ static void VideoPacketExit(VideoStream * stream)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Place video data in packet ringbuffer.
|
** Place video data in packet ringbuffer.
|
||||||
**
|
**
|
||||||
** @param stream video stream
|
** @param stream video stream
|
||||||
** @param pts presentation timestamp of pes packet
|
** @param pts presentation timestamp of pes packet
|
||||||
** @param data data of pes packet
|
** @param data data of pes packet
|
||||||
** @param size size of pes packet
|
** @param size size of pes packet
|
||||||
*/
|
*/
|
||||||
static void VideoEnqueue(VideoStream * stream, int64_t pts, int64_t dts, const void *data, int size)
|
static void VideoEnqueue(VideoStream * stream, int64_t pts, int64_t dts, const void *data, int size)
|
||||||
{
|
{
|
||||||
@ -1431,9 +1431,9 @@ static void VideoEnqueue(VideoStream * stream, int64_t pts, int64_t dts, const v
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Reset current packet.
|
** Reset current packet.
|
||||||
**
|
**
|
||||||
** @param stream video stream
|
** @param stream video stream
|
||||||
*/
|
*/
|
||||||
static void VideoResetPacket(VideoStream * stream)
|
static void VideoResetPacket(VideoStream * stream)
|
||||||
{
|
{
|
||||||
@ -1449,10 +1449,10 @@ static void VideoResetPacket(VideoStream * stream)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Finish current packet advance to next.
|
** Finish current packet advance to next.
|
||||||
**
|
**
|
||||||
** @param stream video stream
|
** @param stream video stream
|
||||||
** @param codec_id codec id of packet (MPEG/H264)
|
** @param codec_id codec id of packet (MPEG/H264)
|
||||||
*/
|
*/
|
||||||
static void VideoNextPacket(VideoStream * stream, int codec_id)
|
static void VideoNextPacket(VideoStream * stream, int codec_id)
|
||||||
{
|
{
|
||||||
@ -1493,18 +1493,18 @@ static void VideoNextPacket(VideoStream * stream, int codec_id)
|
|||||||
#ifdef USE_PIP
|
#ifdef USE_PIP
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Place mpeg video data in packet ringbuffer.
|
** Place mpeg video data in packet ringbuffer.
|
||||||
**
|
**
|
||||||
** Some tv-stations sends mulitple pictures in a single PES packet.
|
** Some tv-stations sends mulitple pictures in a single PES packet.
|
||||||
** Split the packet into single picture packets.
|
** Split the packet into single picture packets.
|
||||||
** Nick/CC, Viva, MediaShop, Deutsches Music Fernsehen
|
** Nick/CC, Viva, MediaShop, Deutsches Music Fernsehen
|
||||||
**
|
**
|
||||||
** FIXME: this code can be written much faster
|
** FIXME: this code can be written much faster
|
||||||
**
|
**
|
||||||
** @param stream video stream
|
** @param stream video stream
|
||||||
** @param pts presentation timestamp of pes packet
|
** @param pts presentation timestamp of pes packet
|
||||||
** @param data data of pes packet
|
** @param data data of pes packet
|
||||||
** @param size size of pes packet
|
** @param size size of pes packet
|
||||||
*/
|
*/
|
||||||
static void VideoMpegEnqueue(VideoStream * stream, int64_t pts, int64_t dts, const uint8_t * data, int size)
|
static void VideoMpegEnqueue(VideoStream * stream, int64_t pts, int64_t dts, const uint8_t * data, int size)
|
||||||
{
|
{
|
||||||
@ -1533,7 +1533,7 @@ static void VideoMpegEnqueue(VideoStream * stream, int64_t pts, int64_t dts, con
|
|||||||
#endif
|
#endif
|
||||||
if (!p[0] || p[0] == 0xb3) {
|
if (!p[0] || p[0] == 0xb3) {
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printf("last: %d start aspect %02x\n", stream->StartCodeState, p[4]);
|
printf("last: %d start aspect %02x\n", stream->StartCodeState, p[4]);
|
||||||
#endif
|
#endif
|
||||||
stream->PacketRb[stream->PacketWrite].stream_index -= 3;
|
stream->PacketRb[stream->PacketWrite].stream_index -= 3;
|
||||||
VideoNextPacket(stream, AV_CODEC_ID_MPEG2VIDEO);
|
VideoNextPacket(stream, AV_CODEC_ID_MPEG2VIDEO);
|
||||||
@ -1551,7 +1551,7 @@ static void VideoMpegEnqueue(VideoStream * stream, int64_t pts, int64_t dts, con
|
|||||||
#endif
|
#endif
|
||||||
if (p[0] == 0x01 && (!p[1] || p[1] == 0xb3)) {
|
if (p[0] == 0x01 && (!p[1] || p[1] == 0xb3)) {
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printf("last: %d start aspect %02x\n", stream->StartCodeState, p[5]);
|
printf("last: %d start aspect %02x\n", stream->StartCodeState, p[5]);
|
||||||
#endif
|
#endif
|
||||||
stream->PacketRb[stream->PacketWrite].stream_index -= 2;
|
stream->PacketRb[stream->PacketWrite].stream_index -= 2;
|
||||||
VideoNextPacket(stream, AV_CODEC_ID_MPEG2VIDEO);
|
VideoNextPacket(stream, AV_CODEC_ID_MPEG2VIDEO);
|
||||||
@ -1568,7 +1568,7 @@ static void VideoMpegEnqueue(VideoStream * stream, int64_t pts, int64_t dts, con
|
|||||||
#endif
|
#endif
|
||||||
if (!p[0] && p[1] == 0x01 && (!p[2] || p[2] == 0xb3)) {
|
if (!p[0] && p[1] == 0x01 && (!p[2] || p[2] == 0xb3)) {
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printf("last: %d start aspect %02x\n", stream->StartCodeState, p[6]);
|
printf("last: %d start aspect %02x\n", stream->StartCodeState, p[6]);
|
||||||
#endif
|
#endif
|
||||||
stream->PacketRb[stream->PacketWrite].stream_index -= 1;
|
stream->PacketRb[stream->PacketWrite].stream_index -= 1;
|
||||||
VideoNextPacket(stream, AV_CODEC_ID_MPEG2VIDEO);
|
VideoNextPacket(stream, AV_CODEC_ID_MPEG2VIDEO);
|
||||||
@ -1650,19 +1650,19 @@ static void VideoMpegEnqueue(VideoStream * stream, int64_t pts, int64_t dts, con
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Fix packet for FFMpeg.
|
** Fix packet for FFMpeg.
|
||||||
**
|
**
|
||||||
** Some tv-stations sends mulitple pictures in a single PES packet.
|
** Some tv-stations sends mulitple pictures in a single PES packet.
|
||||||
** Current ffmpeg 0.10 and libav-0.8 has problems with this.
|
** Current ffmpeg 0.10 and libav-0.8 has problems with this.
|
||||||
** Split the packet into single picture packets.
|
** Split the packet into single picture packets.
|
||||||
**
|
**
|
||||||
** FIXME: there are stations which have multiple pictures and
|
** FIXME: there are stations which have multiple pictures and
|
||||||
** the last picture incomplete in the PES packet.
|
** the last picture incomplete in the PES packet.
|
||||||
**
|
**
|
||||||
** FIXME: move function call into PlayVideo, than the hardware
|
** FIXME: move function call into PlayVideo, than the hardware
|
||||||
** decoder didn't need to support multiple frames decoding.
|
** decoder didn't need to support multiple frames decoding.
|
||||||
**
|
**
|
||||||
** @param avpkt ffmpeg a/v packet
|
** @param avpkt ffmpeg a/v packet
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef USE_PIP
|
#ifndef USE_PIP
|
||||||
@ -1728,9 +1728,9 @@ static void FixPacketForFFMpeg(VideoDecoder * vdecoder, AVPacket * avpkt)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Open video stream.
|
** Open video stream.
|
||||||
**
|
**
|
||||||
** @param stream video stream
|
** @param stream video stream
|
||||||
*/
|
*/
|
||||||
static void VideoStreamOpen(VideoStream * stream)
|
static void VideoStreamOpen(VideoStream * stream)
|
||||||
{
|
{
|
||||||
@ -1745,13 +1745,13 @@ static void VideoStreamOpen(VideoStream * stream)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Close video stream.
|
** Close video stream.
|
||||||
**
|
**
|
||||||
** @param stream video stream
|
** @param stream video stream
|
||||||
** @param delhw flag delete hardware decoder
|
** @param delhw flag delete hardware decoder
|
||||||
**
|
**
|
||||||
** @note must be called from the video thread, otherwise xcb has a
|
** @note must be called from the video thread, otherwise xcb has a
|
||||||
** deadlock.
|
** deadlock.
|
||||||
*/
|
*/
|
||||||
static void VideoStreamClose(VideoStream * stream, int delhw)
|
static void VideoStreamClose(VideoStream * stream, int delhw)
|
||||||
{
|
{
|
||||||
@ -1782,14 +1782,14 @@ static void VideoStreamClose(VideoStream * stream, int delhw)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Poll PES packet ringbuffer.
|
** Poll PES packet ringbuffer.
|
||||||
**
|
**
|
||||||
** Called if video frame buffers are full.
|
** Called if video frame buffers are full.
|
||||||
**
|
**
|
||||||
** @param stream video stream
|
** @param stream video stream
|
||||||
**
|
**
|
||||||
** @retval 1 something todo
|
** @retval 1 something todo
|
||||||
** @retval -1 empty stream
|
** @retval -1 empty stream
|
||||||
*/
|
*/
|
||||||
int VideoPollInput(VideoStream * stream)
|
int VideoPollInput(VideoStream * stream)
|
||||||
{
|
{
|
||||||
@ -1824,13 +1824,13 @@ int VideoPollInput(VideoStream * stream)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Decode from PES packet ringbuffer.
|
** Decode from PES packet ringbuffer.
|
||||||
**
|
**
|
||||||
** @param stream video stream
|
** @param stream video stream
|
||||||
**
|
**
|
||||||
** @retval 0 packet decoded
|
** @retval 0 packet decoded
|
||||||
** @retval 1 stream paused
|
** @retval 1 stream paused
|
||||||
** @retval -1 empty stream
|
** @retval -1 empty stream
|
||||||
*/
|
*/
|
||||||
int VideoDecodeInput(VideoStream * stream)
|
int VideoDecodeInput(VideoStream * stream)
|
||||||
{
|
{
|
||||||
@ -1975,9 +1975,9 @@ int VideoDecodeInput(VideoStream * stream)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Get number of video buffers.
|
** Get number of video buffers.
|
||||||
**
|
**
|
||||||
** @param stream video stream
|
** @param stream video stream
|
||||||
*/
|
*/
|
||||||
int VideoGetBuffers(const VideoStream * stream)
|
int VideoGetBuffers(const VideoStream * stream)
|
||||||
{
|
{
|
||||||
@ -1985,9 +1985,9 @@ int VideoGetBuffers(const VideoStream * stream)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Try video start.
|
** Try video start.
|
||||||
**
|
**
|
||||||
** NOT TRUE: Could be called, when already started.
|
** NOT TRUE: Could be called, when already started.
|
||||||
*/
|
*/
|
||||||
static void StartVideo(void)
|
static void StartVideo(void)
|
||||||
{
|
{
|
||||||
@ -2005,7 +2005,7 @@ static void StartVideo(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Stop video.
|
** Stop video.
|
||||||
*/
|
*/
|
||||||
static void StopVideo(void)
|
static void StopVideo(void)
|
||||||
{
|
{
|
||||||
@ -2043,9 +2043,9 @@ static void StopVideo(void)
|
|||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Dump mpeg video packet.
|
** Dump mpeg video packet.
|
||||||
**
|
**
|
||||||
** Function to dump a mpeg packet, not needed.
|
** Function to dump a mpeg packet, not needed.
|
||||||
*/
|
*/
|
||||||
static void DumpMpeg(const uint8_t * data, int size)
|
static void DumpMpeg(const uint8_t * data, int size)
|
||||||
{
|
{
|
||||||
@ -2067,9 +2067,9 @@ static void DumpMpeg(const uint8_t * data, int size)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Dump h264 video packet.
|
** Dump h264 video packet.
|
||||||
**
|
**
|
||||||
** Function to Dump a h264 packet, not needed.
|
** Function to Dump a h264 packet, not needed.
|
||||||
*/
|
*/
|
||||||
static int DumpH264(const uint8_t * data, int size)
|
static int DumpH264(const uint8_t * data, int size)
|
||||||
{
|
{
|
||||||
@ -2091,9 +2091,9 @@ static int DumpH264(const uint8_t * data, int size)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Validate mpeg video packet.
|
** Validate mpeg video packet.
|
||||||
**
|
**
|
||||||
** Function to validate a mpeg packet, not needed.
|
** Function to validate a mpeg packet, not needed.
|
||||||
*/
|
*/
|
||||||
static int ValidateMpeg(const uint8_t * data, int size)
|
static int ValidateMpeg(const uint8_t * data, int size)
|
||||||
{
|
{
|
||||||
@ -2126,13 +2126,13 @@ static int ValidateMpeg(const uint8_t * data, int size)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Play video packet.
|
** Play video packet.
|
||||||
**
|
**
|
||||||
** @param stream video stream
|
** @param stream video stream
|
||||||
** @param data data of exactly one complete PES packet
|
** @param data data of exactly one complete PES packet
|
||||||
** @param size size of PES packet
|
** @param size size of PES packet
|
||||||
**
|
**
|
||||||
** @return number of bytes used, 0 if internal buffer are full.
|
** @return number of bytes used, 0 if internal buffer are full.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
int PlayVideo3(VideoStream * stream, const uint8_t * data, int size)
|
int PlayVideo3(VideoStream * stream, const uint8_t * data, int size)
|
||||||
@ -2352,20 +2352,20 @@ int PlayVideo3(VideoStream * stream, const uint8_t * data, int size)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Play video packet.
|
** Play video packet.
|
||||||
**
|
**
|
||||||
** @param data data of exactly one complete PES packet
|
** @param data data of exactly one complete PES packet
|
||||||
** @param size size of PES packet
|
** @param size size of PES packet
|
||||||
**
|
**
|
||||||
** @return number of bytes used, 0 if internal buffer are full.
|
** @return number of bytes used, 0 if internal buffer are full.
|
||||||
**
|
**
|
||||||
** @note vdr sends incomplete packets, va-api h264 decoder only
|
** @note vdr sends incomplete packets, va-api h264 decoder only
|
||||||
** supports complete packets.
|
** supports complete packets.
|
||||||
** We buffer here until we receive an complete PES Packet, which
|
** We buffer here until we receive an complete PES Packet, which
|
||||||
** is no problem, the audio is always far behind us.
|
** is no problem, the audio is always far behind us.
|
||||||
** cTsToPes::GetPes splits the packets.
|
** cTsToPes::GetPes splits the packets.
|
||||||
**
|
**
|
||||||
** @todo FIXME: combine the 5 ifs at start of the function
|
** @todo FIXME: combine the 5 ifs at start of the function
|
||||||
*/
|
*/
|
||||||
int PlayVideo(const uint8_t * data, int size)
|
int PlayVideo(const uint8_t * data, int size)
|
||||||
{
|
{
|
||||||
@ -2378,16 +2378,16 @@ extern uint8_t *CreateJpeg(uint8_t *, int *, int, int, int);
|
|||||||
#if defined(USE_JPEG) && JPEG_LIB_VERSION >= 80
|
#if defined(USE_JPEG) && JPEG_LIB_VERSION >= 80
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Create a jpeg image in memory.
|
** Create a jpeg image in memory.
|
||||||
**
|
**
|
||||||
** @param image raw RGB image
|
** @param image raw RGB image
|
||||||
** @param raw_size size of raw image
|
** @param raw_size size of raw image
|
||||||
** @param size[out] size of jpeg image
|
** @param size[out] size of jpeg image
|
||||||
** @param quality jpeg quality
|
** @param quality jpeg quality
|
||||||
** @param width number of horizontal pixels in image
|
** @param width number of horizontal pixels in image
|
||||||
** @param height number of vertical pixels in image
|
** @param height number of vertical pixels in image
|
||||||
**
|
**
|
||||||
** @returns allocated jpeg image.
|
** @returns allocated jpeg image.
|
||||||
*/
|
*/
|
||||||
uint8_t *CreateJpeg(uint8_t * image, int raw_size, int *size, int quality, int width, int height)
|
uint8_t *CreateJpeg(uint8_t * image, int raw_size, int *size, int quality, int width, int height)
|
||||||
{
|
{
|
||||||
@ -2429,13 +2429,13 @@ uint8_t *CreateJpeg(uint8_t * image, int raw_size, int *size, int quality, int w
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Grabs the currently visible screen image.
|
** Grabs the currently visible screen image.
|
||||||
**
|
**
|
||||||
** @param size size of the returned data
|
** @param size size of the returned data
|
||||||
** @param jpeg flag true, create JPEG data
|
** @param jpeg flag true, create JPEG data
|
||||||
** @param quality JPEG quality
|
** @param quality JPEG quality
|
||||||
** @param width number of horizontal pixels in the frame
|
** @param width number of horizontal pixels in the frame
|
||||||
** @param height number of vertical pixels in the frame
|
** @param height number of vertical pixels in the frame
|
||||||
*/
|
*/
|
||||||
uint8_t *GrabImage(int *size, int jpeg, int quality, int width, int height)
|
uint8_t *GrabImage(int *size, int jpeg, int quality, int width, int height)
|
||||||
{
|
{
|
||||||
@ -2461,9 +2461,9 @@ uint8_t *GrabImage(int *size, int jpeg, int quality, int width, int height)
|
|||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Set play mode, called on channel switch.
|
** Set play mode, called on channel switch.
|
||||||
**
|
**
|
||||||
** @param play_mode play mode (none, video+audio, audio-only, ...)
|
** @param play_mode play mode (none, video+audio, audio-only, ...)
|
||||||
*/
|
*/
|
||||||
int SetPlayMode(int play_mode)
|
int SetPlayMode(int play_mode)
|
||||||
{
|
{
|
||||||
@ -2514,8 +2514,8 @@ int SetPlayMode(int play_mode)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Gets the current System Time Counter, which can be used to
|
** Gets the current System Time Counter, which can be used to
|
||||||
** synchronize audio, video and subtitles.
|
** synchronize audio, video and subtitles.
|
||||||
*/
|
*/
|
||||||
int64_t GetSTC(void)
|
int64_t GetSTC(void)
|
||||||
{
|
{
|
||||||
@ -2528,11 +2528,11 @@ int64_t GetSTC(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Get video stream size and aspect.
|
** Get video stream size and aspect.
|
||||||
**
|
**
|
||||||
** @param width[OUT] width of video stream
|
** @param width[OUT] width of video stream
|
||||||
** @param height[OUT] height of video stream
|
** @param height[OUT] height of video stream
|
||||||
** @param aspect[OUT] aspect ratio (4/3, 16/9, ...) of video stream
|
** @param aspect[OUT] aspect ratio (4/3, 16/9, ...) of video stream
|
||||||
*/
|
*/
|
||||||
void GetVideoSize(int *width, int *height, double *aspect)
|
void GetVideoSize(int *width, int *height, double *aspect)
|
||||||
{
|
{
|
||||||
@ -2562,12 +2562,12 @@ void GetVideoSize(int *width, int *height, double *aspect)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Set trick play speed.
|
** Set trick play speed.
|
||||||
**
|
**
|
||||||
** Every single frame shall then be displayed the given number of
|
** Every single frame shall then be displayed the given number of
|
||||||
** times.
|
** times.
|
||||||
**
|
**
|
||||||
** @param speed trick speed
|
** @param speed trick speed
|
||||||
*/
|
*/
|
||||||
void TrickSpeed(int speed)
|
void TrickSpeed(int speed)
|
||||||
{
|
{
|
||||||
@ -2583,7 +2583,7 @@ void TrickSpeed(int speed)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Clears all video and audio data from the device.
|
** Clears all video and audio data from the device.
|
||||||
*/
|
*/
|
||||||
void Clear(void)
|
void Clear(void)
|
||||||
{
|
{
|
||||||
@ -2606,7 +2606,7 @@ void Clear(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Sets the device into play mode.
|
** Sets the device into play mode.
|
||||||
*/
|
*/
|
||||||
void Play(void)
|
void Play(void)
|
||||||
{
|
{
|
||||||
@ -2616,7 +2616,7 @@ void Play(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Sets the device into "freeze frame" mode.
|
** Sets the device into "freeze frame" mode.
|
||||||
*/
|
*/
|
||||||
void Freeze(void)
|
void Freeze(void)
|
||||||
{
|
{
|
||||||
@ -2626,7 +2626,7 @@ void Freeze(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Turns off audio while replaying.
|
** Turns off audio while replaying.
|
||||||
*/
|
*/
|
||||||
void Mute(void)
|
void Mute(void)
|
||||||
{
|
{
|
||||||
@ -2636,10 +2636,10 @@ void Mute(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Display the given I-frame as a still picture.
|
** Display the given I-frame as a still picture.
|
||||||
**
|
**
|
||||||
** @param data pes frame data
|
** @param data pes frame data
|
||||||
** @param size number of bytes in frame
|
** @param size number of bytes in frame
|
||||||
*/
|
*/
|
||||||
void StillPicture(const uint8_t * data, int size)
|
void StillPicture(const uint8_t * data, int size)
|
||||||
{
|
{
|
||||||
@ -2746,17 +2746,17 @@ void StillPicture(const uint8_t * data, int size)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Poll if device is ready. Called by replay.
|
** Poll if device is ready. Called by replay.
|
||||||
**
|
**
|
||||||
** This function is useless, the return value is ignored and
|
** This function is useless, the return value is ignored and
|
||||||
** all buffers are overrun by vdr.
|
** all buffers are overrun by vdr.
|
||||||
**
|
**
|
||||||
** The dvd plugin is using this correct.
|
** The dvd plugin is using this correct.
|
||||||
**
|
**
|
||||||
** @param timeout timeout to become ready in ms
|
** @param timeout timeout to become ready in ms
|
||||||
**
|
**
|
||||||
** @retval true if ready
|
** @retval true if ready
|
||||||
** @retval false if busy
|
** @retval false if busy
|
||||||
*/
|
*/
|
||||||
int Poll(int timeout)
|
int Poll(int timeout)
|
||||||
{
|
{
|
||||||
@ -2789,9 +2789,9 @@ int Poll(int timeout)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Flush the device output buffers.
|
** Flush the device output buffers.
|
||||||
**
|
**
|
||||||
** @param timeout timeout to flush in ms
|
** @param timeout timeout to flush in ms
|
||||||
*/
|
*/
|
||||||
int Flush(int timeout)
|
int Flush(int timeout)
|
||||||
{
|
{
|
||||||
@ -2809,11 +2809,11 @@ int Flush(int timeout)
|
|||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Get OSD size and aspect.
|
** Get OSD size and aspect.
|
||||||
**
|
**
|
||||||
** @param width[OUT] width of OSD
|
** @param width[OUT] width of OSD
|
||||||
** @param height[OUT] height of OSD
|
** @param height[OUT] height of OSD
|
||||||
** @param aspect[OUT] aspect ratio (4/3, 16/9, ...) of OSD
|
** @param aspect[OUT] aspect ratio (4/3, 16/9, ...) of OSD
|
||||||
*/
|
*/
|
||||||
void GetOsdSize(int *width, int *height, double *aspect)
|
void GetOsdSize(int *width, int *height, double *aspect)
|
||||||
{
|
{
|
||||||
@ -2835,7 +2835,7 @@ void GetOsdSize(int *width, int *height, double *aspect)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Close OSD.
|
** Close OSD.
|
||||||
*/
|
*/
|
||||||
void OsdClose(void)
|
void OsdClose(void)
|
||||||
{
|
{
|
||||||
@ -2843,16 +2843,16 @@ void OsdClose(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Draw an OSD pixmap.
|
** Draw an OSD pixmap.
|
||||||
**
|
**
|
||||||
** @param xi x-coordinate in argb image
|
** @param xi x-coordinate in argb image
|
||||||
** @param yi y-coordinate in argb image
|
** @param yi y-coordinate in argb image
|
||||||
** @paran height height in pixel in argb image
|
** @paran height height in pixel in argb image
|
||||||
** @paran width width in pixel in argb image
|
** @paran width width in pixel in argb image
|
||||||
** @param pitch pitch of argb image
|
** @param pitch pitch of argb image
|
||||||
** @param argb 32bit ARGB image data
|
** @param argb 32bit ARGB image data
|
||||||
** @param x x-coordinate on screen of argb image
|
** @param x x-coordinate on screen of argb image
|
||||||
** @param y y-coordinate on screen of argb image
|
** @param y y-coordinate on screen of argb image
|
||||||
*/
|
*/
|
||||||
void OsdDrawARGB(int xi, int yi, int height, int width, int pitch, const uint8_t * argb, int x, int y)
|
void OsdDrawARGB(int xi, int yi, int height, int width, int pitch, const uint8_t * argb, int x, int y)
|
||||||
{
|
{
|
||||||
@ -2864,17 +2864,17 @@ void OsdDrawARGB(int xi, int yi, int height, int width, int pitch, const uint8_t
|
|||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Return command line help string.
|
** Return command line help string.
|
||||||
*/
|
*/
|
||||||
const char *CommandLineHelp(void)
|
const char *CommandLineHelp(void)
|
||||||
{
|
{
|
||||||
return " -a device\taudio device (fe. alsa: hw:0,0 oss: /dev/dsp)\n"
|
return " -a device\taudio device (fe. alsa: hw:0,0 oss: /dev/dsp)\n"
|
||||||
" -p device\taudio device for pass-through (hw:0,1 or /dev/dsp1)\n"
|
" -p device\taudio device for pass-through (hw:0,1 or /dev/dsp1)\n"
|
||||||
" -c channel\taudio mixer channel name (fe. PCM)\n" " -d display\tdisplay of x11 server (fe. :0.0)\n"
|
" -c channel\taudio mixer channel name (fe. PCM)\n" " -d display\tdisplay of x11 server (fe. :0.0)\n"
|
||||||
" -f\t\tstart with fullscreen window (only with window manager)\n"
|
" -f\t\tstart with fullscreen window (only with window manager)\n"
|
||||||
" -g geometry\tx11 window geometry wxh+x+y\n" " -v device\tvideo driver device (cuvid)\n"
|
" -g geometry\tx11 window geometry wxh+x+y\n" " -v device\tvideo driver device (cuvid)\n"
|
||||||
" -s\t\tstart in suspended mode\n" " -x\t\tstart x11 server, with -xx try to connect, if this fails\n"
|
" -s\t\tstart in suspended mode\n" " -x\t\tstart x11 server, with -xx try to connect, if this fails\n"
|
||||||
" -X args\tX11 server arguments (f.e. -nocursor)\n" " -w workaround\tenable/disable workarounds\n"
|
" -X args\tX11 server arguments (f.e. -nocursor)\n" " -w workaround\tenable/disable workarounds\n"
|
||||||
"\tno-hw-decoder\t\tdisable hw decoder, use software decoder only\n"
|
"\tno-hw-decoder\t\tdisable hw decoder, use software decoder only\n"
|
||||||
"\tno-mpeg-hw-decoder\tdisable hw decoder for mpeg only\n"
|
"\tno-mpeg-hw-decoder\tdisable hw decoder for mpeg only\n"
|
||||||
"\tstill-hw-decoder\tenable hardware decoder for still-pictures\n"
|
"\tstill-hw-decoder\tenable hardware decoder for still-pictures\n"
|
||||||
@ -2883,14 +2883,14 @@ const char *CommandLineHelp(void)
|
|||||||
"\talsa-no-close-open\tdisable close open to fix alsa no sound bug\n"
|
"\talsa-no-close-open\tdisable close open to fix alsa no sound bug\n"
|
||||||
"\talsa-close-open-delay\tenable close open delay to fix no sound bug\n"
|
"\talsa-close-open-delay\tenable close open delay to fix no sound bug\n"
|
||||||
"\tignore-repeat-pict\tdisable repeat pict message\n"
|
"\tignore-repeat-pict\tdisable repeat pict message\n"
|
||||||
"\tuse-possible-defect-frames prefer faster channel switch\n" " -D\t\tstart in detached mode\n";
|
"\tuse-possible-defect-frames prefer faster channel switch\n" " -D\t\tstart in detached mode\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Process the command line arguments.
|
** Process the command line arguments.
|
||||||
**
|
**
|
||||||
** @param argc number of arguments
|
** @param argc number of arguments
|
||||||
** @param argv arguments vector
|
** @param argv arguments vector
|
||||||
*/
|
*/
|
||||||
int ProcessArgs(int argc, char *const argv[])
|
int ProcessArgs(int argc, char *const argv[])
|
||||||
{
|
{
|
||||||
@ -3008,9 +3008,9 @@ static const char *X11Server = LOCALBASE "/bin/X"; ///< default x11 server
|
|||||||
static pid_t X11ServerPid; ///< x11 server pid
|
static pid_t X11ServerPid; ///< x11 server pid
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** USR1 signal handler.
|
** USR1 signal handler.
|
||||||
**
|
**
|
||||||
** @param sig signal number
|
** @param sig signal number
|
||||||
*/
|
*/
|
||||||
static void Usr1Handler(int __attribute__((unused)) sig)
|
static void Usr1Handler(int __attribute__((unused)) sig)
|
||||||
{
|
{
|
||||||
@ -3020,7 +3020,7 @@ static void Usr1Handler(int __attribute__((unused)) sig)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Start the X server
|
** Start the X server
|
||||||
*/
|
*/
|
||||||
static void StartXServer(void)
|
static void StartXServer(void)
|
||||||
{
|
{
|
||||||
@ -3104,7 +3104,7 @@ static void StartXServer(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Exit + cleanup.
|
** Exit + cleanup.
|
||||||
*/
|
*/
|
||||||
void SoftHdDeviceExit(void)
|
void SoftHdDeviceExit(void)
|
||||||
{
|
{
|
||||||
@ -3164,11 +3164,11 @@ void SoftHdDeviceExit(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Prepare plugin.
|
** Prepare plugin.
|
||||||
**
|
**
|
||||||
** @retval 0 normal start
|
** @retval 0 normal start
|
||||||
** @retval 1 suspended start
|
** @retval 1 suspended start
|
||||||
** @retval -1 detached start
|
** @retval -1 detached start
|
||||||
*/
|
*/
|
||||||
int Start(void)
|
int Start(void)
|
||||||
{
|
{
|
||||||
@ -3210,9 +3210,9 @@ int Start(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Stop plugin.
|
** Stop plugin.
|
||||||
**
|
**
|
||||||
** @note stop everything, but don't cleanup, module is still called.
|
** @note stop everything, but don't cleanup, module is still called.
|
||||||
*/
|
*/
|
||||||
void Stop(void)
|
void Stop(void)
|
||||||
{
|
{
|
||||||
@ -3222,7 +3222,7 @@ void Stop(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Perform any cleanup or other regular tasks.
|
** Perform any cleanup or other regular tasks.
|
||||||
*/
|
*/
|
||||||
void Housekeeping(void)
|
void Housekeeping(void)
|
||||||
{
|
{
|
||||||
@ -3252,7 +3252,7 @@ void Housekeeping(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Main thread hook, periodic called from main thread.
|
** Main thread hook, periodic called from main thread.
|
||||||
*/
|
*/
|
||||||
void MainThreadHook(void)
|
void MainThreadHook(void)
|
||||||
{
|
{
|
||||||
@ -3273,11 +3273,11 @@ void MainThreadHook(void)
|
|||||||
extern void DelPip(void);
|
extern void DelPip(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Suspend plugin.
|
** Suspend plugin.
|
||||||
**
|
**
|
||||||
** @param video suspend closes video
|
** @param video suspend closes video
|
||||||
** @param audio suspend closes audio
|
** @param audio suspend closes audio
|
||||||
** @param dox11 suspend closes x11 server
|
** @param dox11 suspend closes x11 server
|
||||||
*/
|
*/
|
||||||
void Suspend(int video, int audio, int dox11)
|
void Suspend(int video, int audio, int dox11)
|
||||||
{
|
{
|
||||||
@ -3320,7 +3320,7 @@ void Suspend(int video, int audio, int dox11)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Resume plugin.
|
** Resume plugin.
|
||||||
*/
|
*/
|
||||||
void Resume(void)
|
void Resume(void)
|
||||||
{
|
{
|
||||||
@ -3354,12 +3354,12 @@ void Resume(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Get decoder statistics.
|
** Get decoder statistics.
|
||||||
**
|
**
|
||||||
** @param[out] missed missed frames
|
** @param[out] missed missed frames
|
||||||
** @param[out] duped duped frames
|
** @param[out] duped duped frames
|
||||||
** @param[out] dropped dropped frames
|
** @param[out] dropped dropped frames
|
||||||
** @param[out] count number of decoded frames
|
** @param[out] count number of decoded frames
|
||||||
*/
|
*/
|
||||||
void GetStats(int *missed, int *duped, int *dropped, int *counter, float *frametime)
|
void GetStats(int *missed, int *duped, int *dropped, int *counter, float *frametime)
|
||||||
{
|
{
|
||||||
@ -3374,12 +3374,12 @@ void GetStats(int *missed, int *duped, int *dropped, int *counter, float *framet
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Scale the currently shown video.
|
** Scale the currently shown video.
|
||||||
**
|
**
|
||||||
** @param x video window x coordinate OSD relative
|
** @param x video window x coordinate OSD relative
|
||||||
** @param y video window y coordinate OSD relative
|
** @param y video window y coordinate OSD relative
|
||||||
** @param width video window width OSD relative
|
** @param width video window width OSD relative
|
||||||
** @param height video window height OSD relative
|
** @param height video window height OSD relative
|
||||||
*/
|
*/
|
||||||
void ScaleVideo(int x, int y, int width, int height)
|
void ScaleVideo(int x, int y, int width, int height)
|
||||||
{
|
{
|
||||||
@ -3395,16 +3395,16 @@ void ScaleVideo(int x, int y, int width, int height)
|
|||||||
#ifdef USE_PIP
|
#ifdef USE_PIP
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Set PIP position.
|
** Set PIP position.
|
||||||
**
|
**
|
||||||
** @param x video window x coordinate OSD relative
|
** @param x video window x coordinate OSD relative
|
||||||
** @param y video window y coordinate OSD relative
|
** @param y video window y coordinate OSD relative
|
||||||
** @param width video window width OSD relative
|
** @param width video window width OSD relative
|
||||||
** @param height video window height OSD relative
|
** @param height video window height OSD relative
|
||||||
** @param pip_x pip window x coordinate OSD relative
|
** @param pip_x pip window x coordinate OSD relative
|
||||||
** @param pip_y pip window y coordinate OSD relative
|
** @param pip_y pip window y coordinate OSD relative
|
||||||
** @param pip_width pip window width OSD relative
|
** @param pip_width pip window width OSD relative
|
||||||
** @param pip_height pip window height OSD relative
|
** @param pip_height pip window height OSD relative
|
||||||
*/
|
*/
|
||||||
void PipSetPosition(int x, int y, int width, int height, int pip_x, int pip_y, int pip_width, int pip_height)
|
void PipSetPosition(int x, int y, int width, int height, int pip_x, int pip_y, int pip_width, int pip_height)
|
||||||
{
|
{
|
||||||
@ -3420,16 +3420,16 @@ void PipSetPosition(int x, int y, int width, int height, int pip_x, int pip_y, i
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Start PIP stream.
|
** Start PIP stream.
|
||||||
**
|
**
|
||||||
** @param x video window x coordinate OSD relative
|
** @param x video window x coordinate OSD relative
|
||||||
** @param y video window y coordinate OSD relative
|
** @param y video window y coordinate OSD relative
|
||||||
** @param width video window width OSD relative
|
** @param width video window width OSD relative
|
||||||
** @param height video window height OSD relative
|
** @param height video window height OSD relative
|
||||||
** @param pip_x pip window x coordinate OSD relative
|
** @param pip_x pip window x coordinate OSD relative
|
||||||
** @param pip_y pip window y coordinate OSD relative
|
** @param pip_y pip window y coordinate OSD relative
|
||||||
** @param pip_width pip window width OSD relative
|
** @param pip_width pip window width OSD relative
|
||||||
** @param pip_height pip window height OSD relative
|
** @param pip_height pip window height OSD relative
|
||||||
*/
|
*/
|
||||||
void PipStart(int x, int y, int width, int height, int pip_x, int pip_y, int pip_width, int pip_height)
|
void PipStart(int x, int y, int width, int height, int pip_x, int pip_y, int pip_width, int pip_height)
|
||||||
{
|
{
|
||||||
@ -3444,7 +3444,7 @@ void PipStart(int x, int y, int width, int height, int pip_x, int pip_y, int pip
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Stop PIP.
|
** Stop PIP.
|
||||||
*/
|
*/
|
||||||
void PipStop(void)
|
void PipStop(void)
|
||||||
{
|
{
|
||||||
@ -3464,12 +3464,12 @@ void PipStop(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** PIP play video packet.
|
** PIP play video packet.
|
||||||
**
|
**
|
||||||
** @param data data of exactly one complete PES packet
|
** @param data data of exactly one complete PES packet
|
||||||
** @param size size of PES packet
|
** @param size size of PES packet
|
||||||
**
|
**
|
||||||
** @return number of bytes used, 0 if internal buffer are full.
|
** @return number of bytes used, 0 if internal buffer are full.
|
||||||
*/
|
*/
|
||||||
int PipPlayVideo(const uint8_t * data, int size)
|
int PipPlayVideo(const uint8_t * data, int size)
|
||||||
{
|
{
|
||||||
|
76
video.c
76
video.c
@ -848,13 +848,13 @@ char *eglErrorString(EGLint error)
|
|||||||
void OSD_get_shared_context()
|
void OSD_get_shared_context()
|
||||||
{
|
{
|
||||||
eglMakeCurrent(eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, eglSharedContext);
|
eglMakeCurrent(eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, eglSharedContext);
|
||||||
EglCheck();
|
EglCheck();
|
||||||
}
|
}
|
||||||
|
|
||||||
void OSD_get_context()
|
void OSD_get_context()
|
||||||
{
|
{
|
||||||
eglMakeCurrent(eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, OSDcontext);
|
eglMakeCurrent(eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, OSDcontext);
|
||||||
EglCheck();
|
EglCheck();
|
||||||
}
|
}
|
||||||
|
|
||||||
void OSD_release_context()
|
void OSD_release_context()
|
||||||
@ -2855,11 +2855,12 @@ int get_RGB(CuvidDecoder * decoder)
|
|||||||
glActiveTexture(GL_TEXTURE0);
|
glActiveTexture(GL_TEXTURE0);
|
||||||
|
|
||||||
if (OsdShown && decoder->grab == 2) {
|
if (OsdShown && decoder->grab == 2) {
|
||||||
int x,y,h,w;
|
int x, y, h, w;
|
||||||
GLint texLoc;
|
GLint texLoc;
|
||||||
|
|
||||||
if (OsdShown == 1) {
|
if (OsdShown == 1) {
|
||||||
if (OSDtexture)
|
if (OSDtexture)
|
||||||
glDeleteTextures(1,&OSDtexture);
|
glDeleteTextures(1, &OSDtexture);
|
||||||
pthread_mutex_lock(&OSDMutex);
|
pthread_mutex_lock(&OSDMutex);
|
||||||
glGenTextures(1, &OSDtexture);
|
glGenTextures(1, &OSDtexture);
|
||||||
glBindTexture(GL_TEXTURE_2D, OSDtexture);
|
glBindTexture(GL_TEXTURE_2D, OSDtexture);
|
||||||
@ -2872,11 +2873,11 @@ int get_RGB(CuvidDecoder * decoder)
|
|||||||
OsdShown = 2;
|
OsdShown = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
y = OSDy*height/VideoWindowHeight;
|
y = OSDy * height / VideoWindowHeight;
|
||||||
x = OSDx*width/VideoWindowWidth;
|
x = OSDx * width / VideoWindowWidth;
|
||||||
h = OSDysize*height/VideoWindowHeight;
|
h = OSDysize * height / VideoWindowHeight;
|
||||||
w = OSDxsize*width/VideoWindowWidth;
|
w = OSDxsize * width / VideoWindowWidth;
|
||||||
glViewport(x,(height - h - y) , w, h);
|
glViewport(x, (height - h - y), w, h);
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
|
||||||
@ -3643,21 +3644,21 @@ void make_osd_overlay(int x, int y, int width, int height)
|
|||||||
// pl_tex_clear(p->gpu, pl->plane.texture, (float[4]) { 0 });
|
// pl_tex_clear(p->gpu, pl->plane.texture, (float[4]) { 0 });
|
||||||
pl_tex_destroy(p->gpu, &pl->plane.texture);
|
pl_tex_destroy(p->gpu, &pl->plane.texture);
|
||||||
}
|
}
|
||||||
|
|
||||||
// make texture for OSD
|
// make texture for OSD
|
||||||
if (pl->plane.texture == NULL ) {
|
if (pl->plane.texture == NULL) {
|
||||||
pl->plane.texture = pl_tex_create(p->gpu, &(struct pl_tex_params) {
|
pl->plane.texture = pl_tex_create(p->gpu, &(struct pl_tex_params) {
|
||||||
.w = width,
|
.w = width,
|
||||||
.h = height,
|
.h = height,
|
||||||
.d = 0,
|
.d = 0,
|
||||||
.format = fmt,
|
.format = fmt,
|
||||||
.sampleable = true,
|
.sampleable = true,
|
||||||
.host_writable = true,
|
.host_writable = true,
|
||||||
.blit_dst = true,
|
.blit_dst = true,
|
||||||
.sample_mode = PL_TEX_SAMPLE_LINEAR,
|
.sample_mode = PL_TEX_SAMPLE_LINEAR,
|
||||||
.address_mode = PL_TEX_ADDRESS_CLAMP,
|
.address_mode = PL_TEX_ADDRESS_CLAMP,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// make overlay
|
// make overlay
|
||||||
pl_tex_clear(p->gpu, pl->plane.texture, (float[4]) { 0 });
|
pl_tex_clear(p->gpu, pl->plane.texture, (float[4]) { 0 });
|
||||||
pl->plane.components = 4;
|
pl->plane.components = 4;
|
||||||
@ -3738,7 +3739,7 @@ static void CuvidDisplayFrame(void)
|
|||||||
// printf("Roundtrip Displayframe %d\n",diff);
|
// printf("Roundtrip Displayframe %d\n",diff);
|
||||||
if (diff < 5000 && diff > 0) {
|
if (diff < 5000 && diff > 0) {
|
||||||
// printf("Sleep %d\n",15000-diff);
|
// printf("Sleep %d\n",15000-diff);
|
||||||
usleep((5000 - diff)); // * 1000);
|
usleep((5000 - diff)); // * 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@ -3753,7 +3754,7 @@ static void CuvidDisplayFrame(void)
|
|||||||
pl_swapchain_swap_buffers(p->swapchain); // swap buffers
|
pl_swapchain_swap_buffers(p->swapchain); // swap buffers
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
first = 0;
|
first = 0;
|
||||||
last_time = GetusTicks();
|
last_time = GetusTicks();
|
||||||
|
|
||||||
@ -3878,12 +3879,13 @@ static void CuvidDisplayFrame(void)
|
|||||||
|
|
||||||
if (OsdShown && valid_frame) {
|
if (OsdShown && valid_frame) {
|
||||||
GLint texLoc;
|
GLint texLoc;
|
||||||
int x,y,w,h;
|
int x, y, w, h;
|
||||||
|
|
||||||
glBindTexture(GL_TEXTURE_2D, 0);
|
glBindTexture(GL_TEXTURE_2D, 0);
|
||||||
if (OsdShown == 1) {
|
if (OsdShown == 1) {
|
||||||
if (OSDtexture)
|
if (OSDtexture)
|
||||||
glDeleteTextures(1,&OSDtexture);
|
glDeleteTextures(1, &OSDtexture);
|
||||||
pthread_mutex_lock(&OSDMutex);
|
pthread_mutex_lock(&OSDMutex);
|
||||||
glGenTextures(1, &OSDtexture);
|
glGenTextures(1, &OSDtexture);
|
||||||
glBindTexture(GL_TEXTURE_2D, OSDtexture);
|
glBindTexture(GL_TEXTURE_2D, OSDtexture);
|
||||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, OSDxsize, OSDysize, 0, GL_RGBA, GL_UNSIGNED_BYTE, posd);
|
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, OSDxsize, OSDysize, 0, GL_RGBA, GL_UNSIGNED_BYTE, posd);
|
||||||
@ -3893,7 +3895,7 @@ static void CuvidDisplayFrame(void)
|
|||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER);
|
||||||
glFlush();
|
glFlush();
|
||||||
pthread_mutex_unlock(&OSDMutex);
|
pthread_mutex_unlock(&OSDMutex);
|
||||||
OsdShown = 2;
|
OsdShown = 2;
|
||||||
}
|
}
|
||||||
glBindTexture(GL_TEXTURE_2D, 0);
|
glBindTexture(GL_TEXTURE_2D, 0);
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
@ -3901,12 +3903,12 @@ static void CuvidDisplayFrame(void)
|
|||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
GlxCheck();
|
GlxCheck();
|
||||||
|
|
||||||
y = OSDy*VideoWindowHeight/OsdHeight;
|
y = OSDy * VideoWindowHeight / OsdHeight;
|
||||||
x = OSDx*VideoWindowWidth/OsdWidth;
|
x = OSDx * VideoWindowWidth / OsdWidth;
|
||||||
h = OSDysize*VideoWindowHeight/OsdHeight;
|
h = OSDysize * VideoWindowHeight / OsdHeight;
|
||||||
w = OSDxsize*VideoWindowWidth/OsdWidth;
|
w = OSDxsize * VideoWindowWidth / OsdWidth;
|
||||||
glViewport(x,(VideoWindowHeight - h - y) , w, h);
|
glViewport(x, (VideoWindowHeight - h - y), w, h);
|
||||||
|
|
||||||
if (gl_prog_osd == 0)
|
if (gl_prog_osd == 0)
|
||||||
gl_prog_osd = sc_generate_osd(gl_prog_osd); // generate shader programm
|
gl_prog_osd = sc_generate_osd(gl_prog_osd); // generate shader programm
|
||||||
|
|
||||||
@ -4704,7 +4706,7 @@ void ActivateOsd(GLuint texture, int x, int y, int xsize, int ysize)
|
|||||||
OSDy = y;
|
OSDy = y;
|
||||||
OSDxsize = xsize;
|
OSDxsize = xsize;
|
||||||
OSDysize = ysize;
|
OSDysize = ysize;
|
||||||
OsdShown = 1;
|
OsdShown = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
@ -5217,8 +5219,8 @@ static void VideoThreadExit(void)
|
|||||||
pthread_mutex_destroy(&OSDMutex);
|
pthread_mutex_destroy(&OSDMutex);
|
||||||
|
|
||||||
#ifndef PLACEBO
|
#ifndef PLACEBO
|
||||||
if (OSDtexture)
|
if (OSDtexture)
|
||||||
glDeleteTextures(1,&OSDtexture);
|
glDeleteTextures(1, &OSDtexture);
|
||||||
if (gl_prog_osd) {
|
if (gl_prog_osd) {
|
||||||
glDeleteProgram(gl_prog_osd);
|
glDeleteProgram(gl_prog_osd);
|
||||||
gl_prog_osd = 0;
|
gl_prog_osd = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user