JvanKatwijk / eti-stuff

experimental software for creating and interpreting eti frames
GNU General Public License v2.0
21 stars 12 forks source link

rapidxml::parse_error in eti-cmdline-xmlfiles #61

Open andimik opened 8 months ago

andimik commented 8 months ago

Dear Jan,

I have no idea why I cannot play the attached file in eti-cmdline-xmlfiles, which I have recorded an older version of Qt-DAB (3.4.1) with my Raspberry.

It seems it has nothing to do with the German-Austrian ä in the month ("Jänner", have renamed it) and nothing to do with the missing > at the end of the XML-header (have patched the header, see below) and nothing to do with the 
 after the year. Why? Because I can play this file in Qt-DAB (and AbracaDABra as well).

As the header is 1024 bytes long and my file is u8 raw in fact, I've used the following command to get a valid eti out of it:

dd if=./foo.uff skip=1024 | eti-cmdline-rawfiles -F /dev/stdin | dablin_gtk 

But eti-cmdline-xmlfiles cannot handle the file at all (even after patching it in a hexeditor by replacing the header with another one), therefore I've checked with gdb

$ LANG=C ./eti-cmdline-xmlfiles -F /media/andreas/01782a32-19cf-4832-a802-039dbc61af5d/Generic\ RTL2832U\ OEM-7D-Mi--Jän--24-2024-17-55-00.uff 
terminate called after throwing an instance of 'rapidxml::parse_error'
  what():  expected >
Abgebrochen (Speicherabzug geschrieben)
$ gdb --args ./eti-cmdline-xmlfiles -F /media/andreas/01782a32-19cf-4832-a802-039dbc61af5d/Generic\ RTL2832U\ OEM-7D-Mi--Jän--24-2024-17-55-00.uff 
GNU gdb (Ubuntu 12.1-0ubuntu1~22.04) 12.1
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./eti-cmdline-xmlfiles...
(gdb) r
Starting program: /tmp/eti-stuff/eti-cmdline/build_xmlfiles/eti-cmdline-xmlfiles -F /media/andreas/01782a32-19cf-4832-a802-039dbc61af5d/Generic\ RTL2832U\ OEM-7D-Mi--Jän--24-2024-17-55-00.uff
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
terminate called after throwing an instance of 'rapidxml::parse_error'
  what():  expected >

Program received signal SIGABRT, Aborted.
__pthread_kill_implementation (no_tid=0, signo=6, threadid=140737352618944) at ./nptl/pthread_kill.c:44
44  ./nptl/pthread_kill.c: Datei oder Verzeichnis nicht gefunden.
(gdb) bt
#0  __pthread_kill_implementation (no_tid=0, signo=6, threadid=140737352618944) at ./nptl/pthread_kill.c:44
#1  __pthread_kill_internal (signo=6, threadid=140737352618944) at ./nptl/pthread_kill.c:78
#2  __GI___pthread_kill (threadid=140737352618944, signo=signo@entry=6) at ./nptl/pthread_kill.c:89
#3  0x00007ffff7842476 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#4  0x00007ffff78287f3 in __GI_abort () at ./stdlib/abort.c:79
#5  0x00007ffff7ca2b9e in ?? () from /lib/x86_64-linux-gnu/libstdc++.so.6
#6  0x00007ffff7cae20c in ?? () from /lib/x86_64-linux-gnu/libstdc++.so.6
#7  0x00007ffff7cae277 in std::terminate() () from /lib/x86_64-linux-gnu/libstdc++.so.6
#8  0x00007ffff7cae4d8 in __cxa_throw () from /lib/x86_64-linux-gnu/libstdc++.so.6
#9  0x000055555555d1a9 in rapidxml::xml_node<char>* rapidxml::xml_document<char>::parse_node<0>(char*&) [clone .cold] ()
#10 0x0000555555575ac3 in xmlDescriptor::xmlDescriptor(_IO_FILE*, bool*) ()
#11 0x0000555555572f7c in xml_fileReader::xml_fileReader(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, void (*)()) ()
#12 0x000055555555db3d in main ()

