aboutsummaryrefslogtreecommitdiff
path: root/Src/nsv/svc_nsvFactory.h
diff options
context:
space:
mode:
authorJean-Francois Mauguit <jfmauguit@mac.com>2024-09-24 09:03:25 -0400
committerGitHub <noreply@github.com>2024-09-24 09:03:25 -0400
commitbab614c421ed7ae329d26bf028c4a3b1d2450f5a (patch)
tree12f17f78986871dd2cfb0a56e5e93b545c1ae0d0 /Src/nsv/svc_nsvFactory.h
parent4bde6044fddf053f31795b9eaccdd2a5a527d21f (diff)
parent20d28e80a5c861a9d5f449ea911ab75b4f37ad0d (diff)
downloadwinamp-bab614c421ed7ae329d26bf028c4a3b1d2450f5a.tar.gz
Merge pull request #5 from WinampDesktop/community
Merge to main
Diffstat (limited to 'Src/nsv/svc_nsvFactory.h')
-rw-r--r--Src/nsv/svc_nsvFactory.h52
1 files changed, 52 insertions, 0 deletions
diff --git a/Src/nsv/svc_nsvFactory.h b/Src/nsv/svc_nsvFactory.h
new file mode 100644
index 00000000..ffc0ca66
--- /dev/null
+++ b/Src/nsv/svc_nsvFactory.h
@@ -0,0 +1,52 @@
+#ifndef NULLSOFT_NSV_SVC_NSVFACTORY_H
+#define NULLSOFT_NSV_SVC_NSVFACTORY_H
+
+#include <bfc/Dispatch.h>
+#include <bfc/platform/types.h>
+#include <api/service/services.h>
+class IAudioDecoder;
+class IVideoDecoder;
+class IAudioOutput;
+
+/*
+ **********************************************************************
+ * Important Note! *
+ * *
+ * *
+ * Objects created by this class are allocated using api_memmgr *
+ * You MUST call api_memmgr::Delete() to delete these objects. *
+ * Do not use the C++ delete operator *
+ * as the memory was allocated with a different heap / malloc arena *
+ * *
+ **********************************************************************
+ */
+class svc_nsvFactory : public Dispatchable
+{
+protected:
+ svc_nsvFactory(){}
+ ~svc_nsvFactory(){}
+public:
+ virtual IAudioDecoder *CreateAudioDecoder(FOURCC format, IAudioOutput **output);
+ IVideoDecoder *CreateVideoDecoder(int w, int h, double framerate, unsigned int fmt, int *flip);
+
+public:
+ DISPATCH_CODES
+ {
+ SVC_NSVFACTORY_CREATEAUDIODECODER=10,
+ SVC_NSVFACTORY_CREATEVIDEODECODER=20,
+ };
+
+ static FOURCC getServiceType() { return WaSvc::NSVFACTORY; }
+};
+
+inline IAudioDecoder *svc_nsvFactory::CreateAudioDecoder(FOURCC format, IAudioOutput **output)
+{
+ return _call(SVC_NSVFACTORY_CREATEAUDIODECODER, (IAudioDecoder *)0, format, output);
+}
+
+inline IVideoDecoder *svc_nsvFactory::CreateVideoDecoder(int w, int h, double framerate, unsigned int fmt, int *flip)
+{
+ return _call(SVC_NSVFACTORY_CREATEVIDEODECODER, (IVideoDecoder *)0, w, h, framerate, fmt, flip);
+}
+
+#endif