Logo Search packages:      
Sourcecode: f-spot version File versions  Download package

bool TagLib::Ogg::Bitstream::ReadPage ( Page  page  )  [inline]

Reads the next logical page in the stream.

Parameters:
page The next logical Page object in the stream.
Returns:
if the codec has read all the necessary packets for the stream and does not need to be called again, typically once the Xiph comment has been found. Otherwise .
Exceptions:
ArgumentNullException page is .

Definition at line 120 of file Bitstream.cs.

References TagLib::ByteVector::Add(), TagLib::Ogg::PageHeader::Flags, TagLib::Ogg::Page::Header, and TagLib::Ogg::Page::Packets.

Referenced by TagLib::Ogg::File::ReadStreams().

            {
                  if (page == null)
                        throw new ArgumentNullException ("page");
                  
                  ByteVector[] packets = page.Packets;
                  
                  for (int i = 0; i < packets.Length; i ++) {
                        if ((page.Header.Flags &
                              PageFlags.FirstPacketContinued) == 0 &&
                              previous_packet != null) {
                              if (ReadPacket (previous_packet))
                                    return true;
                              previous_packet = null;
                        }
                        
                        
                        ByteVector packet = packets [i];
                        
                        // If we're at the first packet of the page, and
                        // we're continuing an old packet, combine the
                        // old with the new.
                        if (i == 0 && (page.Header.Flags &
                              PageFlags.FirstPacketContinued) != 0 &&
                              previous_packet != null) {
                              previous_packet.Add (packet);
                              packet = previous_packet;
                        }
                        
                        previous_packet = null;
                        
                        if (i == packets.Length - 1) {
                              // If we're at the last packet of the
                              // page, store it.
                              previous_packet = new ByteVector (packet);
                        } else if (ReadPacket (packet)) {
                              // Otherwise, we need to process it.
                              return true;
                        }
                  }
                  
                  return false;
            }


Generated by  Doxygen 1.6.0   Back to index