mirror of
				https://github.com/jojo61/vdr-plugin-softhdcuvid.git
				synced 2025-03-01 10:39:28 +00:00 
			
		
		
		
	Compare commits
	
		
			43 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					2c8e75e3ff | ||
| 
						 | 
					e3fe68d7e6 | ||
| 
						 | 
					41da5ca526 | ||
| 
						 | 
					68fc7e4511 | ||
| 
						 | 
					46df18afe0 | ||
| 
						 | 
					0ff83f0e31 | ||
| 
						 | 
					230bb5ca11 | ||
| 
						 | 
					f026e8e86d | ||
| 
						 | 
					9dd936df86 | ||
| 
						 | 
					4e5529efcf | ||
| 
						 | 
					20f1bd45e6 | ||
| 
						 | 
					7a7e09ff7a | ||
| 
						 | 
					c4a660ede2 | ||
| 
						 | 
					8e495266e2 | ||
| 
						 | 
					f27e4fb35f | ||
| 
						 | 
					e14ea73a00 | ||
| 
						 | 
					72cb77f771 | ||
| 
						 | 
					c679d812d1 | ||
| 
						 | 
					47b461ab46 | ||
| 
						 | 
					8629946041 | ||
| 
						 | 
					a222f6a1d5 | ||
| 
						 | 
					b51589aaa9 | ||
| 
						 | 
					c3af54aae0 | ||
| 
						 | 
					7e387fa3f1 | ||
| 
						 | 
					f3e5a14fdf | ||
| 
						 | 
					aa0c2f80e4 | ||
| 
						 | 
					215f251572 | ||
| 
						 | 
					a425ec94e0 | ||
| 
						 | 
					91961bdffe | ||
| 
						 | 
					f741dff042 | ||
| 
						 | 
					7a31761c89 | ||
| 
						 | 
					d5ca73c22f | ||
| 
						 | 
					6704b2ca5a | ||
| 
						 | 
					e0bbaceec0 | ||
| 
						 | 
					45043b9ffc | ||
| 
						 | 
					a56b3737c7 | ||
| 
						 | 
					e59eeba0d2 | ||
| 
						 | 
					838dfab45b | ||
| 
						 | 
					ddd44e6f62 | ||
| 
						 | 
					1390139cbd | ||
| 
						 | 
					f72653c3c1 | ||
| 
						 | 
					4e96489e35 | ||
| 
						 | 
					65017da5ac | 
							
								
								
									
										24
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										24
									
								
								Makefile
									
									
									
									
									
								
							@@ -24,18 +24,17 @@ DRM ?= 0
 | 
			
		||||
 | 
			
		||||
# use libplacebo -
 | 
			
		||||
# available for all decoders but for DRM you need LIBPLACEBO_GL
 | 
			
		||||
LIBPLACEBO ?= 1
 | 
			
		||||
LIBPLACEBO ?= 0
 | 
			
		||||
LIBPLACEBO_GL ?= 0
 | 
			
		||||
 | 
			
		||||
# use YADIF deint - only available with cuvid
 | 
			
		||||
#YADIF = 1
 | 
			
		||||
YADIF = 1
 | 
			
		||||
 | 
			
		||||
# use gamma correction
 | 
			
		||||
#GAMMA ?= 0
 | 
			
		||||
 | 
			
		||||
CONFIG := -DDEBUG 		# remove '#' to enable debug output
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#--------------------- no more config needed past this point--------------------------------
 | 
			
		||||
 | 
			
		||||
# sanitize selections --------
 | 
			
		||||
@@ -114,8 +113,8 @@ TMPDIR ?= /tmp
 | 
			
		||||
 | 
			
		||||
### The compiler options:
 | 
			
		||||
 | 
			
		||||
export CFLAGS	= $(call PKGCFG,cflags)
 | 
			
		||||
export CXXFLAGS = $(call PKGCFG,cxxflags)
 | 
			
		||||
export CFLAGS	= $(call PKGCFG,cflags) -fpermissive
 | 
			
		||||
export CXXFLAGS = $(call PKGCFG,cxxflags) -fpermissive
 | 
			
		||||
 | 
			
		||||
ifeq ($(CFLAGS),)
 | 
			
		||||
$(warning CFLAGS not set)
 | 
			
		||||
@@ -159,29 +158,29 @@ endif
 | 
			
		||||
 | 
			
		||||
ifeq ($(LIBPLACEBO_GL),1)
 | 
			
		||||
CONFIG += -DPLACEBO_GL -DPLACEBO
 | 
			
		||||
LIBS += -lepoxy
 | 
			
		||||
LIBS += -lplacebo
 | 
			
		||||
_CFLAGS += $(shell pkg-config --cflags libplacebo)
 | 
			
		||||
LIBS += $(shell pkg-config --libs epoxy libplacebo)
 | 
			
		||||
else
 | 
			
		||||
LIBS += -lEGL
 | 
			
		||||
LIBS += $(shell pkg-config --libs egl)
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
ifeq ($(LIBPLACEBO),1)
 | 
			
		||||
CONFIG += -DPLACEBO
 | 
			
		||||
LIBS += -lEGL
 | 
			
		||||
LIBS += -lplacebo
 | 
			
		||||
_CFLAGS += $(shell pkg-config --cflags libplacebo)
 | 
			
		||||
LIBS += $(shell pkg-config --libs egl libplacebo)
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
ifeq ($(DRM),1)
 | 
			
		||||
PLUGIN = softhddrm
 | 
			
		||||
CONFIG += -DUSE_DRM -DVAAPI
 | 
			
		||||
_CFLAGS += $(shell pkg-config --cflags libdrm)
 | 
			
		||||
LIBS += -lgbm -ldrm -lEGL
 | 
			
		||||
LIBS += $(shell pkg-config --libs egl gbm libdrm)
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
ifeq ($(CUVID),1)
 | 
			
		||||
#CONFIG += -DUSE_PIP			# PIP support
 | 
			
		||||
CONFIG += -DCUVID			# enable CUVID decoder
 | 
			
		||||
LIBS += -lEGL -lGL
 | 
			
		||||
LIBS += $(shell pkg-config --libs egl gl)
 | 
			
		||||
ifeq ($(YADIF),1)
 | 
			
		||||
CONFIG += -DYADIF			# Yadif only with CUVID
 | 
			
		||||
endif
 | 
			
		||||
@@ -274,6 +273,7 @@ LIBS += -lcuda -lnvcuvid
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
LIBS += -lGLEW -lGLU  -ldl -lglut
 | 
			
		||||
#LIBS += -ldl $(shell pkg-config --libs glew glu glut)
 | 
			
		||||
 | 
			
		||||
### Includes and Defines (add further entries here):
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										10
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								README.md
									
									
									
									
									
								
							@@ -82,9 +82,6 @@ You have to adapt the Makefile. There are 3 possible Version that you can build:
 | 
			
		||||
    runs without X Server. There are several commandline options to select the resolution and refresh rate.
 | 
			
		||||
    I recommend to use libplacebo and set LIBPLACEBO_GL=1 in the Makefile.
 | 
			
		||||
 | 
			
		||||
    You should use the following libplacebo Version:
 | 
			
		||||
	https://github.com/haasn/libplacebo/archive/f2c4da9d6121bb330c9fff640aad40e98c081190.zip
 | 
			
		||||
	Newer Versions may not work.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Install:
 | 
			
		||||
@@ -123,6 +120,9 @@ Beginners Guide for libplacebo:
 | 
			
		||||
 | 
			
		||||
    All other settings can be in their default state.
 | 
			
		||||
 | 
			
		||||
	Note for NUC11/12 Users:
 | 
			
		||||
	Provide paramete -w alsa-no-test to get Audio working.
 | 
			
		||||
 | 
			
		||||
    Beginning with libplacebo API 58 user shaders from mpv are supported. Use -S parameter to set the shader.
 | 
			
		||||
    The plugins searches the shaders in $ConfigDir/plugins/shaders for the shaders. One example shader is
 | 
			
		||||
    provided in the shader subdirectory. Copy it to e.g.: /etc/vdr/plugins/shaders and then start
 | 
			
		||||
@@ -251,8 +251,8 @@ Setup: /etc/vdr/setup.conf
 | 
			
		||||
	(Red * 65536 +  Green * 256 + Blue)
 | 
			
		||||
 | 
			
		||||
	softhddevice.StudioLevels = 0
 | 
			
		||||
		0 use PC levels (0-255) with vdpau.
 | 
			
		||||
		1 use studio levels (16-235) with vdpau.
 | 
			
		||||
	0 use limited RGB (16-235) with vdpau.
 | 
			
		||||
	1 use full RGB (0-255) with vdpau.
 | 
			
		||||
 | 
			
		||||
	softhddevice.Suspend.Close = 0
 | 
			
		||||
	1 suspend closes x11 window, connection and audio device.
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										256
									
								
								audio.c
									
									
									
									
									
								
							
							
						
						
									
										256
									
								
								audio.c
									
									
									
									
									
								
							@@ -93,6 +93,7 @@ static const AudioModule NoopModule; ///< forward definition of noop module
 | 
			
		||||
//  Variables
 | 
			
		||||
//----------------------------------------------------------------------------
 | 
			
		||||
 | 
			
		||||
char AudioAlsaNotest;          ///< disable Audio capbility test
 | 
			
		||||
char AudioAlsaDriverBroken;   ///< disable broken driver message
 | 
			
		||||
char AudioAlsaNoCloseOpen;    ///< disable alsa close/open fix
 | 
			
		||||
char AudioAlsaCloseOpenDelay; ///< enable alsa close/open delay fix
 | 
			
		||||
@@ -2187,143 +2188,150 @@ found:
 | 
			
		||||
    AudioRingInit();
 | 
			
		||||
    AudioUsedModule->Init();
 | 
			
		||||
 | 
			
		||||
