//--------------------------------------------------------------------------- void File_Ogg::Data_Parse() { //Counting Frame_Count++; //If first chunk of a stream stream& Stream_Item=Stream[Element_Code]; //[+] FlylinkDC++ Team if (Stream_Item.Parser==NULL) { if (Parsing_End) return; //Maybe multitracks concatained, not supported Stream_Item.Parser=new File_Ogg_SubElement; Open_Buffer_Init(Stream_Item.Parser); ((File_Ogg_SubElement*)Stream_Item.Parser)->InAnotherContainer=IsSub; StreamsToDo++; } ((File_Ogg_SubElement*)Stream_Item.Parser)->MultipleStreams=Stream.size()>1; //has no sens for the first init, must check allways //Parsing File_Ogg_SubElement* Parser=(File_Ogg_SubElement*)Stream_Item.Parser; if (Stream_Item.SearchingPayload) //For each chunk for (size_t Chunk_Sizes_Pos=0; Chunk_Sizes_Pos<Chunk_Sizes.size(); Chunk_Sizes_Pos++) { //Info if (!continued) Peek_L1(packet_type); //Only for information Element_Info1(Ztring::ToZtring(packet_type, 16)); Element_Info1C((continued), "Continue"); //Parsing if (continued || Parser->File_Offset!=Parser->File_Size) Open_Buffer_Continue(Parser, Buffer+Buffer_Offset+(size_t)Element_Offset, Chunk_Sizes[Chunk_Sizes_Pos]); if (Chunk_Sizes_Pos<Chunk_Sizes.size()-1 || (Chunk_Sizes_Pos==Chunk_Sizes.size()-1 && Chunk_Sizes_Finished)) { Open_Buffer_Continue(Parser, Buffer+Buffer_Offset, 0); //Purge old datas } Element_Offset+=Chunk_Sizes[Chunk_Sizes_Pos]; continued=false; //If there is another chunk, this can not be a continued chunk if (Parser->File_GoTo!=(int64u)-1) Chunk_Sizes_Pos=Chunk_Sizes.size(); if (!Status[IsAccepted] && Parser->Status[IsAccepted]) Accept("OGG"); if (Parser->Status[IsFinished] || (Element_Offset==Element_Size && eos)) { StreamsToDo--; Stream_Item.SearchingPayload=false; break; } } else Skip_XX(Element_Size, "Data"); //End of stream if (!Parsing_End && (StreamsToDo==0 || File_Offset+Buffer_Offset+Element_Offset>256*1024)) { if (IsSub) Finish("OGG"); else GoToFromEnd(256*1024, "OGG"); std::map<int64u, stream>::iterator Stream_Temp=Stream.begin(); if (File_GoTo!=(int64u)-1) while (Stream_Temp!=Stream.end()) { Stream_Temp->second.absolute_granule_position=0; ++Stream_Temp; } Parsing_End=true; } Element_Show(); }
//--------------------------------------------------------------------------- // Packet "B3" or "B6" void File_AvsV::picture_start() { //Counting if (File_Offset+Buffer_Offset+Element_Size==File_Size) Frame_Count_Valid=Frame_Count; //Finalize frames in case of there are less than Frame_Count_Valid frames Frame_Count++; //Name Element_Name("picture_start"); Element_Info1(Ztring::ToZtring(Frame_Count)); Element_Info1C((Element_Code==0xB3), __T("I")); //Parsing int8u picture_coding_type=(int8u)-1; bool time_code_flag, progressive_frame, picture_structure=true, top_field_first, repeat_first_field, skip_mode_flag=false, loop_filter_disable; Skip_B2( "bbv_delay"); BS_Begin(); if (Element_Code==0xB3) //Only I { Get_SB ( time_code_flag, "time_code_flag"); if (time_code_flag) { Skip_SB( "time_code_dropframe"); Skip_S1(5, "time_code_hours"); Skip_S1(6, "time_code_minutes"); Skip_S1(6, "time_code_seconds"); Skip_S1(6, "time_code_pictures"); } } if (Element_Code==0xB6) //Only P or B { Get_S1 ( 2, picture_coding_type, "picture_coding_type"); Element_Info1(AvsV_picture_coding_type[picture_coding_type]); } Skip_S1( 8, "picture_distance"); if (low_delay) Skip_UE( "bbv_check_times"); Get_SB ( progressive_frame, "progressive_frame"); if (!progressive_frame) { Get_SB( picture_structure, "picture_structure"); if (Element_Code==0xB6) //Only P or B { if (picture_structure) Skip_SB( "advanced_pred_mode_disable"); } } Get_SB ( top_field_first, "top_field_first"); Get_SB ( repeat_first_field, "repeat_first_field"); Skip_SB( "fixed_picture_qp"); Skip_S1( 6, "picture_qp"); if (Element_Code==0xB3) //Only I { if (!progressive_frame && !picture_structure) Get_SB( skip_mode_flag, "skip_mode_flag"); } if (Element_Code==0xB6) //Only P or B { if (picture_coding_type!=2 || !picture_structure) Skip_SB( "picture_reference_flag"); } Skip_SB( "reserved"); Skip_SB( "reserved"); Skip_SB( "reserved"); Skip_SB( "reserved"); if (Element_Code==0xB6) //Only P or B { Get_SB( skip_mode_flag, "skip_mode_flag"); } Get_SB ( loop_filter_disable, "loop_filter_disable"); if (!loop_filter_disable) { bool loop_filter_parameter_flag; Get_SB ( loop_filter_parameter_flag, "loop_filter_parameter_flag"); if (loop_filter_parameter_flag) { Skip_SE( "alpha_c_offset"); Skip_SE( "beta_offset"); } } BS_End(); if (Element_Size-Element_Offset) Skip_XX(Element_Size-Element_Offset, "Unknown"); FILLING_BEGIN(); if (progressive_frame==false) { if (picture_structure==true) //Frame { if (top_field_first) Interlaced_Top++; else Interlaced_Bottom++; } } else progressive_frame_Count++; //NextCode NextCode_Test(); NextCode_Clear(); for (int8u Pos=0x00; Pos<=0xAF; Pos++) NextCode_Add(Pos); //slice NextCode_Add(0xB0); //video_sequence_start NextCode_Add(0xB3); //picture_start NextCode_Add(0xB6); //picture_start //Autorisation of other streams for (int8u Pos=0x00; Pos<=0xAF; Pos++) Streams[Pos].Searching_Payload=true; //slice //Filling only if not already done if (Frame_Count>=Frame_Count_Valid && Count_Get(Stream_Video)==0) { //No need of more Accept("AVS Video"); Finish("AVS Video"); } FILLING_END(); }