2023-03-25 08:37:51 +08:00
|
|
|
#include "MediaEngine.h"
|
|
|
|
|
2023-04-02 01:51:36 +08:00
|
|
|
#if defined(WINAPI_FAMILY)
|
|
|
|
# if WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP && !defined(AXME_USE_IMFME)
|
|
|
|
# include "media/WmfMediaEngine.h"
|
|
|
|
# else
|
|
|
|
# include "media/MfMediaEngine.h"
|
|
|
|
# endif
|
|
|
|
#elif defined(__APPLE__)
|
|
|
|
# include "media/AvfMediaEngine.h"
|
2023-06-10 22:05:49 +08:00
|
|
|
#elif defined(__ANDROID__)
|
|
|
|
# include "media/AndroidMediaEngine.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(AX_ENABLE_VLC_MEDIA)
|
|
|
|
# include "media/VlcMediaEngine.h"
|
2023-03-25 08:37:51 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
namespace axstd
|
|
|
|
{
|
|
|
|
// static_pointer_cast overload for std::shared_ptr
|
|
|
|
using std::static_pointer_cast;
|
|
|
|
|
|
|
|
// static_pointer_cast overload for std::unique_ptr
|
|
|
|
template <class T, class U>
|
|
|
|
std::unique_ptr<T> static_pointer_cast(std::unique_ptr<U>&& r)
|
|
|
|
{
|
|
|
|
(void)static_cast<T*>(static_cast<U*>(0));
|
|
|
|
|
|
|
|
typedef typename std::unique_ptr<T>::element_type E;
|
|
|
|
|
|
|
|
return std::unique_ptr<T>(static_cast<E*>(r.release()));
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace axstd
|
|
|
|
|
|
|
|
NS_AX_BEGIN
|
|
|
|
|
2023-06-10 22:05:49 +08:00
|
|
|
std::unique_ptr<MediaEngineFactory> MediaEngineFactory::create()
|
2023-03-25 08:37:51 +08:00
|
|
|
{
|
2023-04-02 01:51:36 +08:00
|
|
|
#if defined(WINAPI_FAMILY)
|
|
|
|
# if WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP && !defined(AXME_USE_IMFME)
|
2023-03-25 08:37:51 +08:00
|
|
|
return axstd::static_pointer_cast<MediaEngineFactory>(std::make_unique<WmfMediaEngineFactory>());
|
2023-04-02 01:51:36 +08:00
|
|
|
# else
|
2023-03-25 08:37:51 +08:00
|
|
|
return axstd::static_pointer_cast<MediaEngineFactory>(std::make_unique<MfMediaEngineFactory>());
|
2023-04-02 01:51:36 +08:00
|
|
|
# endif
|
|
|
|
#elif defined(__APPLE__)
|
|
|
|
return axstd::static_pointer_cast<MediaEngineFactory>(std::make_unique<AvfMediaEngineFactory>());
|
2023-06-10 22:05:49 +08:00
|
|
|
#elif defined(__ANDROID__)
|
|
|
|
return axstd::static_pointer_cast<MediaEngineFactory>(std::make_unique<AndroidMediaEngineFactory>());
|
|
|
|
#elif defined(__linux__) && defined(AX_ENABLE_VLC_MEDIA)
|
|
|
|
return axstd::static_pointer_cast<MediaEngineFactory>(std::make_unique<VlcMediaEngineFactory>());
|
2023-03-25 08:37:51 +08:00
|
|
|
#else
|
|
|
|
return nullptr;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_AX_END
|