This is the XML-header:

$ head -c 2048 < /tmp/Generic\ RTL2832U\ OEM-7D-Mi--Jan--24-2024-17-55-00.uff 
<?xml version="1.0" encoding="utf-8"?>
<SDR>
 <Recorder Name="Qt-DAB" Version="3.4.1"/>
 <Device Name="rtlsdr" Model="Generic RTL2832U OEM"/>
 <Time Value="Wed Jan 24 18:00:58 2024&#xa;" Unit="UTC"/>
 <Sample>
  <Samplerate Value="2048000" Unit="Hz"/>
  <Channels Container="uint8" Bits="8" Ordering="LSB">
   <Channel Value="I"/>
   <Channel Value="Q"/>
  </Channels>
 </Sample>
 <Datablocks>
  <Datablock Number="1" Count="1447763254" Unit="Channel">
   <Frequency Value="194064" Unit="KHz"/>
   <Modulation Value="DAB"/>
  </Datablock>
 </Datablocks>
</SDR

The only difference to another XML-files on my drive is the sorting of the XML fields.

Generic RTL2832U OEM-7D-Mi--Jän--24-2024-17-55-00.zip (the file is truncated to 20 MB in order to fit to Github.com extensions)

dd if=Generic\ RTL2832U\ OEM-7D-Mi--Jän--24-2024-17-55-00.uff skip=1024 > /tmp/Generic\ RTL2832U\ OEM-7D-Mi--Jän--24-2024-17-55-00.raw
$ eti-cmdline-rawfiles -F /tmp/Generic\ RTL2832U\ OEM-7D-Mi--Jän--24-2024-17-55-00.raw | dablin_gtk 
DABlin v1.14.0-4-g9a99ed9 - capital DAB experience
Plays a DAB/DAB+ audio service from an ETI-NI or an EDI AF stream.
  https://github.com/Opendigitalradio/dablin

Period = 8000
SDLOutput: using SDL version '2.0.20'
EnsembleSource: reading ETI from 'stdin'
there might be a DAB signal here
programt ( 1) 8s Radio Terminal      9467 is in the list
program  ( 2)    Retro Radio         9465 is in the list
program  ( 3)    ENTER               9464 is in the list
program  ( 4)    Radio 1 SLO HITI    9466 is in the list
program  ( 5)    Radio Energija      9468 is in the list
ensemble SLO DAB+ R3      detected

Hint: Other files work:

$ eti-cmdline-xmlfiles -F /tmp/Generic\ RTL2832U\ OEM-10D-Mi--Jan--24-2024-22-07-13.uff > /dev/null 
rootnode SDR
Datablock detected
attribute Count (14201702)
attribute Unit (Channel)
attribute Number (1)
sampleRate =    2048000
nrChannels  = 2
bitsperChannel = 8
container   = uint8
byteOrder   = LSB
iqOrder = IQ
nrBlocks    = 1 (1)
>>>   1 14201702 Channel 215072000 DAB
nrElements = 14201702
7100851 samples have to be read, order is IQ
samples to read 7100851
ensemble SLO DAB+ R1      detected
program  ( 1)    VAL 202             9202 is in the list
program  ( 2)    Radio Si            933A is in the list
program  ( 3)    Center Slo          9414 is in the list
program  ( 4)    Rock Radio Slo      9516 is in the list
program  ( 5)    Radio Ognjisce      932F is in the list
program  ( 6)    Radio 1 DAB         9442 is in the list
program  ( 7)    Radio 1 80-a        9459 is in the list
program  ( 8)    Radio City          9415 is in the list
program  ( 9)    Radio Student       9440 is in the list
program  (10)    Radio Salomon       9463 is in the list
program  (11)    Radio Veseljak      9449 is in the list
program  (12)    Radio Net FM        942B is in the list
there might be a DAB signal here
programt (13) 9s Ekspres Slo         9462 is in the list
program  (14)    Radio Aktual        941C is in the list
program  (15)    ARS                 9203 is in the list
program  (16)    PRVI                9201 is in the list

