mirror of
https://projects.vdr-developer.org/git/vdr-plugin-softhddevice.git
synced 2023-10-10 19:16:51 +02:00
Initial vdpau support.
This commit is contained in:
parent
37192d5b53
commit
afd7dfe402
12
Makefile
12
Makefile
@ -15,12 +15,18 @@ PLUGIN = softhddevice
|
|||||||
|
|
||||||
VERSION = $(shell grep 'static const char \*const VERSION *=' $(PLUGIN).cpp | awk '{ print $$7 }' | sed -e 's/[";]//g')
|
VERSION = $(shell grep 'static const char \*const VERSION *=' $(PLUGIN).cpp | awk '{ print $$7 }' | sed -e 's/[";]//g')
|
||||||
|
|
||||||
|
### Configuration (edit this for your needs)
|
||||||
|
|
||||||
|
CONFIG := -DDEBUG
|
||||||
|
CONFIG += $(shell pkg-config --exists libva && echo "-DUSE_VAAPI")
|
||||||
|
CONFIG += $(shell pkg-config --exists vdpau && echo "-DUSE_VDPAU")
|
||||||
|
|
||||||
### The C++ compiler and options:
|
### The C++ compiler and options:
|
||||||
|
|
||||||
CXX ?= g++
|
CXX ?= g++
|
||||||
CXXFLAGS ?= -g -O3 -W -Wall -Wextra -Woverloaded-virtual -fPIC
|
CXXFLAGS ?= -g -O2 -W -Wall -Wextra -Woverloaded-virtual -fPIC
|
||||||
override CXXFLAGS += $(DEFINES) $(INCLUDES)
|
override CXXFLAGS += $(DEFINES) $(INCLUDES)
|
||||||
CFLAGS ?= -g -O3 -W -Wall -Wextra -Winit-self \
|
CFLAGS ?= -g -O2 -W -Wall -Wextra -Winit-self \
|
||||||
-Wdeclaration-after-statement -fPIC
|
-Wdeclaration-after-statement -fPIC
|
||||||
#CFLAGS += -Werror
|
#CFLAGS += -Werror
|
||||||
override CFLAGS += $(DEFINES) $(INCLUDES) \
|
override CFLAGS += $(DEFINES) $(INCLUDES) \
|
||||||
@ -60,7 +66,7 @@ PACKAGE = vdr-$(ARCHIVE)
|
|||||||
|
|
||||||
INCLUDES += -I$(VDRDIR)/include
|
INCLUDES += -I$(VDRDIR)/include
|
||||||
|
|
||||||
DEFINES += -D_GNU_SOURCE -DPLUGIN_NAME_I18N='"$(PLUGIN)"'
|
DEFINES += $(CONFIG) -D_GNU_SOURCE -DPLUGIN_NAME_I18N='"$(PLUGIN)"'
|
||||||
|
|
||||||
### The object files (add further files here):
|
### The object files (add further files here):
|
||||||
|
|
||||||
|
4
audio.c
4
audio.c
@ -903,8 +903,10 @@ void AudioInit(void)
|
|||||||
int chan;
|
int chan;
|
||||||
|
|
||||||
#ifndef DEBUG
|
#ifndef DEBUG
|
||||||
// display alsa error messages
|
// disable display alsa error messages
|
||||||
snd_lib_error_set_handler(AlsaNoopCallback);
|
snd_lib_error_set_handler(AlsaNoopCallback);
|
||||||
|
#else
|
||||||
|
(void)AlsaNoopCallback;
|
||||||
#endif
|
#endif
|
||||||
AlsaRingBuffer = RingBufferNew(48000 * 8 * 2); // ~1s 8ch 16bit
|
AlsaRingBuffer = RingBufferNew(48000 * 8 * 2); // ~1s 8ch 16bit
|
||||||
|
|
||||||
|
4
codec.c
4
codec.c
@ -740,8 +740,10 @@ static void CodecNoopCallback( __attribute__ ((unused))
|
|||||||
void CodecInit(void)
|
void CodecInit(void)
|
||||||
{
|
{
|
||||||
#ifndef DEBUG
|
#ifndef DEBUG
|
||||||
// display ffmpeg error messages
|
// disable display ffmpeg error messages
|
||||||
av_log_set_callback(CodecNoopCallback);
|
av_log_set_callback(CodecNoopCallback);
|
||||||
|
#else
|
||||||
|
(void)CodecNoopCallback;
|
||||||
#endif
|
#endif
|
||||||
avcodec_register_all(); // register all formats and codecs
|
avcodec_register_all(); // register all formats and codecs
|
||||||
}
|
}
|
||||||
|
20
softhddev.c
20
softhddev.c
@ -42,8 +42,6 @@
|
|||||||
#include "video.h"
|
#include "video.h"
|
||||||
#include "codec.h"
|
#include "codec.h"
|
||||||
|
|
||||||
#define DEBUG
|
|
||||||
|
|
||||||
static char BrokenThreadsAndPlugins; ///< broken vdr threads and plugins
|
static char BrokenThreadsAndPlugins; ///< broken vdr threads and plugins
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
@ -246,7 +244,6 @@ static void VideoEnqueue(int64_t pts, const void *data, int size)
|
|||||||
avpkt = &VideoPacketRb[VideoPacketWrite];
|
avpkt = &VideoPacketRb[VideoPacketWrite];
|
||||||
if (!avpkt->stream_index) { // add pts only for first added
|
if (!avpkt->stream_index) { // add pts only for first added
|
||||||
avpkt->pts = pts;
|
avpkt->pts = pts;
|
||||||
avpkt->dts = pts;
|
|
||||||
}
|
}
|
||||||
if (avpkt->stream_index + size + FF_INPUT_BUFFER_PADDING_SIZE >=
|
if (avpkt->stream_index + size + FF_INPUT_BUFFER_PADDING_SIZE >=
|
||||||
avpkt->size) {
|
avpkt->size) {
|
||||||
@ -257,10 +254,12 @@ static void VideoEnqueue(int64_t pts, const void *data, int size)
|
|||||||
av_grow_packet(avpkt,
|
av_grow_packet(avpkt,
|
||||||
((size + FF_INPUT_BUFFER_PADDING_SIZE + VIDEO_BUFFER_SIZE / 2)
|
((size + FF_INPUT_BUFFER_PADDING_SIZE + VIDEO_BUFFER_SIZE / 2)
|
||||||
/ (VIDEO_BUFFER_SIZE / 2)) * (VIDEO_BUFFER_SIZE / 2));
|
/ (VIDEO_BUFFER_SIZE / 2)) * (VIDEO_BUFFER_SIZE / 2));
|
||||||
|
#ifdef DEBUG
|
||||||
if (avpkt->size <
|
if (avpkt->size <
|
||||||
avpkt->stream_index + size + FF_INPUT_BUFFER_PADDING_SIZE) {
|
avpkt->stream_index + size + FF_INPUT_BUFFER_PADDING_SIZE) {
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#ifdef xxDEBUG
|
#ifdef xxDEBUG
|
||||||
if (!avpkt->stream_index) { // debug save time of first packet
|
if (!avpkt->stream_index) { // debug save time of first packet
|
||||||
@ -542,7 +541,21 @@ int PlayVideo(const uint8_t * data, int size)
|
|||||||
pts =
|
pts =
|
||||||
(int64_t) (data[9] & 0x0E) << 29 | data[10] << 22 | (data[11] &
|
(int64_t) (data[9] & 0x0E) << 29 | data[10] << 22 | (data[11] &
|
||||||
0xFE) << 14 | data[12] << 7 | (data[13] & 0xFE) >> 1;
|
0xFE) << 14 | data[12] << 7 | (data[13] & 0xFE) >> 1;
|
||||||
|
#ifdef DEBUG
|
||||||
//Debug(3, "video: pts %#012" PRIx64 "\n", pts);
|
//Debug(3, "video: pts %#012" PRIx64 "\n", pts);
|
||||||
|
if (data[13] != (((pts & 0x7F) << 1) | 1)) {
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
if (data[12] != ((pts >> 7) & 0xFF)) {
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
if (data[11] != ((((pts >> 15) & 0x7F) << 1) | 1)) {
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
if (data[10] != ((pts >> 22) & 0xFF)) {
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
// FIXME: no valid mpeg2/h264 detection yet
|
// FIXME: no valid mpeg2/h264 detection yet
|
||||||
|
|
||||||
@ -627,6 +640,7 @@ void SetPlayMode(void)
|
|||||||
void Clear(void)
|
void Clear(void)
|
||||||
{
|
{
|
||||||
VideoClearBuffers = 1;
|
VideoClearBuffers = 1;
|
||||||
|
// FIXME: avcodec_flush_buffers
|
||||||
// FIXME: flush audio buffers
|
// FIXME: flush audio buffers
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user