Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • gstreamer/gst-plugins-base
  • thiblahute/gst-plugins-base
  • slomo/gst-plugins-base
  • sree/gst-plugins-base
  • seungha.yang/gst-plugins-base
  • xclaesse/gst-plugins-base
  • haihao/gst-plugins-base
  • ystreet/gst-plugins-base
  • bilboed/gst-plugins-base
  • ndufresne/gst-plugins-base
  • changbok.chea/gst-plugins-base
  • hgr/gst-plugins-base
  • nielsdg/gst-plugins-base
  • sjoerd/gst-plugins-base
  • linussn/gst-plugins-base
  • alatiera/gst-plugins-base
  • nirbheek/gst-plugins-base
  • redstar/gst-plugins-base
  • philn/gst-plugins-base
  • gdesmott/gst-plugins-base
  • Yeongjin-Jeong/gst-plugins-base
  • vjaquez/gst-plugins-base
  • wangfei/gst-plugins-base
  • Freyr/gst-plugins-base
  • milloni-ct/gst-plugins-base
  • drakkan/gst-plugins-base
  • patricia/gst-plugins-base
  • ghodhben.marwen/gst-plugins-base
  • perfn/gst-plugins-base
  • arun/gst-plugins-base
  • alexashley/gst-plugins-base
  • heftig/gst-plugins-base
  • pH5/gst-plugins-base
  • joykim/gst-plugins-base
  • wonchul/gst-plugins-base
  • meh/gst-plugins-base
  • tpm/gst-plugins-base
  • krokodilerian/gst-plugins-base
  • ylatuya/gst-plugins-base
  • dabrain34/gst-plugins-base
  • wtaymans/gst-plugins-base
  • gkiagia/gst-plugins-base
  • victortoso/gst-plugins-base
  • andy/gst-plugins-base
  • hjespersen/gst-plugins-base
  • mrk501/gst-plugins-base
  • boxerab/gst-plugins-base
  • Yale323/gst-plugins-base
  • gracefulhoon83/gst-plugins-base
  • JimmyOhn/gst-plugins-base
  • Bjorkstrom/gst-plugins-base
  • vivia/gst-plugins-base
  • den_erpel/gst-plugins-base
  • rob-deutsch/gst-plugins-base
  • ulfo/gst-plugins-base
  • Eunhye/gst-plugins-base
  • laugilus/gst-plugins-base
  • lynxeye/gst-plugins-base
  • PanMichal/gst-plugins-base
  • adn770/gst-plugins-base
  • lord.jacold/gst-plugins-base
  • phw/gst-plugins-base
  • m.tretter/gst-plugins-base
  • loganek/gst-plugins-base
  • tomaszbulik/gst-plugins-base
  • He_Junyan/gst-plugins-base
  • awilfox/gst-plugins-base
  • JaredHu/gst-plugins-base
  • dannys/gst-plugins-base
  • dude/gst-plugins-base
  • sumaidsyed/gst-plugins-base
  • akinobu.mita/gst-plugins-base
  • smortex/gst-plugins-base
  • groleo/gst-plugins-base
  • dkl/gst-plugins-base
  • fherrera/gst-plugins-base
  • hein/gst-plugins-base
  • nicolashuet/gst-plugins-base
  • FurongZhang/gst-plugins-base
  • kevinbing.song/gst-plugins-base
  • rsiv/gst-plugins-base
  • GstBlub/gst-plugins-base
  • mgorse1/gst-plugins-base
  • dougnazar/gst-plugins-base
  • goranjn/gst-plugins-base
  • dylanmccall/gst-plugins-base
  • marxin.liska/gst-plugins-base
  • thaytan/gst-plugins-base
  • jh-hsd/gst-plugins-base
  • ljonas/gst-plugins-base
  • charles/gst-plugins-base
  • dv1/gst-plugins-base
  • DaveTrussel/gst-plugins-base
  • JoakimJ/gst-plugins-base
  • peat-psuwit/gst-plugins-base
  • Ambyjkl/gst-plugins-base
  • sancane/gst-plugins-base
  • HadrienPatte/gst-plugins-base
  • hwilkes/gst-plugins-base
  • mparisdiaz/gst-plugins-base
  • leio/gst-plugins-base
  • cap/gst-plugins-base
  • waiwits/gst-plugins-base
  • joshuadoe/gst-plugins-base
  • psreport/gst-plugins-base
  • ntrrgc/gst-plugins-base
  • ayaka/gst-plugins-base
  • andrew.voznytsa/gst-plugins-base
  • NPN/gst-plugins-base
  • Dmt/gst-plugins-base
  • michaelgruner/gst-plugins-base
  • kek/gst-plugins-base
  • thiagossantos/gst-plugins-base
  • Buora/gst-plugins-base
  • Cwiiis/gst-plugins-base
  • lool/gst-plugins-base
  • XuGuangxin/gst-plugins-base
  • cfoch/gst-plugins-base
  • cjmayo/gst-plugins-base
  • marian/gst-plugins-base
  • ludvigr/gst-plugins-base
  • uno20001/gst-plugins-base
  • Knopp/gst-plugins-base
  • rawoul/gst-plugins-base
  • Hosang/gst-plugins-base
  • ayush9398/gst-plugins-base
  • raytiley/gst-plugins-base
  • trollkarlen/gst-plugins-base
  • jedevc/gst-plugins-base
  • nazar-pc/gst-plugins-base
  • jusizela/gst-plugins-base
  • jdm/gst-plugins-base
  • bleetoteelb/gst-plugins-base
  • RomanValov/gst-plugins-base
  • SimonChristensson/gst-plugins-base
  • id_est/gst-plugins-base
  • gstreamer-release-bot/gst-plugins-base
  • will.miller/gst-plugins-base
  • gblanchard/gst-plugins-base
  • zfigura/gst-plugins-base
  • saidinesh5/gst-plugins-base
  • keis/gst-plugins-base
  • Rafostar/gst-plugins-base
  • SanchayanMaity/gst-plugins-base
  • jjardon/gst-plugins-base
  • xhaakon/gst-plugins-base
  • ding/gst-plugins-base
  • ParkJunsoo/gst-plugins-base
  • piotr.gasiorowski/gst-plugins-base
  • vicamo/gst-plugins-base
  • danielknobe/gst-plugins-base
  • kemen209/gst-plugins-base
  • avdb/gst-plugins-base
  • wantlamy/gst-plugins-base
  • davidventura/gst-plugins-base
  • dcasanova/gst-plugins-base
  • AlexTMjugador/gst-plugins-base
  • francisv/gst-plugins-base
  • AntoninRousset/gst-plugins-base
  • TheMuso/gst-plugins-base
  • hq/gst-plugins-base
  • tiger1987p/gst-plugins-base
  • cxw42/gst-plugins-base
  • crziter/gst-plugins-base
  • rburchell/gst-plugins-base
  • dwlsalmeida/gst-plugins-base
  • paul.goulpie/gst-plugins-base
  • lanodan/gst-plugins-base
  • quaresma.jose/gst-plugins-base
  • eocanha/gst-plugins-base
  • julian/gst-plugins-base
  • oreaus/gst-plugins-base
  • Roopang/gst-plugins-base
  • mol/gst-plugins-base
  • aferin/gst-plugins-base
  • mdegans/gst-plugins-base
  • sergei1/gst-plugins-base
  • mamunkc/gst-plugins-base
  • ezequielgarcia/gst-plugins-base
  • aslobodeniuk/gst-plugins-base
  • ccwu660601/gst-plugins-base
  • TobiasR/gst-plugins-base
  • blino/gst-plugins-base
  • felixonmars/gst-plugins-base
  • pldin601/gst-plugins-base
  • aniket_fti/gst-plugins-base
  • ssdeng6812/gst-plugins-base
  • rtiemann/gst-plugins-base
  • personalizedrefrigerator/gst-plugins-base
  • nuttle/gst-plugins-base
  • hoonhee.lee/gst-plugins-base
  • cnhzcy14/gst-plugins-base
  • liu_ming50/gst-plugins-base
  • vnguyentrong/gst-plugins-base
