Panda3D
movieTypeRegistry.h
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file movieTypeRegistry.h
10  * @author rdb
11  * @date 2013-08-24
12  */
13 
14 #ifndef MOVIETYPEREGISTRY_H
15 #define MOVIETYPEREGISTRY_H
16 
17 #include "pandabase.h"
18 #include "movieAudio.h"
19 #include "movieVideo.h"
20 #include "filename.h"
21 #include "pmap.h"
22 #include "reMutex.h"
23 
24 /**
25  * This class records the different types of MovieAudio and MovieVideo that
26  * are available for loading.
27  */
28 class EXPCL_PANDA_MOVIES MovieTypeRegistry {
29 public:
30  typedef PT(MovieAudio) (*MakeAudioFunc)(const Filename&);
31  PT(MovieAudio) make_audio(const Filename &name);
32  void register_audio_type(MakeAudioFunc func, const std::string &extensions);
33  void load_audio_types();
34 
35  typedef PT(MovieVideo) (*MakeVideoFunc)(const Filename&);
36  PT(MovieVideo) make_video(const Filename &name);
37  void register_video_type(MakeVideoFunc func, const std::string &extensions);
38  void load_video_types();
39 
40  void load_movie_library(const std::string &name);
41 
42  INLINE static MovieTypeRegistry *get_global_ptr();
43 
44 private:
45  static MovieTypeRegistry *_global_ptr;
46 
47  ReMutex _audio_lock;
48  pmap<std::string, MakeAudioFunc> _audio_type_registry;
49  pmap<std::string, std::string> _deferred_audio_types;
50 
51  ReMutex _video_lock;
52  pmap<std::string, MakeVideoFunc> _video_type_registry;
53  pmap<std::string, std::string> _deferred_video_types;
54 };
55 
56 #include "movieTypeRegistry.I"
57 
58 #endif
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This class records the different types of MovieAudio and MovieVideo that are available for loading.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
The name of a file, such as a texture file or an Egg file.
Definition: filename.h:39
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A MovieVideo is actually any source that provides a sequence of video frames.
Definition: movieVideo.h:38
A MovieAudio is actually any source that provides a sequence of audio samples.
Definition: movieAudio.h:44
A reentrant mutex.
Definition: reMutex.h:32
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.