[Live-devel] Open RTSP and video file splitting...

Matteo Lisi matteo.lisi at engicam.com
Mon Dec 20 01:38:18 PST 2010


Hi I did a quick change on the QuickTimeFileSink class , for runtime 
output file name changing.

You can see below the code:

void QuickTimeFileSink::ChangeOutputFile(UsageEnvironment& env, char * 
outputFileName)
{
printf("ChangeOutputFile\n");
completeOutputFile();
CloseOutputFile(fOutFid);
fOutFid = OpenOutputFile(env, outputFileName);

// Begin by writing a "mdat" atom at the start of the file.
// (Later, when we've finished copying data to the file, we'll come
// back and fill in its size.)
fMDATposition = TellFile64(fOutFid);
addAtomHeader64("mdat");
// add 64Bit offset
fMDATposition += 8;

if (fOutFid == NULL) return;
}

The result is that only the first videofile is visible with a video 
player, while the others files is not valid.

I suppose that I forgot to update something on the file's header, but what ?

Instead if I use the follow command:

./vigilartsp -v -w 640 -h 480 -f 25 rtsp://admin:12345@192.168.2.62

(without -4 flag)

when I call the ChangeOutputFile its gave me "Segmentation fault"

why ?


Many Thanks.

Il 16/12/2010 18:36, Ross Finlayson ha scritto:
>> But often the program exits in "Segmentation Fault", and I don't know 
>> why...
>
> The reason is that you are closing (and deleting) your 'data sink' 
> object - "qtOut" - but you are still 'playing' that object. I.e., the 
> code thinks that it should still be receiving incoming network data 
> into the original "qtOut" object.
>
> The right way to fix this - with minimal disruption to the existing 
> code - is not to make any changes to the network reading/recording 
> mechanism, but instead to use a different 'data sink' class - one that 
> knows how to periodically close/reopen its output file, but without 
> having to delete/recreate the 'data sink' object itself.
>
> So, I suggest that you subclass the "QuickTimeFileSink" class to do this.
>
> Unfortunately, to do this, you're going to have to make some 
> modifications to "liveMedia/include/QuickTimeFileSink.hh" - to change 
> some fields and member functions from "private:" to "protected:" - so 
> you can subclass "QuickTimeFileSink". (In particular, you will 
> definitely need to change the constructor and destructor, and 
> "completeOutputFile()" and "fOutFid" to "protected:") Once you've done 
> this, please let us know which fields/functions you needed to make 
> "protected:", and I'll change the next released version of the code to 
> make at least those fields/functions "protected:". That way, you won't 
> need to keep changing the released code each time.


-- 


------------------------------------------------------------------------
http://www.engicam.com <http://www.engicam.com>


*ENGICAM s.r.l.*
Progettazione di sistemi elettronici
50018 Scandicci - FIRENZE
Via dei Pratoni, 16 int. 13

Tel. +39 055 7311387
Fax. +39 055 720608
Web www.engicam.com <http://www.engicam.com>

C.F./P.I. 05389070482
Registro Imprese di FIRENZE 542918
Capitale sociale versato 20.000,00€
------------------------------------------------------------------------
NOTICE: This message and attachments are intended only for the use of 
their addresses and may contain confidential information belonging to 
Engicam. If you are not the intended recipient, you are hereby notified 
that any reading, dissemination, distribution, or copying of this 
message, or any attachment, is strictly prohibited. If you have received 
this message in error, please notify the original sender immediately and 
delete this message, along with any attachments.


More information about the live-devel mailing list