D4R issues
Dave Higton (1515) 3526 posts |
Inet$Resolvers? |
Rick Murray (539) 13840 posts |
I normally include “SWIs.h” in my projects, but since that’s a DDE thing I don’t think I should distribute it. If anybody is interested, it is lurking in one of the old examples. Perhaps CModule or something that interworks C and assembler. Though, it will need modernisation, I think the original is RO3.5 era. These days you’re probably supposed to link into parts of the RISC OS build environment for that sort of thing, but that’s not a lot of good for build systems and methods set up prior to this being available (plus given that I develop on three different machines, I prefer to keep my projects fairly self-contained with no dependencies other than DeskLib and CLib). |
Rick Murray (539) 13840 posts |
Strange. I am writing a server, the back end is a module and the front end is an application loaded on demand. The sockets part hasn’t caused me too much difficulty.
Either something is going very badly wrong with your memory accesses, or you are running from a callback/IRQ and you are trying to do “complicated things” when RISC OS is threaded. As for debugging the code, there are two approaches. I’ve used both. The first is to write, and check, that basic sockets (etc) code works as an app. If it does not, you can put tracing code in to switch to single task and “press a key to continue” from one part to the next. I would say “use the debugger” but it seems that the debugger is itself somewhat prone to dying horribly on newer hardware. Useful. ;-) The second, for things that have to be designed and tested as module code, is to drop in as much trace information as is necessary to output to DADebug. I have a version of DADebug that spits output to the serial port. This information is then picked up by the PC running HyperTerm (via a 3.3V serial to USB adaptor). Even if the RISC OS machine stiffs, the debug info is still on my other screen so I can try to work out what went wrong. It is rather old tech (akin to PRINT blah% in days of old) but sometimes the old ways are the simplest to get a job done.
I see you made a DNS client. How come you didn’t just call the Resolver module? |
Malcolm Hussain-Gambles (1596) 811 posts |
Debugging via a serial console isn’t my idea of fun ;-) |
Steve Pampling (1551) 8170 posts |
I do harp on a bit, but it is a bit of an irritation that the networking aspect has languished so long. Have a look at AntiSpam – it contains a partial implementation done by Frank d.B. because the Acorn version plain doesn’t work for reverse lookup as used by DNS blacklist. You could usefully swap notes with Frank. |
Sprow (202) 1158 posts |
Sure you’re calling the right SWI? The StrongHelp manual says Resolver_GetHostByName blocks, but Resolver_GetHost doesn’t, as the following bit of BASIC might show: EINPROGRESS%=36 It’s used just like that by NetTime’s name lookup. |
Malcolm Hussain-Gambles (1596) 811 posts |
Thanks Sprow: That’s funny (in a sick twisted way). I was calling the C function gethostbyname – clearly I should have used the SWI – or gethost (if there is one) Now I’ve gone down this road of pain, it seems a shame to turn around, as I do like tinkering with DNS stuff…. |
Dave Higton (1515) 3526 posts |
It means that the variable error is set TRUE or FALSE according to the truth or falsehood of whether (flags AND 1) is equal to 1. Quite simple when you get your head around it. It’s just a shorthand way of doing: IF (flags AND 1) = 1 THEN error = TRUE ELSE error = FALSE |
Malcolm Hussain-Gambles (1596) 811 posts |
neat! |
Malcolm Hussain-Gambles (1596) 811 posts |
The download speed for d4r is currently between 3 and 3.5MB/sec, pretty bad TBH. (on a pandaboard es) |
Malcolm Hussain-Gambles (1596) 811 posts |
I’ve updated it to v 0.03a with a secondary buffer and a “re-read”, which is a little strange – if I’ve just done a read, do a select immediately afterwards and see if we can read any more. |
Malcolm Hussain-Gambles (1596) 811 posts |
I’ve found out my problem, for some reason the toolbox attach handler is being called three times per window. I think it’s time to scrap it and manually create and manipulate windows using SWI’s. |
WPB (1391) 352 posts |
What do you mean by “attach handler”? Do you mean the event that fires when the window is created? Do you perhaps need to check the window id matches the window id you’re expecting, and just drop out if it doesn’t? |
Chris Johnson (125) 825 posts |
How do you define ‘correct id? There are a number of things to check. Firstly, what are the flag settings (auto create, shared) for the object in question? Secondly how are you creating and showing the object? You can run in to trouble if you both allow the toolbox to create objects (eg by entering their res template name into the definition of the ’calling’ object) and trying to manually create/show at the same time. It is possible to end up with more than one instance of the same object with different IDs without realising it.
I use the toolbox a lot, originally using Basic years ago, and now from C using oslib and oslibsupport. I cannot say I have found any real problems with it, although I did have a small headache recently with ColourDBox, due to something similar to that mentioned above. |
Dave Higton (1515) 3526 posts |
I’ve read a few things about MPEG-DASH in the last few days, which prompts me to ask whether D4R would be useful towards a streaming player? Or do we already have any application that will play MPEG-DASH streaming audio? Naive questions, both. |
jim lesurf (2082) 1438 posts |
I’m also interested in the answers to your questions about mpeg-dash! Main reason being concerns about access to the BBC iplayer. Even if ‘real time’ rendering isn’t feasible, it would be very useful if we could save the stream to a file and process/use it later on! Jim |
Dave Higton (1515) 3526 posts |
Have you looked at the streams or any other information that tells us which codec Auntie is actually using? |
André Timmermans (100) 655 posts |
From what I read on Wikipedia, MPEG-DASH is just a transport method for .mp4 stream, it is codec agnostic. In other words whatever codecs used by the file, so in the most usual cases: H264 for the video and mp3 or ACC for the audio. |
Malcolm Hussain-Gambles (1596) 811 posts |
@Chris, I attach a handler to the toolbox. @Rick the “nightmare” I was talking about was if you leave sockets or file handles open, it screws things up badly. @Jim I’ll have a think about handling streams, it will definately handle using a memory block instead of a file further down the line, as that’s how I’m planning on expanding the code. |
Malcolm Hussain-Gambles (1596) 811 posts |
@Rick I’m having problems getting my head around claiming the event for the internet. I’m thinking that there is some voodoo going on here. (SVC or the like) But for testing purposes I was hoping I could just enable it on the module initialise and release it on the final (when it quits). |
WPB (1391) 352 posts |
Do you mean you have a handler for Toolbox_ObjectAutoCreated? If not, what event ARE you handling which shows you the window getting created three times. It does sound like something is amiss in your Res file, perhaps. |
Malcolm Hussain-Gambles (1596) 811 posts |
In a teenager tantrum I deleted the source. |
Malcolm Hussain-Gambles (1596) 811 posts |
As regards the module issue, I’m guessing the issue is that when the service memory call doesn’t clean up the memory – because I’m using events it causes an explosion. |
Malcolm Hussain-Gambles (1596) 811 posts |
Thankfully I’ve narrowed this down, my event handler is OK. However I’ve got some global variables which are causing a violent fit. |
Malcolm Hussain-Gambles (1596) 811 posts |
A mini update, though not much – but progress. |