TAP to switch subtitles

TAPs für die SRP- und CRP-Serie
dRdoS7
Benutzer
Benutzer
Beiträge: 52
Registriert: So 14. Apr 2013, 00:31

TAP to switch subtitles

#1

Beitrag von dRdoS7 » So 30. Mär 2014, 09:58

Hi,

I am trying to write a TAP to switch subtiles.

This is what I have written:

Code: Alles auswählen

/*******************************************************************************

		TAP to switch subtitles (On or Off in OZ) when the Subtitle key is pressed.
    
		Removed TAP Commander & OSD stuff.

		From Subtitle Switch for PVR5000t by ToppyTools

*******************************************************************************/

#include "tap.h"
#include "key.h"
#include "libFireBird.h"

#define ID_TMSSUBS 0x82470001
#define TAP_NAME "TMS_Subtitle Switching v0.2"

TAP_ID( ID_TMSSUBS );
TAP_PROGRAM_NAME("TMS_Subtitle Switching v0.2");
TAP_AUTHOR_NAME("dRdoS7");
TAP_DESCRIPTION("One press subtitle Switching");
TAP_ETCINFO(__DATE__);


static bool subStatus;

//------------------------------------ TAP EventHandler ----------------------------------------

dword TAP_EventHandler( word event, dword param1, dword param2 )
{
	UNUSED(param2);

	dword mainState, subState;

	TAP_GetState( &mainState, &subState );

	if( event == EVT_KEY )
  {
    if( mainState == STATE_Normal && param1 == RKEY_Subt)	//Subtitle key pressed and not showing any menu
 		{
			subStatus = SubtitleGetStatus(); //Get Subtitle Status
			if( subStatus == TRUE )
			{
				SubtitleSetStatus(FALSE);		//Disable Subtitles
			}
			else
			{
				SubtitleSetStatus(TRUE);		//Enable Subtitles
			}
		}
	}
  return param1;
}
//-------------------------------------- TAP MAIN ------------------------------------------------

int TAP_Main(void)
{
	//TAP_Delay (1000); // pause startup for 10 seconds
	return 1;					//Starting in TSR mode
}
When I run build_TMS.bat, I get this:

Code: Alles auswählen

build_TMS.bat

C:\TAP-Dev\TAPs\Eigene\TMSsubtitle02>set PATH=C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files (x86)\AMD APP\bin\x86_64;C:\Program Files (x86)\AMD APP\bin\x86;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files (x86)\ffmpeg\bin;C:\TAP-Dev\cygwin\bin;C:\TAP-Dev\api\tms\include;D:\Downloads\Topfield\MKVtoolnix;C:\Program Files (x86)\GPAC;C:\TAP-Dev\cygwin\opt\crosstool\bin 

C:\TAP-Dev\TAPs\Eigene\TMSsubtitle02>del /Q bin obj 

