[NUT-devel] Main file loop

Oded Shimon ods15 at ods15.dyndns.org
Sat Nov 4 15:30:49 CET 2006


In my opinion it is all wrong.
This loop deals with legality of file, not how the demuxer reads the file.

Current:
> file:
>     file_id_string
>     while(!eof){
>         packet_header, main_header, packet_footer
>         reserved_headers
>         for(i=0; i<stream_count; i++){
>             packet_header, stream_header, packet_footer
>             reserved_headers
>         }
>         while(next_code == info_startcode){
>             packet_header, info_packet, packet_footer
>             reserved_headers
>         }
>         if(next_code == index_startcode){
>             packet_header, index_packet, packet_footer
>         }
>         if (!eof) while(next_code != main_startcode){
>             if(next_code == syncpoint_startcode){
>                 packet_header, syncpoint, packet_footer
>             }
>             frame
>             reserved_headers
>         }
>     }


The way it should be in my opinion:
file:
    file_id_string
    while(!eof){
        packet_header, main_header, packet_footer
        for(i=0; i<stream_count; i++){
            packet_header, stream_header, packet_footer
        }
        reserved_headers
        while(next_code == info_startcode){
            packet_header, info_packet, packet_footer
        }
        reserved_headers
        if(next_code == index_startcode){
            packet_header, index_packet, packet_footer
        }
        if (!eof) while(next_code != main_startcode){
            packet_header, syncpoint, packet_footer
            do {
                frame
            } while (next_code == framecode)
            reserved_headers
            if (realtime_stream) {
                while(next_code == info_startcode){
                    packet_header, info_packet, packet_footer
                }
                reserved_headers
            }
        }
    }


1. no reserved headers allowed until end of stream headers
   this offers absoloutely no disadvantage in extendibility:
   a. new packets can still be written afterwards.
   b. if it is so important that it needs to be written either next to the 
   main header or next to the streams, it can be written inside the main 
   header or inside the stream headers (reserved_bytes)
2. no reserved headers allowed after index - only either an eof or a 
   syncpoint and frames. no reserved headers inbetween info packets.
3. syncpoints must be written after any non frame packets, before any 
   frame packets.
4. it is illegal to write a syncpoint without a following frame..
5. without a main header set, only reserved headers, info packets, and 
   syncpoints can be written (this solves the question i had in previous 
   mail). Rational:
   a demuxer will give all info packets after the main header set togther 
   with reading the main header set to the caller, ONCE. Any info packets 
   seen after a main header set afterwards are ignored. Any info packets 
   seen OUTSIDE of a main header set are "new information" packets and 
   given to the caller on sight... These packets would have a manditory 
   chapter_id!=0, and are illegal in non-realtime streams.
6. as before, main headers can be written again after main headers..


I'm sorry for bringing up this issue so late :(

- ods15



More information about the NUT-devel mailing list