Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Source/MediaInfo/File__MultipleParsing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,7 @@ File__MultipleParsing::File__MultipleParsing()
Parser.push_back(new File_Av1());
#endif
#if defined(MEDIAINFO_AV2_YES)
Parser.push_back(new File_Av2());
{auto Temp=new File_Av2(); Temp->IsAnnexB=true; Parser.push_back(Temp);}
#endif
#if defined(MEDIAINFO_AVS3V_YES)
Parser.push_back(new File_Avs3V());
Expand Down
4 changes: 2 additions & 2 deletions Source/MediaInfo/MediaInfo_File.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,7 @@ static File__Analyze* SelectFromExtension(const String& Parser)
if (Parser==__T("Av1")) return new File_Av1();
#endif
#if defined(MEDIAINFO_AV2_YES)
if (Parser==__T("Av2")) return new File_Av2();
if (Parser==__T("Av2")) {auto Parser=new File_Av2(); Parser->IsAnnexB=true; return Parser;}
#endif
#if defined(MEDIAINFO_AVC_YES)
if (Parser==__T("Avc")) return new File_Avc();
Expand Down Expand Up @@ -1037,7 +1037,7 @@ int MediaInfo_Internal::ListFormats(const String &File_Name)
SAFE_DELETE(Info); Info=new File_Av1(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1;
#endif
#if defined(MEDIAINFO_AV2_YES)
SAFE_DELETE(Info); Info=new File_Av2(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1;
SAFE_DELETE(Info); Info=new File_Av2(); ((File_Av2*)Info)->IsAnnexB=true; if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1;
#endif
#if defined(MEDIAINFO_AVC_YES)
SAFE_DELETE(Info); Info=new File_Avc(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1;
Expand Down
1 change: 1 addition & 0 deletions Source/MediaInfo/Multiple/File_Mk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4914,6 +4914,7 @@ void File_Mk::CodecID_Manage()
{
File_Av2* Parser=new File_Av2;
Parser->FrameIsAlwaysComplete=true;
Parser->IsAnnexB=true;
streamItem.Parser=Parser;
}
#endif
Expand Down
25 changes: 13 additions & 12 deletions Source/MediaInfo/Video/File_Av2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,6 @@ void File_Av2::Streams_Accept()

Stream_Prepare(Stream_Video);
Fill(Stream_Video, 0, Video_Format, "AV2");

if (!Frame_Count_Valid)
Frame_Count_Valid=Config->ParseSpeed>=0.3?8:(IsSub?1:2);
}

//---------------------------------------------------------------------------
Expand Down Expand Up @@ -240,8 +237,13 @@ void File_Av2::Read_Buffer_OutOfBand()
Get_SB ( initial_presentation_delay_present, "initial_presentation_delay_present");
Skip_S1(4, initial_presentation_delay_present?"initial_presentation_delay_minus_one":"reserved");
BS_End();
}

Open_Buffer_Continue(Buffer, Buffer_Size);
//---------------------------------------------------------------------------
void File_Av2::Read_Buffer_Init()
{
if (!Frame_Count_Valid)
Frame_Count_Valid = IsSub ? 1 : 2;
}

//***************************************************************************
Expand All @@ -258,11 +260,11 @@ void File_Av2::Header_Parse()
Element_End0();
Get_leb128(obu_size, "num_bytes_in_obu");
Element_Begin0();
obu_size += Element_Offset;
}
else {
obu_size = Element_Size;
}
auto sizeof_obu_size = Element_Offset;

Element_Name("obu_header");
bool obu_header_extension_flag;
Expand All @@ -282,7 +284,7 @@ void File_Av2::Header_Parse()
BS_End();

FILLING_BEGIN();
Header_Fill_Size(obu_size + sizeof_obu_size);
Header_Fill_Size(obu_size);
Header_Fill_Code(obu_type, Av2_obu_type(obu_type));
FILLING_END();
}
Expand Down Expand Up @@ -494,8 +496,6 @@ void File_Av2::sequence_header_obu()
FILLING_BEGIN_PRECISE();
if (!sequence_header_Parsed)
{
if (IsSub)
Accept();
Fill(Stream_Video, 0, Video_Width, max_frame_width_minus_1 + 1);
Fill(Stream_Video, 0, Video_Height, max_frame_height_minus_1 + 1);
Fill(Stream_Video, 0, Video_BitDepth, bit_depth_idc == 0 ? 10 : (bit_depth_idc == 1 ? 8 : 12));
Expand Down Expand Up @@ -1305,11 +1305,12 @@ void File_Av2::frame_header(bool isFirst)
Element_End0();

FILLING_BEGIN();
if (!Status[IsAccepted])
Accept();
Frame_Count++;
if (Element_Level < 2 && Frame_Count >= Frame_Count_Valid)
Finish();
if (!Status[IsAccepted] && Frame_Count >= Frame_Count_Valid) {
Accept();
if (Config->ParseSpeed <= 1.0)
Finish();
}
FILLING_END();
}

Expand Down
3 changes: 2 additions & 1 deletion Source/MediaInfo/Video/File_Av2.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class File_Av2 : public File__Analyze
public :
//In
int64u Frame_Count_Valid{};
bool IsAnnexB{ true };
bool IsAnnexB{};

//Constructor/Destructor
File_Av2();
Expand All @@ -41,6 +41,7 @@ private :

//Buffer - Global
void Read_Buffer_OutOfBand() override;
void Read_Buffer_Init() override;

//Buffer - Per element
void Header_Parse() override;
Expand Down