VideoAR Fix - Display Size

Here is information about customize your B series firmware..:!:This forum is NOT FOR USER questions or problems but DEVELOPER.

newagehun
Official SamyGO Developer
Posts: 18
Joined: Tue Oct 06, 2009 10:21 pm

Re: VideoAR Fix - Display Size

Post by newagehun »

OK. I'll check.

Btw theoretically it is possible to make the automatic aspect ratio work.
Samsung uses an old ffmpeg libraries (eg. libavformat 52.23.1). If we update the Comp_LIB folder with new libraries and then safely test the exeDSP still works then I could inject code that read the pixel aspect ratio and apply to the video frame.
Perhaps I don't know latest ffmpeg libraries can read pixel aspect ratio from containers/codecs samsung uses.

For me right now it was easier to make the manual switch.

However if anyone test and do the following things I'll make the exeDSP code injections to apply automatic aspect ratio handling:

1) test: latest ffmpeg libraries support (can read) pixel aspect ratio stored in various containers/codecs
2) compile: working ARM libraries from latest ffmpeg sources
3) safely test original exeDSP with new libraries (meaning if exeDSP freeze then simple reboot will use the old libraries or after reboot old libraries can put back)
newagehun
Official SamyGO Developer
Posts: 18
Joined: Tue Oct 06, 2009 10:21 pm

Re: VideoAR Fix - Display Size

Post by newagehun »

Just thought it over again and figured out that exeDSP will freeze. The latest ffmpeg has different (larger) structs and since the exeDSP was compiled with previous version when exeDSP asks for some info that returns some struct memory overlapping will happen in stack.

So simply if anyone can compile a working ARM ffmpeg libraries from latest sources and those sources also will compiled for win32 (to dll-s) I can test the win32 part for what I need. If it returns PAR then I can patch exeDSP to load new libraries for my functions. :)
newagehun
Official SamyGO Developer
Posts: 18
Joined: Tue Oct 06, 2009 10:21 pm

Re: VideoAR Fix - Display Size

Post by newagehun »

I've made some progress but now I definitely need some (almost) step-by-step help.

I've compiled ffmpeg latest version on win32 and made a simple tool that loads the input file and displays its video frame size and the display size of it applying aspect ratio (if there it is).
It is working fine!

Now what I need to do further tests.

1) telnet support: can be done there is a wiki for that --- check
2) able to stop exeDSP from telnet and prevent the tv to restart
3) copy new exeDSP executable (lets call it exeDSP2) to the same location where exeDSP it is (is it possible from telnet somehow? if not then somehow from usb? and where is exeDSP actually :) )
4) give exeDSP2 a excutable flag
5) run exeDSP2

This way if exeDSP2 fails I can just reset tv and have the exeDSP working fine.

If these things are working then I'll try to compile new avcodec and avformat libraries for ARM. And also copy them to the location of old versions (btw where are they?)
And then lot of code injections into exeDSP2 to use new libraries where I extract aspect ratio information.
newagehun
Official SamyGO Developer
Posts: 18
Joined: Tue Oct 06, 2009 10:21 pm

Re: VideoAR Fix - Display Size

Post by newagehun »

Anyway thanks for your help.

So you say there is not enough space for additional files in /mtd_exe and /mtd_exe/Comp_LIB ?
That sucks.

Meanwhile I've fired up telnet and everything works fine.

ARM libs: if you can easy make a compile from
libavcodec
libavformat
libavutil
from the latest sources than it would be fine.

Also if you can compile a simple program for ARM that will use those lib would be even much better.
here is the source:
(this is visual studio code, but only small modifications needed to be ansi c compatible)

Code: Select all