194 results
Show changes
Commits on Source (36)
Showing
with 242 additions and 112 deletions
# GStreamer OpenGL Library - EGL
This library should be linked to by getting cflags and libs from
`gstreamer-gl-egl-{{ gst_api_version.md }}.pc`.
gi-index
# GStreamer OpenGL Library - Wayland
This library should be linked to by getting cflags and libs from
`gstreamer-gl-wayland-{{ gst_api_version.md }}.pc`.
gi-index
# GStreamer OpenGL Library - X11
This library should be linked to by getting cflags and libs from
`gstreamer-gl-x11-{{ gst_api_version.md }}.pc`.
gi-index
......@@ -106,15 +106,26 @@ libs = [
]
if build_gstgl
libs += [['gl', gl_gir, gstgl_dep, [
libs += [['gl', gl_gir, gstgl_dep]]
if enabled_gl_platforms.contains('egl')
libs += [['gl-egl', gl_egl_gir, gstgl_dep, [
join_paths('../gst-libs/gst', 'gl', 'egl', 'gstegl.[ch]'),
join_paths('../gst-libs/gst', 'gl', 'egl', 'gsteglimage.[ch]'),
join_paths('../gst-libs/gst', 'gl', 'egl', 'gstgldisplay_egl.[ch]'),
join_paths('../gst-libs/gst', 'gl', 'egl', 'gstgldisplay_egl_device.[ch]'),
join_paths('../gst-libs/gst', 'gl', 'egl', 'gstglmemoryegl.[ch]'),
]]]
endif
if enabled_gl_winsys.contains('x11')
libs += [['gl-x11', gl_x11_gir, gstgl_dep, [
join_paths('../gst-libs/gst', 'gl', 'x11', 'gstgldisplay_x11.[ch]'),
]]]
endif
if enabled_gl_winsys.contains('wayland')
libs += [['gl-wayland', gl_wayland_gir, gstgl_dep, [
join_paths('../gst-libs/gst', 'gl', 'wayland', 'gstgldisplay_wayland.[ch]'),
]]]
]]]
endif
endif
# Used to avoid conflicts with known plugin names
......
This diff is collapsed.
......@@ -92,8 +92,6 @@ add_device (GstDeviceProvider * provider, snd_ctl_t * info,
snd_pcm_close (handle);
gst_device_provider_device_add (provider, gst_object_ref (device));
return device;
}
......@@ -169,23 +167,6 @@ beach:
}
static gboolean
gst_alsa_device_provider_start (GstDeviceProvider * provider)
{
g_list_free_full (gst_alsa_device_provider_probe (provider),
gst_object_unref);
/* TODO - Implement monitoring support */
return TRUE;
}
static void
gst_alsa_device_provider_stop (GstDeviceProvider * provider)
{
return;
}
enum
{
PROP_0,
......@@ -199,8 +180,6 @@ gst_alsa_device_provider_class_init (GstAlsaDeviceProviderClass * klass)
GstDeviceProviderClass *dm_class = GST_DEVICE_PROVIDER_CLASS (klass);
dm_class->probe = gst_alsa_device_provider_probe;
dm_class->start = gst_alsa_device_provider_start;
dm_class->stop = gst_alsa_device_provider_stop;
gst_device_provider_class_set_static_metadata (dm_class,
"ALSA Device Provider", "Sink/Source/Audio",
......
......@@ -198,8 +198,7 @@ schedule_next_tick (GstAlsaMidiSrc * alsamidisrc)
GST_TIME_TO_TIMESPEC (alsamidisrc->tick * MIDI_TICK_PERIOD_MS * GST_MSECOND,
time);
snd_seq_ev_schedule_real (&ev, alsamidisrc->queue, SND_SEQ_TIME_MODE_ABS,
&time);
snd_seq_ev_schedule_real (&ev, alsamidisrc->queue, 0, &time);
ret = snd_seq_event_output (alsamidisrc->seq, &ev);
if (ret < 0)
......
......@@ -95,13 +95,14 @@ if png_dep.found()
endif
if glconf.get('GST_GL_HAVE_WINDOW_COCOA', 0) == 1
corefoundation_dep = dependency('appleframeworks', modules : ['CoreFoundation'], required : false)
foundation_dep = dependency('appleframeworks', modules : ['Foundation'], required : false)
quartzcore_dep = dependency('appleframeworks', modules : ['QuartzCore'], required : false)
if foundation_dep.found() and quartzcore_dep.found() # have cocoa
if corefoundation_dep.found() and foundation_dep.found() and quartzcore_dep.found() # have cocoa
opengl_sources += [
'caopengllayersink.m',
]
optional_deps += quartzcore_dep
optional_deps += [quartzcore_dep, foundation_dep, corefoundation_dep]
endif
endif
......
......@@ -60,6 +60,20 @@
* have the same sample rate as either the downstream requirement,
* or the first configured pad, or a combination of both (when
* downstream specifies a range or a set of acceptable rates).
*
* The #GstAggregator::samples-selected signal is provided with some
* additional information about the output buffer:
* - "offset" G_TYPE_UINT64 Offset in samples since segment start
* for the position that is next to be filled in the output buffer.
* - "frames" G_TYPE_UINT Number of frames per output buffer.
*
* In addition the gst_aggregator_peek_next_sample() function returns
* additional information in the info #GstStructure of the returned sample:
* - "output-offset" G_TYPE_UINT64 Sample offset in output segment relative to
* the output segment's start where the current position of this input
* buffer would be placed
* - "position" G_TYPE_UINT current position in the input buffer in samples
* - "size" G_TYPE_UINT size of the input buffer in samples
*/
......@@ -89,8 +103,8 @@ struct _GstAudioAggregatorPadPrivate
GstBuffer *input_buffer;
guint64 output_offset; /* Sample offset in output segment relative to
pad.segment.start that position refers to
in the current buffer. */
srcpad.segment.start where the current position
of this input_buffer would be placed. */
guint64 next_offset; /* Next expected sample offset relative to
pad.segment.start */
......@@ -389,6 +403,10 @@ struct _GstAudioAggregatorPrivate
/* Sample offset starting from 0 at aggregator.segment.start */
gint64 offset;
/* info structure passed to selected-samples signal, must only be accessed
* from the aggregate thread */
GstStructure *selected_samples_info;
};
#define GST_AUDIO_AGGREGATOR_LOCK(self) g_mutex_lock (&(self)->priv->mutex);
......@@ -427,6 +445,8 @@ gst_audio_aggregator_update_src_caps (GstAggregator * agg,
GstCaps * caps, GstCaps ** ret);
static GstCaps *gst_audio_aggregator_fixate_src_caps (GstAggregator * agg,
GstCaps * caps);
static GstSample *gst_audio_aggregator_peek_next_sample (GstAggregator * agg,
GstAggregatorPad * aggpad);
#define DEFAULT_OUTPUT_BUFFER_DURATION (10 * GST_MSECOND)
#define DEFAULT_ALIGNMENT_THRESHOLD (40 * GST_MSECOND)
......@@ -560,6 +580,7 @@ gst_audio_aggregator_class_init (GstAudioAggregatorClass * klass)
gstaggregator_class->fixate_src_caps = gst_audio_aggregator_fixate_src_caps;
gstaggregator_class->negotiated_src_caps =
gst_audio_aggregator_negotiated_src_caps;
gstaggregator_class->peek_next_sample = gst_audio_aggregator_peek_next_sample;
klass->create_output_buffer = gst_audio_aggregator_create_output_buffer;
......@@ -618,6 +639,9 @@ gst_audio_aggregator_init (GstAudioAggregator * aagg)
gst_audio_aggregator_recalculate_latency (aagg);
aagg->current_caps = NULL;
aagg->priv->selected_samples_info =
gst_structure_new_empty ("GstAudioAggregatorSelectedSamplesInfo");
}
static void
......@@ -627,6 +651,8 @@ gst_audio_aggregator_dispose (GObject * object)
gst_caps_replace (&aagg->current_caps, NULL);
gst_clear_structure (&aagg->priv->selected_samples_info);
g_mutex_clear (&aagg->priv->mutex);
G_OBJECT_CLASS (gst_audio_aggregator_parent_class)->dispose (object);
......@@ -869,33 +895,43 @@ gst_audio_aggregator_sink_setcaps (GstAudioAggregatorPad * aaggpad,
{
GstAudioAggregatorPad *first_configured_pad =
gst_audio_aggregator_get_first_configured_pad (agg);
GstCaps *downstream_caps = gst_pad_get_allowed_caps (agg->srcpad);
GstAudioInfo info;
gboolean ret = TRUE;
gint downstream_rate;
GstStructure *s;
/* Returns NULL if there is no downstream peer */
if (!downstream_caps)
downstream_caps = gst_pad_get_pad_template_caps (agg->srcpad);
if (gst_caps_is_empty (downstream_caps)) {
ret = FALSE;
goto done;
}
gboolean downstream_supports_rate = TRUE;
if (!gst_audio_info_from_caps (&info, caps)) {
GST_WARNING_OBJECT (agg, "Rejecting invalid caps: %" GST_PTR_FORMAT, caps);
return FALSE;
}
s = gst_caps_get_structure (downstream_caps, 0);
/* TODO: handle different rates on sinkpads, a bit complex
* because offsets will have to be updated, and audio resampling
* has a latency to take into account
*/
if ((gst_structure_get_int (s, "rate", &downstream_rate)
&& info.rate != downstream_rate) || (first_configured_pad
/* Only check against the downstream caps if we didn't configure any caps
* so far. Otherwise we already know that downstream supports the rate
* because we negotiated with downstream */
if (!first_configured_pad) {
GstCaps *downstream_caps = gst_pad_get_allowed_caps (agg->srcpad);
/* Returns NULL if there is no downstream peer */
if (downstream_caps) {
GstCaps *rate_caps =
gst_caps_new_simple ("audio/x-raw", "rate", G_TYPE_INT, info.rate,
NULL);
gst_caps_set_features_simple (rate_caps,
gst_caps_features_copy (GST_CAPS_FEATURES_ANY));
downstream_supports_rate =
gst_caps_can_intersect (rate_caps, downstream_caps);
gst_caps_unref (rate_caps);
gst_caps_unref (downstream_caps);
}
}
if (!downstream_supports_rate || (first_configured_pad
&& info.rate != first_configured_pad->info.rate)) {
gst_pad_push_event (GST_PAD (aaggpad), gst_event_new_reconfigure ());
ret = FALSE;
......@@ -909,13 +945,9 @@ gst_audio_aggregator_sink_setcaps (GstAudioAggregatorPad * aaggpad,
GST_OBJECT_UNLOCK (aaggpad);
}
done:
if (first_configured_pad)
gst_object_unref (first_configured_pad);
if (downstream_caps)
gst_caps_unref (downstream_caps);
return ret;
}
......@@ -1865,6 +1897,33 @@ sync_pad_values (GstElement * aagg, GstPad * pad, gpointer user_data)
return TRUE;
}
static GstSample *
gst_audio_aggregator_peek_next_sample (GstAggregator * agg,
GstAggregatorPad * aggpad)
{
GstAudioAggregator *aagg = GST_AUDIO_AGGREGATOR (agg);
GstAudioAggregatorPad *pad = GST_AUDIO_AGGREGATOR_PAD (aggpad);
GstSample *sample = NULL;
if (pad->priv->buffer && pad->priv->output_offset >= aagg->priv->offset
&& pad->priv->output_offset <
aagg->priv->offset + aagg->priv->samples_per_buffer) {
GstCaps *caps = gst_pad_get_current_caps (GST_PAD (aggpad));
GstStructure *info =
gst_structure_new ("GstAudioAggregatorPadNextSampleInfo",
"output-offset", G_TYPE_UINT64, pad->priv->output_offset,
"position", G_TYPE_UINT, pad->priv->position,
"size", G_TYPE_UINT, pad->priv->size,
NULL);
sample = gst_sample_new (pad->priv->buffer, caps, &aggpad->segment, info);
gst_caps_unref (caps);
gst_structure_free (info);
}
return sample;
}
static GstFlowReturn
gst_audio_aggregator_aggregate (GstAggregator * agg, gboolean timeout)
{
......@@ -2111,8 +2170,27 @@ gst_audio_aggregator_aggregate (GstAggregator * agg, gboolean timeout)
}
g_assert (pad->priv->buffer);
GST_OBJECT_UNLOCK (pad);
}
GST_OBJECT_UNLOCK (agg);
{
gst_structure_set (aagg->priv->selected_samples_info, "offset",
G_TYPE_UINT64, aagg->priv->offset, "frames", G_TYPE_UINT, blocksize,
NULL);
gst_aggregator_selected_samples (agg, agg_segment->position,
GST_CLOCK_TIME_NONE, next_timestamp - agg_segment->position,
aagg->priv->selected_samples_info);
}
GST_OBJECT_LOCK (agg);
for (iter = element->sinkpads; iter; iter = iter->next) {
GstAudioAggregatorPad *pad = (GstAudioAggregatorPad *) iter->data;
GstAggregatorPad *aggpad = (GstAggregatorPad *) iter->data;
GST_OBJECT_LOCK (pad);
if (pad->priv->output_offset >= aagg->priv->offset
if (pad->priv->buffer && pad->priv->output_offset >= aagg->priv->offset
&& pad->priv->output_offset < aagg->priv->offset + blocksize) {
gboolean drop_buf;
......
......@@ -205,6 +205,7 @@ audioringbuffer_thread_func (GstAudioRingBuffer * buf)
WriteFunc writefunc;
GstMessage *message;
GValue val = { 0 };
gpointer handle;
sink = GST_AUDIO_SINK (GST_OBJECT_PARENT (buf));
csink = GST_AUDIO_SINK_GET_CLASS (sink);
......@@ -220,7 +221,7 @@ audioringbuffer_thread_func (GstAudioRingBuffer * buf)
if (writefunc == NULL)
goto no_function;
if (G_UNLIKELY (!__gst_audio_set_thread_priority ()))
if (G_UNLIKELY (!__gst_audio_set_thread_priority (&handle)))
GST_WARNING_OBJECT (sink, "failed to set thread priority");
message = gst_message_new_stream_status (GST_OBJECT_CAST (buf),
......@@ -306,6 +307,9 @@ stop_running:
g_value_unset (&val);
GST_DEBUG_OBJECT (sink, "posting LEAVE stream status");
gst_element_post_message (GST_ELEMENT_CAST (sink), message);
if (G_UNLIKELY (!__gst_audio_restore_thread_priority (handle)))
GST_WARNING_OBJECT (sink, "failed to restore thread priority");
return;
}
}
......
......@@ -187,6 +187,7 @@ audioringbuffer_thread_func (GstAudioRingBuffer * buf)
ReadFunc readfunc;
GstMessage *message;
GValue val = { 0 };
gpointer handle;
src = GST_AUDIO_SRC (GST_OBJECT_PARENT (buf));
csrc = GST_AUDIO_SRC_GET_CLASS (src);
......@@ -196,7 +197,7 @@ audioringbuffer_thread_func (GstAudioRingBuffer * buf)
if ((readfunc = csrc->read) == NULL)
goto no_function;
if (G_UNLIKELY (!__gst_audio_set_thread_priority ()))
if (G_UNLIKELY (!__gst_audio_set_thread_priority (&handle)))
GST_WARNING_OBJECT (src, "failed to set thread priority");
message = gst_message_new_stream_status (GST_OBJECT_CAST (buf),
......@@ -281,6 +282,9 @@ stop_running:
g_value_unset (&val);
GST_DEBUG_OBJECT (src, "posting LEAVE stream status");
gst_element_post_message (GST_ELEMENT_CAST (src), message);
if (G_UNLIKELY (!__gst_audio_restore_thread_priority (handle)))
GST_WARNING_OBJECT (src, "failed to restore thread priority");
return;
}
}
......
......@@ -222,7 +222,6 @@ exit:
static struct
{
HMODULE dll;
gboolean tried_loading;
FARPROC AvSetMmThreadCharacteristics;
FARPROC AvRevertMmThreadCharacteristics;
......@@ -234,29 +233,45 @@ static gboolean
__gst_audio_init_thread_priority (void)
{
#ifdef G_OS_WIN32
if (_gst_audio_avrt_tbl.tried_loading)
return _gst_audio_avrt_tbl.dll != NULL;
static gsize init_once = 0;
static gboolean ret = FALSE;
if (!_gst_audio_avrt_tbl.dll)
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
_gst_audio_avrt_tbl.dll = LoadPackagedLibrary (TEXT ("avrt.dll"), 0);
#else
if (g_once_init_enter (&init_once)) {
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
_gst_audio_avrt_tbl.dll = LoadLibrary (TEXT ("avrt.dll"));
#endif
if (!_gst_audio_avrt_tbl.dll) {
GST_WARNING ("Failed to set thread priority, can't find avrt.dll");
_gst_audio_avrt_tbl.tried_loading = TRUE;
return FALSE;
}
if (!_gst_audio_avrt_tbl.dll) {
GST_WARNING ("Failed to set thread priority, can't find avrt.dll");
goto done;
}
_gst_audio_avrt_tbl.AvSetMmThreadCharacteristics =
GetProcAddress (_gst_audio_avrt_tbl.dll,
"AvSetMmThreadCharacteristicsA");
if (!_gst_audio_avrt_tbl.AvSetMmThreadCharacteristics) {
GST_WARNING ("Cannot load AvSetMmThreadCharacteristicsA symbol");
FreeLibrary (_gst_audio_avrt_tbl.dll);
goto done;
}
_gst_audio_avrt_tbl.AvSetMmThreadCharacteristics =
GetProcAddress (_gst_audio_avrt_tbl.dll, "AvSetMmThreadCharacteristicsA");
_gst_audio_avrt_tbl.AvRevertMmThreadCharacteristics =
GetProcAddress (_gst_audio_avrt_tbl.dll,
"AvRevertMmThreadCharacteristics");
_gst_audio_avrt_tbl.AvRevertMmThreadCharacteristics =
GetProcAddress (_gst_audio_avrt_tbl.dll,
"AvRevertMmThreadCharacteristics");
_gst_audio_avrt_tbl.tried_loading = TRUE;
if (!_gst_audio_avrt_tbl.AvRevertMmThreadCharacteristics) {
GST_WARNING ("Cannot load AvRevertMmThreadCharacteristics symbol");
FreeLibrary (_gst_audio_avrt_tbl.dll);
goto done;
}
ret = TRUE;
done:
#endif
g_once_init_leave (&init_once, 1);
}
return ret;
#endif
return TRUE;
......@@ -266,20 +281,54 @@ __gst_audio_init_thread_priority (void)
* Increases the priority of the thread it's called from
*/
gboolean
__gst_audio_set_thread_priority (void)
__gst_audio_set_thread_priority (gpointer * handle)
{
#ifdef G_OS_WIN32
DWORD taskIndex = 0;
#endif
g_return_val_if_fail (handle != NULL, FALSE);
*handle = NULL;
if (!__gst_audio_init_thread_priority ())
return FALSE;
#ifdef G_OS_WIN32
/* This is only used from ringbuffer thread functions, so we don't need to
* ever need to revert the thread priorities. */
return _gst_audio_avrt_tbl.AvSetMmThreadCharacteristics (TEXT ("Pro Audio"),
&taskIndex) != 0;
/* This is only used from ringbuffer thread functions */
*handle = (gpointer)
_gst_audio_avrt_tbl.AvSetMmThreadCharacteristics (TEXT ("Pro Audio"),
&taskIndex);
if (*handle == 0) {
gchar *errorMsg = g_win32_error_message (GetLastError ());
GST_WARNING
("Failed to set thread priority, AvSetMmThreadCharacteristics returned: %s",
errorMsg);
g_free (errorMsg);
}
return *handle != 0;
#else
return TRUE;
#endif
}
/*
* Restores the priority of the thread that was increased
* with __gst_audio_set_thread_priority.
* This function must be called from the same thread that called the
* __gst_audio_set_thread_priority function.
* See https://docs.microsoft.com/en-us/windows/win32/api/avrt/nf-avrt-avsetmmthreadcharacteristicsw#remarks
*/
gboolean
__gst_audio_restore_thread_priority (gpointer handle)
{
#ifdef G_OS_WIN32
if (!handle)
return FALSE;
return _gst_audio_avrt_tbl.AvRevertMmThreadCharacteristics ((HANDLE) handle);
#else
return TRUE;
#endif
......
......@@ -43,7 +43,10 @@ gboolean __gst_audio_encoded_audio_convert (GstAudioInfo * fmt, gint64 bytes,
gint64 * dest_value);
G_GNUC_INTERNAL
gboolean __gst_audio_set_thread_priority (void);
gboolean __gst_audio_set_thread_priority (gpointer * handle);
G_GNUC_INTERNAL
gboolean __gst_audio_restore_thread_priority (gpointer handle);
G_END_DECLS
......
......@@ -259,12 +259,12 @@ _gst_egl_image_copy (GstMiniObject * obj)
}
/**
* gst_egl_image_new_wrapped: (skip)
* gst_egl_image_new_wrapped:
* @context: a #GstGLContext (must be an EGL context)
* @image: the image to wrap
* @format: the #GstGLFormat
* @user_data: user data
* @user_data_destroy: (destroy user_data): called when @user_data is no longer needed
* @user_data_destroy: (destroy user_data) (scope async): called when @user_data is no longer needed
*
* Returns: a new #GstEGLImage wrapping @image
*/
......
......@@ -70,7 +70,6 @@ G_DEFINE_TYPE (GstGLDisplayEGL, gst_gl_display_egl, GST_TYPE_GL_DISPLAY);
static void gst_gl_display_egl_finalize (GObject * object);
static guintptr gst_gl_display_egl_get_handle (GstGLDisplay * display);
static gboolean gst_gl_display_egl_get_foreign_display (GstGLDisplay * display);
static void
init_debug (void)
......@@ -89,8 +88,6 @@ gst_gl_display_egl_class_init (GstGLDisplayEGLClass * klass)
{
GST_GL_DISPLAY_CLASS (klass)->get_handle =
GST_DEBUG_FUNCPTR (gst_gl_display_egl_get_handle);
GST_GL_DISPLAY_CLASS (klass)->get_foreign_display =
GST_DEBUG_FUNCPTR (gst_gl_display_egl_get_foreign_display);
G_OBJECT_CLASS (klass)->finalize = gst_gl_display_egl_finalize;
}
......@@ -327,7 +324,6 @@ gst_gl_display_egl_from_gl_display (GstGLDisplay * display)
GstGLDisplayEGL *ret;
GstGLDisplayType display_type;
guintptr native_display;
gboolean foreign_display;
g_return_val_if_fail (GST_IS_GL_DISPLAY (display), NULL);
......@@ -353,7 +349,6 @@ gst_gl_display_egl_from_gl_display (GstGLDisplay * display)
display_type = gst_gl_display_get_handle_type (display);
native_display = gst_gl_display_get_handle (display);
foreign_display = gst_gl_display_get_foreign_display (display);
g_return_val_if_fail (native_display != 0, NULL);
g_return_val_if_fail (display_type != GST_GL_DISPLAY_TYPE_NONE, NULL);
......@@ -363,14 +358,12 @@ gst_gl_display_egl_from_gl_display (GstGLDisplay * display)
ret->display =
gst_gl_display_egl_get_from_native (display_type, native_display);
ret->foreign_display = foreign_display;
if (!ret->display) {
GST_WARNING_OBJECT (ret, "failed to get EGLDisplay from native display");
gst_object_unref (ret);
return NULL;
}
g_object_set_data_full (G_OBJECT (display), GST_GL_DISPLAY_EGL_NAME,
gst_object_ref (ret), (GDestroyNotify) gst_object_unref);
......@@ -382,9 +375,3 @@ gst_gl_display_egl_get_handle (GstGLDisplay * display)
{
return (guintptr) GST_GL_DISPLAY_EGL (display)->display;
}
static gboolean
gst_gl_display_egl_get_foreign_display (GstGLDisplay * display)
{
return GST_GL_DISPLAY_EGL (display)->foreign_display;
}
......@@ -39,6 +39,10 @@ GST_GL_API GType gst_gl_memory_egl_allocator_get_type(void);
#define GST_GL_MEMORY_EGL_ALLOCATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_GL_MEMORY_EGL_ALLOCATOR, GstGLMemoryEGLAllocatorClass))
#define GST_GL_MEMORY_EGL_ALLOCATOR_CAST(obj) ((GstGLMemoryEGLAllocator *)(obj))
typedef struct _GstGLMemoryEGL GstGLMemoryEGL;
typedef struct _GstGLMemoryEGLAllocator GstGLMemoryEGLAllocator;
typedef struct _GstGLMemoryEGLAllocatorClass GstGLMemoryEGLAllocatorClass;
/**
* GstGLMemoryEGL:
*
......
......@@ -55,10 +55,6 @@ typedef struct _GstGLMemoryPBO GstGLMemoryPBO;
typedef struct _GstGLMemoryPBOAllocator GstGLMemoryPBOAllocator;
typedef struct _GstGLMemoryPBOAllocatorClass GstGLMemoryPBOAllocatorClass;
typedef struct _GstGLMemoryEGL GstGLMemoryEGL;
typedef struct _GstGLMemoryEGLAllocator GstGLMemoryEGLAllocator;
typedef struct _GstGLMemoryEGLAllocatorClass GstGLMemoryEGLAllocatorClass;
typedef struct _GstGLRenderbuffer GstGLRenderbuffer;
typedef struct _GstGLRenderbufferAllocator GstGLRenderbufferAllocator;
typedef struct _GstGLRenderbufferAllocatorClass GstGLRenderbufferAllocatorClass;
......