yes, here we go
Handling ensemble SLO DAB+ R1     until you quit
reached end of file, cont = 0: 16, fibquality 100

Maybe you have got an idea?

JvanKatwijk commented 7 months ago

Dear Andreas

I apologize for the delay, but I was (am) too busy. Anyway I looked into the issue and concluded that parsing the xml text aborted by misisng a terminating ">" character in the text The file can be processed by Qt-DAB without problems, there I am using the Qt provided library for parsing the text, and that seems more forgiving for missing end brackets

I'll have to look into Qt-DAB to see whether ot not the xml generator is responsible forthe missing bracket, Fpr the short term remedy is simple, I added a check to see whether or nof the last character in the xml part is a '>', and if not I added it. The modified part is in the xm -descriptor.cpp file and included here. Adding that makes that the file can be processed by eti-cmdline

All the best and have a nice weekend jan

Op wo 24 jan 2024 om 22:19 schreef andimik @.***>:

Dear Jan,

I have no idea why I cannot play the attached file in eti-cmdline-xmlfiles, which I have recorded an older version of Qt-DAB (3.4.1) with my Raspberry.

It seems it has nothing to do with the German-Austrian ä in the month ("Jänner", have renamed it) and nothing to do with the missing > at the end of the XML-header (have patched the header, see below) and nothing to do with the after the year. Why? Because I can play this file in Qt-DAB (and AbracaDABra as well).

As the header is 1024 bytes long and my file is u8 raw in fact, I've used the following command to get a valid eti out of it:

dd if=./foo.uff skip=1024 | eti-cmdline-rawfiles -F /dev/stdin | dablin_gtk

But eti-cmdline-xmlfiles cannot handle the file at all (even after patching it in a hexeditor by replacing the header with another one), therefore I've checked with gdb

$ LANG=C ./eti-cmdline-xmlfiles -F /media/andreas/01782a32-19cf-4832-a802-039dbc61af5d/Generic\ RTL2832U\ OEM-7D-Mi--Jän--24-2024-17-55-00.uff terminate called after throwing an instance of 'rapidxml::parse_error' what(): expected > Abgebrochen (Speicherabzug geschrieben)

$ gdb --args ./eti-cmdline-xmlfiles -F /media/andreas/01782a32-19cf-4832-a802-039dbc61af5d/Generic\ RTL2832U\ OEM-7D-Mi--Jän--24-2024-17-55-00.uff GNU gdb (Ubuntu 12.1-0ubuntu1~22.04) 12.1 Copyright (C) 2022 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: https://www.gnu.org/software/gdb/bugs/. Find the GDB manual and other documentation resources online at: http://www.gnu.org/software/gdb/documentation/.

For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from ./eti-cmdline-xmlfiles... (gdb) r Starting program: /tmp/eti-stuff/eti-cmdline/build_xmlfiles/eti-cmdline-xmlfiles -F /media/andreas/01782a32-19cf-4832-a802-039dbc61af5d/Generic\ RTL2832U\ OEM-7D-Mi--Jän--24-2024-17-55-00.uff [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". terminate called after throwing an instance of 'rapidxml::parse_error' what(): expected >

Program received signal SIGABRT, Aborted. __pthread_kill_implementation (no_tid=0, signo=6, threadid=140737352618944) at ./nptl/pthread_kill.c:44 44 ./nptl/pthread_kill.c: Datei oder Verzeichnis nicht gefunden. (gdb) bt

0 __pthread_kill_implementation (no_tid=0, signo=6, threadid=140737352618944) at ./nptl/pthread_kill.c:44

1 __pthread_kill_internal (signo=6, threadid=140737352618944) at ./nptl/pthread_kill.c:78

2 __GI___pthread_kill (threadid=140737352618944, @.***=6) at ./nptl/pthread_kill.c:89

3 0x00007ffff7842476 in __GI_raise @.***=6) at ../sysdeps/posix/raise.c:26

4 0x00007ffff78287f3 in __GI_abort () at ./stdlib/abort.c:79

