Sean Meighan

Software => xLights Convert => Topic started by: ronp on March 21, 2015, 08:33:59 PM

Title: File format for xseq
Post by: ronp on March 21, 2015, 08:33:59 PM
Hey, I would like to do my own converter. Is there someplace that you document the file format for your sequence file, not the XML version.

Thanks
Ron
Title: Re: File format for xseq
Post by: sean on March 22, 2015, 12:31:48 AM
Hey, I would like to do my own converter. Is there someplace that you document the file format for your sequence file, not the XML version.

Thanks
Ron

Hi Ron; only in the source code. BTW, we no longer use xseq files.

In xLights 3.6
*.xseq was the binary file containing all channels, frames for a sequence
*.xml had the nutcracker efefcts
*.fpp was binary file for the FPP

In xLights 4.0 we standardized on *.fpp as our binary file.

Here is the code that writes the fpp file in xLights

void FRAMECLASS WriteFalconPiFile(const wxString& filename)
{
    wxUint8 vMinor = 0;
    wxUint8 vMajor = 1;
    wxUint16 fixedHeaderLength = 28;
    wxUint32 stepSize = rountTo4(SeqData.NumChannels());

    wxUint16 stepTime = SeqData.FrameTime();
    // Ignored by Pi Player
    wxUint16 numUniverses = 0;
    // Ignored by Pi Player
    wxUint16 universeSize = 0;
    // Gamma 0=encoded 1=linear
    wxUint8 gamma = 1;
    // Gamma 0=unknown 1=mono 2=RGB
    wxUint8 colorEncoding = 2;
    wxFile f;
    // Step Size must be multiple of 4
    //wxUint8 buf[stepSize];

    size_t ch;
    if (!f.Create(filename,true))
    {
        ConversionError(wxString("Unable to create file: ")+filename);
        return;
    }

    wxUint8* buf;
    buf = (wxUint8 *)calloc(sizeof(wxUint8),stepSize < 1024 ? 1024 : stepSize);

    // Header Information
    // Format Identifier
    buf[0] = 'P';
    buf[1] = 'S';
    buf[2] = 'E';
    buf[3] = 'Q';

    buf[6] = vMinor;
    buf[7] = vMajor;
    // Fixed header length
    buf[8] = (wxUint8)(fixedHeaderLength%256);
    buf[9] = (wxUint8)(fixedHeaderLength/256);
    // Step Size
    buf[10] = (wxUint8)(stepSize & 0xFF);
    buf[11] = (wxUint8)((stepSize >> 8) & 0xFF);
    buf[12] = (wxUint8)((stepSize >> 16) & 0xFF);
    buf[13] = (wxUint8)((stepSize >> 24) & 0xFF);
    // Number of Steps
    buf[14] = (wxUint8)(SeqData.NumFrames() & 0xFF);
    buf[15] = (wxUint8)((SeqData.NumFrames() >> 8) & 0xFF);
    buf[16] = (wxUint8)((SeqData.NumFrames() >> 16) & 0xFF);
    buf[17] = (wxUint8)((SeqData.NumFrames() >> 24) & 0xFF);
    // Step time in ms
    buf[18] = (wxUint8)(stepTime & 0xFF);
    buf[19] = (wxUint8)((stepTime >> 8) & 0xFF);
    // universe count
    buf[20] = (wxUint8)(numUniverses & 0xFF);
    buf[21] = (wxUint8)((numUniverses >> 8) & 0xFF);
    // universe Size
    buf[22] = (wxUint8)(universeSize & 0xFF);
    buf[23] = (wxUint8)((universeSize >> 8) & 0xFF);
    // universe Size
    buf[24] = gamma;
    // universe Size
    buf[25] = colorEncoding;
    buf[26] = 0;
    buf[27] = 0;

    if (mediaFilename.length() > 0) {
        int len = strlen(mediaFilename.c_str()) + 5;
        buf[28] = (wxUint8)(len & 0xFF);
        buf[29] = (wxUint8)((len >> 8) & 0xFF);
        buf[30] = 'm';
        buf[31] = 'f';
        strcpy((char *)&buf[32],mediaFilename.c_str());
        fixedHeaderLength += len;
        fixedHeaderLength = rountTo4(fixedHeaderLength);
    }
    // Data offset
    buf[4] = (wxUint8)(fixedHeaderLength%256);
    buf[5] = (wxUint8)(fixedHeaderLength/256);
    f.Write(buf,fixedHeaderLength);


    for (long period=0; period < SeqData.NumFrames(); period++)
    {
        for(ch=0; ch<stepSize; ch++)
        {
            buf[ch] = SeqData[period][ch];
        }
        f.Write(buf,stepSize);
    }
    f.Close();
    free(buf);
}
Title: Re: File format for xseq
Post by: Steve Gase on March 22, 2015, 07:51:50 AM
The file is .fseq file (not .fpp file) right?)

By making .fseq the new base file, can I assume the following are not yet addressed in v4?

(1) when using multiple fpp units, ALL fpps will carry the same file.

(2) all fpps will need to use the same frame rate
Title: Re: File format for xseq
Post by: ronp on March 22, 2015, 02:35:31 PM
Thanks, I was perusing your code and couldn't find it.

Ron
Title: Re: File format for xseq
Post by: CaptainMurdoch on March 22, 2015, 03:48:59 PM

(2) all fpps will need to use the same frame rate

This is actually a restriction of FPP itself currently since the MultiSync code uses frame number to sync remotes.  I want to try to get this changed over to using a time stamp but that would probably be part of larger changes if I can get to them later this year.  The focus right now is support for new controllers and then the new UI which is being developed in parallel to the controller support.
Title: Re: File format for xseq
Post by: Gilrock on March 23, 2015, 07:20:14 AM
The file is .fseq file (not .fpp file) right?)

By making .fseq the new base file, can I assume the following are not yet addressed in v4?

(1) when using multiple fpp units, ALL fpps will carry the same file.

(2) all fpps will need to use the same frame rate


This kinda confused me.  Is there an .fpp file format cause I use the FPP and I've never heard of it.  I thought the reason the XL4 team decided to use .fseq was because it's the native file format of the FPP.  So I don't get the statement about us not addressing those items.  How does where you put your files on the FPP's have anything to do with XL4?