int _tmain(int argc, _TCHAR* argv[])
{
	AVFormatContext *ic = NULL;
	char ansiname[1024];
	BOOL UsedDefaultChar;
	int i, num, den, dwidth;

	if (argc < 2)
	{
		wprintf(L"Usage: %s <filename>\n", argv[0]);
		return 1;
	}

	WideCharToMultiByte(CP_ACP, 0, argv[1], -1, ansiname, sizeof(ansiname), NULL, &UsedDefaultChar);
	
	av_register_all();
	if (av_open_input_file(&ic, ansiname, NULL, 0, NULL) < 0)
	{
		wprintf(L"ERROR OPENING FILE: %s\n", argv[1]);
		return 2;
	}
	av_find_stream_info(ic);
	dump_format(ic, 0, ansiname, 0);

	for (i = 0; i < ic->nb_streams; i++)
	{
		if (ic->streams[i]->codec->codec_type == CODEC_TYPE_VIDEO)
		{
			num = ic->streams[i]->codec->width*ic->streams[i]->sample_aspect_ratio.num;
			den = ic->streams[i]->codec->height*ic->streams[i]->sample_aspect_ratio.den;
			if (!num)
			{
				num = ic->streams[i]->codec->width*ic->streams[i]->codec->sample_aspect_ratio.num;
				den = ic->streams[i]->codec->height*ic->streams[i]->codec->sample_aspect_ratio.den;
			}
			if (num)
			{
				dwidth = num * ic->streams[i]->codec->height / den;
			}
			else
			{
				dwidth = ic->streams[i]->codec->width;
			}
			wprintf(L"\nVIDEO: Frame: %dx%d Display: %dx%d\n", ic->streams[i]->codec->width, ic->streams[i]->codec->height, dwidth, ic->streams[i]->codec->height);
			break;
		}
	}

	av_close_input_file(ic);

	return 0;
}
dynamic1969
SamyGO Admin
Posts: 62
Joined: Sun Oct 04, 2009 12:35 am

Re: VideoAR Fix - Display Size

Post by dynamic1969 »

Hi newagehun,

let me give a try to assist with your questions:
newagehun wrote:2) to stop exeDSP from telnet and prevent the tv to restart
3) copy new exeDSP executable (lets call it exeDSP2) to the same location where exeDSP it is (is it possible from telnet somehow? if not then somehow from usb? and where is exeDSP actually :) )
4) give exeDSP2 a excutable flag
5) run exeDSP2
2)
- Below will do the trick ... this prevents the TV to reboot if exeDSP is stopped

Code: Select all

/mtd_boot/MicomCtrl 23
3,4,5)
- exeDSP is located under /mtd_exe
- You can leave your modified exeDSP on your USB ( /dtv/usb/sda1 ) or alternatively you can also copy to /mtd_swu or another location ( should all work ).
- use chmod +x /dtv/usb/sda1/exeDSP to give it execute permissions
- Now you can simply overlay the original exeDSP with your modified version, by using "mount -o bind ...", see example below

Code: Select all

mount -o bind /dtv/usb/sda1/exeDSP /mtd_boot/exeDSP
Comments:
a) This will mount your modified exeDSP over the original version. You should now be able to start it via /mtd_exe/rc.local
b) If something goes wrong and you have to restart, your original exeDSP will be in place by default, as the mount -o bind is gone after a reboot
c) Your screen will most likely show everything upside down :-). I believe this is due to a variable setting missing, when started via /mtd_exe/rc.local
d) sometimes exeDSP will coredump, when started like this. Didn't test further to figure out why yet
e) You can enforce a sutdown / reboot of your TV via following command, in case your remote doesn't react anylonger:

Code: Select all

/mtd_boot/MicomCtrl 18 # for a shutdown
/mtd_boot/MicomCtrl 123 # for a reboot
- alternatively you can of course simply create a copy of rc.local in /mtd_rwarea and invoke your modified exeDSP from there ( be it from your USB or any other location )

Hope this helps with your next steps.

Regards
dynamic
User avatar
erdem_ua
SamyGO Admin
Posts: 3126
Joined: Thu Oct 01, 2009 6:02 am
Location: Istanbul, Turkey
Contact:

Re: VideoAR Fix - Display Size

Post by erdem_ua »

I tried to execute USA version of exeDSP via USB with editing rc.local file on USB stick and failed. :(

Locked

Return to “[B] Firmware”