/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/MediaInfo_Config_PerPackage.h" #include "MediaInfo/MediaInfo_Config.h" #include using namespace std; //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Info //*************************************************************************** MediaInfo_Config_PerPackage::MediaInfo_Config_PerPackage() { #if MEDIAINFO_EVENTS Event_CallBackFunction=NULL; Event_UserHandler=NULL; #endif //MEDIAINFO_EVENTS CountOfPackages=(size_t)-1; } MediaInfo_Config_PerPackage::~MediaInfo_Config_PerPackage() { } //*************************************************************************** // Info //*************************************************************************** Ztring MediaInfo_Config_PerPackage::Option (const String &Option, const String &Value) { String Option_Lower(Option); size_t Egal_Pos=Option_Lower.find(__T('=')); if (Egal_Pos==string::npos) Egal_Pos=Option_Lower.size(); transform(Option_Lower.begin(), Option_Lower.begin()+Egal_Pos, Option_Lower.begin(), (int(*)(int))tolower); //(int(*)(int)) is a patch for unix if (Option_Lower==__T("file_event_callbackfunction")) { #if MEDIAINFO_EVENTS return Event_CallBackFunction_Set(Value); #else //MEDIAINFO_EVENTS return __T("Event manager is disabled due to compilation options"); #endif //MEDIAINFO_EVENTS } else return __T("Option not known"); } //--------------------------------------------------------------------------- #if MEDIAINFO_EVENTS void MediaInfo_Config_PerPackage::Unsynch () { } #endif //MEDIAINFO_EVENTS //*************************************************************************** // Event //*************************************************************************** //--------------------------------------------------------------------------- #if MEDIAINFO_EVENTS bool MediaInfo_Config_PerPackage::Event_CallBackFunction_IsSet () { CriticalSectionLocker CSL(CS); return Event_CallBackFunction?true:false; } #endif //MEDIAINFO_EVENTS //--------------------------------------------------------------------------- #if MEDIAINFO_EVENTS Ztring MediaInfo_Config_PerPackage::Event_CallBackFunction_Set (const Ztring &Value) { ZtringList List=Value; CriticalSectionLocker CSL(CS); if (List.empty()) { Event_CallBackFunction=(MediaInfo_Event_CallBackFunction*)NULL; Event_UserHandler=NULL; } else for (size_t Pos=0; Pos