5 0x00007ffff7ca2b9e in ?? () from /lib/x86_64-linux-gnu/libstdc++.so.6

6 0x00007ffff7cae20c in ?? () from /lib/x86_64-linux-gnu/libstdc++.so.6

7 0x00007ffff7cae277 in std::terminate() () from /lib/x86_64-linux-gnu/libstdc++.so.6

8 0x00007ffff7cae4d8 in __cxa_throw () from /lib/x86_64-linux-gnu/libstdc++.so.6

9 0x000055555555d1a9 in rapidxml::xml_node rapidxml::xml_document::parse_node<0>(char&) [clone .cold] ()

10 0x0000555555575ac3 in xmlDescriptor::xmlDescriptor(_IO_FILE, bool) ()

11 0x0000555555572f7c in xml_fileReader::xml_fileReader(std::__cxx11::basic_string<char, std::char_traits, std::allocator >, bool, void (*)()) ()

12 0x000055555555db3d in main ()

This is the XML-header:

$ head -c 2048 < /tmp/Generic\ RTL2832U\ OEM-7D-Mi--Jan--24-2024-17-55-00.uff <?xml version="1.0" encoding="utf-8"?>

(the file is truncated to 20 MB in order to fit to Github.com extensions) dd if=Generic\ RTL2832U\ OEM-7D-Mi--Jän--24-2024-17-55-00.uff skip=1024 > /tmp/Generic\ RTL2832U\ OEM-7D-Mi--Jän--24-2024-17-55-00.raw $ eti-cmdline-rawfiles -F /tmp/Generic\ RTL2832U\ OEM-7D-Mi--Jän--24-2024-17-55-00.raw | dablin_gtk DABlin v1.14.0-4-g9a99ed9 - capital DAB experience Plays a DAB/DAB+ audio service from an ETI-NI or an EDI AF stream. https://github.com/Opendigitalradio/dablin Period = 8000 SDLOutput: using SDL version '2.0.20' EnsembleSource: reading ETI from 'stdin' there might be a DAB signal here programt ( 1) 8s Radio Terminal 9467 is in the list program ( 2) Retro Radio 9465 is in the list program ( 3) ENTER 9464 is in the list program ( 4) Radio 1 SLO HITI 9466 is in the list program ( 5) Radio Energija 9468 is in the list ensemble SLO DAB+ R3 detected Hint: Other files work: $ eti-cmdline-xmlfiles -F /tmp/Generic\ RTL2832U\ OEM-10D-Mi--Jan--24-2024-22-07-13.uff > /dev/null rootnode SDR Datablock detected attribute Count (14201702) attribute Unit (Channel) attribute Number (1) sampleRate = 2048000 nrChannels = 2 bitsperChannel = 8 container = uint8 byteOrder = LSB iqOrder = IQ nrBlocks = 1 (1) >>> 1 14201702 Channel 215072000 DAB nrElements = 14201702 7100851 samples have to be read, order is IQ samples to read 7100851 ensemble SLO DAB+ R1 detected program ( 1) VAL 202 9202 is in the list program ( 2) Radio Si 933A is in the list program ( 3) Center Slo 9414 is in the list program ( 4) Rock Radio Slo 9516 is in the list program ( 5) Radio Ognjisce 932F is in the list program ( 6) Radio 1 DAB 9442 is in the list program ( 7) Radio 1 80-a 9459 is in the list program ( 8) Radio City 9415 is in the list program ( 9) Radio Student 9440 is in the list program (10) Radio Salomon 9463 is in the list program (11) Radio Veseljak 9449 is in the list program (12) Radio Net FM 942B is in the list there might be a DAB signal here programt (13) 9s Ekspres Slo 9462 is in the list program (14) Radio Aktual 941C is in the list program (15) ARS 9203 is in the list program (16) PRVI 9201 is in the list yes, here we go Handling ensemble SLO DAB+ R1 until you quit reached end of file, cont = 0: 16, fibquality 100 Maybe you have got an idea? — Reply to this email directly, view it on GitHub , or unsubscribe . You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>

-- Jan van Katwijk