/* Copyright (c) MediaArea.net SARL. All Rights Reserved. * * Use of this source code is governed by a BSD-style license that can * be found in the License.html file in the root of the source tree. */ //--------------------------------------------------------------------------- // // Source: // http://wiki.multimedia.cx/index.php?title=YUV4MPEG2 // //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_Y4M_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Video/File_Y4m.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- namespace MediaInfoLib { //--------------------------------------------------------------------------- //*************************************************************************** // Infos //*************************************************************************** //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- File_Y4m::File_Y4m() :File__Analyze() { //Configuration ParserName="YUV4MPEG2"; #if MEDIAINFO_TRACE Trace_Layers_Update(8); //Stream #endif //MEDIAINFO_TRACE StreamSource=IsStream; Frame_Count_NotParsedIncluded=0; //Temp HeaderEnd=0; } //--------------------------------------------------------------------------- File_Y4m::~File_Y4m() { } //*************************************************************************** // Streams management //*************************************************************************** //--------------------------------------------------------------------------- void File_Y4m::Streams_Accept() { Fill(Stream_General, 0, General_Format, "YUV4MPEG2"); Stream_Prepare(Stream_Video); Fill(Stream_Video, 0, Video_Format, "YUV"); Fill(Stream_Video, 0, Video_ColorSpace, "YUV"); } //--------------------------------------------------------------------------- void File_Y4m::Streams_Fill() { } //*************************************************************************** // Buffer - File header //*************************************************************************** //--------------------------------------------------------------------------- bool File_Y4m::FileHeader_Begin() { if (Buffer_Size<10) return false; if (!(Buffer[0]==0x59 && Buffer[1]==0x55 && Buffer[2]==0x56 && Buffer[3]==0x34 && Buffer[4]==0x4D && Buffer[5]==0x50 && Buffer[6]==0x45 && Buffer[7]==0x47 && Buffer[8]==0x32 && Buffer[9]==0x20)) { Reject(); return false; } for (; HeaderEnd