C:\TAP-Dev\TAPs\Eigene\TMSsubtitle02>bash -i -c make 
bash: cannot set terminal process group (-1): Inappropriate ioctl for device
bash: no job control in this shell
[Compile... /taps/Eigene/TMSsubtitle02/TMSsubtitle02.c]
mipsel-linux-uclibc-gcc -D_TMS_ -DLINUX  -MD -W -Wall -O2 -mips32 -fPIC -I/tapapi/TMS/include -c /taps/Eigene/TMSsubtitle02/TMSsubtitle02.c -o /taps/Eigene/TMSsubtitle02/obj/TMSsubtitle02.o
/taps/Eigene/TMSsubtitle02/TMSsubtitle02.c: In function `TAP_EventHandler':
/taps/Eigene/TMSsubtitle02/TMSsubtitle02.c:42: warning: implicit declaration of function `SubtitleGetStatus'
/taps/Eigene/TMSsubtitle02/TMSsubtitle02.c:45: warning: implicit declaration of function `SubtitleSetStatus'
[Linking... /taps/Eigene/TMSsubtitle02/bin/TMSsubtitle02.tap]
mipsel-linux-uclibc-ld -shared --no-undefined --allow-shlib-undefined  -o /taps/Eigene/TMSsubtitle02/bin/TMSsubtitle02.tap /taps/Eigene/TMSsubtitle02/obj/TMSsubtitle02.o /tapapi/TMS/tapinit.o /tapapi/TMS/libtap.so -lFireBird -ldl -lc -Map /taps/Eigene/TMSsubtitle02/obj/TMSsubtitle02.map
/taps/Eigene/TMSsubtitle02/obj/TMSsubtitle02.o: In function `TAP_EventHandler':
TMSsubtitle02.c :( .text+0x78): undefined reference to `SubtitleGetStatus'
TMSsubtitle02.c :( .text+0x94): undefined reference to `SubtitleSetStatus'
Makefile:53: recipe for target `/taps/Eigene/TMSsubtitle02/bin/TMSsubtitle02.tap' failed
make: *** [/taps/Eigene/TMSsubtitle02/bin/TMSsubtitle02.tap] Error 1

C:\TAP-Dev\TAPs\Eigene\TMSsubtitle02>rem pause 
>Exit code: 0    Time: 0.720
MAKEFILE:

Code: Alles auswählen

APP = TMSsubtitle02
OBJS = TMSsubtitle02.o


BASE = $(shell cd /tapapi/TMS; pwd)
CUR_DIR = $(shell pwd)

# include default settings
include ${BASE}/include/tool.mk

# output object directory
OBJ_DIR = ${CUR_DIR}/obj
BIN_DIR = ${CUR_DIR}/bin
SRC_DIR = ${CUR_DIR}


#if you want to use other source path..
#vpath %.cpp $(VPATH)
#vpath %.c $(VPATH)

TAP_FLAGS += -fPIC

ifeq (${DEBUG},y)
TAP_FLAGS += -g -DDEBUG
endif

#compile options
CFLAGS += -DLINUX  -MD -W -Wall -O2 -mips32
CPPFLAGS += -DLINUX  -MD -W -Wall  -O2 -mips32

#include directories.
INCLUDE_DIRS = ${BASE}/include

TAP_INCLUDE_DIRS = $(addprefix -I, $(INCLUDE_DIRS))
TAP_FLAGS += $(TAP_INCLUDE_DIRS)

TAP_OBJS = $(addprefix $(OBJ_DIR)/, ${OBJS})

TAP_LIBS =  ${BASE}/tapinit.o ${BASE}/libtap.so -lFireBird -ldl -lc

TAP_APP = $(BIN_DIR)/$(APP).tap
TAP_MAP = $(OBJ_DIR)/$(APP).map

all: $(OBJ_DIR) $(BIN_DIR) $(TAP_APP)

$(OBJ_DIR) $(BIN_DIR):
	@echo "[Making direcotry... $@]"
	${Q_}$(MKDIR) "$@"

$(TAP_APP): ${TAP_OBJS}
	@echo "[Linking... $@]"
	$(Q_)$(LD) -shared --no-undefined --allow-shlib-undefined  -o $@ ${TAP_OBJS} $(TAP_LIBS) -Map ${TAP_MAP}
	$(Q_)$(JB) $(TAP_APP)

clean:
	@echo "[Clean all objs...]"
	$(Q_)-${RM} $(TAP_APP) $(OBJ_DIR)/*.d $(OBJ_DIR)/*.o $(OBJ_DIR)/*.map


# Implicit rule for building local apps
%.o : %.c
	@echo [Compile... $<]
	${Q_}$(CC) $(CFLAGS) $(TAP_FLAGS) -c $< -o $@

%.o : %.cpp
	@echo "[Compile... $<]"
	${Q_}$(CXX)  $(CPPFLAGS) $(TAP_FLAGS) -c $< -o $@

$(OBJ_DIR)/%.o : $(SRC_DIR)/%.c
	@echo [Compile... $<]
	${Q_}$(CC) $(CFLAGS) $(TAP_FLAGS) -c $< -o $@

$(OBJ_DIR)/%.o : $(SRC_DIR)/%.cpp
	@echo "[Compile... $<]"
	${Q_}$(CXX)  $(CPPFLAGS) $(TAP_FLAGS) -c $< -o $@


# Dependency file checking (created with gcc -M command)
-include $(OBJ_DIR)/*.d
What am I doing wrong?

I appreciate any help.

dRdoS7

Benutzeravatar
FireBird
Suspekter verdächtiger Zauberküchenchef, TAP & Firmware-Guru
Suspekter verdächtiger Zauberküchenchef, TAP & Firmware-Guru
Beiträge: 28981
Registriert: Fr 9. Dez 2005, 09:59
Receivertyp: SRP-2401CI+ TFIR
vu+ Duo 4k
Wohnort: Wien

AW: TAP to switch subtitles

#2

Beitrag von FireBird » So 30. Mär 2014, 10:16

The compiler tries to tell you that it doesn't know SubtitleGetStatus() and SubtitleSetStatus(). Either you forgot to add these subroutines or you forgot to include the libraries that contain these functions.

/Edit:

Code: Alles auswählen

From Subtitle Switch for [b]PVR5000t[/b]
Whatever lib they used...

/Edit2 - finally: both functions where taken from a FireBird lib for the TF5000 series but these are not available anymore on the “new” TMS Toppies.
Zuletzt geändert von FireBird am So 30. Mär 2014, 10:20, insgesamt 1-mal geändert.

dRdoS7
Benutzer
Benutzer
Beiträge: 52
Registriert: So 14. Apr 2013, 00:31

AW: TAP to switch subtitles

#3

Beitrag von dRdoS7 » So 30. Mär 2014, 10:39

Hi,

The functions weren't in the old 5000 TAP, I put them in for the TMS.

They are still listed in the FireBirdLib-E.pdf. I downloaded the latest FirebirdLib.zip

Is there any way to switch subs with a TAP?

I tried another way earlier:

Code: Alles auswählen

/**************************************************************************
     TAP to switch subtitles On or Off when the Subtitle key is pressed.

**************************************************************************/

#include "tap.h"

#define ID_USERTAP 0x80070072
#define TAP_NAME "TMS Subtitle Switch v1.0"

TAP_ID( ID_USERTAP );
TAP_PROGRAM_NAME("TMS Subtitle Switch v1.0");
TAP_AUTHOR_NAME("ToppyTools");
TAP_DESCRIPTION("One press subtitle switching");
TAP_ETCINFO(__DATE__);


//------------------------------------ TAP EventHandler ----------------------------------------

dword TAP_EventHandler( word event, dword param1, dword param2 )
{

	UNUSED(param2);
//	static dword TimeOutTick = 0;
	dword mainState, subState;

    	TAP_GetState( &mainState, &subState );

	if( event == EVT_KEY )
 	{
 		if( mainState == STATE_Normal && param1 == RKEY_Subt)	//Subtitle key pressed and not showing any menu
		{
			TAP_GenerateEvent(EVT_KEY, RKEY_Down, 0);	//Send "Down" key
			TAP_GenerateEvent(EVT_KEY, RKEY_Ok, 0);		//Send "OK" key
		}
	}
  	return param1;
}


//-------------------------------------- TAP MAIN ------------------------------------------------

int TAP_Main(void)
{
	TAP_Delay (50);
	return 1;				//Starting in TSR mode
}
All that happened was the Subtitle screen appeared, quickly; it didn't switch.

Thanks,

dRdoS7
Zuletzt geändert von dRdoS7 am So 30. Mär 2014, 11:03, insgesamt 2-mal geändert.

Benutzeravatar
FireBird
Suspekter verdächtiger Zauberküchenchef, TAP & Firmware-Guru
Suspekter verdächtiger Zauberküchenchef, TAP & Firmware-Guru
Beiträge: 28981
Registriert: Fr 9. Dez 2005, 09:59
Receivertyp: SRP-2401CI+ TFIR
vu+ Duo 4k
Wohnort: Wien

AW: TAP to switch subtitles

#4

Beitrag von FireBird » So 30. Mär 2014, 11:28

dRdoS7 hat geschrieben:They are still listed in the FireBirdLib-E.pdf.

My pdf is from 2011. :wink:

Does it change the cursor position in the subtitle window?

That timing is a bit critical.

Code: Alles auswählen

TAP_GetState( &mainState, &subState );

if( event == EVT_KEY )
{
  if( mainState == STATE_Normal && param1 == RKEY_Subt)
  {
    TAP_GenerateEvent(EVT_KEY, RKEY_Down, 0);	//Send "Down" key
    TAP_GenerateEvent(EVT_KEY, RKEY_Ok, 0);		//Send "OK" key
  } 
If a key gets pressed, the key event is first fed through all TAPs and is then processed by the firmware. This means that the subtitle window opens after you were sending the Down and Ok keys. Try to find out if the subtitle window generates a subState you can detect.

dRdoS7
Benutzer
Benutzer
Beiträge: 52
Registriert: So 14. Apr 2013, 00:31

AW: TAP to switch subtitles

#5

Beitrag von dRdoS7 » Mo 31. Mär 2014, 00:13

Hi,

This is a fragment of the original code (by ToppyTools):

Code: Alles auswählen

//------------------------------------ TAP EventHandler ----------------------------------------

//TSRCommanderInit( int 3, bool false );

dword TAP_EventHandler( word event, dword param1, dword param2 )
{
	static dword TimeOutTick = 0;
	dword mainState, subState;

    	TAP_GetState( &mainState, &subState );
		
	if( event == EVT_KEY )
    	{
    		if( mainState == STATE_Normal && param1 == RKEY_Subt)	//Subtitle key pressed and not showing any menu
 		{
			TAP_GenerateEvent(EVT_KEY, RKEY_ChDown, 0);	//Send "Down" key
			TAP_GenerateEvent(EVT_KEY, RKEY_Ok, 0);		//Send "OK" key
		}
	}
	

I have only removed TAPCommander & a message window. Also changed RKEY_ChDown to RKEY_Down for the TMS.
If a key gets pressed, the key event is first fed through all TAPs and is then processed by the firmware. This Means did the subtitle window opens after you were sending the Down and OK keys.
Does this mean the action of TMS Toppy WRT TAPs is changed from the 5000?

I don't know a lot about about programming, I am able to take code fragments and make some slight alterations.
Try to find out if the subtitle window gene rates a substate you can detect.
That is beyond me. I can follow examples, I've search all the TAPs for whch there is a source code and can't find any.

Do you mean add a line?:

Code: Alles auswählen

TAP_GetState( &mainState, &subState );
Then:

Code: Alles auswählen

if (  subState == SUBSTATE_*Menu ) 
Where "*Menu" is the name of the subtitle menu.

Thanks,

dRdoS7

EDIT: I just found this: TapLauncher for 5000; it has key & state logging. I will run it on the 5000 and see what the substate is when the subtitle menu is on screen.
Zuletzt geändert von dRdoS7 am Mo 31. Mär 2014, 00:28, insgesamt 1-mal geändert.

Benutzeravatar
FireBird
Suspekter verdächtiger Zauberküchenchef, TAP & Firmware-Guru
Suspekter verdächtiger Zauberküchenchef, TAP & Firmware-Guru
Beiträge: 28981
Registriert: Fr 9. Dez 2005, 09:59
Receivertyp: SRP-2401CI+ TFIR
vu+ Duo 4k
Wohnort: Wien

AW: TAP to switch subtitles

#6

Beitrag von FireBird » Mo 31. Mär 2014, 00:35

Maybe the problem is coming from a different side. If your Toppy uses a remote with different codes compared to key.h, RKEY_ChDown doesn’t trigger a cursor movement. Try RKEY_F4 and RKEY_Down instead of RKEY_ChDown.

dRdoS7
Benutzer
Benutzer
Beiträge: 52
Registriert: So 14. Apr 2013, 00:31

AW: TAP to switch subtitles

#7

Beitrag von dRdoS7 » Mo 31. Mär 2014, 04:26

Hi,

FireBird hat geschrieben:Maybe the problem is coming from a different side. If your Toppy uses a remote with different codes compared to key.h, RKEY_ChDown doesn?t trigger a cursor movement. Try RKEY_F4 and RKEY_Down instead of RKEY_ChDown.


This is was the code:

Code: Alles auswählen

			TAP_GenerateEvent (EVT_KEY, RKEY_Down, 0) / / Send "Down" key
			TAP_GenerateEvent (EVT_KEY, RKEY_Ok, 0) / / Send the "OK" key
This is the current code:

Code: Alles auswählen

			TAP_GenerateEvent (EVT_KEY, RKEY_R4, 0) 
			TAP_GenerateEvent (EVT_KEY, RKEY_Down, 0)
I removed the "OK" key so I could see if the cursor went down; it didn't.

dRdoS7

dRdoS7
Benutzer
Benutzer
Beiträge: 52
Registriert: So 14. Apr 2013, 00:31

AW: TAP to switch subtitles

#8

Beitrag von dRdoS7 » Mi 2. Apr 2014, 00:11

Hi,

I changed the TAP so it only sends the OK key. That key does work in the TAP with the Subtitle Menu displayed.

I ran KeyDisplay and pressed the Down key: Keycode 65565 0x1001d.

dRdoS7

Benutzeravatar
FireBird
Suspekter verdächtiger Zauberküchenchef, TAP & Firmware-Guru
Suspekter verdächtiger Zauberküchenchef, TAP & Firmware-Guru
Beiträge: 28981
Registriert: Fr 9. Dez 2005, 09:59
Receivertyp: SRP-2401CI+ TFIR
vu+ Duo 4k
Wohnort: Wien

AW: TAP to switch subtitles

#9

Beitrag von FireBird » Mi 2. Apr 2014, 00:13

And 0x1001d is RKEY_Down. I'll make a note that I'll do some tests tomorrow. It's already too late now.

dRdoS7
Benutzer
Benutzer
Beiträge: 52
Registriert: So 14. Apr 2013, 00:31

AW: TAP to switch subtitles

#10

Beitrag von dRdoS7 » Mi 2. Apr 2014, 04:44

Hi,

This afternoon, instead of RKEY_Down, I tried FKEY_ChDown.

Earlier today I was looking through key.h and saw Front Panel keys listed.

I tested that the front panel down key moved the cursor in the Subtitle Menu, it did.

I edited the TAP and it toggles the subtitles!

Thanks,

dRdoS7

Du hast keine ausreichende Berechtigung, um die Dateianhänge dieses Beitrags anzusehen.
Zuletzt geändert von dRdoS7 am Mi 2. Apr 2014, 05:22, insgesamt 3-mal geändert.

Antworten

Zurück zu „SRP/CRP TAP-Bereich“