signalwareltd / AndroidDvbDriver

Android driver framework for USB TV tuners
GNU General Public License v2.0
203 stars 70 forks source link

T230C Support #9

Closed dmgouriev closed 6 years ago

dmgouriev commented 7 years ago

Hello,

I forked your driver and added support for the MyGica T230C tuner. https://github.com/dmgouriev/AndroidDvbDriver To do this, I had to port source code from the project https://github.com/crazycat69/linux_media to Java. Before porting, I compiled the sources under Ubuntu 16.04 and made sure that everything works ok in VLС. But now I'm faced with a problem that can not be solved for a long time: there is no transport stream. Perhaps you know the specific places in the project that are responsible for issuing the transport stream, or could help with the solution?

Now I get all parametrs FE_HAS_SIGNAL, FE_HAS_CARRIER, FE_HAS_VITERBI, FE_HAS_SYNC, FE_HAS_LOCK is checked and getting value for Signal strength and Quality? but it is no Bitrate value =( While debug I get, that method IsoRequest.getReadyRequestId allways returns -1.

http://i98.fastpic.ru/big/2017/1117/0d/c68debb4d8d970e3be67f286c6c70d0d.png

Best regards, Dmitry G.

martinmarinov commented 7 years ago

Hey Dmitry,

Thats' very impressive :)

So the TS is handled by the device itself. It comes over the USB interface defined in https://github.com/dmgouriev/AndroidDvbDriver/blob/639b2118df6f4ddf906ef9837d8f2c8893527a8d/drivers/src/main/java/info/martinmarinov/drivers/usb/DvbUsbDevice.java#L251

The framework will wait for data on that interface and forward it as soon as data is available.

I think your code may have a bug somewhere. I think some devices need to send a specific command internally to enable the output of the TS stream. Double check your original source file of the driver whether you have omitted something that relates to enabling ts on the device itself.

dmgouriev commented 7 years ago

Hey,

In fact, the whole problem is that I checked the code several times, but I did not find mistake in porting. Okay, thanks, now I at least know exactly where to look!

martinmarinov commented 6 years ago

Did you manage to find the issue?

dmgouriev commented 6 years ago

Hey! Yes, I do it =) I talked to the С original driver developer. In the firmware of the USB-controller there is a little bug and it is necessary to restart streaming after lock. https://github.com/crazycat69/linux_media/blob/latest/drivers/media/usb/dvb-usb/cxusb.c#L382

Now i'm trying to port C code for tuner with lme2510. Tuner uses original android application Cidana.

And I have a little problem with parsing TS stream. I think it's algorithmic mistake, but now I cant find it. Have you any source sample for parsing stream for SDT tables?

P.S. In your AerialTV app I find incorrect charset for founded Russian channels. I think you don't convert channel names to UTF8...

martinmarinov commented 6 years ago

Hey. If t230c works now I would be happy to look at a pull request :)

As for SDT, well my app does parse them but it is closed source for various reasons.

The charset story is very complicated. SDT does not use UTF-8 and some countries like Russia use a non-standard encoding for EPG in Cyrillic. So there is literally an if statement - if language is Russian switch to different encoding.

dmgouriev commented 6 years ago

Yes, it works! I will commit changes tomorrow=) On the issue of encoding, I found a solution: serviceName = new String(new String(parseNchars(binaryFields, position, serviceNameLength * charSize), "ISO-8859-5").getBytes(), "UTF-8");

Returning to the SDT, perhaps you can help. The problem is the following: I get section_length = 278, which is larger than the packet size (188), so the remaining 278 - 188 = 90 bytes are filled with zeros. During the loop, when service_id reaches 1090 (in my example), non-null bytes finished on the first letter of the provider "P", below is the full parsing result:

table_id = 66 section_syntax_indicator = 1 section_length = 278 transport_stream_id = 1 version_number = 24 current_next_indicator = 1 section_number = 0 last_section_number = 0 original_network_id = 8835

   --------------loop1-------------- 
   service_id = 1010 
   EIT_schedule_flag = 1 
   EIT_present_following_flag = 1 
   running_status = 4 
   free_CA_mode = 0 
   descriptors_loop_length = 26 

           *********descriptor********* 
           descriptor_tag = 72 
           descriptor_length = 24 
           service_type = 22 
           service_provider_name_length = 5 
           service_provider_name =  PTPC 
           service_name_length = 16 
           service_name =  01 OPT 

   --------------loop2-------------- 
   service_id = 1030 
   EIT_schedule_flag = 1 
   EIT_present_following_flag = 1 
   running_status = 4 
   free_CA_mode = 0 
   descriptors_loop_length = 19 

           *********descriptor********* 
           descriptor_tag = 72 
           descriptor_length = 17 
           service_type = 22 
           service_provider_name_length = 5 
           service_provider_name = PTPC 
           service_name_length = 9 
           service_name =  03 FOOTBALL! 

   ...

   --------------loop7-------------- 
   service_id = 1090 
   EIT_schedule_flag = 1 
   EIT_present_following_flag = 1 
   running_status = 4 
   free_CA_mode = 0 
   descriptors_loop_length = 17 

           *********descriptor********* 
           descriptor_tag = 72 
           descriptor_length = 15 
           service_type = 22 
           service_provider_name_length = 5 
           service_provider_name =  P
           service_name_length = 0 
           service_name =                

I think, somewhere its my algorithmic mistake, but now I cant find it. And many samples, what i can find dont give me correct result. BUT ffmpeg or vlc give me full info, and i can see service provider and service name for service_id=1090.

You can email me=) dm.gouriev@gmail.com

Best regards

martinmarinov commented 6 years ago

Hey man, does Aerial TV display correct Cyrillic service name in this case?