#if 1
 | 
			
		||||
    for (u = 0; u < AudioRatesMax; ++u) {
 | 
			
		||||
    if (AudioAlsaNotest) {
 | 
			
		||||
        for (u = 0; u < AudioRatesMax; ++u) {
 | 
			
		||||
        
 | 
			
		||||
        AudioChannelMatrix[u][1]=AudioChannelMatrix[u][2]=AudioChannelMatrix[u][3]=AudioChannelMatrix[u][4]=\
 | 
			
		||||
        AudioChannelMatrix[u][5]=AudioChannelMatrix[u][6]=AudioChannelMatrix[u][7]=AudioChannelMatrix[u][8]=2;
 | 
			
		||||
        //printf("audio: %6dHz supports %d %d %d %d %d %d %d %d channels\n", AudioRatesTable[u],
 | 
			
		||||
        //    AudioChannelMatrix[u][1], AudioChannelMatrix[u][2], AudioChannelMatrix[u][3], AudioChannelMatrix[u][4],
 | 
			
		||||
        //    AudioChannelMatrix[u][5], AudioChannelMatrix[u][6], AudioChannelMatrix[u][7], AudioChannelMatrix[u][8]);
 | 
			
		||||
            AudioChannelMatrix[u][1]=AudioChannelMatrix[u][2]=2;
 | 
			
		||||
            AudioChannelMatrix[u][3]=AudioChannelMatrix[u][4]=4;
 | 
			
		||||
            AudioChannelMatrix[u][5]=AudioChannelMatrix[u][6]=6;
 | 
			
		||||
            AudioChannelMatrix[u][7]=AudioChannelMatrix[u][8]=8;
 | 
			
		||||
            printf("audio: %6dHz supports %d %d %d %d %d %d %d %d channels\n", AudioRatesTable[u],
 | 
			
		||||
                AudioChannelMatrix[u][1], AudioChannelMatrix[u][2], AudioChannelMatrix[u][3], AudioChannelMatrix[u][4],
 | 
			
		||||
                AudioChannelMatrix[u][5], AudioChannelMatrix[u][6], AudioChannelMatrix[u][7], AudioChannelMatrix[u][8]);
 | 
			
		||||
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        AudioChannelsInHw[1]=AudioChannelsInHw[3]=AudioChannelsInHw[4]=AudioChannelsInHw[5]=AudioChannelsInHw[6]=AudioChannelsInHw[7]=AudioChannelsInHw[8]=0;
 | 
			
		||||
        AudioChannelsInHw[2]=2;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    AudioChannelsInHw[1]=AudioChannelsInHw[3]=AudioChannelsInHw[4]=AudioChannelsInHw[5]=AudioChannelsInHw[6]=AudioChannelsInHw[7]=AudioChannelsInHw[8]=0;
 | 
			
		||||
    AudioChannelsInHw[2]=2;
 | 
			
		||||
 | 
			
		||||
#else
 | 
			
		||||
    //
 | 
			
		||||
    //	Check which channels/rates/formats are supported
 | 
			
		||||
    //	FIXME: we force 44.1Khz and 48Khz must be supported equal
 | 
			
		||||
    //	FIXME: should use bitmap of channels supported in RatesInHw
 | 
			
		||||
    //	FIXME: use loop over sample-rates
 | 
			
		||||
    freq = 44100;
 | 
			
		||||
    AudioRatesInHw[Audio44100] = 0;
 | 
			
		||||
    for (chan = 1; chan < 9; ++chan) {
 | 
			
		||||
        int tchan;
 | 
			
		||||
        int tfreq;
 | 
			
		||||
 | 
			
		||||
        tchan = chan;
 | 
			
		||||
        tfreq = freq;
 | 
			
		||||
        if (AudioUsedModule->Setup(&tfreq, &tchan, 0)) {
 | 
			
		||||
            AudioChannelsInHw[chan] = 0;
 | 
			
		||||
        } else {
 | 
			
		||||
            AudioChannelsInHw[chan] = chan;
 | 
			
		||||
            AudioRatesInHw[Audio44100] |= (1 << chan);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    freq = 48000;
 | 
			
		||||
    AudioRatesInHw[Audio48000] = 0;
 | 
			
		||||
    for (chan = 1; chan < 9; ++chan) {
 | 
			
		||||
        int tchan;
 | 
			
		||||
        int tfreq;
 | 
			
		||||
 | 
			
		||||
        if (!AudioChannelsInHw[chan]) {
 | 
			
		||||
            continue;
 | 
			
		||||
        }
 | 
			
		||||
        tchan = chan;
 | 
			
		||||
        tfreq = freq;
 | 
			
		||||
        if (AudioUsedModule->Setup(&tfreq, &tchan, 0)) {
 | 
			
		||||
            // AudioChannelsInHw[chan] = 0;
 | 
			
		||||
        } else {
 | 
			
		||||
            AudioChannelsInHw[chan] = chan;
 | 
			
		||||
            AudioRatesInHw[Audio48000] |= (1 << chan);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    freq = 192000;
 | 
			
		||||
    AudioRatesInHw[Audio192000] = 0;
 | 
			
		||||
    for (chan = 1; chan < 9; ++chan) {
 | 
			
		||||
        int tchan;
 | 
			
		||||
        int tfreq;
 | 
			
		||||
 | 
			
		||||
        if (!AudioChannelsInHw[chan]) {
 | 
			
		||||
            continue;
 | 
			
		||||
        }
 | 
			
		||||
        tchan = chan;
 | 
			
		||||
        tfreq = freq;
 | 
			
		||||
        if (AudioUsedModule->Setup(&tfreq, &tchan, 0)) {
 | 
			
		||||
            // AudioChannelsInHw[chan] = 0;
 | 
			
		||||
        } else {
 | 
			
		||||
            AudioChannelsInHw[chan] = chan;
 | 
			
		||||
            AudioRatesInHw[Audio192000] |= (1 << chan);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    //	build channel support and conversion table
 | 
			
		||||
    for (u = 0; u < AudioRatesMax; ++u) {
 | 
			
		||||
    else {
 | 
			
		||||
        //
 | 
			
		||||
        //	Check which channels/rates/formats are supported
 | 
			
		||||
        //	FIXME: we force 44.1Khz and 48Khz must be supported equal
 | 
			
		||||
        //	FIXME: should use bitmap of channels supported in RatesInHw
 | 
			
		||||
        //	FIXME: use loop over sample-rates
 | 
			
		||||
        freq = 44100;
 | 
			
		||||
        AudioRatesInHw[Audio44100] = 0;
 | 
			
		||||
        for (chan = 1; chan < 9; ++chan) {
 | 
			
		||||
            AudioChannelMatrix[u][chan] = 0;
 | 
			
		||||
            if (!AudioRatesInHw[u]) { // rate unsupported
 | 
			
		||||
            int tchan;
 | 
			
		||||
            int tfreq;
 | 
			
		||||
 | 
			
		||||
            tchan = chan;
 | 
			
		||||
            tfreq = freq;
 | 
			
		||||
            if (AudioUsedModule->Setup(&tfreq, &tchan, 0)) {
 | 
			
		||||
                AudioChannelsInHw[chan] = 0;
 | 
			
		||||
            } else {
 | 
			
		||||
                AudioChannelsInHw[chan] = chan;
 | 
			
		||||
                AudioRatesInHw[Audio44100] |= (1 << chan);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        freq = 48000;
 | 
			
		||||
        AudioRatesInHw[Audio48000] = 0;
 | 
			
		||||
        for (chan = 1; chan < 9; ++chan) {
 | 
			
		||||
            int tchan;
 | 
			
		||||
            int tfreq;
 | 
			
		||||
 | 
			
		||||
            if (!AudioChannelsInHw[chan]) {
 | 
			
		||||
                continue;
 | 
			
		||||
            }
 | 
			
		||||
            if (AudioChannelsInHw[chan]) {
 | 
			
		||||
                AudioChannelMatrix[u][chan] = chan;
 | 
			
		||||
            tchan = chan;
 | 
			
		||||
            tfreq = freq;
 | 
			
		||||
            if (AudioUsedModule->Setup(&tfreq, &tchan, 0)) {
 | 
			
		||||
                // AudioChannelsInHw[chan] = 0;
 | 
			
		||||
            } else {
 | 
			
		||||
                switch (chan) {
 | 
			
		||||
                    case 1:
 | 
			
		||||
                        if (AudioChannelsInHw[2]) {
 | 
			
		||||
                            AudioChannelMatrix[u][chan] = 2;
 | 
			
		||||
                        }
 | 
			
		||||
                        break;
 | 
			
		||||
                    case 2:
 | 
			
		||||
                    case 3:
 | 
			
		||||
                        if (AudioChannelsInHw[4]) {
 | 
			
		||||
                            AudioChannelMatrix[u][chan] = 4;
 | 
			
		||||
                AudioChannelsInHw[chan] = chan;
 | 
			
		||||
                AudioRatesInHw[Audio48000] |= (1 << chan);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        freq = 192000;
 | 
			
		||||
        AudioRatesInHw[Audio192000] = 0;
 | 
			
		||||
        for (chan = 1; chan < 9; ++chan) {
 | 
			
		||||
            int tchan;
 | 
			
		||||
            int tfreq;
 | 
			
		||||
 | 
			
		||||
            if (!AudioChannelsInHw[chan]) {
 | 
			
		||||
                continue;
 | 
			
		||||
            }
 | 
			
		||||
            tchan = chan;
 | 
			
		||||
            tfreq = freq;
 | 
			
		||||
            if (AudioUsedModule->Setup(&tfreq, &tchan, 0)) {
 | 
			
		||||
                // AudioChannelsInHw[chan] = 0;
 | 
			
		||||
            } else {
 | 
			
		||||
                AudioChannelsInHw[chan] = chan;
 | 
			
		||||
                AudioRatesInHw[Audio192000] |= (1 << chan);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        //	build channel support and conversion table
 | 
			
		||||
        for (u = 0; u < AudioRatesMax; ++u) {
 | 
			
		||||
            for (chan = 1; chan < 9; ++chan) {
 | 
			
		||||
                AudioChannelMatrix[u][chan] = 0;
 | 
			
		||||
                if (!AudioRatesInHw[u]) { // rate unsupported
 | 
			
		||||
                    continue;
 | 
			
		||||
                }
 | 
			
		||||
                if (AudioChannelsInHw[chan]) {
 | 
			
		||||
                    AudioChannelMatrix[u][chan] = chan;
 | 
			
		||||
                } else {
 | 
			
		||||
                    switch (chan) {
 | 
			
		||||
                        case 1:
 | 
			
		||||
                            if (AudioChannelsInHw[2]) {
 | 
			
		||||
                                AudioChannelMatrix[u][chan] = 2;
 | 
			
		||||
                            }
 | 
			
		||||
                            break;
 | 
			
		||||
                        }
 | 
			
		||||
                    case 4:
 | 
			
		||||
                        if (AudioChannelsInHw[5]) {
 | 
			
		||||
                            AudioChannelMatrix[u][chan] = 5;
 | 
			
		||||
                        case 2:
 | 
			
		||||
                        case 3:
 | 
			
		||||
                            if (AudioChannelsInHw[4]) {
 | 
			
		||||
                                AudioChannelMatrix[u][chan] = 4;
 | 
			
		||||
                                break;
 | 
			
		||||
                            }
 | 
			
		||||
                            __attribute__ ((fallthrough));
 | 
			
		||||
                        case 4:
 | 
			
		||||
                            if (AudioChannelsInHw[5]) {
 | 
			
		||||
                                AudioChannelMatrix[u][chan] = 5;
 | 
			
		||||
                                break;
 | 
			
		||||
                            }
 | 
			
		||||
                            __attribute__ ((fallthrough));
 | 
			
		||||
                        case 5:
 | 
			
		||||
                            if (AudioChannelsInHw[6]) {
 | 
			
		||||
                                AudioChannelMatrix[u][chan] = 6;
 | 
			
		||||
                                break;
 | 
			
		||||
                            }
 | 
			
		||||
                            __attribute__ ((fallthrough));
 | 
			
		||||
                        case 6:
 | 
			
		||||
                            if (AudioChannelsInHw[7]) {
 | 
			
		||||
                                AudioChannelMatrix[u][chan] = 7;
 | 
			
		||||
                                break;
 | 
			
		||||
                            }
 | 
			
		||||
                            __attribute__ ((fallthrough));
 | 
			
		||||
                        case 7:
 | 
			
		||||
                            if (AudioChannelsInHw[8]) {
 | 
			
		||||
                                AudioChannelMatrix[u][chan] = 8;
 | 
			
		||||
                                break;
 | 
			
		||||
                            }
 | 
			
		||||
                            __attribute__ ((fallthrough));
 | 
			
		||||
                        case 8:
 | 
			
		||||
                            if (AudioChannelsInHw[6]) {
 | 
			
		||||
                                AudioChannelMatrix[u][chan] = 6;
 | 
			
		||||
                                break;
 | 
			
		||||
                            }
 | 
			
		||||
                            if (AudioChannelsInHw[2]) {
 | 
			
		||||
                                AudioChannelMatrix[u][chan] = 2;
 | 
			
		||||
                                break;
 | 
			
		||||
                            }
 | 
			
		||||
                            if (AudioChannelsInHw[1]) {
 | 
			
		||||
                                AudioChannelMatrix[u][chan] = 1;
 | 
			
		||||
                                break;
 | 
			
		||||
                            }
 | 
			
		||||
                            break;
 | 
			
		||||
                        }
 | 
			
		||||
                    case 5:
 | 
			
		||||
                        if (AudioChannelsInHw[6]) {
 | 
			
		||||
                            AudioChannelMatrix[u][chan] = 6;
 | 
			
		||||
                            break;
 | 
			
		||||
                        }
 | 
			
		||||
                    case 6:
 | 
			
		||||
                        if (AudioChannelsInHw[7]) {
 | 
			
		||||
                            AudioChannelMatrix[u][chan] = 7;
 | 
			
		||||
                            break;
 | 
			
		||||
                        }
 | 
			
		||||
                    case 7:
 | 
			
		||||
                        if (AudioChannelsInHw[8]) {
 | 
			
		||||
                            AudioChannelMatrix[u][chan] = 8;
 | 
			
		||||
                            break;
 | 
			
		||||
                        }
 | 
			
		||||
                    case 8:
 | 
			
		||||
                        if (AudioChannelsInHw[6]) {
 | 
			
		||||
                            AudioChannelMatrix[u][chan] = 6;
 | 
			
		||||
                            break;
 | 
			
		||||
                        }
 | 
			
		||||
                        if (AudioChannelsInHw[2]) {
 | 
			
		||||
                            AudioChannelMatrix[u][chan] = 2;
 | 
			
		||||
                            break;
 | 
			
		||||
                        }
 | 
			
		||||
                        if (AudioChannelsInHw[1]) {
 | 
			
		||||
                            AudioChannelMatrix[u][chan] = 1;
 | 
			
		||||
                            break;
 | 
			
		||||
                        }
 | 
			
		||||
                        break;
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        for (u = 0; u < AudioRatesMax; ++u) {
 | 
			
		||||
            Debug(3,"audio: %6dHz supports %d %d %d %d %d %d %d %d channels\n", AudioRatesTable[u],
 | 
			
		||||
                AudioChannelMatrix[u][1], AudioChannelMatrix[u][2], AudioChannelMatrix[u][3], AudioChannelMatrix[u][4],
 | 
			
		||||
                AudioChannelMatrix[u][5], AudioChannelMatrix[u][6], AudioChannelMatrix[u][7], AudioChannelMatrix[u][8]);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    for (u = 0; u < AudioRatesMax; ++u) {
 | 
			
		||||
        Info(_("audio: %6dHz supports %d %d %d %d %d %d %d %d channels\n"), AudioRatesTable[u],
 | 
			
		||||
             AudioChannelMatrix[u][1], AudioChannelMatrix[u][2], AudioChannelMatrix[u][3], AudioChannelMatrix[u][4],
 | 
			
		||||
             AudioChannelMatrix[u][5], AudioChannelMatrix[u][6], AudioChannelMatrix[u][7], AudioChannelMatrix[u][8]);
 | 
			
		||||
    }
 | 
			
		||||
#endif
 | 
			
		||||
#ifdef USE_AUDIO_THREAD
 | 
			
		||||
    if (AudioUsedModule->Thread) { // supports threads
 | 
			
		||||
        AudioInitThread();
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										1
									
								
								audio.h
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								audio.h
									
									
									
									
									
								
							@@ -60,6 +60,7 @@ extern void AudioExit(void);               ///< cleanup and exit audio module
 | 
			
		||||
//  Variables
 | 
			
		||||
//----------------------------------------------------------------------------
 | 
			
		||||
 | 
			
		||||
extern char AudioAlsaNotest;         ///< disable Alsa capability test
 | 
			
		||||
extern char AudioAlsaDriverBroken;   ///< disable broken driver message
 | 
			
		||||
extern char AudioAlsaNoCloseOpen;    ///< disable alsa close/open fix
 | 
			
		||||
extern char AudioAlsaCloseOpenDelay; ///< enable alsa close/open delay fix
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										153
									
								
								codec.c
									
									
									
									
									
								
							
							
						
						
									
										153
									
								
								codec.c
									
									
									
									
									
								
							@@ -125,7 +125,7 @@ struct _video_decoder_
 | 
			
		||||
*/
 | 
			
		||||
static enum AVPixelFormat Codec_get_format(AVCodecContext *video_ctx, const enum AVPixelFormat *fmt) {
 | 
			
		||||
    VideoDecoder *decoder;
 | 
			
		||||
    enum AVPixelFormat fmt1;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    decoder = video_ctx->opaque;
 | 
			
		||||
    // bug in ffmpeg 1.1.1, called with zero width or height
 | 
			
		||||
@@ -208,9 +208,13 @@ void CodecVideoDelDecoder(VideoDecoder *decoder) { free(decoder); }
 | 
			
		||||
**  @param codec_id video codec id
 | 
			
		||||
*/
 | 
			
		||||
void CodecVideoOpen(VideoDecoder *decoder, int codec_id) {
 | 
			
		||||
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(59,0,100)
 | 
			
		||||
    AVCodec *video_codec;
 | 
			
		||||
#else
 | 
			
		||||
    const AVCodec *video_codec;
 | 
			
		||||
#endif
 | 
			
		||||
    const char *name;
 | 
			
		||||
    int ret, deint = 2;
 | 
			
		||||
    int ret;
 | 
			
		||||
 | 
			
		||||
    Debug(3, "***************codec: Video Open using video codec ID %#06x (%s)\n", codec_id,
 | 
			
		||||
          avcodec_get_name(codec_id));
 | 
			
		||||
@@ -260,14 +264,12 @@ void CodecVideoOpen(VideoDecoder *decoder, int codec_id) {
 | 
			
		||||
 | 
			
		||||
    decoder->VideoCtx->pkt_timebase.num = 1;
 | 
			
		||||
    decoder->VideoCtx->pkt_timebase.den = 90000;
 | 
			
		||||
    decoder->VideoCtx->framerate.num = 50;
 | 
			
		||||
    decoder->VideoCtx->framerate.den = 1;
 | 
			
		||||
    //decoder->VideoCtx->framerate.num = 50;
 | 
			
		||||
    //decoder->VideoCtx->framerate.den = 1;
 | 
			
		||||
 | 
			
		||||
    pthread_mutex_lock(&CodecLockMutex);
 | 
			
		||||
    // open codec
 | 
			
		||||
#ifdef YADIF
 | 
			
		||||
    deint = 2;
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#if defined VAAPI
 | 
			
		||||
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(59,8,100)
 | 
			
		||||
@@ -305,18 +307,19 @@ void CodecVideoOpen(VideoDecoder *decoder, int codec_id) {
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifdef CUVID
 | 
			
		||||
    int deint = 2;
 | 
			
		||||
    if (strcmp(decoder->VideoCodec->long_name,
 | 
			
		||||
               "Nvidia CUVID MPEG2VIDEO decoder") == 0) { // deinterlace for mpeg2 is somehow broken
 | 
			
		||||
        if (av_opt_set_int(decoder->VideoCtx->priv_data, "deint", deint, 0) < 0) { // adaptive
 | 
			
		||||
            pthread_mutex_unlock(&CodecLockMutex);
 | 
			
		||||
            Fatal(_("codec: can't set option deint to video codec!\n"));
 | 
			
		||||
        }
 | 
			
		||||
#if 1
 | 
			
		||||
        if (av_opt_set_int(decoder->VideoCtx->priv_data, "surfaces", 9, 0) < 0) {
 | 
			
		||||
 | 
			
		||||
        if (av_opt_set_int(decoder->VideoCtx->priv_data, "surfaces", 10, 0) < 0) {
 | 
			
		||||
            pthread_mutex_unlock(&CodecLockMutex);
 | 
			
		||||
            Fatal(_("codec: can't set option surfces to video codec!\n"));
 | 
			
		||||
        }
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
        if (av_opt_set(decoder->VideoCtx->priv_data, "drop_second_field", "false", 0) < 0) {
 | 
			
		||||
            pthread_mutex_unlock(&CodecLockMutex);
 | 
			
		||||
            Fatal(_("codec: can't set option drop 2.field to video codec!\n"));
 | 
			
		||||
@@ -326,12 +329,10 @@ void CodecVideoOpen(VideoDecoder *decoder, int codec_id) {
 | 
			
		||||
            pthread_mutex_unlock(&CodecLockMutex);
 | 
			
		||||
            Fatal(_("codec: can't set option deint to video codec!\n"));
 | 
			
		||||
        }
 | 
			
		||||
#if 1
 | 
			
		||||
        if (av_opt_set_int(decoder->VideoCtx->priv_data, "surfaces", 13, 0) < 0) {
 | 
			
		||||
            pthread_mutex_unlock(&CodecLockMutex);
 | 
			
		||||
            Fatal(_("codec: can't set option surfces to video codec!\n"));
 | 
			
		||||
        }
 | 
			
		||||
#endif
 | 
			
		||||
        if (av_opt_set(decoder->VideoCtx->priv_data, "drop_second_field", "false", 0) < 0) {
 | 
			
		||||
            pthread_mutex_unlock(&CodecLockMutex);
 | 
			
		||||
            Fatal(_("codec: can't set option drop 2.field  to video codec!\n"));
 | 
			
		||||
@@ -391,15 +392,19 @@ void CodecVideoClose(VideoDecoder *video_decoder) {
 | 
			
		||||
    Debug(3, "CodecVideoClose\n");
 | 
			
		||||
    if (video_decoder->VideoCtx) {
 | 
			
		||||
        pthread_mutex_lock(&CodecLockMutex);
 | 
			
		||||
#if 1
 | 
			
		||||
 | 
			
		||||
        frame = av_frame_alloc();
 | 
			
		||||
        avcodec_send_packet(video_decoder->VideoCtx, NULL);
 | 
			
		||||
        while (avcodec_receive_frame(video_decoder->VideoCtx, frame) >= 0)
 | 
			
		||||
            ;
 | 
			
		||||
        av_frame_free(&frame);
 | 
			
		||||
 | 
			
		||||
#if LIBAVUTIL_VERSION_INT < AV_VERSION_INT(55,63,100)
 | 
			
		||||
	    avcodec_close(video_decoder->VideoCtx);
 | 
			
		||||
	    av_freep(&video_decoder->VideoCtx);
 | 
			
		||||
#else
 | 
			
		||||
	    avcodec_free_context(&video_decoder->VideoCtx);
 | 
			
		||||
#endif
 | 
			
		||||
        avcodec_close(video_decoder->VideoCtx);
 | 
			
		||||
        av_freep(&video_decoder->VideoCtx);
 | 
			
		||||
        pthread_mutex_unlock(&CodecLockMutex);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -492,8 +497,7 @@ void CodecVideoDecode(VideoDecoder *decoder, const AVPacket *avpkt) {
 | 
			
		||||
                            decoder->filter = 2;
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                    if (frame->interlaced_frame && decoder->filter == 2 &&
 | 
			
		||||
                        (frame->height != 720)) { // broken ZDF sends Interlaced flag
 | 
			
		||||
                    if (decoder->filter == 2) { 
 | 
			
		||||
                        push_filters(video_ctx, decoder->HwDecoder, frame);
 | 
			
		||||
                        continue;
 | 
			
		||||
                    }
 | 
			
		||||
@@ -516,7 +520,7 @@ void CodecVideoDecode(VideoDecoder *decoder, const AVPacket *avpkt) {
 | 
			
		||||
    int ret, ret1;
 | 
			
		||||
    int got_frame;
 | 
			
		||||
    int consumed = 0;
 | 
			
		||||
    static uint64_t first_time = 0;
 | 
			
		||||
    //static uint64_t first_time = 0;
 | 
			
		||||
    const AVPacket *pkt;
 | 
			
		||||
 | 
			
		||||
next_part:
 | 
			
		||||
@@ -525,7 +529,6 @@ next_part:
 | 
			
		||||
    pkt = avpkt; // use copy
 | 
			
		||||
    got_frame = 0;
 | 
			
		||||
 | 
			
		||||
    // printf("decode packet  %d\n",(GetusTicks()-first_time)/1000000);
 | 
			
		||||
    ret1 = avcodec_send_packet(video_ctx, pkt);
 | 
			
		||||
 | 
			
		||||
    // first_time = GetusTicks();
 | 
			
		||||
@@ -545,12 +548,12 @@ next_part:
 | 
			
		||||
            frame = av_frame_alloc();
 | 
			
		||||
            ret = avcodec_receive_frame(video_ctx, frame); // get new frame
 | 
			
		||||
            if (ret >= 0) {                                // one is avail.
 | 
			
		||||
                //first_time = frame->pts;
 | 
			
		||||
                got_frame = 1;
 | 
			
		||||
            } else {
 | 
			
		||||
                got_frame = 0;
 | 
			
		||||
            }
 | 
			
		||||
            //		  printf("got %s packet from
 | 
			
		||||
            // decoder\n",got_frame?"1":"no");
 | 
			
		||||
            //printf("got %s packet from decoder\n",got_frame?"1":"no");
 | 
			
		||||
            if (got_frame) { // frame completed
 | 
			
		||||
//		printf("video frame pts %#012" PRIx64 "
 | 
			
		||||
//%dms\n",frame->pts,(int)(apts - frame->pts) / 90);
 | 
			
		||||
@@ -558,15 +561,14 @@ next_part:
 | 
			
		||||
                if (decoder->filter) {
 | 
			
		||||
                    if (decoder->filter == 1) {
 | 
			
		||||
                        if (init_filters(video_ctx, decoder->HwDecoder, frame) < 0) {
 | 
			
		||||
                            Fatal(_("video: Init of YADIF Filter failed\n"));
 | 
			
		||||
                            Debug(3,"video: Init of YADIF Filter failed\n");
 | 
			
		||||
                            decoder->filter = 0;
 | 
			
		||||
                        } else {
 | 
			
		||||
                            Debug(3, "Init YADIF ok\n");
 | 
			
		||||
                            decoder->filter = 2;
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                    if (frame->interlaced_frame && decoder->filter == 2 &&
 | 
			
		||||
                        (frame->height != 720)) { // broken ZDF sends Interlaced flag
 | 
			
		||||
                    if (decoder->filter == 2) { 
 | 
			
		||||
                        ret = push_filters(video_ctx, decoder->HwDecoder, frame);
 | 
			
		||||
                        // av_frame_unref(frame);
 | 
			
		||||
                        continue;
 | 
			
		||||
@@ -620,7 +622,11 @@ typedef struct _audio_decoder_ AudioDecoder;
 | 
			
		||||
/// Audio decoder structure.
 | 
			
		||||
///
 | 
			
		||||
struct _audio_decoder_ {
 | 
			
		||||
    AVCodec *AudioCodec;      ///< audio codec
 | 
			
		||||
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(59,0,100)
 | 
			
		||||
    AVCodec *AudioCodec;		///< audio codec
 | 
			
		||||
#else
 | 
			
		||||
    const AVCodec *AudioCodec;		///< audio codec
 | 
			
		||||
#endif
 | 
			
		||||
    AVCodecContext *AudioCtx; ///< audio codec context
 | 
			
		||||
 | 
			
		||||
    char Passthrough; ///< current pass-through flags
 | 
			
		||||
@@ -707,8 +713,11 @@ void CodecAudioDelDecoder(AudioDecoder *decoder) {
 | 
			
		||||
**  @param codec_id audio   codec id
 | 
			
		||||
*/
 | 
			
		||||
void CodecAudioOpen(AudioDecoder *audio_decoder, int codec_id) {
 | 
			
		||||
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(59,0,100)
 | 
			
		||||
    AVCodec *audio_codec;
 | 
			
		||||
 | 
			
		||||
#else
 | 
			
		||||
    const AVCodec *audio_codec;
 | 
			
		||||
#endif
 | 
			
		||||
    Debug(3, "codec: using audio codec ID %#06x (%s)\n", codec_id, avcodec_get_name(codec_id));
 | 
			
		||||
    if (!(audio_codec = avcodec_find_decoder(codec_id))) {
 | 
			
		||||
        // if (!(audio_codec = avcodec_find_decoder(codec_id))) {
 | 
			
		||||
@@ -721,9 +730,6 @@ void CodecAudioOpen(AudioDecoder *audio_decoder, int codec_id) {
 | 
			
		||||
        Fatal(_("codec: can't allocate audio codec context\n"));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (CodecDownmix) {
 | 
			
		||||
        audio_decoder->AudioCtx->request_channel_layout = AV_CH_LAYOUT_STEREO;
 | 
			
		||||
    }
 | 
			
		||||
    pthread_mutex_lock(&CodecLockMutex);
 | 
			
		||||
    // open codec
 | 
			
		||||
    if (1) {
 | 
			
		||||
@@ -763,8 +769,12 @@ void CodecAudioClose(AudioDecoder *audio_decoder) {
 | 
			
		||||
    }
 | 
			
		||||
    if (audio_decoder->AudioCtx) {
 | 
			
		||||
        pthread_mutex_lock(&CodecLockMutex);
 | 
			
		||||
        avcodec_close(audio_decoder->AudioCtx);
 | 
			
		||||
        av_freep(&audio_decoder->AudioCtx);
 | 
			
		||||
#if LIBAVUTIL_VERSION_INT < AV_VERSION_INT(55,63,100)
 | 
			
		||||
	    avcodec_close(audio_decoder->AudioCtx);
 | 
			
		||||
	    av_freep(&audio_decoder->AudioCtx);
 | 
			
		||||
#else
 | 
			
		||||
	    avcodec_free_context(&audio_decoder->AudioCtx);
 | 
			
		||||
#endif
 | 
			
		||||
        pthread_mutex_unlock(&CodecLockMutex);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -876,19 +886,35 @@ static int CodecAudioUpdateHelper(AudioDecoder *audio_decoder, int *passthrough)
 | 
			
		||||
    int err;
 | 
			
		||||
 | 
			
		||||
    audio_ctx = audio_decoder->AudioCtx;
 | 
			
		||||
    Debug(3, "codec/audio: format change %s %dHz *%d channels%s%s%s%s%s\n",
 | 
			
		||||
          av_get_sample_fmt_name(audio_ctx->sample_fmt), audio_ctx->sample_rate, audio_ctx->channels,
 | 
			
		||||
          CodecPassthrough & CodecPCM ? " PCM" : "", CodecPassthrough & CodecMPA ? " MPA" : "",
 | 
			
		||||
          CodecPassthrough & CodecAC3 ? " AC-3" : "", CodecPassthrough & CodecEAC3 ? " E-AC-3" : "",
 | 
			
		||||
          CodecPassthrough ? " pass-through" : "");
 | 
			
		||||
    
 | 
			
		||||
 
 | 
			
		||||
    Debug(3, "codec/audio: format change %s %dHz *%d channels%s%s%s%s%s%s\n",
 | 
			
		||||
	av_get_sample_fmt_name(audio_ctx->sample_fmt), audio_ctx->sample_rate,
 | 
			
		||||
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(59,24,100)
 | 
			
		||||
	audio_ctx->channels, CodecPassthrough & CodecPCM ? " PCM" : "",
 | 
			
		||||
#else
 | 
			
		||||
	audio_ctx->ch_layout.nb_channels, CodecPassthrough & CodecPCM ? " PCM" : "",
 | 
			
		||||
#endif
 | 
			
		||||
	CodecPassthrough & CodecMPA ? " MPA" : "",
 | 
			
		||||
	CodecPassthrough & CodecAC3 ? " AC-3" : "",
 | 
			
		||||
	CodecPassthrough & CodecEAC3 ? " E-AC-3" : "",
 | 
			
		||||
	CodecPassthrough & CodecDTS ? " DTS" : "",
 | 
			
		||||
	CodecPassthrough ? " pass-through" : "");
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    *passthrough = 0;
 | 
			
		||||
    audio_decoder->SampleRate = audio_ctx->sample_rate;
 | 
			
		||||
    audio_decoder->HwSampleRate = audio_ctx->sample_rate;
 | 
			
		||||
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(59,24,100)
 | 
			
		||||
    audio_decoder->Channels = audio_ctx->channels;
 | 
			
		||||
    audio_decoder->HwChannels = audio_ctx->channels;
 | 
			
		||||
    audio_decoder->Passthrough = CodecPassthrough;
 | 
			
		||||
#else
 | 
			
		||||
    audio_decoder->Channels = audio_ctx->ch_layout.nb_channels;
 | 
			
		||||
    audio_decoder->HwChannels = audio_ctx->ch_layout.nb_channels;
 | 
			
		||||
#endif
 | 
			
		||||
    if (CodecDownmix && !CodecPassthrough) audio_decoder->HwChannels = 2;
 | 
			
		||||
 | 
			
		||||
    audio_decoder->Passthrough = CodecPassthrough;
 | 
			
		||||
    // SPDIF/HDMI pass-through
 | 
			
		||||
    if ((CodecPassthrough & CodecAC3 && audio_ctx->codec_id == AV_CODEC_ID_AC3) ||
 | 
			
		||||
        (CodecPassthrough & CodecEAC3 && audio_ctx->codec_id == AV_CODEC_ID_EAC3)) {
 | 
			
		||||
@@ -917,9 +943,15 @@ static int CodecAudioUpdateHelper(AudioDecoder *audio_decoder, int *passthrough)
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    Debug(3, "codec/audio: resample %s %dHz *%d -> %s %dHz *%d\n", av_get_sample_fmt_name(audio_ctx->sample_fmt),
 | 
			
		||||
          audio_ctx->sample_rate, audio_ctx->channels, av_get_sample_fmt_name(AV_SAMPLE_FMT_S16),
 | 
			
		||||
          audio_decoder->HwSampleRate, audio_decoder->HwChannels);
 | 
			
		||||
    Debug(3, "codec/audio: resample %s %dHz *%d -> %s %dHz *%d\n",
 | 
			
		||||
	    av_get_sample_fmt_name(audio_ctx->sample_fmt), audio_ctx->sample_rate,
 | 
			
		||||
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(59,24,100)
 | 
			
		||||
	    audio_ctx->channels, av_get_sample_fmt_name(AV_SAMPLE_FMT_S16),
 | 
			
		||||
#else
 | 
			
		||||
	    audio_ctx->ch_layout.nb_channels, av_get_sample_fmt_name(AV_SAMPLE_FMT_S16),
 | 
			
		||||
#endif
 | 
			
		||||
	    audio_decoder->HwSampleRate, audio_decoder->HwChannels);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    return 0;
 | 
			
		||||
}
 | 
			
		||||
@@ -1148,6 +1180,12 @@ static void CodecAudioUpdateFormat(AudioDecoder *audio_decoder) {
 | 
			
		||||
    int passthrough;
 | 
			
		||||
    const AVCodecContext *audio_ctx;
 | 
			
		||||
 | 
			
		||||
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(59,24,100)
 | 
			
		||||
    int64_t dmlayout = AV_CH_LAYOUT_STEREO;
 | 
			
		||||
#else
 | 
			
		||||
    AVChannelLayout dmlayout = AV_CHANNEL_LAYOUT_STEREO;
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
    if (CodecAudioUpdateHelper(audio_decoder, &passthrough)) {
 | 
			
		||||
        // FIXME: handle swresample format conversions.
 | 
			
		||||
        return;
 | 
			
		||||
@@ -1158,6 +1196,12 @@ static void CodecAudioUpdateFormat(AudioDecoder *audio_decoder) {
 | 
			
		||||
 | 
			
		||||
    audio_ctx = audio_decoder->AudioCtx;
 | 
			
		||||
 | 
			
		||||
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(59,24,100)
 | 
			
		||||
    if (!CodecDownmix || CodecPassthrough) dmlayout = audio_ctx->channel_layout;
 | 
			
		||||
#else
 | 
			
		||||
    if (!CodecDownmix || CodecPassthrough) dmlayout = audio_ctx->ch_layout;
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifdef DEBUG
 | 
			
		||||
    if (audio_ctx->sample_fmt == AV_SAMPLE_FMT_S16 && audio_ctx->sample_rate == audio_decoder->HwSampleRate &&
 | 
			
		||||
        !CodecAudioDrift) {
 | 
			
		||||
@@ -1166,14 +1210,25 @@ static void CodecAudioUpdateFormat(AudioDecoder *audio_decoder) {
 | 
			
		||||
    }
 | 
			
		||||
#endif
 | 
			
		||||
    
 | 
			
		||||
    audio_decoder->Resample = swr_alloc_set_opts(audio_decoder->Resample, audio_ctx->channel_layout, AV_SAMPLE_FMT_S16,
 | 
			
		||||
                                                 audio_decoder->HwSampleRate, audio_ctx->channel_layout,
 | 
			
		||||
                                                 audio_ctx->sample_fmt, audio_ctx->sample_rate, 0, NULL);
 | 
			
		||||
#if LIBSWRESAMPLE_VERSION_INT < AV_VERSION_INT(4,5,100)
 | 
			
		||||
    audio_decoder->Resample =
 | 
			
		||||
        swr_alloc_set_opts(audio_decoder->Resample, dmlayout,
 | 
			
		||||
        AV_SAMPLE_FMT_S16, audio_decoder->HwSampleRate,
 | 
			
		||||
        audio_ctx->channel_layout, audio_ctx->sample_fmt,
 | 
			
		||||
#else
 | 
			
		||||
        swr_alloc_set_opts2(&audio_decoder->Resample, &dmlayout,
 | 
			
		||||
        AV_SAMPLE_FMT_S16, audio_decoder->HwSampleRate,
 | 
			
		||||
        &audio_ctx->ch_layout, audio_ctx->sample_fmt,
 | 
			
		||||
#endif
 | 
			
		||||
	   audio_ctx->sample_rate, 0, NULL); 
 | 
			
		||||
 | 
			
		||||
    if (audio_decoder->Resample) {
 | 
			
		||||
        swr_init(audio_decoder->Resample);
 | 
			
		||||
	swr_init(audio_decoder->Resample);
 | 
			
		||||
    } else {
 | 
			
		||||
        Error(_("codec/audio: can't setup resample\n"));
 | 
			
		||||
	Error(_("codec/audio: can't setup resample\n"));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
@@ -1216,7 +1271,11 @@ void CodecAudioDecode(AudioDecoder *audio_decoder, const AVPacket *avpkt) {
 | 
			
		||||
            // format change
 | 
			
		||||
            if (audio_decoder->Passthrough != CodecPassthrough ||
 | 
			
		||||
                audio_decoder->SampleRate != audio_ctx->sample_rate ||
 | 
			
		||||
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(59,24,100)
 | 
			
		||||
                audio_decoder->Channels != audio_ctx->channels) {
 | 
			
		||||
#else
 | 
			
		||||
                audio_decoder->Channels != audio_ctx->ch_layout.nb_channels) {
 | 
			
		||||
#endif
 | 
			
		||||
                CodecAudioUpdateFormat(audio_decoder);
 | 
			
		||||
            }
 | 
			
		||||
            if (!audio_decoder->HwSampleRate || !audio_decoder->HwChannels) {
 | 
			
		||||
@@ -1225,13 +1284,15 @@ void CodecAudioDecode(AudioDecoder *audio_decoder, const AVPacket *avpkt) {
 | 
			
		||||
            if (CodecAudioPassthroughHelper(audio_decoder, avpkt)) {
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
            
 | 
			
		||||
            if (audio_decoder->Resample) {
 | 
			
		||||
                uint8_t outbuf[8192 * 2 * 8];
 | 
			
		||||
                uint8_t outbuf[8192  * 2 * 8];
 | 
			
		||||
                uint8_t *out[1];
 | 
			
		||||
 | 
			
		||||
                out[0] = outbuf;
 | 
			
		||||
                ret = swr_convert(audio_decoder->Resample, out, sizeof(outbuf) / (2 * audio_decoder->HwChannels),
 | 
			
		||||
                                  (const uint8_t **)frame->extended_data, frame->nb_samples);
 | 
			
		||||
                                  
 | 
			
		||||
                if (ret > 0) {
 | 
			
		||||
                    if (!(audio_decoder->Passthrough & CodecPCM)) {
 | 
			
		||||
                        CodecReorderAudioFrame((int16_t *)outbuf, ret * 2 * audio_decoder->HwChannels,
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										6
									
								
								codec.h
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								codec.h
									
									
									
									
									
								
							@@ -56,7 +56,11 @@ struct _video_decoder_ {
 | 
			
		||||
    VideoHwDecoder *HwDecoder; ///< video hardware decoder
 | 
			
		||||
 | 
			
		||||
    int GetFormatDone;        ///< flag get format called!
 | 
			
		||||
    AVCodec *VideoCodec;      ///< video codec
 | 
			
		||||
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(59,0,100)
 | 
			
		||||
     AVCodec *VideoCodec;                ///< video codec
 | 
			
		||||
#else
 | 
			
		||||
     const AVCodec *VideoCodec;          ///< video codec
 | 
			
		||||
#endif
 | 
			
		||||
    AVCodecContext *VideoCtx; ///< video codec context
 | 
			
		||||
    // #ifdef FFMPEG_WORKAROUND_ARTIFACTS
 | 
			
		||||
    int FirstKeyFrame; ///< flag first frame
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										38
									
								
								drm.c
									
									
									
									
									
								
							
							
						
						
									
										38
									
								
								drm.c
									
									
									
									
									
								
							@@ -209,8 +209,11 @@ static int FindDevice(VideoRender *render) {
 | 
			
		||||
    int found = 0;
 | 
			
		||||
    render->fd_drm = open("/dev/dri/card0", O_RDWR);
 | 
			
		||||
    if (render->fd_drm < 0) {
 | 
			
		||||
        fprintf(stderr, "FindDevice: cannot open /dev/dri/card0: %m\n");
 | 
			
		||||
        return -errno;
 | 
			
		||||
        render->fd_drm = open("/dev/dri/card1", O_RDWR);
 | 
			
		||||
        if (render->fd_drm < 0) {
 | 
			
		||||
            fprintf(stderr, "FindDevice: cannot open /dev/dri/card0 or card1: %m\n");
 | 
			
		||||
            return -errno;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    int ret = drmSetMaster(render->fd_drm);
 | 
			
		||||
@@ -545,6 +548,7 @@ static void drm_swap_buffers() {
 | 
			
		||||
        m_need_modeset = 0;
 | 
			
		||||
        has_modeset = 1;
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    drmModeSetCrtc(render->fd_drm, render->crtc_id, fb, 0, 0, &render->connector_id, 1, &render->mode);
 | 
			
		||||
 | 
			
		||||
    if (previous_bo) {
 | 
			
		||||
@@ -562,15 +566,16 @@ static void drm_clean_up() {
 | 
			
		||||
        return;
 | 
			
		||||
    Debug(3, "drm clean up\n");
 | 
			
		||||
 | 
			
		||||
    if (previous_bo) {
 | 
			
		||||
        drmModeRmFB(render->fd_drm, previous_fb);
 | 
			
		||||
        gbm_surface_release_buffer(gbm.surface, previous_bo);
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    drmModeSetCrtc(render->fd_drm, render->saved_crtc->crtc_id, render->saved_crtc->buffer_id, render->saved_crtc->x,
 | 
			
		||||
                   render->saved_crtc->y, &render->connector_id, 1, &render->saved_crtc->mode);
 | 
			
		||||
    drmModeFreeCrtc(render->saved_crtc);
 | 
			
		||||
 | 
			
		||||
    if (previous_bo) {
 | 
			
		||||
        drmModeRmFB(render->fd_drm, previous_fb);
 | 
			
		||||
        gbm_surface_release_buffer(gbm.surface, previous_bo);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (has_modeset) {
 | 
			
		||||
        drmModeAtomicReqPtr ModeReq;
 | 
			
		||||
        const uint32_t flags = DRM_MODE_ATOMIC_ALLOW_MODESET;
 | 
			
		||||
@@ -613,22 +618,29 @@ static void drm_clean_up() {
 | 
			
		||||
    if (render->hdr_blob_id)
 | 
			
		||||
        drmModeDestroyPropertyBlob(render->fd_drm, render->hdr_blob_id);
 | 
			
		||||
    render->hdr_blob_id = 0;
 | 
			
		||||
 | 
			
		||||
#if 0
 | 
			
		||||
    eglMakeCurrent(eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
 | 
			
		||||
    eglDestroySurface(eglDisplay, eglSurface);
 | 
			
		||||
    EglCheck();
 | 
			
		||||
    gbm_surface_destroy(gbm.surface);
 | 
			
		||||
    eglDestroyContext(eglDisplay, eglContext);
 | 
			
		||||
    EglCheck();
 | 
			
		||||
    eglDestroyContext(eglDisplay, eglSharedContext);
 | 
			
		||||
    EglCheck();
 | 
			
		||||
    eglDestroyContext(eglDisplay, eglContext);
 | 
			
		||||
    EglCheck();
 | 
			
		||||
    eglSharedContext = NULL;
 | 
			
		||||
 | 
			
		||||
    eglContext = NULL;
 | 
			
		||||
    eglTerminate(eglDisplay);
 | 
			
		||||
    EglCheck();
 | 
			
		||||
 | 
			
		||||
    eglDisplay = NULL;
 | 
			
		||||
#endif
 | 
			
		||||
    eglMakeCurrent(eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
 | 
			
		||||
    eglDestroySurface(eglDisplay, eglSurface);
 | 
			
		||||
    EglCheck();
 | 
			
		||||
    eglSurface = NULL;
 | 
			
		||||
    gbm_surface_destroy(gbm.surface);
 | 
			
		||||
    gbm_device_destroy(gbm.dev);
 | 
			
		||||
    drmDropMaster(render->fd_drm);
 | 
			
		||||
    close(render->fd_drm);
 | 
			
		||||
    eglDisplay = NULL;
 | 
			
		||||
    free(render);
 | 
			
		||||
    render = NULL;
 | 
			
		||||
    Debug(3, "nach drm clean up\n");
 | 
			
		||||
}
 | 
			
		||||
@@ -726,14 +726,15 @@ bool cOglCmdDeleteFb::Execute(void) {
 | 
			
		||||
 | 
			
		||||
//------------------ cOglCmdRenderFbToBufferFb --------------------
 | 
			
		||||
cOglCmdRenderFbToBufferFb::cOglCmdRenderFbToBufferFb(cOglFb *fb, cOglFb *buffer, GLint x, GLint y, GLint transparency,
 | 
			
		||||
                                                     GLint drawPortX, GLint drawPortY)
 | 
			
		||||
                                                     GLint drawPortX, GLint drawPortY, bool alphablending)
 | 
			
		||||
    : cOglCmd(fb) {
 | 
			
		||||
    this->buffer = buffer;
 | 
			
		||||
    this->x = (GLfloat)x;
 | 
			
		||||
    this->y = (GLfloat)y;
 | 
			
		||||
    this->drawPortX = (GLfloat)drawPortX;
 | 
			
		||||
    this->drawPortY = (GLfloat)drawPortY;
 | 
			
		||||
    this->transparency = transparency;
 | 
			
		||||
     this->transparency = (alphablending ? transparency : ALPHA_OPAQUE);
 | 
			
		||||
    this->alphablending = alphablending;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool cOglCmdRenderFbToBufferFb::Execute(void) {
 | 
			
		||||
@@ -773,11 +774,14 @@ bool cOglCmdRenderFbToBufferFb::Execute(void) {
 | 
			
		||||
 | 
			
		||||
    if (!fb->BindTexture())
 | 
			
		||||
        return false;
 | 
			
		||||
 | 
			
		||||
    if (!alphablending)
 | 
			
		||||
        VertexBuffers[vbTexture]->DisableBlending();
 | 
			
		||||
    VertexBuffers[vbTexture]->Bind();
 | 
			
		||||
    VertexBuffers[vbTexture]->SetVertexData(quadVertices);
 | 
			
		||||
    VertexBuffers[vbTexture]->DrawArrays();
 | 
			
		||||
    VertexBuffers[vbTexture]->Unbind();
 | 
			
		||||
    if (!alphablending)
 | 
			
		||||
        VertexBuffers[vbTexture]->EnableBlending();
 | 
			
		||||
    buffer->Unbind();
 | 
			
		||||
 | 
			
		||||
    return true;
 | 
			
		||||
@@ -1283,10 +1287,10 @@ bool cOglCmdDrawImage::Execute(void) {
 | 
			
		||||
    pthread_mutex_unlock(&OSDMutex);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
    GLfloat x1 = x;          // left
 | 
			
		||||
    GLfloat y1 = y;          // top
 | 
			
		||||
    GLfloat x2 = x + width;  // right
 | 
			
		||||
    GLfloat y2 = y + height; // bottom
 | 
			
		||||
    GLfloat x1 = x;                   // left
 | 
			
		||||
    GLfloat y1 = y;                   // top
 | 
			
		||||
    GLfloat x2 = x + width * scaleX;  // right
 | 
			
		||||
    GLfloat y2 = y + height * scaleY; // bottom
 | 
			
		||||
 | 
			
		||||
    GLfloat quadVertices[] = {
 | 
			
		||||
        x1, y2, 0.0, 1.0, // left bottom
 | 
			
		||||
@@ -1320,19 +1324,21 @@ bool cOglCmdDrawImage::Execute(void) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//------------------ cOglCmdDrawTexture --------------------
 | 
			
		||||
cOglCmdDrawTexture::cOglCmdDrawTexture(cOglFb *fb, sOglImage *imageRef, GLint x, GLint y) : cOglCmd(fb) {
 | 
			
		||||
cOglCmdDrawTexture::cOglCmdDrawTexture(cOglFb *fb, sOglImage *imageRef, GLint x, GLint y, double scaleX, double scaleY) : cOglCmd(fb) {
 | 
			
		||||
    this->imageRef = imageRef;
 | 
			
		||||
    this->x = x;
 | 
			
		||||
    this->y = y;
 | 
			
		||||
    this->scaleX = scaleX;
 | 
			
		||||
    this->scaleY = scaleY;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool cOglCmdDrawTexture::Execute(void) {
 | 
			
		||||
    if (imageRef->width <= 0 || imageRef->height <= 0)
 | 
			
		||||
        return false;
 | 
			
		||||
    GLfloat x1 = x;                    // top
 | 
			
		||||
    GLfloat y1 = y;                    // left
 | 
			
		||||
    GLfloat x2 = x + imageRef->width;  // right
 | 
			
		||||
    GLfloat y2 = y + imageRef->height; // bottom
 | 
			
		||||
    GLfloat x1 = x;                             // top
 | 
			
		||||
    GLfloat y1 = y;                             // left
 | 
			
		||||
    GLfloat x2 = x + imageRef->width * scaleX;  // right
 | 
			
		||||
    GLfloat y2 = y + imageRef->height * scaleY; // bottom
 | 
			
		||||
 | 
			
		||||
    GLfloat quadVertices[] = {
 | 
			
		||||
        // Pos	  // TexCoords
 | 
			
		||||
@@ -1826,6 +1832,10 @@ void cOglPixmap::Fill(tColor Color) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void cOglPixmap::DrawImage(const cPoint &Point, const cImage &Image) {
 | 
			
		||||
    DrawScaledImage(Point, Image);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void cOglPixmap::DrawScaledImage(const cPoint &Point, const cImage &Image, double FactorX, double FactorY, bool AntiAlias) {
 | 
			
		||||
    if (!oglThread->Active())
 | 
			
		||||
        return;
 | 
			
		||||
    tColor *argb = MALLOC(tColor, Image.Width() * Image.Height());
 | 
			
		||||
@@ -1834,19 +1844,25 @@ void cOglPixmap::DrawImage(const cPoint &Point, const cImage &Image) {
 | 
			
		||||
        return;
 | 
			
		||||
    memcpy(argb, Image.Data(), sizeof(tColor) * Image.Width() * Image.Height());
 | 
			
		||||
 | 
			
		||||
    oglThread->DoCmd(new cOglCmdDrawImage(fb, argb, Image.Width(), Image.Height(), Point.X(), Point.Y()));
 | 
			
		||||
    oglThread->DoCmd(new cOglCmdDrawImage(fb, argb, Image.Width(), Image.Height(), Point.X(), Point.Y(), true, FactorX, FactorY));
 | 
			
		||||
    SetDirty();
 | 
			
		||||
    MarkDrawPortDirty(cRect(Point, cSize(Image.Width(), Image.Height())).Intersected(DrawPort().Size()));
 | 
			
		||||
    MarkDrawPortDirty(cRect(Point, cSize(Image.Width() * FactorX, Image.Height() * FactorY)).Intersected(DrawPort().Size()));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void cOglPixmap::DrawImage(const cPoint &Point, int ImageHandle) {
 | 
			
		||||
    DrawScaledImage(Point, ImageHandle);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void cOglPixmap::DrawScaledImage(const cPoint &Point, int ImageHandle, double FactorX, double FactorY, bool AntiAlias) {
 | 
			
		||||
    if (!oglThread->Active())
 | 
			
		||||
        return;
 | 
			
		||||
 | 
			
		||||
    if (ImageHandle < 0 && oglThread->GetImageRef(ImageHandle)) {
 | 
			
		||||
        sOglImage *img = oglThread->GetImageRef(ImageHandle);
 | 
			
		||||
 | 
			
		||||
        oglThread->DoCmd(new cOglCmdDrawTexture(fb, img, Point.X(), Point.Y()));
 | 
			
		||||
        oglThread->DoCmd(new cOglCmdDrawTexture(fb, img, Point.X(), Point.Y(), FactorX, FactorY));
 | 
			
		||||
        SetDirty();
 | 
			
		||||
        MarkDrawPortDirty(cRect(Point, cSize(img->width * FactorX, img->height * FactorY)).Intersected(DrawPort().Size()));
 | 
			
		||||
    }
 | 
			
		||||
    /*
 | 
			
		||||
       Fallback to VDR implementation, needs to separate cSoftOsdProvider from
 | 
			
		||||
@@ -1854,8 +1870,6 @@ void cOglPixmap::DrawImage(const cPoint &Point, int ImageHandle) {
 | 
			
		||||
       DrawImage(Point, *cSoftOsdProvider::GetImageData(ImageHandle));
 | 
			
		||||
       }
 | 
			
		||||
     */
 | 
			
		||||
    SetDirty();
 | 
			
		||||
    MarkDrawPortDirty(DrawPort());
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void cOglPixmap::DrawPixel(const cPoint &Point, tColor Color) {
 | 
			
		||||
@@ -2096,6 +2110,14 @@ cPixmap *cOglOsd::CreatePixmap(int Layer, const cRect &ViewPort, const cRect &Dr
 | 
			
		||||
    return NULL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
extern "C" {void VideoSetOsdSize(int, int ) ;}
 | 
			
		||||
 | 
			
		||||
void SetOsdPosition(int Left, int Top, int Width, int Height) {
 | 
			
		||||
    printf("Set OSD Position %d %d\n",Width,Height);
 | 
			
		||||
  VideoSetOsdSize( Width, Height) ; 
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void cOglOsd::DestroyPixmap(cPixmap *Pixmap) {
 | 
			
		||||
    if (!oglThread->Active())
 | 
			
		||||
        return;
 | 
			
		||||
@@ -2141,10 +2163,16 @@ void cOglOsd::Flush(void) {
 | 
			
		||||
        for (int i = 0; i < oglPixmaps.Size(); i++) {
 | 
			
		||||
            if (oglPixmaps[i]) {
 | 
			
		||||
                if (oglPixmaps[i]->Layer() == layer) {
 | 
			
		||||
                    oglThread->DoCmd(new cOglCmdRenderFbToBufferFb(
 | 
			
		||||
                        oglPixmaps[i]->Fb(), bFb, oglPixmaps[i]->ViewPort().X(),
 | 
			
		||||
                        (!isSubtitleOsd) ? oglPixmaps[i]->ViewPort().Y() : 0, oglPixmaps[i]->Alpha(),
 | 
			
		||||
                        oglPixmaps[i]->DrawPort().X(), oglPixmaps[i]->DrawPort().Y()));
 | 
			
		||||
                    bool alphablending = layer == 0 ? false : true; // Decide wether to render (with alpha) or copy a pixmap
 | 
			
		||||
                    oglThread->DoCmd(new cOglCmdRenderFbToBufferFb( oglPixmaps[i]->Fb(), 
 | 
			
		||||
                                                                    bFb,
 | 
			
		||||
                                                                    oglPixmaps[i]->ViewPort().X(), 
 | 
			
		||||
                                                                    (!isSubtitleOsd) ? oglPixmaps[i]->ViewPort().Y() : 0,
 | 
			
		||||
                                                                    oglPixmaps[i]->Alpha(), 
 | 
			
		||||
                                                                    oglPixmaps[i]->DrawPort().X(), 
 | 
			
		||||
                                                                    oglPixmaps[i]->DrawPort().Y(),
 | 
			
		||||
                                                                    alphablending
 | 
			
		||||
                                                                    ));
 | 
			
		||||
                    oglPixmaps[i]->SetDirty(false);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 
 | 
			
		||||
@@ -290,10 +290,11 @@ class cOglCmdRenderFbToBufferFb : public cOglCmd {
 | 
			
		||||
    GLfloat x, y;
 | 
			
		||||
    GLfloat drawPortX, drawPortY;
 | 
			
		||||
    GLint transparency;
 | 
			
		||||
    GLint alphablending;
 | 
			
		||||
 | 
			
		||||
  public:
 | 
			
		||||
    cOglCmdRenderFbToBufferFb(cOglFb *fb, cOglFb *buffer, GLint x, GLint y, GLint transparency, GLint drawPortX,
 | 
			
		||||
                              GLint drawPortY);
 | 
			
		||||
                              GLint drawPortY, bool alphablending);
 | 
			
		||||
    virtual ~cOglCmdRenderFbToBufferFb(void){};
 | 
			
		||||
    virtual const char *Description(void) { return "Render Framebuffer to Buffer"; }
 | 
			
		||||
    virtual bool Execute(void);
 | 
			
		||||
@@ -402,9 +403,10 @@ class cOglCmdDrawTexture : public cOglCmd {
 | 
			
		||||
  private:
 | 
			
		||||
    sOglImage *imageRef;
 | 
			
		||||
    GLint x, y;
 | 
			
		||||
    GLfloat scaleX, scaleY;
 | 
			
		||||
 | 
			
		||||
  public:
 | 
			
		||||
    cOglCmdDrawTexture(cOglFb *fb, sOglImage *imageRef, GLint x, GLint y);
 | 
			
		||||
    cOglCmdDrawTexture(cOglFb *fb, sOglImage *imageRef, GLint x, GLint y, double scaleX = 1.0f, double scaleY = 1.0f);
 | 
			
		||||
    virtual ~cOglCmdDrawTexture(void){};
 | 
			
		||||
    virtual const char *Description(void) { return "Draw Texture"; }
 | 
			
		||||
    virtual bool Execute(void);
 | 
			
		||||
@@ -500,6 +502,8 @@ class cOglPixmap : public cPixmap {
 | 
			
		||||
    virtual void Fill(tColor Color);
 | 
			
		||||
    virtual void DrawImage(const cPoint &Point, const cImage &Image);
 | 
			
		||||
    virtual void DrawImage(const cPoint &Point, int ImageHandle);
 | 
			
		||||
    virtual void DrawScaledImage(const cPoint &Point, const cImage &Image, double FactorX = 1.0f, double FactorY = 1.0f, bool AntiAlias = false);
 | 
			
		||||
    virtual void DrawScaledImage(const cPoint &Point, int ImageHandle, double FactorX = 1.0f, double FactorY = 1.0f, bool AntiAlias = false);
 | 
			
		||||
    virtual void DrawPixel(const cPoint &Point, tColor Color);
 | 
			
		||||
    virtual void DrawBitmap(const cPoint &Point, const cBitmap &Bitmap, tColor ColorFg = 0, tColor ColorBg = 0,
 | 
			
		||||
                            bool Overlay = false);
 | 
			
		||||
@@ -528,6 +532,7 @@ class cOglOsd : public cOsd {
 | 
			
		||||
  public:
 | 
			
		||||
    cOglOsd(int Left, int Top, uint Level, std::shared_ptr<cOglThread> oglThread);
 | 
			
		||||
    virtual ~cOglOsd();
 | 
			
		||||
    static void SetOsdPosition(int Left, int Top, int Width, int Height);
 | 
			
		||||
    virtual eOsdError SetAreas(const tArea *Areas, int NumAreas);
 | 
			
		||||
    virtual cPixmap *CreatePixmap(int Layer, const cRect &ViewPort, const cRect &DrawPort = cRect::Null);
 | 
			
		||||
    virtual void DestroyPixmap(cPixmap *Pixmap);
 | 
			
		||||
 
 | 
			
		||||
@@ -126,7 +126,7 @@ void pl_shader_append_v(const char *fmt, ...) {
 | 
			
		||||
        Fatal(_("Shaderlenght fault\n"));
 | 
			
		||||
    strcat(shv, temp);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#ifndef PLACEBO
 | 
			
		||||
static void compile_attach_shader(GLuint program, GLenum type, const char *source) {
 | 
			
		||||
    GLuint shader;
 | 
			
		||||
    GLint status = 1234, log_length;
 | 
			
		||||
@@ -159,6 +159,7 @@ static void link_shader(GLuint program) {
 | 
			
		||||
    Debug(3, "Link Status %d loglen %d\n", status, log_length);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static GLuint sc_generate_osd(GLuint gl_prog) {
 | 
			
		||||
 | 
			
		||||
    Debug(3, "vor create osd\n");
 | 
			
		||||
@@ -209,7 +210,7 @@ static GLuint sc_generate(GLuint gl_prog, enum AVColorSpace colorspace) {
 | 
			
		||||
    int n;
 | 
			
		||||
    GLint cmsLoc;
 | 
			
		||||
    float *m, *c, *cms;
 | 
			
		||||
    char *frag;
 | 
			
		||||
    //char *frag;
 | 
			
		||||
 | 
			
		||||
    GL_init();
 | 
			
		||||
    GLSL("%s\n", gl_version);
 | 
			
		||||
@@ -446,3 +447,4 @@ static void render_pass_quad(int flip, float xcrop, float ycrop) {
 | 
			
		||||
    for (n = 0; vertex_vao[n].name; n++)
 | 
			
		||||
        glDisableVertexAttribArray(n);
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
 
 | 
			
		||||
@@ -61,7 +61,7 @@ extern void ToggleLUT();
 | 
			
		||||
/// vdr-plugin version number.
 | 
			
		||||
/// Makefile extracts the version number for generating the file name
 | 
			
		||||
/// for the distribution archive.
 | 
			
		||||
static const char *const VERSION = "3.12"
 | 
			
		||||
static const char *const VERSION = "3.27"
 | 
			
		||||
#ifdef GIT_REV
 | 
			
		||||
                                   "-GIT" GIT_REV
 | 
			
		||||
#endif
 | 
			
		||||
@@ -658,6 +658,20 @@ class cDummyPixmap : public cPixmap {
 | 
			
		||||
        (void)Point;
 | 
			
		||||
        (void)ImageHandle;
 | 
			
		||||
    }
 | 
			
		||||
    virtual void DrawScaledImage(const cPoint &Point, const cImage &Image, double FactorX, double FactorY, bool AntiAlias) {
 | 
			
		||||
        (void)Point;
 | 
			
		||||
        (void)Image;
 | 
			
		||||
        (void)FactorX;
 | 
			
		||||
        (void)FactorY;
 | 
			
		||||
        (void)AntiAlias;
 | 
			
		||||
    }
 | 
			
		||||
    virtual void DrawScaledImage(const cPoint &Point, int ImageHandle, double FactorX, double FactorY, bool AntiAlias) {
 | 
			
		||||
        (void)Point;
 | 
			
		||||
        (void)ImageHandle;
 | 
			
		||||
        (void)FactorX;
 | 
			
		||||
        (void)FactorY;
 | 
			
		||||
        (void)AntiAlias;
 | 
			
		||||
    }
 | 
			
		||||
    virtual void DrawPixel(const cPoint &Point, tColor Color) {
 | 
			
		||||
        (void)Point;
 | 
			
		||||
        (void)Color;
 | 
			
		||||
@@ -723,6 +737,12 @@ class cDummyOsd : public cOsd {
 | 
			
		||||
  public:
 | 
			
		||||
    cDummyOsd(int Left, int Top, uint Level) : cOsd(Left, Top, Level) {}
 | 
			
		||||
    virtual ~cDummyOsd() {}
 | 
			
		||||
    static void SetOsdPosition(int Left, int Top, int Width, int Height) {
 | 
			
		||||
        (void) Left;
 | 
			
		||||
        (void) Top;
 | 
			
		||||
        (void) Width;
 | 
			
		||||
        (void) Height;
 | 
			
		||||
    }
 | 
			
		||||
    virtual cPixmap *CreatePixmap(int Layer, const cRect &ViewPort, const cRect &DrawPort = cRect::Null) {
 | 
			
		||||
        p = new cDummyPixmap(Layer, ViewPort, DrawPort);
 | 
			
		||||
        return p;
 | 
			
		||||
@@ -1147,9 +1167,9 @@ void cMenuSetupSoft::Create(void) {
 | 
			
		||||
 | 
			
		||||
    if (scalers == 0) {
 | 
			
		||||
        scalingtest[0] = (char *)"Off";
 | 
			
		||||
        for (scalers = 0; pl_named_filters[scalers].name != NULL; scalers++) {
 | 
			
		||||
            scaling[scalers] = (char *)pl_named_filters[scalers].name;
 | 
			
		||||
            scalingtest[scalers + 1] = (char *)pl_named_filters[scalers].name;
 | 
			
		||||
        for (scalers = 0; pl_filter_presets[scalers].name != NULL; scalers++) {
 | 
			
		||||
            scaling[scalers] = (char *)pl_filter_presets[scalers].name;
 | 
			
		||||
            scalingtest[scalers + 1] = (char *)pl_filter_presets[scalers].name;
 | 
			
		||||
            // printf("Scaler %s\n",pl_named_filters[scalers].name);
 | 
			
		||||
        }
 | 
			
		||||
        // scalers -= 2;
 | 
			
		||||
@@ -1206,7 +1226,7 @@ void cMenuSetupSoft::Create(void) {
 | 
			
		||||
	Add(new cMenuEditIntItem(tr("Video background color (Alpha)"), (int *)&BackgroundAlpha, 0, 0xFF));
 | 
			
		||||
#endif
 | 
			
		||||
#ifdef PLACEBO
 | 
			
		||||
        Add(new cMenuEditBoolItem(tr("Use studio levels"), &StudioLevels, trVDR("no"), trVDR("yes")));
 | 
			
		||||
        Add(new cMenuEditBoolItem(tr("RGB Level"), &StudioLevels, trVDR("limited RGB"), trVDR("Full RGB")));
 | 
			
		||||
#endif
 | 
			
		||||
        Add(new cMenuEditBoolItem(tr("60hz display mode"), &_60HzMode, trVDR("no"), trVDR("yes")));
 | 
			
		||||
        Add(new cMenuEditBoolItem(tr("Soft start a/v sync"), &SoftStartSync, trVDR("no"), trVDR("yes")));
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										37
									
								
								softhddev.c
									
									
									
									
									
								
							
							
						
						
									
										37
									
								
								softhddev.c
									
									
									
									
									
								
							@@ -60,7 +60,7 @@
 | 
			
		||||
#include "codec.h"
 | 
			
		||||
// clang-format on
 | 
			
		||||
 | 
			
		||||
#ifdef DEBUG
 | 
			
		||||
#if 0
 | 
			
		||||
static int DumpH264(const uint8_t *data, int size);
 | 
			
		||||
static void DumpMpeg(const uint8_t *data, int size);
 | 
			
		||||
#endif
 | 
			
		||||
@@ -662,7 +662,13 @@ static void PesParse(PesDemux *pesdx, const uint8_t *data, int size, int is_star
 | 
			
		||||
                        break;
 | 
			
		||||
                    }
 | 
			
		||||
                    if (r > 0) {
 | 
			
		||||
                        AVPacket avpkt[1];
 | 
			
		||||
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(58,33,100)
 | 
			
		||||
				        AVPacket avpkt[1];
 | 
			
		||||
				        av_init_packet(avpkt);
 | 
			
		||||
#else
 | 
			
		||||
                        AVPacket * avpkt;
 | 
			
		||||
				        avpkt = av_packet_alloc();
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
                        // new codec id, close and open new
 | 
			
		||||
                        if (AudioCodecID != codec_id) {
 | 
			
		||||
@@ -671,13 +677,15 @@ static void PesParse(PesDemux *pesdx, const uint8_t *data, int size, int is_star
 | 
			
		||||
                            CodecAudioOpen(MyAudioDecoder, codec_id);
 | 
			
		||||
                            AudioCodecID = codec_id;
 | 
			
		||||
                        }
 | 
			
		||||
                        av_init_packet(avpkt);
 | 
			
		||||
                        avpkt->data = (void *)q;
 | 
			
		||||
                        avpkt->size = r;
 | 
			
		||||
                        avpkt->pts = pesdx->PTS;
 | 
			
		||||
                        avpkt->dts = pesdx->DTS;
 | 
			
		||||
                        // FIXME: not aligned for ffmpeg
 | 
			
		||||
                        CodecAudioDecode(MyAudioDecoder, avpkt);
 | 
			
		||||
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(58,33,100)
 | 
			
		||||
				        av_packet_free(&avpkt);
 | 
			
		||||
#endif
 | 
			
		||||
                        pesdx->PTS = AV_NOPTS_VALUE;
 | 
			
		||||
                        pesdx->DTS = AV_NOPTS_VALUE;
 | 
			
		||||
                        pesdx->Skip += r;
 | 
			
		||||
@@ -1147,21 +1155,28 @@ int PlayAudio(const uint8_t *data, int size, uint8_t id) {
 | 
			
		||||
            break;
 | 
			
		||||
        }
 | 
			
		||||
        if (r > 0) {
 | 
			
		||||
            AVPacket avpkt[1];
 | 
			
		||||
 | 
			
		||||
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(58,33,100)
 | 
			
		||||
	        AVPacket avpkt[1];
 | 
			
		||||
	        av_init_packet(avpkt);
 | 
			
		||||
#else
 | 
			
		||||
	        AVPacket * avpkt;
 | 
			
		||||
	        avpkt = av_packet_alloc();
 | 
			
		||||
#endif
 | 
			
		||||
            // new codec id, close and open new
 | 
			
		||||
            if (AudioCodecID != codec_id) {
 | 
			
		||||
                CodecAudioClose(MyAudioDecoder);
 | 
			
		||||
                CodecAudioOpen(MyAudioDecoder, codec_id);
 | 
			
		||||
                AudioCodecID = codec_id;
 | 
			
		||||
            }
 | 
			
		||||
            av_init_packet(avpkt);
 | 
			
		||||
            avpkt->data = (void *)p;
 | 
			
		||||
            avpkt->size = r;
 | 
			
		||||
            avpkt->pts = AudioAvPkt->pts;
 | 
			
		||||
            avpkt->dts = AudioAvPkt->dts;
 | 
			
		||||
            // FIXME: not aligned for ffmpeg
 | 
			
		||||
            CodecAudioDecode(MyAudioDecoder, avpkt);
 | 
			
		||||
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(58,33,100)
 | 
			
		||||
	        av_packet_free(&avpkt);
 | 
			
		||||
#endif
 | 
			
		||||
            AudioAvPkt->pts = AV_NOPTS_VALUE;
 | 
			
		||||
            AudioAvPkt->dts = AV_NOPTS_VALUE;
 | 
			
		||||
            p += r;
 | 
			
		||||
@@ -1625,7 +1640,7 @@ static void VideoMpegEnqueue(VideoStream *stream, int64_t pts, int64_t dts, cons
 | 
			
		||||
**  @param avpkt    ffmpeg a/v packet
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
#ifndef USE_PIP
 | 
			
		||||
#if !defined USE_PIP &&  !defined VAAPI
 | 
			
		||||
static void FixPacketForFFMpeg(VideoDecoder *vdecoder, AVPacket *avpkt) {
 | 
			
		||||
    uint8_t *p;
 | 
			
		||||
    int n;
 | 
			
		||||
@@ -1993,7 +2008,7 @@ static void StopVideo(void) {
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#ifdef DEBUG
 | 
			
		||||
#if 0
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
**  Dump mpeg video packet.
 | 
			
		||||
@@ -2817,8 +2832,8 @@ const char *CommandLineHelp(void) {
 | 
			
		||||
           "\tstill-h264-hw-decoder\tenable h264 hw decoder for still-pictures\n"
 | 
			
		||||
           "\talsa-driver-broken\tdisable broken alsa driver message\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-no-test\tdisable Alsa Capability test on start for NUC11/12\n"
 | 
			
		||||
           "\talsa-close-open-delay\tenable close open delay to fix no sound bug\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";
 | 
			
		||||
@@ -2908,6 +2923,8 @@ int ProcessArgs(int argc, char *const argv[]) {
 | 
			
		||||
                    AudioAlsaDriverBroken = 1;
 | 
			
		||||
                } else if (!strcasecmp("alsa-no-close-open", optarg)) {
 | 
			
		||||
                    AudioAlsaNoCloseOpen = 1;
 | 
			
		||||
                } else if (!strcasecmp("alsa-no-test", optarg)) {
 | 
			
		||||
                    AudioAlsaNotest = 1;
 | 
			
		||||
                } else if (!strcasecmp("alsa-close-open-delay", optarg)) {
 | 
			
		||||
                    AudioAlsaCloseOpenDelay = 1;
 | 
			
		||||
                } else if (!strcasecmp("ignore-repeat-pict", optarg)) {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user