<commit_before>#include "osg/Image"
#include "osg/Notify"

#include <osg/Geode>

#include <osg/observer_ptr>

#include "osg/GL"

#include "osgDB/FileNameUtils"
#include "osgDB/Registry"
#include "osgDB/FileUtils"

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sstream>


#ifndef __APPLE__
#include "Components.h"
#include "QuickTimeComponents.h"
#else
#include <QuickTime/QuickTime.h>
#endif

#ifndef SEEK_SET
#  define SEEK_SET 0
#endif
#include "QTUtils.h"
#include "QTLiveUtils.h"
#include "QTImportExport.h"
#include "QuicktimeImageStream.h"
#include "QuicktimeLiveImageStream.h"


using namespace osg;


class ReaderWriterQT : public osgDB::ReaderWriter
{
public:


    // This class is used as a helper to de-initialize
    // properly quicktime, when the last media loaded 
    // with the quicktime plugin is released. 
    // All loaded media must be added to the observer 
    // (see ReaderWriterQT::readImage() function) 
    class QuicktimeInitializer : public osg::Observer
    {
    public:

       QuicktimeInitializer (): 
          _instanceCount(0),
             _setup(false)
          {}

          virtual ~QuicktimeInitializer()
          {
             // When we get here, the exit() function 
             // should have been called, when last media was released. 
             // In case no media has been added after initialization, 
             // let's perform an extra check
             if (_setup && _instanceCount == 0)
             {
                exit();
             }
          };

          void addMedia(Image* ptr)
          {
             ptr->addObserver(this);
             ++ _instanceCount;
          }

          virtual void objectDeleted(void*) 
          {
             -- _instanceCount;
             if(_instanceCount== 0)
                exit();
          }

          void init()
          {
             if (!_setup)
             {
                #ifndef __APPLE__
                InitializeQTML(0);
                #endif

                OSErr err = EnterMovies();
                if (err!=0)
                   osg::notify(osg::FATAL) << "Error while initializing quicktime: " << err << std::endl; 
                else
                   osg::notify(osg::DEBUG_INFO) << "Quicktime initialized successfully"  << std::endl;            

                _setup = true;            
             }
          }

          void exit()
          {
             #ifndef __APPLE__
             ExitMovies();
             #endif

             _setup = false;
          }

    private:
       unsigned int _instanceCount;
       bool _setup;

    };





    ReaderWriterQT::ReaderWriterQT()
    {

       registerQtReader();


        supportsExtension("mov","Movie format");
        supportsExtension("mpg","Movie format");
        supportsExtension("mpv","Movie format");
        supportsExtension("mp4","Movie format");
        supportsExtension("m4v","Movie format");
        supportsExtension("dv","Movie format");
        supportsExtension("avi","Movie format");
        supportsExtension("sdp","RTSP Movie format");
        supportsExtension("flv","Movie format");
        supportsExtension("swf","Movie format");
        supportsExtension("3gp","Mobile movie format");

        supportsExtension("live","Live video streaming");
        
        supportsProtocol("http", "streaming media per http");
        supportsProtocol("rtsp", "streaming media per rtsp");

        #ifdef QT_HANDLE_IMAGES_ALSO
        supportsExtension("jpg","jpg image format");
        supportsExtension("jpeg","jpeg image format");
        supportsExtension("tif","tif image format");
        supportsExtension("tiff","tiff image format");
        supportsExtension("gif","gif image format");
        supportsExtension("png","png image format");
        supportsExtension("pict","pict image format");
        supportsExtension("pct","pct image format");
        supportsExtension("tga","tga image format");
        supportsExtension("psd","psd image format");
        #endif
    }

    ReaderWriterQT::~ReaderWriterQT()
    {
    }


   virtual const char* className() const { return "Default Quicktime Image Reader/Writer"; }

