2010-10-27 17:30:11 +00:00
|
|
|
/*
|
2013-02-16 01:44:19 +00:00
|
|
|
* Copyright (C) 2009-2010 Ole André Vadla Ravnås <oleavr@soundrop.com>
|
2010-10-27 17:30:11 +00:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
2012-11-03 20:38:00 +00:00
|
|
|
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
|
|
* Boston, MA 02110-1301, USA.
|
2010-10-27 17:30:11 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include <config.h>
|
|
|
|
#endif
|
|
|
|
|
2013-12-14 12:30:01 +00:00
|
|
|
#include <Foundation/Foundation.h>
|
2015-04-02 17:04:18 +00:00
|
|
|
#include "corevideomemory.h"
|
2010-10-27 17:30:11 +00:00
|
|
|
#ifdef HAVE_IOS
|
2013-09-26 11:21:59 +00:00
|
|
|
#include "iosassetsrc.h"
|
2017-01-27 16:11:15 +00:00
|
|
|
#include "iosglmemory.h"
|
2016-08-30 13:21:25 +00:00
|
|
|
#endif
|
2013-10-30 12:40:01 +00:00
|
|
|
#ifdef HAVE_AVFOUNDATION
|
|
|
|
#include "avfvideosrc.h"
|
2014-04-14 18:08:01 +00:00
|
|
|
#include "avfassetsrc.h"
|
2019-01-27 03:09:59 +00:00
|
|
|
#include "avfdeviceprovider.h"
|
2015-01-19 01:43:23 +00:00
|
|
|
#include "avsamplevideosink.h"
|
2010-10-27 17:30:11 +00:00
|
|
|
#endif
|
2014-07-02 10:54:45 +00:00
|
|
|
#ifdef HAVE_VIDEOTOOLBOX
|
|
|
|
#include "vtdec.h"
|
|
|
|
#endif
|
2014-01-20 09:34:57 +00:00
|
|
|
#ifndef HAVE_IOS
|
2014-04-18 18:04:25 +00:00
|
|
|
#define AV_RANK GST_RANK_SECONDARY
|
|
|
|
#else
|
|
|
|
#define AV_RANK GST_RANK_PRIMARY
|
2014-01-20 09:34:57 +00:00
|
|
|
#endif
|
2010-10-27 17:30:11 +00:00
|
|
|
|
2014-07-02 10:54:45 +00:00
|
|
|
#ifdef HAVE_VIDEOTOOLBOX
|
2013-12-07 22:55:13 +00:00
|
|
|
void gst_vtenc_register_elements (GstPlugin * plugin);
|
2014-07-02 10:54:45 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef HAVE_IOS
|
2013-12-07 22:55:13 +00:00
|
|
|
|
2010-10-27 17:30:11 +00:00
|
|
|
static void
|
|
|
|
enable_mt_mode (void)
|
|
|
|
{
|
|
|
|
NSThread * th = [[NSThread alloc] init];
|
|
|
|
[th start];
|
|
|
|
g_assert ([NSThread isMultiThreaded]);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
plugin_init (GstPlugin * plugin)
|
|
|
|
{
|
|
|
|
gboolean res = TRUE;
|
|
|
|
|
2015-04-02 17:04:18 +00:00
|
|
|
gst_apple_core_video_memory_init ();
|
|
|
|
|
2010-10-27 17:30:11 +00:00
|
|
|
#ifdef HAVE_IOS
|
2016-08-26 07:37:54 +00:00
|
|
|
gst_ios_gl_memory_init ();
|
|
|
|
|
2013-09-26 11:21:59 +00:00
|
|
|
res &= gst_element_register (plugin, "iosassetsrc", GST_RANK_SECONDARY,
|
|
|
|
GST_TYPE_IOS_ASSET_SRC);
|
2010-10-27 17:30:11 +00:00
|
|
|
#else
|
|
|
|
enable_mt_mode ();
|
2016-08-30 13:21:25 +00:00
|
|
|
#endif
|
2010-10-27 17:30:11 +00:00
|
|
|
|
2013-10-30 12:40:01 +00:00
|
|
|
#ifdef HAVE_AVFOUNDATION
|
2014-04-18 18:04:25 +00:00
|
|
|
res &= gst_element_register (plugin, "avfvideosrc", AV_RANK,
|
2013-10-30 12:40:01 +00:00
|
|
|
GST_TYPE_AVF_VIDEO_SRC);
|
2014-04-18 18:04:25 +00:00
|
|
|
res &= gst_element_register (plugin, "avfassetsrc", AV_RANK,
|
2014-04-14 18:08:01 +00:00
|
|
|
GST_TYPE_AVF_ASSET_SRC);
|
2015-01-19 01:43:23 +00:00
|
|
|
res &= gst_element_register (plugin, "avsamplebufferlayersink",
|
|
|
|
GST_RANK_NONE, GST_TYPE_AV_SAMPLE_VIDEO_SINK);
|
2019-01-27 03:09:59 +00:00
|
|
|
res &= gst_device_provider_register (plugin, "avfdeviceprovider",
|
|
|
|
GST_RANK_PRIMARY, GST_TYPE_AVF_DEVICE_PROVIDER);
|
2013-10-30 12:40:01 +00:00
|
|
|
#endif
|
|
|
|
|
2014-07-02 10:54:45 +00:00
|
|
|
#ifdef HAVE_VIDEOTOOLBOX
|
2014-09-17 07:38:20 +00:00
|
|
|
/* Check if the framework actually exists at runtime */
|
2015-04-18 15:55:50 +00:00
|
|
|
if (&VTCompressionSessionCreate != NULL) {
|
2015-03-07 09:28:35 +00:00
|
|
|
gst_vtdec_register_elements (plugin);
|
2014-09-17 07:38:20 +00:00
|
|
|
gst_vtenc_register_elements (plugin);
|
|
|
|
}
|
2013-09-23 09:35:56 +00:00
|
|
|
#endif
|
2010-10-27 17:30:11 +00:00
|
|
|
|
2015-01-19 01:43:23 +00:00
|
|
|
|
2010-10-27 17:30:11 +00:00
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
|
|
|
|
GST_VERSION_MINOR,
|
2012-04-05 16:02:56 +00:00
|
|
|
applemedia,
|
2022-01-30 13:36:29 +00:00
|
|
|
"Elements for capture and codec access on Apple macOS and iOS",
|
2017-05-18 09:58:20 +00:00
|
|
|
plugin_init, VERSION, "LGPL", GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)
|