   virtual bool acceptsMovieExtension(const std::string& extension) const
   {<commit_msg>From <NAME>, remove double qualifier of ReaderWriterQT constructor/destructor.<commit_after>#include "osg/Image"
#include "osg/Notify"

#include <osg/Geode>

#include <osg/observer_ptr>

#include "osg/GL"

#include "osgDB/FileNameUtils"
#include "osgDB/Registry"
#include "osgDB/FileUtils"

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sstream>


#ifndef __APPLE__
#include "Components.h"
#include "QuickTimeComponents.h"
#else
#include <QuickTime/QuickTime.h>
#endif

#ifndef SEEK_SET
#  define SEEK_SET 0
#endif
#include "QTUtils.h"
#include "QTLiveUtils.h"
#include "QTImportExport.h"
#include "QuicktimeImageStream.h"
#include "QuicktimeLiveImageStream.h"


using namespace osg;


class ReaderWriterQT : public osgDB::ReaderWriter
{
public:


    // This class is used as a helper to de-initialize
    // properly quicktime, when the last media loaded 
    // with the quicktime plugin is released. 
    // All loaded media must be added to the observer 
    // (see ReaderWriterQT::readImage() function) 
    class QuicktimeInitializer : public osg::Observer
    {
    public:

       QuicktimeInitializer (): 
          _instanceCount(0),
             _setup(false)
          {}

          virtual ~QuicktimeInitializer()
          {
             // When we get here, the exit() function 
             // should have been called, when last media was released. 
             // In case no media has been added after initialization, 
             // let's perform an extra check
             if (_setup && _instanceCount == 0)
             {
                exit();
             }
          };

          void addMedia(Image* ptr)
          {
             ptr->addObserver(this);
             ++ _instanceCount;
          }

          virtual void objectDeleted(void*) 
          {
             -- _instanceCount;
             if(_instanceCount== 0)
                exit();
          }

          void init()
          {
             if (!_setup)
             {
                #ifndef __APPLE__
                InitializeQTML(0);
                #endif

                OSErr err = EnterMovies();
                if (err!=0)
                   osg::notify(osg::FATAL) << "Error while initializing quicktime: " << err << std::endl; 
                else
                   osg::notify(osg::DEBUG_INFO) << "Quicktime initialized successfully"  << std::endl;            

                _setup = true;            
             }
          }

          void exit()
          {
             #ifndef __APPLE__
             ExitMovies();
             #endif

             _setup = false;
          }

    private:
       unsigned int _instanceCount;
       bool _setup;

    };





    ReaderWriterQT()
    {

       registerQtReader();


        supportsExtension("mov","Movie format");
        supportsExtension("mpg","Movie format");
        supportsExtension("mpv","Movie format");
        supportsExtension("mp4","Movie format");
        supportsExtension("m4v","Movie format");
        supportsExtension("dv","Movie format");
        supportsExtension("avi","Movie format");
        supportsExtension("sdp","RTSP Movie format");
        supportsExtension("flv","Movie format");
        supportsExtension("swf","Movie format");
        supportsExtension("3gp","Mobile movie format");

        supportsExtension("live","Live video streaming");
        
        supportsProtocol("http", "streaming media per http");
        supportsProtocol("rtsp", "streaming media per rtsp");

        #ifdef QT_HANDLE_IMAGES_ALSO
        supportsExtension("jpg","jpg image format");
        supportsExtension("jpeg","jpeg image format");
        supportsExtension("tif","tif image format");
        supportsExtension("tiff","tiff image format");
        supportsExtension("gif","gif image format");
        supportsExtension("png","png image format");
        supportsExtension("pict","pict image format");
        supportsExtension("pct","pct image format");
        supportsExtension("tga","tga image format");
        supportsExtension("psd","psd image format");
        #endif
    }

    ~ReaderWriterQT()
    {
    }


   virtual const char* className() const { return "Default Quicktime Image Reader/Writer"; }

   virtual bool acceptsMovieExtension(const std::string& extension) const
   {
{'fraction_non_alphanumeric': 0.11357018054746651, 'fraction_numerical': 0.00209668025626092, 'mean_word_length': 2.129008746355685, 'pattern_counts': {'":': 0, '<': 38, '<?xml version=': 0, '>': 20, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4032110', 'n_tokens_mistral': 2387, 'n_tokens_neox': 2255, 'n_words': 567}