[vlc-commits] [Git][videolan/vlc][master] 3 commits: es_out: send vout_order to ES events

2024-07-05 Thread Thomas Guillem (@tguillem)


Thomas Guillem pushed to branch master at VideoLAN / VLC


Commits:
8538decd by Timshel at 2024-07-05T14:35:15+00:00
es_out: send vout_order to ES events

Secondary subtitles cycling is broken because `trackpriv->vout_order`
is never set.

Add `vlc_vout_order` in `vlc_input_event_es` to keep track of it.

Additionnaly to limit modifications when selecting multiples tracks
(Ex: `EsOutSelectList`) we consider that the PRIMARY is always in
first position.

- - - - -
4b043ab2 by Timshel at 2024-07-05T14:35:15+00:00
hotkeys: order selected sub tracks by vout

- - - - -
976f8473 by Timshel at 2024-07-05T14:35:15+00:00
player: support vout_order in vlc_player_CycleTrack

- - - - -


11 changed files:

- include/vlc_player.h
- modules/control/gestures.c
- modules/control/hotkeys.c
- modules/gui/macosx/playlist/VLCPlayerController.m
- modules/gui/ncurses.c
- src/input/es_out.c
- src/input/input_internal.h
- src/libvlccore.sym
- src/player/input.c
- src/player/player.c
- test/src/player/player.c


Changes:

=
include/vlc_player.h
=
@@ -1585,39 +1585,55 @@ vlc_player_SelectEsIdList(vlc_player_t *player,
   enum es_format_category_e cat,
   vlc_es_id_t *const es_id_list[]);
 
+
 /**
- * Select the next track
+ * Cycle through the tracks
  *
  * If the last track is already selected, a call to this function will disable
  * this last track. And a second call will select the first track.
- *
- * @warning This function has no effects if there are several tracks selected
- * for a same category. Therefore the default policy is
- * VLC_PLAYER_SELECT_EXCLUSIVE.
+ * Unless called on the PRIMARY with a SECONDARY selected, it will cycle 
through
  *
  * @param player locked player instance
  * @param cat VIDEO_ES, AUDIO_ES or SPU_ES
+ * @param next the cycle order
  */
 VLC_API void
-vlc_player_SelectNextTrack(vlc_player_t *player,
-   enum es_format_category_e cat);
+vlc_player_CycleTrack(vlc_player_t *player, enum es_format_category_e cat,
+  enum vlc_vout_order vout_order, bool next);
 
 /**
- * Select the Previous track
+ * Helper to select the next track
+ *
+ * If the last track is already selected, a call to this function will disable
+ * this last track. And a second call will select the first track.
+ * Unless called on the PRIMARY with a SECONDARY selected, it will cycle 
through
+ *
+ * @param player locked player instance
+ * @param cat VIDEO_ES, AUDIO_ES or SPU_ES
+ */
+static inline void
+vlc_player_SelectNextTrack(vlc_player_t *player, enum es_format_category_e cat,
+   enum vlc_vout_order vout_order)
+{
+vlc_player_CycleTrack(player, cat, vout_order, true);
+}
+
+/**
+ * Helper to select the Previous track
  *
  * If the first track is already selected, a call to this function will disable
  * this first track. And a second call will select the last track.
- *
- * @warning This function has no effects if there are several tracks selected
- * for a same category. Therefore the default policy is
- * VLC_PLAYER_SELECT_EXCLUSIVE.
+ * Unless called on the PRIMARY with a SECONDARY selected, it will cycle 
through
  *
  * @param player locked player instance
  * @param cat VIDEO_ES, AUDIO_ES or SPU_ES
  */
-VLC_API void
-vlc_player_SelectPrevTrack(vlc_player_t *player,
-   enum es_format_category_e cat);
+static inline void
+vlc_player_SelectPrevTrack(vlc_player_t *player, enum es_format_category_e cat,
+   enum vlc_vout_order vout_order)
+{
+vlc_player_CycleTrack(player, cat, vout_order, false);
+}
 
 /**
  * Unselect a track from an ES identifier


=
modules/control/gestures.c
=
@@ -274,7 +274,7 @@ static void ProcessGesture( intf_thread_t *p_intf )
 enum es_format_category_e cat =
 p_sys->i_pattern == GESTURE(UP,RIGHT,NONE,NONE) ?
 AUDIO_ES : SPU_ES;
-vlc_player_SelectNextTrack(player, cat);
+vlc_player_SelectNextTrack(player, cat, VLC_VOUT_ORDER_PRIMARY);
 break;
 }
 


=
modules/control/hotkeys.c
=
@@ -365,109 +365,17 @@ PLAYER_ACTION_HANDLER(NavigateMedia)
 }
 }
 
-static void CycleSecondarySubtitles(intf_thread_t *intf, vlc_player_t *player,
-bool next)
-{
-intf_sys_t *sys = intf->p_sys;
-const enum es_format_category_e cat = SPU_ES;
-size_t count = vlc_player_GetTrackCount(player, cat);
-if (!count)
-return;
-
-vlc_es_id_t *cycle_id = NULL;
-vlc_es_id_t *keep_id = NULL;
-
-/* Check how many subtitle tracks are already selected */
-size_t selected_count = 0;
-for (size_t i = 0; i < count; ++i)
-{
-const struct vlc_player_track *track =
-   

[vlc-commits] [Git][videolan/vlc][master] 3 commits: configure: factorize qmake makefile patching

2024-05-29 Thread Thomas Guillem (@tguillem)


Thomas Guillem pushed to branch master at VideoLAN / VLC


Commits:
1cf1d94d by Pierre Lamot at 2024-05-29T17:06:58+02:00
configure: factorize qmake makefile patching

- - - - -
d55f9d65 by Pierre Lamot at 2024-05-29T17:07:06+02:00
configure: fix library path extracted from qmake

- - - - -
4473bb37 by Pierre Lamot at 2024-05-29T17:07:09+02:00
configure: extract LDFLAGS from qmake

- - - - -


2 changed files:

- configure.ac
- modules/gui/qt/Makefile.am


Changes:

=
configure.ac
=
@@ -4019,29 +4019,41 @@ AS_IF([test "${enable_qt}" != "no"], [
   QT_PKG_ERRORS=$(${QMAKE} ${srcdir}/modules/gui/qt/qt6.pro -o 
${ac_pwd}/modules/gui/qt/qmake-qt 2>&1)
   ac_status=$?
   AS_IF([test $ac_status = 0 && test -f ${ac_pwd}/modules/gui/qt/qmake-qt],[
-  echo "get_cflags:">> 
${ac_pwd}/modules/gui/qt/qmake-qt
-  echo '   $(info $(DEFINES) $(INCPATH))' >> 
${ac_pwd}/modules/gui/qt/qmake-qt
-  echo "get_libs:"  >> 
${ac_pwd}/modules/gui/qt/qmake-qt
-  echo '   echo $(LIBS) | sed -e "s@/[[^ ]]*/lib\([[^ ]]*\)\.so@-l\1@g"' 
>> ${ac_pwd}/modules/gui/qt/qmake-qt
+  echo "get_cflags:"> 
${ac_pwd}/modules/gui/qt/qmake-common.mk
+  echo '   $(info $(DEFINES) $(INCPATH))' >> 
${ac_pwd}/modules/gui/qt/qmake-common.mk
+  echo "get_libs:"  >> 
${ac_pwd}/modules/gui/qt/qmake-common.mk
+  dnl transform /foo/bar/libbaz.so arguments to -L/foo/bar -lbaz
+  dnl RS: each arguments (space separated) are treated as a new line
+  dnl FS: split fields using /[^/]* to extract the file basepath ($1)
+  dnl  /lib.*\.so/ lines (arguments) will add -Lxxx if this is not the 
current path (p), then transform into a -lxxx argument
+  dnl other arguments are kept as-is
+  echo '   echo $(LIBS) | awk '\''BEGIN{FS="/[[^/]]*$$";RS=" ";ORS=" 
"}{if($$0 ~ /\/lib.*\.so/){ if(p != $$1){ print "-L" $$1; p=$$1}; 
sub(/.*\/lib/, "-l"); sub(/\.so.*/, "")}; print $$0}'\' >> 
${ac_pwd}/modules/gui/qt/qmake-common.mk
+  echo 'get_ldflags:'   >> 
${ac_pwd}/modules/gui/qt/qmake-common.mk
+  echo '   echo $(LFLAGS)' >> 
${ac_pwd}/modules/gui/qt/qmake-common.mk
+
+  echo "include ${ac_pwd}/modules/gui/qt/qmake-common.mk"  >> 
${ac_pwd}/modules/gui/qt/qmake-qt
+
   AC_MSG_RESULT([yes])
   QT_LIBS=$(cd ${ac_pwd}/modules/gui/qt && make -s -f qmake-qt get_libs)
   QT_CFLAGS=$(cd ${ac_pwd}/modules/gui/qt && make -s -f qmake-qt 
get_cflags)
+  QT_LDFLAGS=$(cd ${ac_pwd}/modules/gui/qt && make -s -f qmake-qt 
get_ldflags)
   AC_SUBST([QT_LIBS])
   AC_SUBST([QT_CFLAGS])
+  AC_SUBST([QT_LDFLAGS])
 
   AC_MSG_CHECKING([for Qt6WaylandClient])
   (${QMAKE} ${srcdir}/modules/gui/qt/wayland.pro -o 
${ac_pwd}/modules/gui/qt/qmake-wayland) 2>/dev/null
   ac_status=$?
   AS_IF([test $ac_status = 0 && test -f 
${ac_pwd}/modules/gui/qt/qmake-wayland],[
-echo 'get_cflags:' >> 
${ac_pwd}/modules/gui/qt/qmake-wayland
-echo ' $(info $(DEFINES) $(INCPATH))' >> 
${ac_pwd}/modules/gui/qt/qmake-wayland
-echo 'get_libs:'   >> 
${ac_pwd}/modules/gui/qt/qmake-wayland
-echo ' echo $(LIBS) | sed -e "s@/[[^ ]]*/lib\([[^ ]]*\)\.so@-l\1@g"' 
>> ${ac_pwd}/modules/gui/qt/qmake-wayland
+echo "include ${ac_pwd}/modules/gui/qt/qmake-common.mk"  >> 
${ac_pwd}/modules/gui/qt/qmake-wayland
+
 AC_MSG_RESULT([yes])
 QT_WAYLAND_LIBS=$(cd ${ac_pwd}/modules/gui/qt && make -s -f 
qmake-wayland get_libs)
 QT_WAYLAND_CFLAGS=$(cd ${ac_pwd}/modules/gui/qt && make -s -f 
qmake-wayland get_cflags)
+QT_WAYLAND_LDFLAGS=$(cd ${ac_pwd}/modules/gui/qt && make -s -f 
qmake-wayland get_ldflags)
 AC_SUBST([QT_WAYLAND_LIBS])
 AC_SUBST([QT_WAYLAND_CFLAGS])
+AC_SUBST([QT_WAYLAND_LDFLAGS])
 have_qt_wayland="yes"
   ],[
 AC_MSG_RESULT([no])
@@ -4091,15 +4103,14 @@ AS_IF([test "${enable_qt}" != "no"], [
 --qtconf "${with_qtconf}" \
 --modules QtTest="" \
 >&AS_MESSAGE_FD ], [
-echo 'get_cflags:' >> 
${ac_pwd}/modules/gui/qt/qmake-quicktest
-echo ' $(info $(DEFINES) $(INCPATH))' >> 
${ac_pwd}/modules/gui/qt/qmake-quicktest
-echo 'get_libs:'   >> 
${ac_pwd}/modules/gui/qt/qmake-quicktest
-echo ' echo $(LIBS) | sed -e "s@/[[^ ]]*/lib\([[^ 
]]*\)\.so@-l\1@g"' >> ${ac_pwd}/modules/gui/qt/qmake-quicktest
+echo "include ${ac_pwd}/modules/gui/qt/qmake-common.mk">> 
${ac_pwd}/modules/gui/qt/qmake-quicktest
 AC_MSG_RESULT([yes])
 QT_QUICK_TEST_LIBS=$(cd ${ac_pwd}/modules/gui/qt && make -s -f 
qmake-quicktest get_libs)
 QT_QUICK_TEST_CFLAGS=$(cd ${ac_pwd}/modules/gui/qt && make -s -f 
qmake-quicktest get_cflags)
+QT_QUICK_TES

[vlc-commits] [Git][videolan/vlc][master] aout: remove original_pts

2024-04-07 Thread Thomas Guillem (@tguillem)


Thomas Guillem pushed to branch master at VideoLAN / VLC


Commits:
1727b938 by Thomas Guillem at 2024-04-07T18:11:04+00:00
aout: remove original_pts

Partial revert of 9d4bad0da0f49033ed0efaa961066d1187ac5780

All "audio resampler" already use the original pts (out->pts = 
in->pts)
(but the block->length do match the new rate).

- - - - -


1 changed file:

- src/audio_output/dec.c


Changes:

=
src/audio_output/dec.c
=
@@ -59,7 +59,6 @@ struct vlc_aout_stream
 vlc_tick_t request_delay;
 vlc_tick_t delay;
 } sync;
-vlc_tick_t original_pts;
 
 struct
 {
@@ -159,7 +158,6 @@ static int stream_GetDelay(vlc_aout_stream *stream, 
vlc_tick_t *delay)
 static void stream_Discontinuity(vlc_aout_stream *stream)
 {
 stream->sync.discontinuity = true;
-stream->original_pts = VLC_TICK_INVALID;
 
 vlc_mutex_lock(&stream->timing.lock);
 stream->timing.first_pts = VLC_TICK_INVALID;
@@ -735,15 +733,6 @@ int vlc_aout_stream_Play(vlc_aout_stream *stream, block_t 
*block)
 if (block->i_flags & BLOCK_FLAG_DISCONTINUITY)
 stream_Discontinuity(stream);
 
-if (stream->original_pts == VLC_TICK_INVALID)
-{
-/* Use the original PTS for synchronization and as a play date of the
- * aout module. This PTS need to be saved here in order to use the PTS
- * of the first block that has been filtered. Indeed, aout filters may
- * need more than one block to output a new one. */
-stream->original_pts = block->i_pts;
-}
-
 if (stream->filters)
 {
 if (atomic_load_explicit(&owner->vp.update, memory_order_relaxed))
@@ -759,9 +748,6 @@ int vlc_aout_stream_Play(vlc_aout_stream *stream, block_t 
*block)
 return ret;
 }
 
-const vlc_tick_t original_pts = stream->original_pts;
-stream->original_pts = VLC_TICK_INVALID;
-
 /* Software volume */
 if (stream->volume != NULL)
 aout_volume_Amplify(stream->volume, block);
@@ -784,10 +770,10 @@ int vlc_aout_stream_Play(vlc_aout_stream *stream, block_t 
*block)
 
 vlc_clock_Lock(stream->sync.clock);
 vlc_tick_t play_date =
-vlc_clock_ConvertToSystem(stream->sync.clock, system_now, original_pts,
+vlc_clock_ConvertToSystem(stream->sync.clock, system_now, block->i_pts,
   stream->sync.rate);
 vlc_clock_Unlock(stream->sync.clock);
-stream_Synchronize(stream, system_now, play_date, original_pts);
+stream_Synchronize(stream, system_now, play_date, block->i_pts);
 
 vlc_audio_meter_Process(&owner->meter, block, play_date);
 
@@ -797,14 +783,14 @@ int vlc_aout_stream_Play(vlc_aout_stream *stream, block_t 
*block)
 vlc_mutex_lock(&stream->timing.lock);
 /* Save the first timing point seeing a rate change */
 stream->timing.rate_system_ts = play_date;
-stream->timing.rate_audio_ts = original_pts;
+stream->timing.rate_audio_ts = block->i_pts;
 stream->timing.rate = stream->sync.rate;
 
 /* Update the clock immediately with the new rate, instead of waiting
  * for a timing update that could come too late (after 1second). */
 vlc_clock_Lock(stream->sync.clock);
 stream->timing.last_drift =
-vlc_clock_Update(stream->sync.clock, play_date, original_pts,
+vlc_clock_Update(stream->sync.clock, play_date, block->i_pts,
  stream->sync.rate);
 vlc_clock_Unlock(stream->sync.clock);
 vlc_mutex_unlock(&stream->timing.lock);
@@ -813,7 +799,7 @@ int vlc_aout_stream_Play(vlc_aout_stream *stream, block_t 
*block)
 if (stream->timing.first_pts == VLC_TICK_INVALID)
 {
 vlc_mutex_lock(&stream->timing.lock);
-stream->timing.first_pts = original_pts;
+stream->timing.first_pts = block->i_pts;
 vlc_mutex_unlock(&stream->timing.lock);
 }
 



View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/commit/1727b938bf13514bbb34ecb00c4adb91164b4e57

-- 
View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/commit/1727b938bf13514bbb34ecb00c4adb91164b4e57
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] [Git][videolan/vlc][master] core: fix assert in libvlc_MetadataRequest()

2024-03-18 Thread Thomas Guillem (@tguillem)


Thomas Guillem pushed to branch master at VideoLAN / VLC


Commits:
39a6ab3d by Thomas Guillem at 2024-03-18T10:01:52+00:00
core: fix assert in libvlc_MetadataRequest()

It is now possible to use the preparser only for parsing, only for
fetching or both.

Fixes #28545

- - - - -


1 changed file:

- src/libvlc.c


Changes:

=
src/libvlc.c
=
@@ -481,7 +481,8 @@ int libvlc_MetadataRequest(libvlc_int_t *libvlc, 
input_item_t *item,
int timeout, void *id)
 {
 libvlc_priv_t *priv = libvlc_priv(libvlc);
-assert(i_options & META_REQUEST_OPTION_SCOPE_ANY);
+assert(i_options & META_REQUEST_OPTION_SCOPE_ANY ||
+   i_options & META_REQUEST_OPTION_FETCH_ANY);
 
 if (unlikely(priv->parser == NULL))
 return VLC_ENOMEM;



View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/commit/39a6ab3d7c9b6214cf2bf3d3f41b5b308fef81d4

-- 
View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/commit/39a6ab3d7c9b6214cf2bf3d3f41b5b308fef81d4
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] [Git][videolan/vlc][master] contrib: aom: update to 3.8.2

2024-03-17 Thread Thomas Guillem (@tguillem)


Thomas Guillem pushed to branch master at VideoLAN / VLC


Commits:
d72ecb37 by Tristan Matthews at 2024-03-17T23:43:34+00:00
contrib: aom: update to 3.8.2

- Bug Fixes
* aomedia:3523: SIGFPE in av1_twopass_postencode_update()
  pass2_strategy.c:4261.
* aomedia:3535, b/317646516: Over reads in aom_convolve_copy_neon().
* aomedia:3543: invalid feature modifier when compiling
  aom_dsp/arm/aom_convolve8_neon_i8mm.c on Debian 10 with arm64
  architecture.
* aomedia:3545: Failed to parse configurations due to inconsistent
  elements between two arrays "av1_ctrl_args" and 
"av1_arg_ctrl_map"
  in aomenc.c.
* oss-fuzz:66474, b/319140742: Integer-overflow in search_wiener.
* Zero initialize an array in cdef search.

See:
https://aomedia.googlesource.com/aom/+/refs/tags/v3.8.2

- - - - -


2 changed files:

- contrib/src/aom/SHA512SUMS
- contrib/src/aom/rules.mak


Changes:

=
contrib/src/aom/SHA512SUMS
=
@@ -1 +1 @@
-f9ee918a37699cfaf2bcb5aa16a4d8b077feb1fc577d8c5437ed3fa1a1c0a5d734c9564e3c8c0f0b1baf43dc5abb7ff0196a77607b10d926c0be7858778ac1e3
  libaom-3.8.1.tar.gz
+539cb86645f1675e3f2d45c7c10d5d66ef7d36eaddf0c2d50f1a532287c70f780c8ce6dd8959f4bb112fd74e2b63501652e8e1eba5d18bf03a926ad158f6cfb0
  libaom-3.8.2.tar.gz


=
contrib/src/aom/rules.mak
=
@@ -1,5 +1,5 @@
 # aom
-AOM_VERSION := 3.8.1
+AOM_VERSION := 3.8.2
 AOM_URL := 
https://storage.googleapis.com/aom-releases/libaom-$(AOM_VERSION).tar.gz
 
 PKGS += aom



View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/commit/d72ecb37c622a246f853b51d22db0d092142caff

-- 
View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/commit/d72ecb37c622a246f853b51d22db0d092142caff
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] [Git][videolan/vlc][master] macosx: Fix scroll in home view

2024-03-15 Thread Thomas Guillem (@tguillem)


Thomas Guillem pushed to branch master at VideoLAN / VLC


Commits:
f1aab7a6 by Claudio Cambra at 2024-03-15T16:52:48+00:00
macosx: Fix scroll in home view

Signed-off-by: Claudio Cambra 

- - - - -


1 changed file:

- modules/gui/macosx/UI/VLCLibraryWindow.xib


Changes:

=
modules/gui/macosx/UI/VLCLibraryWindow.xib
=
@@ -932,7 +932,7 @@
 
 
 
-
+
 
 
 



View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/commit/f1aab7a6f18f6a9a7f8de084f1964cefc28de52b

-- 
View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/commit/f1aab7a6f18f6a9a7f8de084f1964cefc28de52b
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] [Git][videolan/vlc][master] qt: mlplaylist: Display duration from MediaLibrary

2024-03-15 Thread Thomas Guillem (@tguillem)


Thomas Guillem pushed to branch master at VideoLAN / VLC


Commits:
50960ca5 by darshan jain at 2024-03-15T16:28:17+00:00
qt: mlplaylist: Display duration from MediaLibrary

- - - - -


1 changed file:

- modules/gui/qt/medialibrary/mlplaylist.cpp


Changes:

=
modules/gui/qt/medialibrary/mlplaylist.cpp
=
@@ -29,7 +29,7 @@
 MLPlaylist::MLPlaylist(const vlc_ml_playlist_t * data)
 : MLItem(MLItemId(data->i_id, VLC_ML_PARENT_PLAYLIST))
 , m_name(qfu(data->psz_name))
-, m_duration(0) // TODO m_duration
+, m_duration(data->i_duration)
 , m_count(data->i_nb_media)
 {
 assert(data);



View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/commit/50960ca5531e9e8b43e3a41a28cd928b6d2d4da2

-- 
View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/commit/50960ca5531e9e8b43e3a41a28cd928b6d2d4da2
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] [Git][videolan/vlc][master] 2 commits: clock: rework event handling

2024-03-15 Thread Thomas Guillem (@tguillem)


Thomas Guillem pushed to branch master at VideoLAN / VLC


Commits:
a3f7f88f by Thomas Guillem at 2024-03-15T15:35:29+00:00
clock: rework event handling

vlc_clock_RegisterEvents become:
 - vlc_clock_AddListener
 - vlc_clock_RemoveListener

Using the same mechanism than player and playlist.

This will allow more controls on (future) clock events.

- - - - -
e4a4e067 by Thomas Guillem at 2024-03-15T15:35:29+00:00
clock: remove event limitation

Future events might be used by every type of clocks.

- - - - -


3 changed files:

- src/clock/clock.c
- src/clock/clock.h
- src/video_output/video_output.c


Changes:

=
src/clock/clock.c
=
@@ -32,7 +32,7 @@
 
 #define COEFF_THRESHOLD 0.2 /* between 0.8 and 1.2 */
 
-struct vlc_clock_event
+struct vlc_clock_listener_id
 {
 vlc_clock_t *clock;
 const struct vlc_clock_event_cbs *cbs;
@@ -70,7 +70,7 @@ struct vlc_clock_main_t
 vlc_tick_t output_dejitter; /* Delay used to absorb the output clock 
jitter */
 vlc_tick_t input_dejitter; /* Delay used to absorb the input jitter */
 
-struct VLC_VECTOR(struct vlc_clock_event) events;
+struct VLC_VECTOR(vlc_clock_listener_id *) listeners;
 };
 
 struct vlc_clock_ops
@@ -96,53 +96,60 @@ struct vlc_clock_t
 void *cbs_data;
 };
 
-int vlc_clock_RegisterEvents(vlc_clock_t *clock,
- const struct vlc_clock_event_cbs *cbs,
- void *data)
+vlc_clock_listener_id *
+vlc_clock_AddListener(vlc_clock_t *clock,
+  const struct vlc_clock_event_cbs *cbs,
+  void *data)
 {
 vlc_clock_main_t *main_clock = clock->owner;
+assert(cbs != NULL);
+
+vlc_clock_listener_id *listener_id = malloc(sizeof(*listener_id));
+if (listener_id == NULL)
+return NULL;
+
+listener_id->clock = clock;
+listener_id->cbs = cbs;
+listener_id->data = data;
 
 vlc_mutex_lock(&main_clock->lock);
-if (clock == main_clock->master || clock == main_clock->input_master)
-{
-/* Events are only from master to slaves */
-vlc_mutex_unlock(&main_clock->lock);
-return -EINVAL;
-}
+bool success = vlc_vector_push(&main_clock->listeners, listener_id);
+vlc_mutex_unlock(&main_clock->lock);
 
-int ret;
-if (cbs != NULL)
+if (!success)
 {
-const struct vlc_clock_event event = {
-.clock = clock,
-.cbs = cbs,
-.data = data,
-};
-ret = vlc_vector_push(&main_clock->events, event) ? 0 : -ENOMEM;
-}
-else
-{
-ret = -EINVAL;
-const struct vlc_clock_event *event;
-vlc_vector_foreach_ref(event, &main_clock->events)
-if (event->clock == clock)
-{
-vlc_vector_remove(&main_clock->events, vlc_vector_idx_event);
-ret = 0;
-break;
-}
-assert(ret == 0);
+free(listener_id);
+return NULL;
 }
+return listener_id;
+}
 
-vlc_mutex_unlock(&main_clock->lock);
-return ret;
+void
+vlc_clock_RemoveListener(vlc_clock_t *clock, vlc_clock_listener_id 
*listener_id)
+{
+vlc_clock_main_t *main_clock = clock->owner;
+
+vlc_mutex_lock(&main_clock->lock);
+
+const vlc_clock_listener_id *it;
+vlc_vector_foreach(it, &main_clock->listeners)
+if (it == listener_id)
+{
+vlc_vector_remove(&main_clock->listeners, vlc_vector_idx_it);
+free(listener_id);
+
+vlc_mutex_unlock(&main_clock->lock);
+return;
+}
+
+vlc_assert_unreachable();
 }
 
 #define vlc_clock_SendEvent(main_clock, event) { \
-const struct vlc_clock_event *event; \
-vlc_vector_foreach_ref(event, &main_clock->events) \
-if (event->cbs->on_##event != NULL) \
-event->cbs->on_##event(event->data); \
+const struct vlc_clock_listener_id *listener_id; \
+vlc_vector_foreach(listener_id, &main_clock->listeners) \
+if (listener_id->cbs->on_##event != NULL) \
+listener_id->cbs->on_##event(listener_id->data); \
 }
 
 static inline void TraceRender(struct vlc_tracer *tracer, const char *type,
@@ -575,7 +582,7 @@ vlc_clock_main_t *vlc_clock_main_New(struct vlc_logger 
*parent_logger, struct vl
 AvgInit(&main_clock->coeff_avg, 10);
 AvgResetAndFill(&main_clock->coeff_avg, main_clock->coeff);
 
-vlc_vector_init(&main_clock->events);
+vlc_vector_init(&main_clock->listeners);
 
 return main_clock;
 }
@@ -655,8 +662,8 @@ void vlc_clock_main_Delete(vlc_clock_main_t *main_clock)
 if (main_clock->logger != NULL)
 vlc_LogDestroy(main_clock->logger);
 
-assert(main_clock->events.size == 0);
-vlc_vector_destroy(&main_clock->events);
+assert(main_clock->listeners.size == 0);
+vlc_vector_destroy(&main_clock->listeners);
 
 free(main_clock);
 }


=
src/cl

[vlc-commits] [Git][videolan/vlc][master] 2 commits: qt: mlalbummodel: Sort Title by Alphabetical Order

2024-03-15 Thread Thomas Guillem (@tguillem)


Thomas Guillem pushed to branch master at VideoLAN / VLC


Commits:
f4a2f119 by darshan jain at 2024-03-15T14:33:00+00:00
qt: mlalbummodel: Sort Title by Alphabetical Order

The view in MusicArtistsAlbums was incorrectly trying to sort Albums
from an Artist by "Album" which would resort to sorting them by
releasing date.

This commit change the sorting order for "title" to 
"alphabetical",
matching it with how the roleToCriteria defines the order:

  case ALBUM_TITLE:
  return VLC_ML_SORTING_ALPHA;

 Fixes: #28505

- - - - -
5cd2d7ae by darshan jain at 2024-03-15T14:33:00+00:00
qt: MusicArtistsAlbums: add Release Year Sorting Criteria for Albums

By this commit Albums in MusicArtistsAlbums are now sort wrt Release
Year with no Default fallback sort criteria warnings.

- - - - -


2 changed files:

- modules/gui/qt/medialibrary/mlalbummodel.cpp
- modules/gui/qt/medialibrary/qml/MusicArtistsAlbums.qml


Changes:

=
modules/gui/qt/medialibrary/mlalbummodel.cpp
=
@@ -22,7 +22,7 @@
 
 QHash MLAlbumModel::M_names_to_criteria 
= {
 {"id", VLC_ML_SORTING_DEFAULT},
-{"title", VLC_ML_SORTING_ALBUM},
+{"title", VLC_ML_SORTING_ALPHA},
 {"release_year", VLC_ML_SORTING_RELEASEDATE},
 {"main_artist", VLC_ML_SORTING_ARTIST},
 //{"nb_tracks"},


=
modules/gui/qt/medialibrary/qml/MusicArtistsAlbums.qml
=
@@ -39,7 +39,8 @@ FocusScope {
 property int rightPadding: 0
 
 property var sortModel: [
-{ text: I18n.qtr("Alphabetic"),  criteria: "title" }
+{ text: I18n.qtr("Alphabetic"),  criteria: "title" },
+{ text: I18n.qtr("Release Year"),  criteria: "release_year" }
 ]
 
 property int initialIndex: 0



View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/compare/dc82c0b98d2f9a6a36d39fdabb5d06409f3e990e...5cd2d7aec11914d0e6c6ef0b5e7c02aeb1bc3e3b

-- 
View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/compare/dc82c0b98d2f9a6a36d39fdabb5d06409f3e990e...5cd2d7aec11914d0e6c6ef0b5e7c02aeb1bc3e3b
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] [Git][videolan/vlc][master] 2 commits: update: don't pretend all debug builds are Win32

2024-03-15 Thread Thomas Guillem (@tguillem)


Thomas Guillem pushed to branch master at VideoLAN / VLC


Commits:
c79116dc by Rémi Denis-Courmont at 2024-03-15T13:20:49+00:00
update: don't pretend all debug builds are Win32

If you want to test this on something else, then update the corresponding
status file, seriously.

- - - - -
dc82c0b9 by Rémi Denis-Courmont at 2024-03-15T13:20:49+00:00
update: update to 64-bit VLC on 64-bit Windows

This is justified just by the sheer amount of 64-bit arithmetic we do.

The only point in sticking to a 32-bit VLC is binary compatibility,
either for external VLC plugins, or for LibVLC applications. But VLC 4.0
will break binary compatibility on both counts, so that is moot.
This constitutes a once in a decade opportunity to smoothly switch over,
considering how rarely LibVLC compatibility is broken.

- - - - -


1 changed file:

- src/misc/update.c


Changes:

=
src/misc/update.c
=
@@ -73,18 +73,10 @@
  * Remaining text is a required description of the update
  */
 
-#if defined( _WIN64 )
-# define UPDATE_OS_SUFFIX "-win-x64"
-#elif defined( _WIN32 )
-# define UPDATE_OS_SUFFIX "-win-x86"
-#else
-# define UPDATE_OS_SUFFIX ""
-#endif
-
 #ifndef NDEBUG
-# define UPDATE_VLC_STATUS_URL 
"http://update-test.videolan.org/vlc/status-win-x86";
+# define UPDATE_VLC_STATUS_URL "http://update-test.videolan.org/vlc/status";
 #else
-# define UPDATE_VLC_STATUS_URL "http://update.videolan.org/vlc/status"; 
UPDATE_OS_SUFFIX
+# define UPDATE_VLC_STATUS_URL "http://update.videolan.org/vlc/status";
 #endif
 
 #define dialog_FatalWait( p_obj, psz_title, psz_fmt, ... ) \
@@ -179,11 +171,26 @@ static void EmptyRelease( update_t *p_update )
  */
 static bool GetUpdateFile( update_t *p_update )
 {
+#if defined(_WIN64)
+static const char url[] = UPDATE_VLC_STATUS_URL "-win-x64";
+#elif defined(_WIN32)
+static const char *urls[] = {
+UPDATE_VLC_STATUS_URL "-win-x86", UPDATE_VLC_STATUS_URL "-win-x64"
+};
+BOOL sixtyfour;
+
+if (!IsWow64Process(GetCurrentProcess(), &sixtyfour))
+sixtyfour = FALSE; // not clear how this can fail but MSDN says so
+
+const char *url = urls[sixtyfour != FALSE];
+#else
+static const char url[] = UPDATE_VLC_STATUS_URL;
+#endif
 stream_t *p_stream = NULL;
 char *psz_version_line = NULL;
 char *psz_update_data = NULL;
 
-p_stream = vlc_stream_NewURL( p_update->p_libvlc, UPDATE_VLC_STATUS_URL );
+p_stream = vlc_stream_NewURL( p_update->p_libvlc, url );
 if( !p_stream )
 {
 msg_Err( p_update->p_libvlc, "Failed to open %s for reading",



View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/compare/0051b5f46e14b1719a620040262bef7d442d61a6...dc82c0b98d2f9a6a36d39fdabb5d06409f3e990e

-- 
View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/compare/0051b5f46e14b1719a620040262bef7d442d61a6...dc82c0b98d2f9a6a36d39fdabb5d06409f3e990e
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] [Git][videolan/vlc][master] player: move SetMediaStoppedAction() to the playlist

2024-03-01 Thread Thomas Guillem (@tguillem)


Thomas Guillem pushed to branch master at VideoLAN / VLC


Commits:
3657a537 by Thomas Guillem at 2024-03-01T15:59:57+00:00
player: move SetMediaStoppedAction() to the playlist

The playlist is more suited to handle what to do after a playback.

This will allow to simplify the vlc_player_t media provider by removing
its callback that was sent depending on the media_stopped_action.

Thanks to Pierre for the Qt part of this commit.

Co-authored-by: Pierre Lamot 

Related to #28524

- - - - -


23 changed files:

- include/vlc_player.h
- include/vlc_playlist.h
- modules/gui/macosx/menus/VLCMainMenu.m
- modules/gui/macosx/playlist/VLCPlayerController.h
- modules/gui/macosx/playlist/VLCPlayerController.m
- modules/gui/macosx/playlist/VLCPlaylistController.h
- modules/gui/macosx/playlist/VLCPlaylistController.m
- modules/gui/qt/menus/menus.cpp
- modules/gui/qt/player/player_controller.cpp
- modules/gui/qt/player/player_controller.hpp
- modules/gui/qt/player/player_controller_p.hpp
- modules/gui/qt/playlist/playlist_controller.cpp
- modules/gui/qt/playlist/playlist_controller.hpp
- modules/gui/qt/playlist/playlist_controller_p.hpp
- src/interface/interface.c
- src/libvlccore.sym
- src/player/input.c
- src/player/player.c
- src/player/player.h
- src/playlist/notify.c
- src/playlist/player.c
- src/playlist/playlist.c
- src/playlist/playlist.h


Changes:

=
include/vlc_player.h
=
@@ -87,22 +87,6 @@ enum vlc_player_lock_type
 VLC_PLAYER_LOCK_REENTRANT,
 };
 
-/**
- * Action when the player is stopped
- *
- * @see vlc_player_SetMediaStoppedAction()
- */
-enum vlc_player_media_stopped_action {
-/** Continue (or stop if there is no next media), default behavior */
-VLC_PLAYER_MEDIA_STOPPED_CONTINUE,
-/** Pause when reaching the end of file */
-VLC_PLAYER_MEDIA_STOPPED_PAUSE,
-/** Stop, even if there is a next media to play */
-VLC_PLAYER_MEDIA_STOPPED_STOP,
-/** Exit VLC */
-VLC_PLAYER_MEDIA_STOPPED_EXIT,
-};
-
 /**
  * Callbacks for the owner of the player.
  *
@@ -186,16 +170,6 @@ vlc_player_Unlock(vlc_player_t *player);
 VLC_API void
 vlc_player_CondWait(vlc_player_t *player, vlc_cond_t *cond);
 
-/**
- * Setup an action when a media is stopped
- *
- * @param player locked player instance
- * @param action action to do when a media is stopped
- */
-VLC_API void
-vlc_player_SetMediaStoppedAction(vlc_player_t *player,
- enum vlc_player_media_stopped_action action);
-
 /**
  * Ask to start in a paused state
  *
@@ -3143,18 +3117,6 @@ struct vlc_player_cbs
 enum vlc_player_abloop new_state, vlc_tick_t time, double pos,
 void *data);
 
-/**
- * Called when media stopped action has changed
- *
- * @see vlc_player_SetMediaStoppedAction()
- *
- * @param player locked player instance
- * @param new_action action to execute when a media is stopped
- * @param data opaque pointer set by vlc_player_AddListener()
- */
-void (*on_media_stopped_action_changed)(vlc_player_t *player,
-enum vlc_player_media_stopped_action new_action, void *data);
-
 /**
  * Called when the media meta and/or info has changed
  *


=
include/vlc_playlist.h
=
@@ -154,6 +154,22 @@ struct vlc_playlist_sort_criterion
 enum vlc_playlist_sort_order order;
 };
 
+/**
+ * Action when a media is stopped
+ *
+ * @see vlc_playlist_SetMediaStoppedAction()
+ */
+enum vlc_playlist_media_stopped_action {
+/** Continue (or stop if there is no next media), default behavior */
+VLC_PLAYLIST_MEDIA_STOPPED_CONTINUE,
+/** Pause when reaching the end of file */
+VLC_PLAYLIST_MEDIA_STOPPED_PAUSE,
+/** Stop, even if there is a next media to play */
+VLC_PLAYLIST_MEDIA_STOPPED_STOP,
+/** Exit VLC */
+VLC_PLAYLIST_MEDIA_STOPPED_EXIT,
+};
+
 /**
  * Playlist callbacks.
  *
@@ -292,6 +308,19 @@ struct vlc_playlist_callbacks
 void
 (*on_has_next_changed)(vlc_playlist_t *playlist,
bool has_next, void *userdata);
+
+/**
+ * Called when the stopped action has changed
+ *
+ * @see vlc_playlist_SetMediaStoppedAction()
+ *
+ * \param playlist the playlist
+ * @param new_action action to execute when a media is stopped
+ * \param userdata userdata provided to AddListener()
+ */
+void (*on_media_stopped_action_changed)(vlc_playlist_t *playlist,
+enum 
vlc_playlist_media_stopped_action new_action,
+void *userdata);
 };
 
 /* Playlist items */
@@ -401,6 +430,16 @@ VLC_API void
 vlc_playlist_RemoveListener(vlc_playlist_t *playlist,
 vlc_playlist_listener_id *id);
 
+/**
+ * Setup an action when a media is stopped
+ *
+ * @param playlist the playlist, locked
+ * @pa

[vlc-commits] [Git][videolan/vlc][master] lib: add media_player synchronisation functions

2024-02-28 Thread Thomas Guillem (@tguillem)


Thomas Guillem pushed to branch master at VideoLAN / VLC


Commits:
e648e238 by Thomas Guillem at 2024-02-28T13:28:01+00:00
lib: add media_player synchronisation functions

Related to #28524

- - - - -


4 changed files:

- include/vlc/libvlc_media_player.h
- lib/libvlc.sym
- lib/media_player.c
- lib/media_player_internal.h


Changes:

=
include/vlc/libvlc_media_player.h
=
@@ -2944,6 +2944,67 @@ libvlc_media_player_time_point_get_next_date(const 
libvlc_media_player_time_poin
 
 /** @} libvlc_media_player_watch_time */
 
+/** \defgroup libvlc_media_player_concurrency LibVLC media player concurrency 
API
+ * @{
+ */
+
+/**
+ * Lock the media_player internal lock
+
+ * The lock is recursive, so it's safe to use it multiple times from the same
+ * thread. You must call libvlc_media_player_unlock() the same number of times
+ * you called libvlc_media_player_lock().
+ *
+ * Locking is not mandatory before calling a libvlc_media_player_t function
+ * since they will automatically hold the lock internally.
+ *
+ * This lock can be used to synchronise user variables that interact with the
+ * libvlc_media_player_t or can be used to call several functions together.
+ *
+ * \param mp media player object
+ * \version LibVLC 4.0.0 or later
+ */
+LIBVLC_API void libvlc_media_player_lock( libvlc_media_player_t *mp );
+
+/**
+ * Unlock the media_player internal lock
+ *
+ * \see libvlc_media_player_lock
+ *
+ * \param mp media player object locked using /ref libvlc_media_player_lock
+ * \version LibVLC 4.0.0 or later
+ */
+LIBVLC_API void libvlc_media_player_unlock( libvlc_media_player_t *mp );
+
+/**
+ * Wait for an event to be signalled
+ *
+ * \note this is equivalent to pthread_cond_wait() with the
+ * libvlc_media_player_t internal mutex and condition variable. This function
+ * may spuriously wake up even without libvlc_media_player_signal() being
+ * called.
+ *
+ * \warning this function must not be called from any libvlc callbacks and
+ * events. The lock should be held only one time before waiting.
+ *
+ * \param mp media player object locked using /ref libvlc_media_player_lock
+ * \version LibVLC 4.0.0 or later
+ */
+LIBVLC_API void libvlc_media_player_wait( libvlc_media_player_t *mp );
+
+/**
+ * Signal all threads waiting for a signalling event
+ *
+ * \note this is equivalent to pthread_cond_broadcast() with the
+ * libvlc_media_player_t internal condition variable.
+ *
+ * \param mp media player object locked using /ref libvlc_media_player_lock
+ * \version LibVLC 4.0.0 or later
+ */
+LIBVLC_API void libvlc_media_player_signal( libvlc_media_player_t *mp );
+
+/** @} libvlc_media_player_concurrency */
+
 /** @} media_player */
 
 # ifdef __cplusplus


=
lib/libvlc.sym
=
@@ -159,6 +159,10 @@ libvlc_media_player_previous_chapter
 libvlc_media_player_record
 libvlc_media_player_release
 libvlc_media_player_retain
+libvlc_media_player_lock
+libvlc_media_player_unlock
+libvlc_media_player_wait
+libvlc_media_player_signal
 libvlc_media_player_set_android_context
 libvlc_media_player_set_chapter
 libvlc_media_player_set_equalizer


=
lib/media_player.c
=
@@ -777,6 +777,7 @@ libvlc_media_player_new( libvlc_instance_t *instance )
 NULL, NULL);
 if (unlikely(!mp->player))
 goto error1;
+vlc_cond_init(&mp->wait);
 
 vlc_player_Lock(mp->player);
 
@@ -890,6 +891,26 @@ void libvlc_media_player_release( libvlc_media_player_t 
*p_mi )
 libvlc_media_player_destroy( p_mi );
 }
 
+void libvlc_media_player_lock( libvlc_media_player_t *mp )
+{
+vlc_player_Lock(mp->player);
+}
+
+void libvlc_media_player_unlock( libvlc_media_player_t *mp )
+{
+vlc_player_Unlock(mp->player);
+}
+
+void libvlc_media_player_wait( libvlc_media_player_t *mp )
+{
+vlc_player_CondWait(mp->player, &mp->wait);
+}
+
+void libvlc_media_player_signal( libvlc_media_player_t *mp )
+{
+vlc_cond_broadcast(&mp->wait);
+}
+
 /**
  * Retain a Media Instance object.
  *


=
lib/media_player_internal.h
=
@@ -41,6 +41,7 @@ struct libvlc_media_player_t
 vlc_player_t *player;
 vlc_player_listener_id *listener;
 vlc_player_aout_listener_id *aout_listener;
+vlc_cond_t wait;
 
 struct libvlc_instance_t * p_libvlc_instance; /* Parent instance */
 libvlc_media_t * p_md; /* current media descriptor */



View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/commit/e648e23872d4321c8e6a2b3157d8022336cc40fa

-- 
View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/commit/e648e23872d4321c8e6a2b3157d8022336cc40fa
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository in

[vlc-commits] [Git][videolan/vlc][master] 5 commits: access: rtp: refactor code to h26x header

2024-02-28 Thread Thomas Guillem (@tguillem)


Thomas Guillem pushed to branch master at VideoLAN / VLC


Commits:
7c9f7725 by François Cartegnie at 2024-02-28T09:54:31+00:00
access: rtp: refactor code to h26x header

- - - - -
d9994497 by François Cartegnie at 2024-02-28T09:54:31+00:00
access: rtp: packetize before output

- - - - -
5fa45e1c by François Cartegnie at 2024-02-28T09:54:31+00:00
access: rtp: generate h26x dts from packetized blocks

- - - - -
b4329d10 by François Cartegnie at 2024-02-28T09:54:31+00:00
access: rtp: use block dts for pcr when available

- - - - -
4d691734 by François Cartegnie at 2024-02-28T09:54:31+00:00
access: rtp: add H265 payload

- - - - -


6 changed files:

- modules/access/rtp/Makefile.am
- modules/access/rtp/h264.c
- + modules/access/rtp/h265.c
- + modules/access/rtp/h26x.h
- modules/access/rtp/rtp.c
- modules/demux/mpeg/h26x.c


Changes:

=
modules/access/rtp/Makefile.am
=
@@ -41,6 +41,7 @@ rtpparse_LTLIBRARIES = \
librtp_pcm_plugin.la \
librtp_raw_plugin.la \
librtp_h264_plugin.la \
+   librtp_h265_plugin.la \
librtp_opus_plugin.la \
librtp_xiph_plugin.la
 
@@ -52,7 +53,9 @@ librtp_pcm_plugin_la_CPPFLAGS = $(AM_CPPFLAGS) 
-I$(srcdir)/access/rtp
 
 librtp_raw_plugin_la_SOURCES = access/rtp/raw.c
 
-librtp_h264_plugin_la_SOURCES = access/rtp/h264.c
+librtp_h264_plugin_la_SOURCES = access/rtp/h264.c access/rtp/h26x.h
+
+librtp_h265_plugin_la_SOURCES = access/rtp/h265.c access/rtp/h26x.h
 
 librtp_opus_plugin_la_SOURCES = access/rtp/opus.c
 


=
modules/access/rtp/h264.c
=
@@ -24,96 +24,21 @@
 
 #include 
 
-#include 
+#include "h26x.h"
+
 #include 
-#include 
-#include 
 #include 
 
-#include "rtp.h"
-#include "sdp.h"
-
-struct rtp_h26x_sys
+struct h264_pt_opaque
 {
-vlc_tick_t pts;
-block_t **pp_packets_next;
-block_t *p_packets;
-block_t *xps;
-struct vlc_rtp_es *es;
+block_t *sdpxps;
+vlc_object_t *obj;
 };
 
-static void rtp_h26x_clear(struct rtp_h26x_sys *sys)
-{
-block_ChainRelease(sys->p_packets);
-if(sys->xps)
-block_Release(sys->xps);
-}
-
-static void rtp_h26x_init(struct rtp_h26x_sys *sys)
-{
-sys->pts = VLC_TICK_INVALID;
-sys->p_packets = NULL;
-sys->pp_packets_next = &sys->p_packets;
-sys->xps = NULL;
-sys->es = NULL;
-}
-
-static const uint8_t annexbheader[] = { 0, 0, 0, 1 };
-
-static block_t * h26x_wrap_prefix(block_t *block, bool b_annexb)
-{
-block = block_Realloc(block, 4, block->i_buffer);
-if(block)
-{
-if(b_annexb)
-memcpy(block->p_buffer, annexbheader, 4);
-else
-SetDWBE(block->p_buffer, block->i_buffer - 4);
-}
-return block;
-}
-
-static void h26x_extractbase64xps(const char *psz64,
-  const char *pszend,
-  void(*pf_output)(void *, uint8_t *, size_t),
-  void *outputsys)
-{
-do
-{
-psz64 += strspn(psz64, " ");
-uint8_t *xps = NULL;
-size_t xpssz = vlc_b64_decode_binary(&xps, psz64);
-pf_output(outputsys, xps, xpssz);
-psz64 = strchr(psz64, ',');
-if(psz64)
-++psz64;
-} while(psz64 && *psz64 && psz64 < pszend);
-}
-
-static void h264_add_xps(void *priv, uint8_t *xps, size_t xpssz)
-{
-block_t *b = block_heap_Alloc(xps, xpssz);
-if(!b || !(b = h26x_wrap_prefix(b, true)))
-return;
-
-block_t ***ppp_append = priv;
-**ppp_append = b;
-*ppp_append = &((**ppp_append)->p_next);
-}
-
-static block_t * h264_fillextradata (const char *psz)
-{
-block_t *xps = NULL;
-block_t **pxps = &xps;
-h26x_extractbase64xps(psz, strchr(psz, ';'), h264_add_xps, &pxps);
-if(xps)
-xps = block_ChainGather(xps);
-return xps;
-}
-
 static void *rtp_h264_init(struct vlc_rtp_pt *pt)
 {
-block_t *sdpparams = pt->opaque;
+struct h264_pt_opaque *opaque = pt->opaque;
+block_t *sdpparams = opaque->sdpxps;
 struct rtp_h26x_sys *sys = malloc(sizeof(*sys));
 if(!sys)
 return NULL;
@@ -123,7 +48,14 @@ static void *rtp_h264_init(struct vlc_rtp_pt *pt)
 es_format_Init (&fmt, VIDEO_ES, VLC_CODEC_H264);
 fmt.b_packetized = false;
 
-sys->es = vlc_rtp_pt_request_es(pt, &fmt);
+sys->p_packetizer = demux_PacketizerNew(opaque->obj, &fmt, "rtp 
packetizer");
+if(!sys->p_packetizer)
+{
+free(sys);
+return NULL;
+}
+
+sys->es = vlc_rtp_pt_request_es(pt, &sys->p_packetizer->fmt_out);
 if(sdpparams)
 sys->xps = block_Duplicate(sdpparams);
 
@@ -136,6 +68,8 @@ static void rtp_h264_destroy(struct vlc_rtp_pt *pt, void 
*data)
 struct rtp_h26x_sys *sys = data;
 if(sys)
 {
+if(sys->p_packetizer)
+demux_PacketizerDestroy(sys->p_packetizer);
 vlc_rtp_es_destroy(sys->es);
 rtp_h26x_clear(sy

[vlc-commits] [Git][videolan/vlc][master] 4 commits: extras: ci: fix typos in get-contrib-sha

2024-02-27 Thread Thomas Guillem (@tguillem)


Thomas Guillem pushed to branch master at VideoLAN / VLC


Commits:
bccd0513 by Alexandre Janniaux at 2024-02-27T08:55:42+00:00
extras: ci: fix typos in get-contrib-sha

Missing quote `"` from 0dffba0ebaf05d236e02f0b24ec9ca19786eb842.

- - - - -
2cbc35cf by Alexandre Janniaux at 2024-02-27T08:55:42+00:00
extras: ci: export coverage artifacts

The files are reported to gitlab but not made public. Being able to
download it enables running gcovr locally and makes it easier to debug
coverage issues.

- - - - -
a80d692b by Alexandre Janniaux at 2024-02-27T08:55:42+00:00
extras: ci: change source path for cobertura output

Gitlab has some constraints[^1] regarding the cobertura output to have
the coverage results displayed on the merge request:

 - Files in the diff view must appear in the cobertura file to have the
   coverage enabled for them.

 -  must be absolute or  must typically have an
   absolute path to the project directory.

 - Pipeline must have completed to show the results.

  - The coverage report must not exceed the limits (10MiB and 100
sources node).

The second point on absolute filename was not valid given that meson
gcovr setup the  with `.`, leading to the only  
element
referencing `.` instead of ${CI_PROJECT_DIR}.

This commit patches the generated coverage to ensure it's relative to
the root directory, enabling diff coverage.

[^1]: 
https://docs.gitlab.com/ee/ci/testing/test_coverage_visualization.html#test-coverage-visualization-not-displayed

- - - - -
7f19145d by Alexandre Janniaux at 2024-02-27T08:55:42+00:00
extras: ci: enable coverage reports in MR

To enable coverage report in MRs (and not just in artifacts), we need to
indicate the regex for gitlab to parse the total percentage. See general
documentation[^1] highlighting that uploading doesn't enable, as well as
how to enable history [^2] and in merge requests[^3] for more details.

The || true is needed on the script line extracting the coverage
percentage, because the job is failing otherwise, but I'm still not sure
what is causing the failure.

[^1]: https://docs.gitlab.com/ee/ci/testing/test_coverage_visualization.html
[^2]: 
https://docs.gitlab.com/ee/ci/testing/code_coverage.html#view-history-of-project-code-coverage
[^3]: 
https://docs.gitlab.com/ee/ci/testing/code_coverage.html#view-code-coverage-results-in-the-mr

Co-authored-by: Alaric Senat 

- - - - -


2 changed files:

- extras/ci/get-contrib-sha.sh
- extras/ci/gitlab-ci.yml


Changes:

=
extras/ci/get-contrib-sha.sh
=
@@ -54,7 +54,7 @@ case $1 in
 esac
 
 VLC_LAST_CONTRIB_SHA=$(
-cd "${VLC_SRC_ROOT_DIR} && git rev-list -1 "${VLC_START_REVISION}" -- 
"${VLC_CONTRIB_REBUILD_PATHS[@]}"
+cd "${VLC_SRC_ROOT_DIR}" && git rev-list -1 "${VLC_START_REVISION}" -- 
"${VLC_CONTRIB_REBUILD_PATHS[@]}"
 )
 
 [ -n "${VLC_LAST_CONTRIB_SHA}" ] || abort_err "Failed to determine last 
contrib SHA using Git!"


=
extras/ci/gitlab-ci.yml
=
@@ -327,6 +327,7 @@ nightly-debian:
 #
 debian-meson:
 extends: .base-template
+coverage: '/^coverage result: (\d+.\d+)$/'
 image:
 name: $VLC_DEBIAN_IMAGE
 script:
@@ -373,7 +374,15 @@ debian-meson:
 --xml="cobertura.xml"
 --html="html-coverage/vlc.html"
 --html-details -s -j$NCPU
-
+- |
+# Ensure that sources are reported from CI_PROJECT_DIR directory so
+# that gitlab can associate the files correctly.
+sed -i 
's,.*,'"${CI_PROJECT_DIR}"',' cobertura.xml
+# Expose the line coverage percentage to gitlab from the cobertura XML.
+- >
+grep -Eo 'line-rate="[^"]+"' cobertura.xml | head -n 1 |
+grep -Eo '[0-9.]+' | awk '{ print "coverage result:", $1 * 100 } ' 
||
+true
 allow_failure: true
 variables: *variables-debian
 artifacts:
@@ -383,6 +392,8 @@ debian-meson:
 coverage_format: cobertura
 path: cobertura.xml
 paths:
+- ${CI_PROJECT_DIR}/${CI_JOB_NAME}.cov.json
+- cobertura.xml
 - html-coverage/
 - ${CI_PROJECT_DIR}/build-meson/meson-logs/testlog.junit.xml
 



View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/compare/5f0a9649aa73747ea41f94a77fe32954dd892804...7f19145d9335546c5af0ad6ccf8c2227ecb9f093

-- 
View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/compare/5f0a9649aa73747ea41f94a77fe32954dd892804...7f19145d9335546c5af0ad6ccf8c2227ecb9f093
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] [Git][videolan/npapi-vlc][master] update vlcpp

2024-01-31 Thread Thomas Guillem (@tguillem)


Thomas Guillem pushed to branch master at VideoLAN / VLC Browser Plugins


Commits:
a33f59b3 by Thomas Guillem at 2024-01-31T10:21:27+01:00
update vlcpp

- - - - -


1 changed file:

- vlcpp


Changes:

=
vlcpp
=
@@ -1 +1 @@
-Subproject commit e1a03b37cb104f4086e2a49aedc18339f31b4d6c
+Subproject commit b6876c8189f63656db27844e33b6b476714ba131



View it on GitLab: 
https://code.videolan.org/videolan/npapi-vlc/-/commit/a33f59b33b13d5a5c6eecfe5439ccfd09aab2657

-- 
View it on GitLab: 
https://code.videolan.org/videolan/npapi-vlc/-/commit/a33f59b33b13d5a5c6eecfe5439ccfd09aab2657
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] [Git][videolan/libvlcpp][master] Remove TrackDescription in 4.0

2024-01-31 Thread Thomas Guillem (@tguillem)


Thomas Guillem pushed to branch master at VideoLAN / libvlcpp


Commits:
b6876c81 by Thomas Guillem at 2024-01-31T09:43:42+01:00
Remove TrackDescription in 4.0

- - - - -


1 changed file:

- vlcpp/structures.hpp


Changes:

=
vlcpp/structures.hpp
=
@@ -800,6 +800,7 @@ class AudioOutputDeviceDescription
 std::string m_description;
 };
 
+#if LIBVLC_VERSION_INT < LIBVLC_VERSION(4, 0, 0, 0)
 ///
 /// \brief The TrackDescription class describes a track
 ///
@@ -833,6 +834,7 @@ private:
 int m_id;
 std::string m_name;
 };
+#endif
 
 #if LIBVLC_VERSION_INT >= LIBVLC_VERSION(3, 0, 0, 0)
 ///



View it on GitLab: 
https://code.videolan.org/videolan/libvlcpp/-/commit/b6876c8189f63656db27844e33b6b476714ba131

-- 
View it on GitLab: 
https://code.videolan.org/videolan/libvlcpp/-/commit/b6876c8189f63656db27844e33b6b476714ba131
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] [Git][videolan/libvlcpp][master] Remove TrackDescription in 3.0

2024-01-31 Thread Thomas Guillem (@tguillem)


Thomas Guillem pushed to branch master at VideoLAN / libvlcpp


Commits:
9bea609a by Thomas Guillem at 2024-01-31T09:22:31+01:00
Remove TrackDescription in 3.0

- - - - -


1 changed file:

- vlcpp/structures.hpp


Changes:

=
vlcpp/structures.hpp
=
@@ -800,6 +800,7 @@ class AudioOutputDeviceDescription
 std::string m_description;
 };
 
+#if LIBVLC_VERSION_INT < LIBVLC_VERSION(4, 0, 0, 0)
 ///
 /// \brief The TrackDescription class describes a track
 ///
@@ -833,6 +834,7 @@ private:
 int m_id;
 std::string m_name;
 };
+#endif
 
 #if LIBVLC_VERSION_INT >= LIBVLC_VERSION(3, 0, 0, 0)
 ///



View it on GitLab: 
https://code.videolan.org/videolan/libvlcpp/-/commit/9bea609a4db3ad78a61d0b58b1f7b995de0f8187

-- 
View it on GitLab: 
https://code.videolan.org/videolan/libvlcpp/-/commit/9bea609a4db3ad78a61d0b58b1f7b995de0f8187
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] [Git][videolan/vlc][master] switch C++ support to C++17

2024-01-26 Thread Thomas Guillem (@tguillem)


Thomas Guillem pushed to branch master at VideoLAN / VLC


Commits:
5dcc5ff8 by Steve Lhomme at 2024-01-26T10:42:23+00:00
switch C++ support to C++17

As contribs keep being updated with newer versions of the language, we need to
support a more modern version of C++ going forward.

Setting -std=c++17 should not break existing contribs that are built with C++11 
or C++14.
In fact we already support the mix of versions between 11 and 14 without 
problem.
Modern C++ compilers are designed to take care of this [1].
When switching to a new C++ version there might however be some slight 
differences on how the
code is interpreted. These differences [2] might trigger some build errors for 
removed parts.

[1] 
https://stackoverflow.com/questions/46746878/is-it-safe-to-link-c17-c14-and-c11-objects
[2] https://www.open-std.org/JTC1/SC22/WG21/docs/papers/2018/p0636r3.html

- - - - -


6 changed files:

- configure.ac
- m4/Makefile.am
- + m4/ax_cxx_compile_stdcxx.m4
- + m4/ax_cxx_compile_stdcxx_17.m4
- − m4/stdcxx_14.m4
- meson.build


Changes:

=
configure.ac
=
@@ -73,7 +73,7 @@ AC_C_CONST
 AC_C_INLINE
 AC_C_RESTRICT
 AC_LANG_PUSH([C++])
-AX_CXX_COMPILE_STDCXX_14([noext], [mandatory])
+AX_CXX_COMPILE_STDCXX_17([noext], [mandatory])
 AX_CXX_TYPEOF
 AC_LANG_POP([C++])
 


=
m4/Makefile.am
=
@@ -14,7 +14,7 @@ EXTRA_DIST = \
nls.m4 \
po.m4 \
progtest.m4 \
-   stdcxx_14.m4 \
+   ax_cxx_compile_stdcxx.m4 \
+   ax_cxx_compile_stdcxx_17.m4 \
vlc.m4 \
$(NULL)
-


=
m4/ax_cxx_compile_stdcxx.m4
=
@@ -0,0 +1,1018 @@
+# ===
+#  https://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx.html
+# ===
+#
+# SYNOPSIS
+#
+#   AX_CXX_COMPILE_STDCXX(VERSION, [ext|noext], [mandatory|optional])
+#
+# DESCRIPTION
+#
+#   Check for baseline language coverage in the compiler for the specified
+#   version of the C++ standard.  If necessary, add switches to CXX and
+#   CXXCPP to enable support.  VERSION may be '11', '14', '17', or '20' for
+#   the respective C++ standard version.
+#
+#   The second argument, if specified, indicates whether you insist on an
+#   extended mode (e.g. -std=gnu++11) or a strict conformance mode (e.g.
+#   -std=c++11).  If neither is specified, you get whatever works, with
+#   preference for no added switch, and then for an extended mode.
+#
+#   The third argument, if specified 'mandatory' or if left unspecified,
+#   indicates that baseline support for the specified C++ standard is
+#   required and that the macro should error out if no mode with that
+#   support is found.  If specified 'optional', then configuration proceeds
+#   regardless, after defining HAVE_CXX${VERSION} if and only if a
+#   supporting mode is found.
+#
+# LICENSE
+#
+#   Copyright (c) 2008 Benjamin Kosnik 
+#   Copyright (c) 2012 Zack Weinberg 
+#   Copyright (c) 2013 Roy Stogner 
+#   Copyright (c) 2014, 2015 Google Inc.; contributed by Alexey Sokolov 

+#   Copyright (c) 2015 Paul Norman 
+#   Copyright (c) 2015 Moritz Klammler 
+#   Copyright (c) 2016, 2018 Krzesimir Nowak 
+#   Copyright (c) 2019 Enji Cooper 
+#   Copyright (c) 2020 Jason Merrill 
+#   Copyright (c) 2021 Jörn Heusipp 
+#
+#   Copying and distribution of this file, with or without modification, are
+#   permitted in any medium without royalty provided the copyright notice
+#   and this notice are preserved.  This file is offered as-is, without any
+#   warranty.
+
+#serial 18
+
+dnl  This macro is based on the code from the AX_CXX_COMPILE_STDCXX_11 macro
+dnl  (serial version number 13).
+
+AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl
+  m4_if([$1], [11], [ax_cxx_compile_alternatives="11 0x"],
+[$1], [14], [ax_cxx_compile_alternatives="14 1y"],
+[$1], [17], [ax_cxx_compile_alternatives="17 1z"],
+[$1], [20], [ax_cxx_compile_alternatives="20"],
+[m4_fatal([invalid first argument `$1' to AX_CXX_COMPILE_STDCXX])])dnl
+  m4_if([$2], [], [],
+[$2], [ext], [],
+[$2], [noext], [],
+[m4_fatal([invalid second argument `$2' to AX_CXX_COMPILE_STDCXX])])dnl
+  m4_if([$3], [], [ax_cxx_compile_cxx$1_required=true],
+[$3], [mandatory], [ax_cxx_compile_cxx$1_required=true],
+[$3], [optional], [ax_cxx_compile_cxx$1_required=false],
+[m4_fatal([invalid third argument `$3' to AX_CXX_COMPILE_STDCXX])])
+  AC_LANG_PUSH([C++])dnl
+  ac_success=no
+
+  m4_if([$2], [], [dnl
+AC_CACHE_CHECK(whether $CXX supports C++$1 features by default,
+  ax_cv_cxx_compile_cxx$1,
+  
[AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])],
+[ax_cv_cxx_compile_cxx$1=y

[vlc-commits] [Git][videolan/vlc][master] qt: fix video scaling with mutter wayland

2024-01-19 Thread Thomas Guillem (@tguillem)


Thomas Guillem pushed to branch master at VideoLAN / VLC


Commits:
c08d8d3f by Pierre Lamot at 2024-01-19T13:25:40+00:00
qt: fix video scaling with mutter wayland

partially reverts 32836475cbe594eb55d26ee38c5db220246c010f

- - - - -


4 changed files:

- modules/gui/qt/maininterface/compositor_wayland.cpp
- modules/gui/qt/maininterface/compositor_wayland_module.c
- modules/gui/qt/maininterface/compositor_wayland_module.h
- modules/gui/qt/maininterface/videosurface.cpp


Changes:

=
modules/gui/qt/maininterface/compositor_wayland.cpp
=
@@ -34,6 +34,15 @@
 
 namespace vlc {
 
+static qreal dprForWindow(QQuickWindow* window)
+{
+QPlatformWindow* nativeWindow = window->handle();
+if (!nativeWindow)
+return 1.0;
+
+return nativeWindow->devicePixelRatio();
+}
+
 CompositorWayland::CompositorWayland(qt_intf_t *p_intf, QObject* parent)
 : CompositorVideo(p_intf, parent)
 {
@@ -108,7 +117,7 @@ bool CompositorWayland::makeMainInterface(MainCtx* mainCtx)
 if (!interfaceSurface)
 return false;
 
-m_waylandImpl->setupInterface(m_waylandImpl, interfaceSurface);
+m_waylandImpl->setupInterface(m_waylandImpl, interfaceSurface, 
dprForWindow(m_qmlView.get()));
 
 return commonGUICreate(m_qmlView.get(), m_qmlView.get(),
 CompositorVideo::CAN_SHOW_PIP);
@@ -175,33 +184,27 @@ void CompositorWayland::windowDisable()
 commonWindowDisable();
 }
 
-static qreal dprForWindow(QQuickWindow* window)
-{
-qreal dpr = window->devicePixelRatio();
-
-QPlatformWindow* nativeWindow = window->handle();
-if (nativeWindow)
-dpr /= nativeWindow->devicePixelRatio();
-
-return dpr;
-}
-
 void CompositorWayland::onSurfacePositionChanged(const QPointF& position)
 {
 QMargins margins = m_qmlView->frameMargins();
 
-qreal dpr = dprForWindow(m_qmlView.get());
+qreal qtDpr = m_qmlView.get()->effectiveDevicePixelRatio();
+qreal nativeDpr = dprForWindow(m_qmlView.get());
 
-m_waylandImpl->move(m_waylandImpl,
-margins.left() * dpr + position.x(),
-margins.top() * dpr + position.y());
+m_waylandImpl->move(
+m_waylandImpl,
+(margins.left() * qtDpr + position.x() ) / nativeDpr,
+(margins.top()  * qtDpr + position.y() ) / nativeDpr
+);
 }
 
 void CompositorWayland::onSurfaceSizeChanged(const QSizeF& size)
 {
+qreal nativeDpr = dprForWindow(m_qmlView.get());
+
 m_waylandImpl->resize(m_waylandImpl,
-size.width(),
-size.height());
+size.width() / nativeDpr,
+size.height() / nativeDpr);
 }
 
 }


=
modules/gui/qt/maininterface/compositor_wayland_module.c
=
@@ -38,6 +38,8 @@ typedef struct
 
 struct wl_surface* video_surface;
 struct wl_subsurface* video_subsurface;
+
+int buffer_scale;
 } qtwayland_priv_t;
 
 static void registry_global_cb(void* data, struct wl_registry* registry,
@@ -66,7 +68,7 @@ static const struct wl_registry_listener registry_cbs = {
 registry_global_remove_cb,
 };
 
-static int SetupInterface(qtwayland_t* obj, void* qpni_interface_surface)
+static int SetupInterface(qtwayland_t* obj, void* qpni_interface_surface, int 
scale)
 {
 qtwayland_priv_t* sys = (qtwayland_priv_t*)obj->p_sys;
 
@@ -74,6 +76,7 @@ static int SetupInterface(qtwayland_t* obj, void* 
qpni_interface_surface)
 return VLC_EGENERIC;
 
 sys->interface_surface = (struct wl_surface*)qpni_interface_surface;
+sys->buffer_scale = scale;
 
 return VLC_SUCCESS;
 }
@@ -87,6 +90,8 @@ static int SetupVoutWindow(qtwayland_t* obj, vlc_window_t* 
wnd)
 if (!sys->video_surface)
 return VLC_EGENERIC;
 
+wl_surface_set_buffer_scale(sys->video_surface, sys->buffer_scale);
+
 struct wl_region* region = wl_compositor_create_region(sys->compositor);
 if (!region)
 {


=
modules/gui/qt/maininterface/compositor_wayland_module.h
=
@@ -30,7 +30,7 @@ typedef struct qtwayland_t
 
 bool (*init)(struct qtwayland_t*, void* display);
 
-int (*setupInterface)(struct qtwayland_t*, void* video_surface );
+int (*setupInterface)(struct qtwayland_t*, void* video_surface, int scale);
 
 int (*setupVoutWindow)(struct qtwayland_t*, vlc_window_t* p_wnd);
 void (*teardownVoutWindow)(struct qtwayland_t*);


=
modules/gui/qt/maininterface/videosurface.cpp
=
@@ -381,15 +381,7 @@ static qreal dprForWindow(QQuickWindow* quickWindow)
 if (!window)
 window = quickWindow;
 
-qreal dpr = window->devicePixelRatio();
-
-#ifdef QT5_DECLARATIVE_PRIVATE
-QPlatformWindow* nativeWindow = window->handle();
-if (nativeWindow)
-dpr /= nativeWindow->devicePixelRatio();
-

[vlc-commits] [Git][videolan/vlc][master] 5 commits: qml: fix video surface scaling

2024-01-17 Thread Thomas Guillem (@tguillem)


Thomas Guillem pushed to branch master at VideoLAN / VLC


Commits:
32836475 by Pierre Lamot at 2024-01-17T13:34:48+00:00
qml: fix video surface scaling

QWindow::devicePixelRatio mixes QPlateformWindow::devicePixelRatio (scale factor
from the plateform) and QHighDpiScaling::factor (QT_SCALE_FACTOR,
QT_SCREEN_SCALE_FACTORS). Platform such as wayland may have a >1 scale 
factor,
surface are directly scaled by the compositor, so we shouln't re-apply this
scale factor

- - - - -
8d9907bd by Pierre Lamot at 2024-01-17T13:34:48+00:00
qt: fix CompositorVideo interface release order

m_videoWindowHandler references the window, so it needs to be released before 
the
window is destroyed

- - - - -
a290285a by Pierre Lamot at 2024-01-17T13:34:48+00:00
qt: don't include native interface headers using QPNI_HEADER macro

we have already fixed the private headers includes for QtQuick, this patch uses
the same mechanism

- - - - -
9dc025d0 by Pierre Lamot at 2024-01-17T13:34:48+00:00
qt: add wayland support

fixes #22156

- - - - -
3c622d4c by Pierre Lamot at 2024-01-17T13:34:48+00:00
qt: reorder compositor definitions in Makefile.am

no functionnal changes

- - - - -


16 changed files:

- configure.ac
- modules/gui/qt/Makefile.am
- modules/gui/qt/maininterface/compositor.cpp
- modules/gui/qt/maininterface/compositor.hpp
- modules/gui/qt/maininterface/compositor_dcomp.cpp
- modules/gui/qt/maininterface/compositor_dcomp_uisurface.cpp
- + modules/gui/qt/maininterface/compositor_wayland.cpp
- + modules/gui/qt/maininterface/compositor_wayland.hpp
- + modules/gui/qt/maininterface/compositor_wayland_module.c
- + modules/gui/qt/maininterface/compositor_wayland_module.h
- modules/gui/qt/maininterface/interface_window_handler.hpp
- modules/gui/qt/maininterface/mainctx_win32.cpp
- modules/gui/qt/maininterface/video_window_handler.hpp
- modules/gui/qt/maininterface/videosurface.cpp
- modules/gui/qt/maininterface/videosurface.hpp
- modules/gui/qt/qt.cpp


Changes:

=
configure.ac
=
@@ -3970,6 +3970,8 @@ AC_ARG_ENABLE([qt],
 have_qt5_x11="no"
 have_qt5_gtk="no"
 have_qt5_quick_test="no"
+have_qt5_declarative_private="no"
+have_qt5_gui_private="no"
 AS_IF([test "${enable_qt}" != "no"], [
   PKG_CHECK_MODULES([QT], [Qt5Core >= 5.12.0 Qt5Widgets Qt5Gui Qt5Quick 
Qt5QuickWidgets Qt5QuickControls2 Qt5Svg], [
   PKG_CHECK_MODULES([QT5_X11], [Qt5X11Extras], [
@@ -4037,7 +4039,9 @@ AS_IF([test "${enable_qt}" != "no"], [
 
   AC_LANG_PUSH([C++])
   AC_CHECK_HEADERS([private/qquickitem_p.h private/qquickwindow_p.h],
- [have_declarative_private="yes"], [])
+ [have_qt5_declarative_private="yes"], [])
+  AC_CHECK_HEADERS([QtGui/qpa/qplatformnativeinterface.h],
+ [have_qt5_gui_private="yes"], [])
   AC_LANG_POP([C++])
   VLC_RESTORE_FLAGS
 
@@ -4110,7 +4114,8 @@ AM_CONDITIONAL([ENABLE_QT], [test "$enable_qt" != "no"])
 AM_CONDITIONAL([HAVE_QT5_X11], [test "${have_qt5_x11}" = "yes"])
 AM_CONDITIONAL([HAVE_QT5_WAYLAND], [test "${have_qt5_wayland}" = "yes"])
 AM_CONDITIONAL([HAVE_QT5_GTK], [test "${have_qt5_gtk}" = "yes"])
-AM_CONDITIONAL([HAVE_QT5_DECLARATIVE_PRIVATE], [test 
"${have_declarative_private}" = "yes"])
+AM_CONDITIONAL([HAVE_QT5_DECLARATIVE_PRIVATE], [test 
"${have_qt5_declarative_private}" = "yes"])
+AM_CONDITIONAL([HAVE_QT5_GUI_PRIVATE], [test "${have_qt5_gui_private}" = 
"yes"])
 AM_CONDITIONAL([HAVE_QT5_QUICK_TEST], [test "${have_qt5_quick_test}" = "yes"])
 
 dnl


=
modules/gui/qt/Makefile.am
=
@@ -51,29 +51,15 @@ if HAVE_XCB
 libqt_plugin_la_CXXFLAGS += $(XCB_CFLAGS)  -DQT5_HAS_X11
 libqt_plugin_la_LIBADD += $(XCB_LIBS) $(X_LIBS) $(X_PRE_LIB) -lX11
 vlc_qt_check_CXXFLAGS += $(XCB_CFLAGS) -DQT5_HAS_X11
-
-if HAVE_QT5_X11
-if HAVE_XCB_DAMAGE
-if HAVE_XCB_XFIXES
-libqt_plugin_la_CXXFLAGS += -DQT5_HAS_X11_COMPOSITOR \
-   $(QT5_X11_CFLAGS) $(XCB_RENDER_CFLAGS) $(XCB_COMPOSITE_CFLAGS) 
$(XLCB_DAMAGE_CFLAGS) $(XCB_XFIXES_CFLAGS)
-libqt_plugin_la_LIBADD += $(QT5_X11_LIBS) $(XCB_RENDER_LIBS) 
$(XCB_COMPOSITE_LIBS) $(XCB_DAMAGE_LIBS) $(XCB_XFIXES_LIBS)
-endif
-endif
-endif
 endif
 
-if HAVE_WAYLAND
-libqt_plugin_la_CPPFLAGS += -DQT5_HAS_WAYLAND
-libqt_plugin_la_CXXFLAGS += $(WAYLAND_CLIENT_CFLAGS)
-libqt_plugin_la_LIBADD += $(WAYLAND_CLIENT_LIBS)
-endif
 if HAVE_QT5_WAYLAND
 libqt_plugin_la_CPPFLAGS += $(QT5_WAYLAND_CFLAGS)
 libqt_plugin_la_LIBADD += $(QT5_WAYLAND_LIBS)
 vlc_qt_check_CPPFLAGS += $(QT5_WAYLAND_CFLAGS) -DQT5_HAS_WAYLAND
 vlc_qt_check_LDADD += $(QT5_WAYLAND_LIBS)
 endif
+
 if HAVE_WIN32
 libqt_plugin_la_CXXFLAGS += $(LIBCOMCXXFLAGS)
 libqt_plugin_la_LIBADD += $(LIBCOM) -lcomctl32 -luuid -ld3d11 -ldwmapi
@@ -87,6 +73,15 @@ endif
 if HAVE_QT5_GTK
 libqt_plugin_la_CPPFLAGS += -DQT5_HAS_GTK
 endif
+
+if HAVE_QT5_GUI_PRIVATE
+libqt_plugin_la_CPPFLAGS += -DQT5_GUI_PRIVATE \
+   -I$(QT_INCLUDE_DIRECTORY)/QtCore/$(QT_VERSION) \
+  

[vlc-commits] [Git][videolan/vlc][master] 11 commits: preparser: set the preparsed state only if actually done

2023-12-22 Thread Thomas Guillem (@tguillem)


Thomas Guillem pushed to branch master at VideoLAN / VLC


Commits:
d275d1e7 by Thomas Guillem at 2023-12-22T15:55:41+00:00
preparser: set the preparsed state only if actually done

This fixes item with 0 meta, if the preparser failed (or was skipped).

This let a second chance for the player to fetch meta and attachments.

This was happening with every mock media that are skipped by the
preparser.

- - - - -
77390aac by Thomas Guillem at 2023-12-22T15:55:41+00:00
input: add INPUT_EVENT_ATTACHMENTS

Send attachments via the input_thread_t.
The possibility to send attachments via the input_item_t will be removed
soon.

- - - - -
f53180cf by Thomas Guillem at 2023-12-22T15:55:41+00:00
input: add on_attachments_added event to the parser

- - - - -
8499dd99 by Thomas Guillem at 2023-12-22T15:55:41+00:00
preparser: add on_attachments_added

- - - - -
32a94365 by Thomas Guillem at 2023-12-22T15:55:41+00:00
medialibrary: use on_attachments_added

- - - - -
dd7cdf2d by Thomas Guillem at 2023-12-22T15:55:41+00:00
lib: picture: add const

- - - - -
23a5842c by Thomas Guillem at 2023-12-22T15:55:41+00:00
lib: media: use on_attachments_added

- - - - -
a6f45882 by Thomas Guillem at 2023-12-22T15:55:41+00:00
player: add on_media_attachments_added event

- - - - -
48ed9b94 by Thomas Guillem at 2023-12-22T15:55:41+00:00
mock: add attachments support

- - - - -
182c1b63 by Thomas Guillem at 2023-12-22T15:55:41+00:00
mock: add some meta

- - - - -
08e5bcf3 by Thomas Guillem at 2023-12-22T15:55:41+00:00
test: player: test on_media_attachments_added

- - - - -


17 changed files:

- include/vlc_input_item.h
- include/vlc_player.h
- lib/media.c
- lib/picture.c
- lib/picture_internal.h
- modules/demux/mock.c
- modules/gui/qt/dialogs/dialogs_provider.cpp
- modules/gui/qt/player/player_controller.cpp
- modules/misc/medialibrary/MetadataExtractor.cpp
- modules/misc/medialibrary/fs/directory.cpp
- modules/misc/medialibrary/medialibrary.h
- src/input/input.c
- src/input/input_internal.h
- src/input/item.c
- src/player/input.c
- src/preparser/preparser.c
- test/src/player/player.c


Changes:

=
include/vlc_input_item.h
=
@@ -444,6 +444,23 @@ typedef struct input_item_parser_cbs_t
  * @param userdata user data set by input_item_Parse()
  */
 void (*on_subtree_added)(input_item_t *item, input_item_node_t *subtree, 
void *userdata);
+
+/**
+ * Event received when new attachments are added
+ *
+ * @note This callback is optional. It can be called several times for one
+ * parse request. The array contains only new elements after a second call.
+ *
+ * @param item the parsed item
+ * @param array valid array containing new elements, should only be used
+ * within the callback. One and all elements can be held and stored on a
+ * new variable or new array.
+ * @param count number of elements in the array
+ * @param userdata user data set by input_item_Parse()
+ */
+void (*on_attachments_added)(input_item_t *item,
+ input_attachment_t *const *array,
+ size_t count, void *userdata);
 } input_item_parser_cbs_t;
 
 /**
@@ -513,6 +530,9 @@ struct vlc_metadata_cbs {
 void (*on_preparse_ended)(input_item_t *, enum input_item_preparse_status 
status, void *userdata);
 void (*on_art_fetch_ended)(input_item_t *, bool fetched, void *userdata);
 void (*on_subtree_added)(input_item_t *, input_item_node_t *subtree, void 
*userdata);
+void (*on_attachments_added)(input_item_t *item,
+ input_attachment_t *const *array,
+ size_t count, void *userdata);
 };
 
 VLC_API int libvlc_MetadataRequest( libvlc_int_t *, input_item_t *,


=
include/vlc_player.h
=
@@ -3186,6 +3186,24 @@ struct vlc_player_cbs
 void (*on_media_subitems_changed)(vlc_player_t *player,
 input_item_t *media, input_item_node_t *new_subitems, void *data);
 
+/**
+ * Called when new attachments are added to the media
+ *
+ * @note It can be called several times for one parse request. The array
+ * contains only new elements after a second call.
+ *
+ * @param player locked player instance
+ * @param media current media
+ * @param array valid array containing new elements, should only be used
+ * within the callback. One and all elements can be held and stored on a
+ * new variable or new array.
+ * @param count number of elements in the array
+ * @param data opaque pointer set by vlc_player_AddListener()
+ */
+void (*on_media_attachments_added)(vlc_player_t *player,
+input_item_t *media, input_attachment_t *const *array, size_t count,
+void *data);
+
 /**
  * Called when a vout is started or stopped
  *


=

[vlc-commits] [Git][videolan/vlc][master] 3 commits: libvlc.h: ensure the header is correctly exposed to C++

2023-12-22 Thread Thomas Guillem (@tguillem)


Thomas Guillem pushed to branch master at VideoLAN / VLC


Commits:
1701e2da by Alexandre Janniaux at 2023-12-22T13:00:09+00:00
libvlc.h: ensure the header is correctly exposed to C++

The header is not public but can be used by tests in C++.

- - - - -
6cfbabfc by Alexandre Janniaux at 2023-12-22T13:00:09+00:00
vlc_objects: expose wrappers around vlc_object_create/delete

Using placement new and manual call to the destructor. It ensures that
C++ objects are correctly handled when creating C++ objects through
vlc_object_create<>(), and that their destructors are correctly called
when the (C++) object is destroyed.

According to the C++ draft standard, the vlc_object_t won't get
overwritten by the placement new since (7.1) will apply to the C++
object being allocated and placement-new'ed, which triggers the default
initialization of members, and the default initialization of the
vlc_object_t member enters the (7.3) case since no constructors exists
for the structure. (It's an extern "C" structure).

To default-initialize an object of type T means:
(7.1)
If T is a (possibly cv-qualified) class type ([class]), constructors are 
considered.
The applicable constructors are enumerated ([over.match.ctor]), and the 
best one for the initializer () is chosen through overload resolution 
([over.match]).
The constructor thus selected is called, with an empty argument list, to 
initialize the object.
(7.2)
If T is an array type, each element is default-initialized.
(7.3)
Otherwise, no initialization is performed.
--: https://eel.is/c++draft/dcl.init#general-7

However, it's not possible to use a zero-initializing placement-new
operation.

- - - - -
dbe399b5 by Alexandre Janniaux at 2023-12-22T13:00:09+00:00
objects: add test for C++ wrappers

The test is exposing a stub var_DestroyAll() because object.c is
link-dependant to this symbol, but no variable is created anyway.

It's also checking that the vlc_object_t member doesn't get overwritten.

- - - - -


4 changed files:

- include/vlc_objects.h
- src/Makefile.am
- src/libvlc.h
- + src/misc/objects_cxx_test.cpp


Changes:

=
include/vlc_objects.h
=
@@ -24,6 +24,7 @@
 #define VLC_OBJECTS_H 1
 
 #ifdef __cplusplus
+#include 
 extern "C" {
 #endif
 
@@ -314,8 +315,22 @@ template VLC_MALLOC VLC_USED
 static inline T* vlc_object_create(O *obj)
 {
 static_assert(std::is_pointer::value == false, "vlc_object_create can 
only create objects");
-return static_cast(vlc_object_create(VLC_OBJECT(obj), sizeof(T)));
+void *object = vlc_object_create(VLC_OBJECT(obj), sizeof(T));
+if (object == nullptr)
+return nullptr;
+
+return new(object) T;
 }
+
+#undef vlc_object_delete
+template
+static inline void vlc_object_delete(O *obj)
+{
+if (!std::is_trivially_destructible::value)
+obj->~O();
+vlc_object_delete(VLC_OBJECT(obj));
+}
+
 #endif
 
 /** @} */


=
src/Makefile.am
=
@@ -612,6 +612,7 @@ check_PROGRAMS = \
test_jaro_winkler \
test_list \
test_md5 \
+   test_objects_cxx \
test_picture_pool \
test_sort \
test_timer \
@@ -642,6 +643,7 @@ test_interrupt_LDADD = $(LDADD) $(LIBS_libvlccore)
 test_jaro_winkler_SOURCES = test/jaro_winkler.c config/jaro_winkler.c
 test_list_SOURCES = test/list.c
 test_md5_SOURCES = test/md5.c
+test_objects_cxx_SOURCES = misc/objects_cxx_test.cpp misc/objects.c
 test_picture_pool_SOURCES = test/picture_pool.c
 test_sort_SOURCES = test/sort.c
 test_timer_SOURCES = test/timer.c


=
src/libvlc.h
=
@@ -26,6 +26,10 @@
 
 #include 
 
+# ifdef __cplusplus
+extern "C" {
+# endif
+
 extern const char psz_vlc_changeset[];
 
 typedef struct variable_t variable_t;
@@ -210,4 +214,8 @@ int vlc_MetadataRequest(libvlc_int_t *libvlc, input_item_t 
*item,
  */
 void var_OptionParse (vlc_object_t *, const char *, bool trusted);
 
+# ifdef __cplusplus
+} // extern "C"
+# endif
+
 #endif


=
src/misc/objects_cxx_test.cpp
=
@@ -0,0 +1,77 @@
+/*
+ * objects_cxx_test.cpp: vlc_object_t helper tests
+ *
+ * Copyright (C) 2023 Videlabs
+ *
+ * Authors: Alexandre Janniaux 
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 PARTIC

[vlc-commits] [Git][videolan/vlc][master] 3 commits: vout: display: fix inverted logic

2023-12-22 Thread Thomas Guillem (@tguillem)


Thomas Guillem pushed to branch master at VideoLAN / VLC


Commits:
3f51e549 by Alaric Senat at 2023-12-22T12:30:45+00:00
vout: display: fix inverted logic

Those mouse coordinates translation were inverted probably due to a bad
copy/paste.
This was found by testing video filters with horizontal captured videos.
(ORIENT_RIGHT_TOP in this case).

- - - - -
384a410a by Alaric Senat at 2023-12-22T12:30:45+00:00
vout: display: split `PlacePicture` internals

Extract video format rotation from the function. This will be useful in
the next commit to avoid rotating the format twice in the translate
function.

- - - - -
ca32e6b9 by Alaric Senat at 2023-12-22T12:30:45+00:00
vout: display: fix coord translation for rotated format

The placed picture might have its width and height swapped due to
rotation. This needs to be taken into account in the translation.
This patch applies the format rotation early so the correct width and
height can be used in the translate code.

- - - - -


1 changed file:

- src/video_output/display.c


Changes:

=
src/video_output/display.c
=
@@ -78,23 +78,17 @@ void vout_display_GetDefaultDisplaySize(unsigned *width, 
unsigned *height,
 }
 }
 
-/* */
-void vout_display_PlacePicture(vout_display_place_t *restrict place,
-   const video_format_t *restrict source,
-   const struct vout_display_placement *restrict 
dp)
+static void vout_display_PlaceRotatedPicture(vout_display_place_t *restrict 
place,
+ const video_format_t *restrict 
source,
+ const struct 
vout_display_placement *restrict dp)
 {
 memset(place, 0, sizeof(*place));
 if (dp->width == 0 || dp->height == 0)
 return;
 
-/* */
 unsigned display_width;
 unsigned display_height;
 
-video_format_t source_rot;
-video_format_ApplyRotation(&source_rot, source);
-source = &source_rot;
-
 if (dp->fitting != VLC_VIDEO_FIT_NONE) {
 display_width  = dp->width;
 display_height = dp->height;
@@ -167,6 +161,17 @@ void vout_display_PlacePicture(vout_display_place_t 
*restrict place,
 place->y = ((int)dp->height - (int)place->height) / 2;
 break;
 }
+
+}
+
+/* */
+void vout_display_PlacePicture(vout_display_place_t *restrict place,
+   const video_format_t *restrict source,
+   const struct vout_display_placement *restrict 
dp)
+{
+video_format_t source_rot;
+video_format_ApplyRotation(&source_rot, source);
+vout_display_PlaceRotatedPicture(place, &source_rot, dp);
 }
 
 /** Translates window coordinates to video coordinates */
@@ -174,9 +179,11 @@ void vout_display_TranslateCoordinates(int *restrict xp, 
int *restrict yp,
const video_format_t *restrict source,
const struct vout_display_placement 
*restrict dp)
 {
-vout_display_place_t place;
+video_format_t source_rot;
+video_format_ApplyRotation(&source_rot, source);
 
-vout_display_PlacePicture(&place, source, dp);
+vout_display_place_t place;
+vout_display_PlaceRotatedPicture(&place, &source_rot, dp);
 
 if (place.width <= 0 || place.height <= 0)
 return;
@@ -206,13 +213,13 @@ void vout_display_TranslateCoordinates(int *restrict xp, 
int *restrict yp,
 y = wx;
 break;
 case ORIENT_LEFT_BOTTOM:
-x = wy;
-y = place.width - wx;
-break;
-case ORIENT_RIGHT_TOP:
 x = place.height - wy;
 y = wx;
 break;
+case ORIENT_RIGHT_TOP:
+x = wy;
+y = place.width - wx;
+break;
 case ORIENT_RIGHT_BOTTOM:
 x = place.height - wy;
 y = place.width - wx;
@@ -221,10 +228,10 @@ void vout_display_TranslateCoordinates(int *restrict xp, 
int *restrict yp,
 vlc_assert_unreachable();
 }
 
-x = source->i_x_offset
-+ (int64_t)(x - place.x) * source->i_visible_width / place.width;
-y = source->i_y_offset
-+ (int64_t)(y - place.y) * source->i_visible_height / place.height;
+x = source_rot.i_x_offset
++ (int64_t)(x - place.x) * source_rot.i_visible_width / place.width;
+y = source_rot.i_y_offset
++ (int64_t)(y - place.y) * source_rot.i_visible_height / place.height;
 *xp = x;
 *yp = y;
 }



View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/compare/46a99f0b73dac93896ed02b05aee2cb879bd2b37...ca32e6b95fa6dfb2e2cc8b2b946d87df168dffa3

-- 
View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/compare/46a99f0b73dac93896ed02b05aee2cb879bd2b37...ca32e6b95fa6dfb2e2cc8b2b946d87df168dffa3
You're receiving this email because of your account on code.videolan.org.


VideoLAN code reposito

[vlc-commits] [Git][videolan/vlc][master] 3 commits: macosx: Do not double-instantiate VLCMainVideoViewController when creating video windows

2023-12-22 Thread Thomas Guillem (@tguillem)


Thomas Guillem pushed to branch master at VideoLAN / VLC


Commits:
a31afa22 by Claudio Cambra at 2023-12-22T12:04:59+00:00
macosx: Do not double-instantiate VLCMainVideoViewController when creating 
video windows

Signed-off-by: Claudio Cambra 

- - - - -
3d1dd29a by Claudio Cambra at 2023-12-22T12:04:59+00:00
macosx: Add convenience update method to VLCControlsBarCommon

Signed-off-by: Claudio Cambra 

- - - - -
46a99f0b by Claudio Cambra at 2023-12-22T12:04:59+00:00
macosx: Ensure control bar gets updated on instantiation within 
VLCMainVideoViewController

Signed-off-by: Claudio Cambra 

- - - - -


4 changed files:

- modules/gui/macosx/windows/mainwindow/VLCControlsBarCommon.h
- modules/gui/macosx/windows/mainwindow/VLCControlsBarCommon.m
- modules/gui/macosx/windows/video/VLCMainVideoViewController.m
- modules/gui/macosx/windows/video/VLCVideoOutputProvider.m


Changes:

=
modules/gui/macosx/windows/mainwindow/VLCControlsBarCommon.h
=
@@ -73,6 +73,7 @@
 - (IBAction)volumeAction:(id)sender;
 - (IBAction)fullscreen:(id)sender;
 
+- (void)update;
 - (void)updateMuteVolumeButtonImage;
 
 - (void)updateTimeSlider:(NSNotification *)aNotification;


=
modules/gui/macosx/windows/mainwindow/VLCControlsBarCommon.m
=
@@ -324,6 +324,15 @@
 #pragma mark -
 #pragma mark Updaters
 
+- (void)update 
+{
+[self updateTimeSlider:nil];
+[self updateVolumeSlider:nil];
+[self updateMuteVolumeButtonImage];
+[self updatePlaybackControls:nil];
+[self updateCurrentItemDisplayControls:nil];
+}
+
 - (void)updateTimeSlider:(NSNotification *)aNotification;
 {
 VLCInputItem *inputItem = _playerController.currentMedia;


=
modules/gui/macosx/windows/video/VLCMainVideoViewController.m
=
@@ -145,6 +145,7 @@
 _playlistButtonBottomConstraint.active = NO;
 
 [self setupAudioDecorativeView];
+[self.controlsBar update];
 }
 
 - (void)playerCurrentMediaItemChanged:(NSNotification *)notification


=
modules/gui/macosx/windows/video/VLCVideoOutputProvider.m
=
@@ -245,7 +245,6 @@ int WindowOpen(vlc_window_t *p_wnd)
 newVideoWindow.acceptsMouseMovedEvents = !asVideoWallpaper;
 newVideoWindow.movableByWindowBackground = !asVideoWallpaper;
 
-newVideoWindow.videoViewController = [[VLCMainVideoViewController alloc] 
init];
 newVideoWindow.videoViewController.displayLibraryControls = NO;
 newVideoWindow.videoViewController.view.autoresizingMask = 
NSViewWidthSizable | NSViewHeightSizable;
 newVideoWindow.videoViewController.view.frame = 
newVideoWindow.contentView.frame;
@@ -300,7 +299,6 @@ int WindowOpen(vlc_window_t *p_wnd)
 newVideoWindow.minSize = NSMakeSize(VLCVideoWindowCommonMinimalHeight, 
VLCVideoWindowCommonMinimalHeight);
 newVideoWindow.titlebarAppearsTransparent = YES;
 
-newVideoWindow.videoViewController = [[VLCMainVideoViewController alloc] 
init];
 newVideoWindow.videoViewController.displayLibraryControls = NO;
 newVideoWindow.videoViewController.view.autoresizingMask = 
NSViewWidthSizable | NSViewHeightSizable;
 newVideoWindow.videoViewController.view.frame = 
newVideoWindow.contentView.frame;



View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/compare/88e6f2580a35433a84fff59f8d77e8764ba37968...46a99f0b73dac93896ed02b05aee2cb879bd2b37

-- 
View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/compare/88e6f2580a35433a84fff59f8d77e8764ba37968...46a99f0b73dac93896ed02b05aee2cb879bd2b37
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] [Git][videolan/vlc][master] qt: fix moc include paths

2023-12-22 Thread Thomas Guillem (@tguillem)


Thomas Guillem pushed to branch master at VideoLAN / VLC


Commits:
f9f1aa1b by Pierre Lamot at 2023-12-22T09:07:59+00:00
qt: fix moc include paths

moc needs to be able to include headers for dependencies, and missing includes
silently fails

include path change was forgotten in ddfc6d0de8ae0f450895ec5cee6626e4efacb422

fixes #28460

- - - - -


1 changed file:

- modules/gui/qt/Makefile.am


Changes:

=
modules/gui/qt/Makefile.am
=
@@ -27,7 +27,7 @@ vlc_qt_check_LDADD = $(vlc_qt_libs)
 
 libqt_plugin_la_CPPFLAGS = $(AM_CPPFLAGS) \
-DQT_STRICT_ITERATORS \
-   -I$(srcdir)/gui/qt -I$(builddir)/ \
+   -I$(srcdir) -I$(builddir) \
-I$(builddir)/dialogs/extended \
-I$(builddir)/dialogs/fingerprint \
-I$(builddir)/dialogs/firstrun \



View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/commit/f9f1aa1b39dafe5693dbba8ba119a523804c148d

-- 
View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/commit/f9f1aa1b39dafe5693dbba8ba119a523804c148d
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] [Git][videolan/vlc][master] qml: delay visibility of no content info in playlist

2023-12-22 Thread Thomas Guillem (@tguillem)


Thomas Guillem pushed to branch master at VideoLAN / VLC


Commits:
ba8542db by Fatih Uzunoglu at 2023-12-22T08:33:36+00:00
qml: delay visibility of no content info in playlist

- - - - -


1 changed file:

- modules/gui/qt/playlist/qml/PlaylistListView.qml


Changes:

=
modules/gui/qt/playlist/qml/PlaylistListView.qml
=
@@ -467,11 +467,16 @@ T.Pane {
 
 anchors.centerIn: parent
 
-visible: (model.count === 0 && 
!listView.footerItem.firstItemIndicatorVisible)
+visible: false
 enabled: visible
 
 opacity: (listView.activeFocus) ? 1.0 : 0.4
 
+BindingCompat on visible {
+delayed: true
+value: (listView.model.count === 0 && 
!listView.footerItem.firstItemIndicatorVisible)
+}
+
 Widgets.IconLabel {
 id: label
 



View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/commit/ba8542db998096c81ef11d092b8cda7e66c4e1bb

-- 
View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/commit/ba8542db998096c81ef11d092b8cda7e66c4e1bb
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] [Git][videolan/vlc][master] qt: compositor_common: use unique_ptr

2023-12-22 Thread Thomas Guillem (@tguillem)


Thomas Guillem pushed to branch master at VideoLAN / VLC


Commits:
806ecd96 by Alexandre Janniaux at 2023-12-22T08:04:48+00:00
qt: compositor_common: use unique_ptr

Indirect leak of 8 byte(s) in 1 object(s) allocated from:
#0 0x7fe5ed0e2002 in operator new(unsigned long) 
/usr/src/debug/gcc/gcc/libsanitizer/asan/asan_new_delete.cpp:95
#1 0x7fe5d827e2f0 in vlc::DummyRenderWindow::init() 
../../modules/gui/qt/maininterface/compositor_common.cpp:85
#2 0x7fe5d827ece3 in vlc::DummyRenderWindow::render() 
../../modules/gui/qt/maininterface/compositor_common.cpp:91
#3 0x7fe5d8281930 in vlc::DummyRenderWindow::event(QEvent*) 
../../modules/gui/qt/maininterface/compositor_common.cpp:58
#4 0x7fe5d33788fe in QApplicationPrivate::notify_helper(QObject*, 
QEvent*) (/usr/lib/libQt5Widgets.so.5+0x1788fe) (BuildId: 
52d5f70b4f7ad263a7bd749141af6d1968d1f4aa)

- - - - -


2 changed files:

- modules/gui/qt/maininterface/compositor_common.cpp
- modules/gui/qt/maininterface/compositor_common.hpp


Changes:

=
modules/gui/qt/maininterface/compositor_common.cpp
=
@@ -30,6 +30,8 @@
 
 using namespace vlc;
 
+DummyRenderWindow::~DummyRenderWindow() = default;
+
 DummyRenderWindow::DummyRenderWindow(QWindow* parent)
 : QWindow(parent)
 {
@@ -82,7 +84,7 @@ void DummyRenderWindow::init()
 if (m_initialized)
 return;
 m_initialized = true;
-m_backingStore = new QBackingStore(this);
+m_backingStore = std::make_unique(this);
 }
 
 void DummyRenderWindow::render()


=
modules/gui/qt/maininterface/compositor_common.hpp
=
@@ -22,6 +22,8 @@
 #include 
 #include 
 
+#include 
+
 namespace vlc {
 
 /**
@@ -34,6 +36,8 @@ class DummyRenderWindow : public QWindow
 {
 Q_OBJECT
 public:
+~DummyRenderWindow();
+
 explicit DummyRenderWindow(QWindow* parent = nullptr);
 
 virtual QAccessibleInterface *accessibleRoot() const override;
@@ -47,7 +51,7 @@ private:
 void init();
 void render();
 
-QBackingStore* m_backingStore = nullptr;
+std::unique_ptr m_backingStore;
 bool m_initialized = false;
 };
 



View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/commit/806ecd968c0350c63fd0a0813851fa0de5084cca

-- 
View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/commit/806ecd968c0350c63fd0a0813851fa0de5084cca
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] [Git][videolan/vlc][master] 3 commits: qml: fix broken anchor in IconToolButton

2023-12-22 Thread Thomas Guillem (@tguillem)


Thomas Guillem pushed to branch master at VideoLAN / VLC


Commits:
b05c04a8 by Fatih Uzunoglu at 2023-12-22T06:04:23+00:00
qml: fix broken anchor in IconToolButton

- - - - -
67a816e4 by Fatih Uzunoglu at 2023-12-22T06:04:23+00:00
qml: fix broken code in PlaybackSpeedButton

- - - - -
ab4b8dcc by Fatih Uzunoglu at 2023-12-22T06:04:23+00:00
qml: add wheel and right-click functionality to PlaybackSpeedButton

- - - - -


3 changed files:

- modules/gui/qt/player/qml/PlaybackSpeed.qml
- modules/gui/qt/player/qml/controlbarcontrols/PlaybackSpeedButton.qml
- modules/gui/qt/widgets/qml/IconToolButton.qml


Changes:

=
modules/gui/qt/player/qml/PlaybackSpeed.qml
=
@@ -29,6 +29,8 @@ import "qrc:///util/Helpers.js" as Helpers
 ColumnLayout {
 id: root
 
+property alias slider: slider
+
 // Private
 
 property var _model: [{ "value": 0.25 },


=
modules/gui/qt/player/qml/controlbarcontrols/PlaybackSpeedButton.qml
=
@@ -41,10 +41,9 @@ PopupIconToolButton {
 Navigation.rightItem: root
 }
 
-// Children
-
-T.Label {
-anchors.centerIn: parent
+contentItem: T.Label {
+verticalAlignment: Text.AlignVCenter
+horizontalAlignment: Text.AlignHCenter
 
 font.pixelSize: VLCStyle.fontSize_normal
 
@@ -53,4 +52,55 @@ PopupIconToolButton {
 
 color: root.color
 }
+
+// TODO: Qt 5.15 Use WheelHandler & TapHandler
+MouseArea {
+anchors.fill: parent
+
+acceptedButtons: Qt.RightButton
+
+onWheel: function(wheel) {
+if (!root.popup.contentItem || !root.popup.contentItem.slider) {
+wheel.accepted = false
+return
+}
+
+let delta = 0
+
+if (wheel.angleDelta.x)
+delta = wheel.angleDelta.x
+else if (wheel.angleDelta.y)
+delta = wheel.angleDelta.y
+else {
+wheel.accepted = false
+return
+}
+
+if (wheel.inverted)
+delta = -delta
+
+wheel.accepted = true
+
+delta = delta / 8 / 15
+
+let func
+if (delta > 0)
+func = root.popup.contentItem.slider.increase
+else
+func = root.popup.contentItem.slider.decrease
+
+for (let i = 0; i < Math.ceil(Math.abs(delta)); ++i)
+func()
+}
+
+onClicked: function(mouse) {
+if (!root.popup.contentItem || !root.popup.contentItem.slider) {
+mouse.accepted = false
+return
+}
+
+mouse.accepted = true
+root.popup.contentItem.slider.value = 0
+}
+}
 }


=
modules/gui/qt/widgets/qml/IconToolButton.qml
=
@@ -98,8 +98,6 @@ T.ToolButton {
 }
 
 contentItem: T.Label {
-anchors.centerIn: parent
-
 verticalAlignment: Text.AlignVCenter
 horizontalAlignment: Text.AlignHCenter
 



View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/compare/b905473ea05e2d4341bbf14b9e884c8ab003e723...ab4b8dcc860b3e1693c0256ddf60c09e716c460f

-- 
View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/compare/b905473ea05e2d4341bbf14b9e884c8ab003e723...ab4b8dcc860b3e1693c0256ddf60c09e716c460f
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] [Git][videolan/vlc][master] 5 commits: lib: media_discoverer: remove useless variable initialisation

2023-12-21 Thread Thomas Guillem (@tguillem)


Thomas Guillem pushed to branch master at VideoLAN / VLC


Commits:
468fe700 by Thomas Guillem at 2023-12-22T05:47:54+00:00
lib: media_discoverer: remove useless variable initialisation

libvlc_media_subitems() already returns a read-only media list.

- - - - -
07b01add by Thomas Guillem at 2023-12-22T05:47:54+00:00
lib: media: always initialize subitems

Avoid the NULL check protected by a mutex.

- - - - -
8f6d3910 by Thomas Guillem at 2023-12-22T05:47:54+00:00
lib: media_list: fix leak

- - - - -
43383a58 by Thomas Guillem at 2023-12-22T05:47:54+00:00
lib: media_list_player: check set_current_playing_item() return

This allows to fix a leak by only checking the return code instead of
fetching the media (and forgetting to release it...)

- - - - -
b905473e by Thomas Guillem at 2023-12-22T05:47:54+00:00
lib: media_list_player: fix leaks

- - - - -


5 changed files:

- lib/media.c
- lib/media_discoverer.c
- lib/media_internal.h
- lib/media_list_path.h
- lib/media_list_player.c


Changes:

=
lib/media.c
=
@@ -135,26 +135,6 @@ static_assert(
 MULTIVIEW_STEREO_CHECKERBOARD   == (int) 
libvlc_video_multiview_stereo_checkerboard,
 "Mismatch between libvlc_video_multiview_t and video_multiview_mode_t");
 
-static libvlc_media_list_t *media_get_subitems( libvlc_media_t * p_md,
-bool b_create )
-{
-libvlc_media_list_t *p_subitems = NULL;
-
-vlc_mutex_lock( &p_md->subitems_lock );
-if( p_md->p_subitems == NULL && b_create )
-{
-p_md->p_subitems = libvlc_media_list_new();
-if( p_md->p_subitems != NULL )
-{
-p_md->p_subitems->b_read_only = true;
-p_md->p_subitems->p_internal_md = p_md;
-}
-}
-p_subitems = p_md->p_subitems;
-vlc_mutex_unlock( &p_md->subitems_lock );
-return p_subitems;
-}
-
 static libvlc_media_t *input_item_add_subitem( libvlc_media_t *p_md,
input_item_t *item )
 {
@@ -165,13 +145,10 @@ static libvlc_media_t *input_item_add_subitem( 
libvlc_media_t *p_md,
 p_md_child = libvlc_media_new_from_input_item( item );
 
 /* Add this to our media list */
-p_subitems = media_get_subitems( p_md, true );
-if( p_subitems != NULL )
-{
-libvlc_media_list_lock( p_subitems );
-libvlc_media_list_internal_add_media( p_subitems, p_md_child );
-libvlc_media_list_unlock( p_subitems );
-}
+p_subitems = p_md->p_subitems;
+libvlc_media_list_lock( p_subitems );
+libvlc_media_list_internal_add_media( p_subitems, p_md_child );
+libvlc_media_list_unlock( p_subitems );
 
 /* Construct the event */
 event.type = libvlc_MediaSubItemAdded;
@@ -375,14 +352,11 @@ static void send_parsed_changed( libvlc_media_t *p_md,
 /* Send the event */
 libvlc_event_send( &p_md->event_manager, &event );
 
-libvlc_media_list_t *p_subitems = media_get_subitems( p_md, false );
-if( p_subitems != NULL )
-{
-/* notify the media list */
-libvlc_media_list_lock( p_subitems );
-libvlc_media_list_internal_end_reached( p_subitems );
-libvlc_media_list_unlock( p_subitems );
-}
+libvlc_media_list_t *p_subitems = p_md->p_subitems;
+/* notify the media list */
+libvlc_media_list_lock( p_subitems );
+libvlc_media_list_internal_end_reached( p_subitems );
+libvlc_media_list_unlock( p_subitems );
 }
 
 /**
@@ -484,15 +458,20 @@ libvlc_media_t * 
libvlc_media_new_from_input_item(input_item_t *p_input_item )
 return NULL;
 }
 
+p_md->p_subitems = libvlc_media_list_new();
+if( p_md->p_subitems == NULL )
+{
+free( p_md );
+return NULL;
+}
+p_md->p_subitems->b_read_only = true;
+p_md->p_subitems->p_internal_md = p_md;
+
 p_md->p_input_item  = p_input_item;
 vlc_atomic_rc_init(&p_md->rc);
 
-vlc_mutex_init(&p_md->subitems_lock);
 atomic_init(&p_md->worker_count, 0);
 
-/* A media descriptor can be a playlist. When you open a playlist
- * It can give a bunch of item to read. */
-p_md->p_subitems= NULL;
 p_md->p_input_item->libvlc_owner = p_md;
 atomic_init(&p_md->parsed_status, libvlc_media_parsed_status_none);
 
@@ -575,7 +554,6 @@ libvlc_media_t * libvlc_media_new_as_node(const char 
*psz_name)
 {
 input_item_t * p_input_item;
 libvlc_media_t * p_md;
-libvlc_media_list_t * p_subitems;
 
 p_input_item = input_item_New( INPUT_ITEM_URI_NOP, psz_name );
 
@@ -588,12 +566,6 @@ libvlc_media_t * libvlc_media_new_as_node(const char 
*psz_name)
 p_md = libvlc_media_new_from_input_item( p_input_item );
 input_item_Release( p_input_item );
 
-p_subitems = media_get_subitems( p_md, true );
-if( p_subitems == NULL) {
-libvlc_media_release( p_md );
-return NULL;
-}
-
 return p_md;
 }
 
@@ -740,10 +712,8 @@ int libvlc_media_s

[vlc-commits] [Git][videolan/vlc][master] 3 commits: decoder: handle potential DecoderWaitUnblock return

2023-11-24 Thread Thomas Guillem (@tguillem)


Thomas Guillem pushed to branch master at VideoLAN / VLC


Commits:
8a967f0d by Thomas Guillem at 2023-11-24T19:27:58+00:00
decoder: handle potential DecoderWaitUnblock return

If a wait failed (in case of flush for example, cf. next commit), the
current frame should not be displayed.

- - - - -
3f1bf4e4 by Thomas Guillem at 2023-11-24T19:27:58+00:00
decoder: cancel DecoderWaitUnblock on Flush()

This fixes clock being updated by a point that was decoded just before a flush.

- - - - -
5e9747b6 by Thomas Guillem at 2023-11-24T19:27:58+00:00
test: player: also test without master source

Add a new test: test_src_player_monotonic_clock, same than
test_src_player but with a monotonic clock.

But with one restriction on "test_timers", cf. comment.

- - - - -


3 changed files:

- src/input/decoder.c
- test/Makefile.am
- test/src/player/player.c


Changes:

=
src/input/decoder.c
=
@@ -1029,7 +1029,7 @@ static void RequestReload( vlc_input_decoder_t *p_owner )
 atomic_compare_exchange_strong( &p_owner->reload, &expected, 
RELOAD_DECODER );
 }
 
-static void DecoderWaitUnblock( vlc_input_decoder_t *p_owner )
+static int DecoderWaitUnblock( vlc_input_decoder_t *p_owner )
 {
 vlc_fifo_Assert(p_owner->p_fifo);
 
@@ -1039,8 +1039,17 @@ static void DecoderWaitUnblock( vlc_input_decoder_t 
*p_owner )
 vlc_cond_signal( &p_owner->wait_acknowledge );
 }
 
-while( p_owner->b_waiting && p_owner->b_has_data )
+while (p_owner->b_waiting && p_owner->b_has_data && !p_owner->flushing)
 vlc_fifo_WaitCond(p_owner->p_fifo, &p_owner->wait_request);
+
+if (p_owner->flushing)
+{
+p_owner->b_has_data = false;
+vlc_cond_signal(&p_owner->wait_acknowledge);
+return VLC_ENOENT;
+}
+
+return VLC_SUCCESS;
 }
 
 static inline void DecoderUpdatePreroll( vlc_tick_t *pi_preroll, const 
vlc_frame_t *p )
@@ -1350,7 +1359,12 @@ static int ModuleThread_PlayVideo( vlc_input_decoder_t 
*p_owner, picture_t *p_pi
 }
 else
 {
-DecoderWaitUnblock( p_owner );
+int ret = DecoderWaitUnblock(p_owner);
+if (ret != VLC_SUCCESS)
+{
+picture_Release(p_picture);
+return ret;
+}
 }
 
 if( unlikely(p_owner->paused) && likely(p_owner->frames_countdown > 0) )
@@ -1487,7 +1501,12 @@ static int ModuleThread_PlayAudio( vlc_input_decoder_t 
*p_owner, vlc_frame_t *p_
 vlc_aout_stream_Flush( p_astream );
 }
 
-DecoderWaitUnblock( p_owner );
+int ret = DecoderWaitUnblock(p_owner);
+if (ret != VLC_SUCCESS)
+{
+block_Release(p_audio);
+return ret;
+}
 
 int status = vlc_aout_stream_Play( p_astream, p_audio );
 if( status == AOUT_DEC_CHANGED )
@@ -1550,10 +1569,10 @@ static void ModuleThread_PlaySpu( vlc_input_decoder_t 
*p_owner, subpicture_t *p_
 
 /* */
 vlc_fifo_Lock(p_owner->p_fifo);
-DecoderWaitUnblock( p_owner );
+int ret = DecoderWaitUnblock(p_owner);
 vlc_fifo_Unlock(p_owner->p_fifo);
 
-if( p_subpic->i_start == VLC_TICK_INVALID )
+if (ret != VLC_SUCCESS || p_subpic->i_start == VLC_TICK_INVALID)
 {
 subpicture_Delete( p_subpic );
 return;
@@ -2538,6 +2557,23 @@ void vlc_input_decoder_Flush( vlc_input_decoder_t 
*p_owner )
 }
 }
 vlc_fifo_Signal( p_owner->p_fifo );
+
+if (unlikely(p_owner->b_waiting && p_owner->b_has_data))
+{
+/* Signal the output thread to stop waiting from DecoderWaitUnblock()
+ * and to discard the current frame (via 'flushing' = true). */
+vlc_cond_signal(&p_owner->wait_request);
+
+/* Flushing is fully asynchronous, but we need to wait for the output
+ * thread to unblock in DecoderWaitUnblock() otherwise there are no
+ * ways to know if the frame referenced when waiting comes from before
+ * or after the flush. Waiting here is almost instantaneous since we
+ * are sure that the output thread is waiting in DecoderWaitUnblock().
+ */
+while (p_owner->b_has_data)
+vlc_fifo_WaitCond(p_owner->p_fifo, &p_owner->wait_acknowledge);
+}
+
 vlc_fifo_Unlock( p_owner->p_fifo );
 
 if (vlc_input_decoder_IsSynchronous(p_owner))


=
test/Makefile.am
=
@@ -32,6 +32,7 @@ check_PROGRAMS = \
test_src_input_thumbnail \
test_src_input_decoder \
test_src_player \
+   test_src_player_monotonic_clock \
test_src_interface_dialog \
test_src_media_source \
test_src_misc_bits \
@@ -179,6 +180,9 @@ test_src_input_thumbnail_SOURCES = src/input/thumbnail.c
 test_src_input_thumbnail_LDADD = $(LIBVLCCORE) $(LIBVLC)
 test_src_player_SOURCES = src/player/player.c
 test_src_player_LDADD = $(LIBVLCCORE) $(LIBVLC) $(LIBM)
+test_src_player_monotonic_clock_SOURCES = src/player/player.c
+test_src_player_monot

[vlc-commits] [Git][videolan/vlc][master] 4 commits: aout: don't handle drift when paused

2023-11-17 Thread Thomas Guillem (@tguillem)


Thomas Guillem pushed to branch master at VideoLAN / VLC


Commits:
d946275c by Thomas Guillem at 2023-11-17T15:44:31+00:00
aout: don't handle drift when paused

In case where the audio is not master and paused (unlikely since audio
is not master in case of live playback, that is generally not pauseable).

Fixes some potential enormous silence:
playback way too early (-9223371872593688789): playing silence

"luckily" the allocation was too big and silently failing, and not 
causing OOM.

- - - - -
e0f1805f by Thomas Guillem at 2023-11-17T15:44:31+00:00
aout: use the same system_time when converting

The system time is only used when there is no master in order to get the
reference point (wait_sync_ref). Therefore, it's better to always use
the same vlc_tick_now() to avoid gaps.

- - - - -
2a25f23a by Thomas Guillem at 2023-11-17T15:44:31+00:00
aout: call vlc_clock_ConvertToSystem() only one time when playing

- - - - -
a3ddf46f by Thomas Guillem at 2023-11-17T15:44:31+00:00
aout: fix wrong delay after a pause when not master

This fixes the following case when resuming from pause:

main audio output warning: playback way too early (-7040339): playing silence
main audio output debug: inserting 337936 zeroes / 7040ms
main audio output warning: playback way too late (7038677): flushing buffers

It was not happening with all aout modules. For example, PulseAudio was
likely updating its timing just after a uncork and just before the core
was playing the next audio sample.

- - - - -


1 changed file:

- src/audio_output/dec.c


Changes:

=
src/audio_output/dec.c
=
@@ -76,6 +76,8 @@ struct vlc_aout_stream
 
 vlc_tick_t system_ts;
 vlc_tick_t audio_ts;
+
+vlc_tick_t pause_date;
 float rate;
 } timing;
 
@@ -165,6 +167,8 @@ static void stream_Discontinuity(vlc_aout_stream *stream)
 stream->timing.system_ts = VLC_TICK_INVALID;
 stream->timing.audio_ts = VLC_TICK_INVALID;
 vlc_mutex_unlock(&stream->timing.lock);
+
+stream->timing.pause_date = VLC_TICK_INVALID;
 stream->timing.played_samples = 0;
 }
 
@@ -588,7 +592,7 @@ static void stream_HandleDrift(vlc_aout_stream *stream, 
vlc_tick_t drift,
 }
 
 static void stream_Synchronize(vlc_aout_stream *stream, vlc_tick_t system_now,
-   vlc_tick_t dec_pts)
+   vlc_tick_t play_date, vlc_tick_t dec_pts)
 {
 /**
  * Depending on the drift between the actual and intended playback times,
@@ -625,11 +629,6 @@ static void stream_Synchronize(vlc_aout_stream *stream, 
vlc_tick_t system_now,
 if (stream_GetDelay(stream, &delay) != 0)
 return; /* nothing can be done if timing is unknown */
 
-/* Equivalent to vlc_clock_Update() but we don't want to update points
- * (since there are already updated via aout_TimingReport()). */
-vlc_tick_t play_date =
-vlc_clock_ConvertToSystem(stream->sync.clock, system_now + delay, 
dec_pts,
-  stream->sync.rate);
 drift = play_date - system_now - delay;
 }
 else
@@ -648,9 +647,7 @@ static void stream_Synchronize(vlc_aout_stream *stream, 
vlc_tick_t system_now,
  * clock without taking the jitter into account. Therefore, we
  * manually insert silence that correspond to the clock jitter
  * value before updating the clock. */
-vlc_tick_t play_date =
-vlc_clock_ConvertToSystem(stream->sync.clock, system_now + 
delay,
-  dec_pts, stream->sync.rate);
+
 vlc_tick_t jitter = play_date - system_now;
 if (jitter > 0)
 {
@@ -772,7 +769,6 @@ int vlc_aout_stream_Play(vlc_aout_stream *stream, block_t 
*block)
 
 /* Drift correction */
 vlc_tick_t system_now = vlc_tick_now();
-stream_Synchronize(stream, system_now, original_pts);
 
 vlc_tick_t play_date =
 vlc_clock_ConvertToSystem(stream->sync.clock, system_now, original_pts,
@@ -782,8 +778,9 @@ int vlc_aout_stream_Play(vlc_aout_stream *stream, block_t 
*block)
 /* The clock is paused but not the output, play the audio anyway since
  * we can't delay audio playback from here. */
 play_date = system_now;
-
 }
+else
+stream_Synchronize(stream, system_now, play_date, original_pts);
 
 vlc_audio_meter_Process(&owner->meter, block, play_date);
 
@@ -845,6 +842,24 @@ void vlc_aout_stream_ChangePause(vlc_aout_stream *stream, 
bool paused, vlc_tick_
 vlc_tracer_TraceEvent(tracer, "RENDER", stream->str_id,
   paused ? "paused" : "resumed");
 
+if (paused)
+{
+assert(stream->timing.pause_date == VLC_TICK_INVALID);
+stream->timing.pause_date = date;
+}
+else
+{
+assert(stream->timing.pause_date != VLC_

[vlc-commits] [Git][videolan/vlc] Pushed new branch 28411-intermitent-test_src_input_decoder-fail

2023-10-26 Thread Thomas Guillem (@tguillem)


Thomas Guillem pushed new branch 28411-intermitent-test_src_input_decoder-fail 
at VideoLAN / VLC

-- 
View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/tree/28411-intermitent-test_src_input_decoder-fail
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] [Git][videolan/vlc][3.0.x] mmsh: check user size bounds

2023-10-26 Thread Thomas Guillem (@tguillem)


Thomas Guillem pushed to branch 3.0.x at VideoLAN / VLC


Commits:
27840cb5 by Thomas Guillem at 2023-10-26T17:27:03+02:00
mmsh: check user size bounds

(cherry picked from commit f7f346e686405638342721dd1c980d63e542dbe0)
Signed-off-by: Thomas Guillem 

- - - - -


1 changed file:

- modules/access/mms/mmsh.c


Changes:

=
modules/access/mms/mmsh.c
=
@@ -927,7 +927,15 @@ static int GetPacket( stream_t * p_access, chunk_t *p_ck )
 if( restsize < 8 )
 p_ck->i_size2 = 8;
 else
+{
 p_ck->i_size2 = GetWLE( p_sys->buffer + 10);
+if (p_ck->i_size2 < 8 /* Prevent underflow when set to i_data */
+ || p_ck->i_size2 - 8 > BUFFER_SIZE - 12 /* Prevent Out Of Bound Write 
*/)
+{
+msg_Err(p_access, "invalid size2: %" PRIu16, p_ck->i_size2);
+return VLC_EGENERIC;
+}
+}
 
 p_ck->p_data  = p_sys->buffer + 12;
 p_ck->i_data  = p_ck->i_size2 - 8;



View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/commit/27840cb5b20bc4651ba6af01d0a7ae6da17297ef

-- 
View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/commit/27840cb5b20bc4651ba6af01d0a7ae6da17297ef
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] [Git][videolan/vlc][master] mmsh: check user size bounds

2023-10-26 Thread Thomas Guillem (@tguillem)


Thomas Guillem pushed to branch master at VideoLAN / VLC


Commits:
f7f346e6 by Thomas Guillem at 2023-10-26T17:16:24+02:00
mmsh: check user size bounds

- - - - -


1 changed file:

- modules/access/mms/mmsh.c


Changes:

=
modules/access/mms/mmsh.c
=
@@ -926,7 +926,15 @@ static int GetPacket( stream_t * p_access, chunk_t *p_ck )
 if( restsize < 8 )
 p_ck->i_size2 = 8;
 else
+{
 p_ck->i_size2 = GetWLE( p_sys->buffer + 10);
+if (p_ck->i_size2 < 8 /* Prevent underflow when set to i_data */
+ || p_ck->i_size2 - 8 > BUFFER_SIZE - 12 /* Prevent Out Of Bound Write 
*/)
+{
+msg_Err(p_access, "invalid size2: %" PRIu16, p_ck->i_size2);
+return VLC_EGENERIC;
+}
+}
 
 p_ck->p_data  = p_sys->buffer + 12;
 p_ck->i_data  = p_ck->i_size2 - 8;



View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/commit/f7f346e686405638342721dd1c980d63e542dbe0

-- 
View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/commit/f7f346e686405638342721dd1c980d63e542dbe0
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] [Git][videolan/vlc][master] 5 commits: charset: fix typo in documentation

2023-10-26 Thread Thomas Guillem (@tguillem)


Thomas Guillem pushed to branch master at VideoLAN / VLC


Commits:
6af3b461 by Thomas Guillem at 2023-10-26T10:05:58+00:00
charset: fix typo in documentation

- - - - -
5b759337 by Thomas Guillem at 2023-10-26T10:05:58+00:00
charset: add vlc_fprintf_c() and vlc_vfprintf_c()

- - - - -
a41647df by Thomas Guillem at 2023-10-26T10:05:58+00:00
tracer: add double type

- - - - -
a228304b by Thomas Guillem at 2023-10-26T10:05:58+00:00
logger: json: handle double types

- - - - -
6a8aeb53 by Thomas Guillem at 2023-10-26T10:05:58+00:00
clock: trace the clock coefficient

- - - - -


6 changed files:

- include/vlc_charset.h
- include/vlc_tracer.h
- modules/logger/json.c
- src/clock/clock.c
- src/libvlccore.sym
- src/text/charset.c


Changes:

=
include/vlc_charset.h
=
@@ -421,7 +421,7 @@ VLC_API int vlc_vasprintf_c(char **restrict p, const char 
*restrict fmt,
  * Formats a string using the C locale.
  *
  * This function formats a string from a format string and a variable argument
- * list, just like the standard vasprintf() but using the C locale for the
+ * list, just like the standard asprintf() but using the C locale for the
  * formatting of numerals.
  *
  * \param[out] p storage space for a pointer to the heap-allocated formatted
@@ -432,6 +432,35 @@ VLC_API int vlc_vasprintf_c(char **restrict p, const char 
*restrict fmt,
  */
 VLC_API int vlc_asprintf_c( char **p, const char *fmt, ... ) VLC_USED;
 
+/**
+ * Write a string to the output using the C locale
+ *
+ * This function formats a string from a format string and a variable argument
+ * list, just like the standard vfprintf() but using the C locale for the
+ * formatting of numerals.
+ *
+ * \param f output stream to write the string to
+ * \param fmt format string
+ * \param ap variable argument list
+ * \return number of bytes formatted (excluding the nul terminator)
+ *or -1 on error
+ */
+VLC_API int vlc_vfprintf_c(FILE *f, const char *fmt, va_list ap);
+
+/**
+ * Write a string to the output using the C locale
+ *
+ * This function formats a string from a format string and a variable argument
+ * list, just like the standard fprintf() but using the C locale for the
+ * formatting of numerals.
+ *
+ * \param f output stream to write the string to
+ * \param fmt format string
+ * \return number of bytes formatted (excluding the nul terminator)
+ *or -1 on error
+ */
+VLC_API int vlc_fprintf_c(FILE *f, const char *fmt, ...);
+
 int vlc_vsscanf_c(const char *, const char *, va_list) VLC_USED;
 int vlc_sscanf_c(const char*, const char*, ...) VLC_USED
 #ifdef __GNUC__


=
include/vlc_tracer.h
=
@@ -46,12 +46,14 @@
 enum vlc_tracer_value
 {
 VLC_TRACER_INT,
+VLC_TRACER_DOUBLE,
 VLC_TRACER_STRING
 };
 
 typedef union
 {
 int64_t integer;
+double double_;
 const char *string;
 } vlc_tracer_value_t;
 
@@ -112,6 +114,15 @@ static inline struct vlc_tracer_entry 
vlc_tracer_entry_FromInt(const char *key,
 return trace;
 }
 
+static inline struct vlc_tracer_entry vlc_tracer_entry_FromDouble(const char 
*key, double value)
+{
+vlc_tracer_value_t tracer_value = {
+.double_ = value,
+};
+struct vlc_tracer_entry trace = { key, tracer_value, VLC_TRACER_DOUBLE };
+return trace;
+}
+
 static inline struct vlc_tracer_entry vlc_tracer_entry_FromString(const char 
*key, const char *value)
 {
 vlc_tracer_value_t tracer_value;
@@ -127,6 +138,7 @@ static inline struct vlc_tracer_entry 
vlc_tracer_entry_FromString(const char *ke
 #define VLC_TRACE(key, value) \
 _Generic((value), \
 int64_t: vlc_tracer_entry_FromInt, \
+double: vlc_tracer_entry_FromDouble, \
 char *: vlc_tracer_entry_FromString, \
 const char *: vlc_tracer_entry_FromString) (key, value)
 #else


=
modules/logger/json.c
=
@@ -138,6 +138,12 @@ static void JsonPrintKeyValueNumber(FILE *stream, const 
char *key, int64_t value
 fprintf(stream, ": \"%"PRId64"\"", value);
 }
 
+static void JsonPrintKeyValueNumberFromDouble(FILE *stream, const char *key, 
double value)
+{
+JsonPrintString(stream, key);
+vlc_fprintf_c(stream, ": \"%le\"", value);
+}
+
 static void JsonPrintKeyValueLabel(FILE *stream, const char *key, const char 
*value)
 {
 JsonPrintString(stream, key);
@@ -178,6 +184,9 @@ static void TraceJson(void *opaque, vlc_tick_t ts, va_list 
entries)
 case VLC_TRACER_INT:
 JsonPrintKeyValueNumber(stream, entry.key, 
entry.value.integer);
 break;
+case VLC_TRACER_DOUBLE:
+JsonPrintKeyValueNumberFromDouble(stream, entry.key, 
entry.value.double_);
+break;
 case VLC_TRACER_STRING:
 JsonPrintKeyValueLabel(stream, entry.key, entry.value.string);

[vlc-commits] [Git][videolan/vlc][master] 3 commits: es_out: remove unused variables

2023-10-13 Thread Thomas Guillem (@tguillem)


Thomas Guillem pushed to branch master at VideoLAN / VLC


Commits:
f1fc1514 by Thomas Guillem at 2023-10-13T05:04:00+00:00
es_out: remove unused variables

- - - - -
603a767b by Thomas Guillem at 2023-10-13T05:04:00+00:00
es_out: do the drain wait hack only where it's needed

It's only needed from the ES_OUT_SET_ES_FMT control and when the demuxer
is deleting an ES.

The normal drain polling is done via ES_OUT_GET_EMPTY.

Both solutions are not good, but it's not for VLC 4.0...

- - - - -
236d2c3b by Thomas Guillem at 2023-10-13T05:04:00+00:00
es_out: call the drain helper function

This fix EsOutDrainCCChannels() not being called in the nominal case.

But this does not fix any issues since the es_out don't have access to CC
dec pointers: EsOutDrainCCChannels() is a noop (will be fixed in a next
commit).

- - - - -


1 changed file:

- src/input/es_out.c


Changes:

=
src/input/es_out.c
=
@@ -3003,16 +3003,20 @@ static int EsOutSend( es_out_t *out, es_out_id_t *es, 
block_t *p_block )
 }
 
 static void
-EsOutDrainDecoder( es_out_t *out, es_out_id_t *es )
+EsOutDrainDecoder(es_out_t *out, es_out_id_t *es, bool wait)
 {
 es_out_sys_t *p_sys = container_of(out, es_out_sys_t, out);
 assert( es->p_dec );
 
+vlc_input_decoder_Drain( es->p_dec );
+EsOutDrainCCChannels( es );
+
+if (!wait)
+return;
+
 /* FIXME: This might hold the ES output caller (i.e. the demux), and
  * the corresponding thread (typically the input thread), for a little
  * bit too long if the ES is deleted in the middle of a stream. */
-vlc_input_decoder_Drain( es->p_dec );
-EsOutDrainCCChannels( es );
 while( !input_Stopped(p_sys->p_input) && !p_sys->b_buffering )
 {
 if( vlc_input_decoder_IsEmpty( es->p_dec ) &&
@@ -3037,7 +3041,7 @@ static void EsOutDelLocked( es_out_t *out, es_out_id_t 
*es )
 /* We don't try to reselect */
 if( es->p_dec )
 {
-EsOutDrainDecoder( out, es );
+EsOutDrainDecoder(out, es, true);
 EsOutUnselectEs( out, es, es->p_pgrm == p_sys->p_pgrm );
 }
 
@@ -3492,7 +3496,7 @@ static int EsOutVaControlLocked( es_out_t *out, 
input_source_t *source,
 const bool b_was_selected = EsIsSelected( es );
 if( es->p_dec )
 {
-EsOutDrainDecoder( out, es );
+EsOutDrainDecoder(out, es, true);
 EsDeleteCCChannels( out, es );
 EsOutDestroyDecoder( out, es );
 }
@@ -3961,7 +3965,7 @@ static int EsOutVaPrivControlLocked( es_out_t *out, 
input_source_t *source,
 es_out_id_t *id;
 foreach_es_then_es_slaves(id)
 if (id->p_dec != NULL)
-vlc_input_decoder_Drain(id->p_dec);
+EsOutDrainDecoder(out, id, false);
 return VLC_SUCCESS;
 }
 case ES_OUT_PRIV_SET_VBI_PAGE:
@@ -4203,9 +4207,7 @@ static int LanguageArrayIndex( char **ppsz_langs, const 
char *psz_lang )
 static int EsOutEsUpdateFmt(es_out_t *out, es_out_id_t *es,
 const es_format_t *fmt)
 {
-es_out_sys_t *p_sys = container_of(out, es_out_sys_t, out);
-input_thread_t *p_input = p_sys->p_input;
-
+(void) out;
 assert(es->fmt.i_cat == fmt->i_cat);
 
 es_format_t update = *fmt;



View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/compare/253e81b30cc33e5eb709d6dba241c4a4a3529e92...236d2c3b224070e53d6223018bc7c2df2ddd311b

-- 
View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/compare/253e81b30cc33e5eb709d6dba241c4a4a3529e92...236d2c3b224070e53d6223018bc7c2df2ddd311b
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] [Git][videolan/vlc][master] 12 commits: lib: set libvlc_media_parse_local > 0

2023-04-04 Thread Thomas Guillem (@tguillem)


Thomas Guillem pushed to branch master at VideoLAN / VLC


Commits:
a82b0976 by Thomas Guillem at 2023-04-04T07:39:58+00:00
lib: set libvlc_media_parse_local > 0

This will allow to use the preparser to only fetch metadata.

- - - - -
5d2278c4 by Thomas Guillem at 2023-04-04T07:39:58+00:00
input_item: avoid constant use in input_item_meta_request_option_t

- - - - -
5a6942eb by Thomas Guillem at 2023-04-04T07:39:58+00:00
input_item: move META_REQUEST_OPTION NO_SKIP to SCOPE_FORCED

SCOPE_* enums are for the preparser (not for the fetcher) and this
option only touches the preparser.

- - - - -
41323953 by Thomas Guillem at 2023-04-04T07:39:58+00:00
lib: move libvlc_media_ no_skip to parse_forced

- - - - -
e5a3f4fc by Thomas Guillem at 2023-04-04T07:39:58+00:00
preparse: also use input_preparser_Push() to only fetch meta

- - - - -
8638652a by Thomas Guillem at 2023-04-04T07:39:58+00:00
preparser: notify if an art was fetched

- - - - -
99b11788 by Thomas Guillem at 2023-04-04T07:39:58+00:00
qt: use libvlc_MetadataRequest()

Instead of libvlc_ArtRequest()

- - - - -
538fcb20 by Thomas Guillem at 2023-04-04T07:39:58+00:00
core: remove libvlc_ArtRequest()

- - - - -
d59a5127 by Thomas Guillem at 2023-04-04T07:39:58+00:00
core: rename input_preparser to vlc_preparser

and input_preparser_callbacks_t to struct vlc_metadata_cbs

- - - - -
3d526a6a by Thomas Guillem at 2023-04-04T07:39:58+00:00
core: move preparser.h into vlc_preparser.h

- - - - -
9c3caa7b by Thomas Guillem at 2023-04-04T07:39:58+00:00
preparser: improve documentation

- - - - -
bc056eb4 by Thomas Guillem at 2023-04-04T07:39:58+00:00
core: expose vlc_preparser API

- - - - -


18 changed files:

- include/meson.build
- include/vlc/libvlc_media.h
- include/vlc_input_item.h
- src/preparser/preparser.h → include/vlc_preparser.h
- lib/media.c
- modules/gui/macosx/library/VLCInputItem.m
- modules/gui/qt/player/player_controller.cpp
- modules/gui/qt/player/player_controller.hpp
- src/Makefile.am
- src/libvlc.c
- src/libvlc.h
- src/libvlccore.sym
- src/media_source/media_tree.c
- src/meson.build
- src/playlist/preparse.c
- src/preparser/fetcher.h
- src/preparser/preparser.c
- test/libvlc/media.c


Changes:

=
include/meson.build
=
@@ -85,6 +85,7 @@ install_headers(
 'vlc_playlist.h',
 'vlc_playlist_export.h',
 'vlc_plugin.h',
+'vlc_preparser.h',
 'vlc_probe.h',
 'vlc_rand.h',
 'vlc_renderer_discovery.h',


=
include/vlc/libvlc_media.h
=
@@ -147,29 +147,29 @@ typedef enum libvlc_media_parse_flag_t
 /**
  * Parse media if it's a local file
  */
-libvlc_media_parse_local= 0x00,
+libvlc_media_parse_local= 0x01,
 /**
  * Parse media even if it's a network file
  */
-libvlc_media_parse_network  = 0x01,
+libvlc_media_parse_network  = 0x02,
+/**
+ * Force parsing the media even if it would be skipped.
+ */
+libvlc_media_parse_forced   = 0x04,
 /**
  * Fetch meta and cover art using local resources
  */
-libvlc_media_fetch_local= 0x02,
+libvlc_media_fetch_local= 0x08,
 /**
  * Fetch meta and cover art using network resources
  */
-libvlc_media_fetch_network  = 0x04,
+libvlc_media_fetch_network  = 0x10,
 /**
  * Interact with the user (via libvlc_dialog_cbs) when preparsing this item
  * (and not its sub items). Set this flag in order to receive a callback
  * when the input is asking for credentials.
  */
-libvlc_media_do_interact= 0x08,
-/**
- * Force parsing the media even if it would be skipped.
- */
-libvlc_media_no_skip= 0x10,
+libvlc_media_do_interact= 0x20,
 } libvlc_media_parse_flag_t;
 
 /**


=
include/vlc_input_item.h
=
@@ -38,7 +38,6 @@
 
 typedef struct input_item_opaque input_item_opaque_t;
 typedef struct input_item_slave input_item_slave_t;
-typedef struct input_preparser_callbacks_t input_preparser_callbacks_t;
 
 struct info_t
 {
@@ -478,12 +477,14 @@ typedef enum input_item_meta_request_option_t
 META_REQUEST_OPTION_NONE  = 0x00,
 META_REQUEST_OPTION_SCOPE_LOCAL   = 0x01,
 META_REQUEST_OPTION_SCOPE_NETWORK = 0x02,
-META_REQUEST_OPTION_SCOPE_ANY = 0x03,
-META_REQUEST_OPTION_FETCH_LOCAL   = 0x04,
-META_REQUEST_OPTION_FETCH_NETWORK = 0x08,
-META_REQUEST_OPTION_FETCH_ANY = 0x0C,
-META_REQUEST_OPTION_DO_INTERACT   = 0x10,
-META_REQUEST_OPTION_NO_SKIP   = 0x20,
+META_REQUEST_OPTION_SCOPE_ANY =
+META_REQUEST_OPTION_SCOPE_LOCAL|META_REQUEST_OPTION_SCOPE_NETWORK,
+META_REQUEST_OPTION_SCOPE_FORCED  = 0x04,
+META_REQUEST_OPTION_FETCH_LOCAL   = 0x08,
+META_REQUEST_OPTION_FETCH_NETWORK = 0x10,
+META_REQUEST_OPTION_FETCH_ANY =
+META_REQUEST_OPTION_

[vlc-commits] [Git][videolan/vlc][master] vlc_queue: fix restrict violation

2023-03-17 Thread Thomas Guillem (@tguillem)


Thomas Guillem pushed to branch master at VideoLAN / VLC


Commits:
90e98b01 by Thomas Guillem at 2023-03-17T08:10:38+00:00
vlc_queue: fix restrict violation

`restrict` tells the compiler that the tombstone pointer is the only way
to access the variable pointed by it. This is not case with multi-threading.

>From the C11 specs:

§ 6.7.3 item 8
An object that is accessed through a restrict-qualified pointer has
a special association with that pointer. This association, defined
in 6.7.3.1 below, requires that all accesses to that object use,
directly or indirectly, the value of that particular pointer.

§ 6.7.3.1 item 4
Every other lvalue used to access the value of X shall also have its
address based on P.

Also set the pointer to const.

Fixes the following race condition when closing live555:

Thread 80 (Thread 28393.4880):
0  0x007953dbebbc in syscall () from 
/home/tom/work/git/libvlcjni/libvlc/.gdb/obj/local/arm64-v8a/system/lib64/libc.so
1  0x007855d2c0ec in sys_futex (addr=0x89, op=137, val=0, to=0x0, 
addr2=0x0, val3=-1) at ../../src/linux/thread.c:82
2  vlc_futex_wait (addr=0x89, flags=0, val=0, to=0x0) at 
../../src/linux/thread.c:93
3  vlc_atomic_wait (addr=0x89, val=0) at ../../src/linux/thread.c:109
4  0x007855d20e9c in vlc_cond_wait (cond=cond@entry=0x7829f26ce8, 
mutex=mutex@entry=0x7829f26cd8) at ../../src/misc/threads.c:298
5  0x007855d42244 in vlc_queue_Wait (q=0x7829f26cc0) at 
../../include/vlc_queue.h:122
6  vlc_queue_DequeueKillable (q=0x7829f26cc0, tombstone=0x7829f26d00) at 
../../include/vlc_queue.h:248
7  vlc_stream_fifo_Block (s=, eof=0x78709a8838) at 
../../src/input/stream_fifo.c:75
8  0x007855cfa160 in vlc_stream_ReadRaw (s=s@entry=0x7819411360, 
buf=buf@entry=0x78c4393c80, len=len@entry=188) at ../../src/input/stream.c:466
9  0x007855cf9fe0 in vlc_stream_ReadPartial (s=s@entry=0x7819411360, 
buf=buf@entry=0x78c4393c80, len=len@entry=188) at ../../src/input/stream.c:489
10 0x007855cfad44 in vlc_stream_Read (s=, 
buf=0x78c4393c80, len=188) at ../../src/input/stream.c:504
11 vlc_stream_Block (s=0x7819411360, size=) at 
../../src/input/stream.c:909
12 0x007855f1fe5c in ReadTSPacket (p_demux=p_demux@entry=0x78c42c0ce0) at 
../../modules/demux/mpeg/ts.c:1808
13 0x007855f1de30 in Demux (p_demux=) at 
../../modules/demux/mpeg/ts.c:649
4 0x007855d41e4c in vlc_demux_chained_Thread (data=0x7829f26c70) at 
../../src/input/demux_chained.c:96
15 0x007855d2d5b8 in joinable_thread (data=0x7823341ea0) at 
../../src/android/thread.c:96
16 0x007953e217c4 in __pthread_start(void*) () from 
/home/tom/work/git/libvlcjni/libvlc/.gdb/obj/local/arm64-v8a/system/lib64/libc.so
17 0x007953dc41ac in __start_thread () from 
/home/tom/work/git/libvlcjni/libvlc/.gdb/obj/local/arm64-v8a/system/lib64/libc.so

Thread 79 (Thread 28393.4875):
0  0x007953dbebbc in syscall () from 
/home/tom/work/git/libvlcjni/libvlc/.gdb/obj/local/arm64-v8a/system/lib64/libc.so
1  0x007953e21d98 in pthread_join () from 
/home/tom/work/git/libvlcjni/libvlc/.gdb/obj/local/arm64-v8a/system/lib64/libc.so
2  0x007855d2d204 in vlc_join (handle=0x7823341ea0, result=0x0) at 
../../src/android/thread.c:147
3  0x007855d4202c in vlc_demux_chained_Delete (dc=0x7829f26c70) at 
../../src/input/demux_chained.c:167
4  0x007855d3d92c in Close (p_this=) at 
../../modules/access/live555.cpp:505
5  0x007855cb49dc in module_unneed (obj=obj@entry=0x78194110c0, 
module=0x78c83b0520) at ../../src/modules/modules.c:305
6  0x007855ceae78 in vlc_access_Destroy (access=0x78194110c0) at 
../../src/input/access.c:54
7  0x007855cf958c in vlc_stream_Delete (s=0x78194110c0) at 
../../src/input/stream.c:150
8  0x007855ce4954 in demux_Delete (demux=0x78709a8d60) at 
../../include/vlc_demux.h:291
9  InputSourceDestroy (in=0x781a3aa780) at ../../src/input/input.c:2852
10 0x007855ce39f0 in End (p_input=p_input@entry=0x7863073c00) at 
../../src/input/input.c:1413
11 0x007855ce0620 in Run (data=0x7863073c00) at ../../src/input/input.c:431
12 0x007855d2d5b8 in joinable_thread (data=0x78231b02c0) at 
../../src/android/thread.c:96
13 0x007953e217c4 in __pthread_start(void*) () from 
/home/tom/work/git/libvlcjni/libvlc/.gdb/obj/local/arm64-v8a/system/lib64/libc.so
14 0x007953dc41ac in __start_thread () from 
/home/tom/work/git/libvlcjni/libvlc/.gdb/obj/local/arm64-v8a/system/lib64/libc.so

- - - - -


1 changed file:

- include/vlc_queue.h


Changes:

=
include/vlc_queue.h
=
@@ -239,7 +239,7 @@ static inline void vlc_queue_Kill(vlc_queue_t *q,
  * @return an entry, or NULL if the queue is empty and has been ended.
  */
 static inline void *vlc_queue_DequeueKillable(vlc_queue_t *q,
-  bool *restrict tombstone)
+

[vlc-commits] [Git][videolan/vlc][master] logger/json: change license to LGPL 2.1

2023-03-16 Thread Thomas Guillem (@tguillem)


Thomas Guillem pushed to branch master at VideoLAN / VLC


Commits:
5f603968 by Thomas Guillem at 2023-03-16T08:37:18+00:00
logger/json: change license to LGPL 2.1

The original GPL 2 license was an error, that I missed during the review
process. Nicolas agreed with this license change by mail.

- - - - -


1 changed file:

- modules/logger/json.c


Changes:

=
modules/logger/json.c
=
@@ -6,18 +6,18 @@
  * Authors : Nicolas Le Quec
  *
  * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
  * (at your option) any later version.
  *
  * This program 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 General Public License for more details.
+ * GNU Lesser General Public License for more details.
  *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  */
 
 #ifdef HAVE_CONFIG_H



View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/commit/5f60396843627874ef7470447d19c5411f067834

-- 
View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/commit/5f60396843627874ef7470447d19c5411f067834
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] [Git][videolan/vlc][master] 6 commits: modules: split android_env from android_utils

2023-03-15 Thread Thomas Guillem (@tguillem)


Thomas Guillem pushed to branch master at VideoLAN / VLC


Commits:
c65493d6 by Alexandre Janniaux at 2023-03-15T15:30:09+01:00
modules: split android_env from android_utils

android_utils depends on GLES2_LIBS and EGL_LIBS, but it isn't forwarded
correctly from the convenience library. In particlar, it contains mostly
video-related code, and some helpers for the android environment state,
which is why the non-video code is using the utils library.

Move the code in a separate convenience library so that it can be
imported without constraints.

- - - - -
ddb540cb by Alexandre Janniaux at 2023-03-15T15:30:09+01:00
audio_output: android: link android_env

The convenience library libandroid_env is needed in particular for the
function android_GetEnv.

There's no functional changes for the current way we distribute android,
ie. in static builds, since link options are ignored, but it's needed to
compile a dynamic build.

- - - - -
189d4353 by Alexandre Janniaux at 2023-03-15T15:30:09+01:00
audio_output: android: move AudioFormat vtable

Move the AudioFormat vtable to a separate file and convenience library
so as to use the AudioFormat vtable from device.c.

The choice of a convenience library here is to compile the code only
once but be able to use it from different locations, especially since it
needs the vtable filled before using the associated function.

The commit doesn't change audiotrack yet, as the goal is mostly to fix
the dynamic build on Android, and thus duplicates part of the code from
there. Some more changes would be needed to potentially supply the
vtable as parameter and provides what's missing for audiotrack.c to use
this convenience library instead.

- - - - -
ec94c477 by Thomas Guillem at 2023-03-15T15:30:09+01:00
audio_output: android: remove AudioTrack_HasEncoding()

The encoding is previously checked in device.c

- - - - -
352a3cd3 by Thomas Guillem at 2023-03-15T15:30:09+01:00
audio_output: android: add vlc_android_AudioFormat_FourCCToEncoding()

Finish the transition to the new audioformat_jni helper.

- - - - -
38d17118 by Alexandre Janniaux at 2023-03-15T15:30:09+01:00
audio_output: android: split DynamicsProcessing

DynamicsProcessing is used by android/device.c, by audiotrack and by
aaudio and a common vtable is needed as well as the matching JNI helpers
to use the vtable.

The vtable is currently stored in the audiotrack vtable, which is
available in the other plugins in static build. But it leads to
undefined reference errors when compiling a dynamic build of libvlc for
android.

Split the code handling this vtable in a separate convenience library to
address this, which is then linked to every other targets.

Since convenience libraries are playing a different role than static
libraries, and are not linked but merged into the final objects that
will be part of the library output (shared or archive), the symbols are
then available to each of the plugins.

Fixes #27726

- - - - -


20 changed files:

- modules/audio_output/Makefile.am
- modules/audio_output/android/aaudio.c
- + modules/audio_output/android/audioformat_jni.c
- + modules/audio_output/android/audioformat_jni.h
- modules/audio_output/android/audiotrack.c
- modules/audio_output/android/device.c
- modules/audio_output/android/device.h
- + modules/audio_output/android/dynamicsprocessing_jni.c
- + modules/audio_output/android/dynamicsprocessing_jni.h
- modules/audio_output/android/opensles.c
- modules/codec/Makefile.am
- modules/codec/omxil/mediacodec_jni.c
- modules/keystore/Makefile.am
- modules/keystore/file_crypt_android.c
- modules/video_output/Makefile.am
- + modules/video_output/android/env.c
- + modules/video_output/android/env.h
- modules/video_output/android/utils.c
- modules/video_output/android/utils.h
- modules/video_output/opengl/Makefile.am


Changes:

=
modules/audio_output/Makefile.am
=
@@ -1,16 +1,35 @@
 aoutdir = $(pluginsdir)/audio_output
 aout_LTLIBRARIES =
 
+libvlc_android_audioformat_jni_la_SOURCES = \
+   audio_output/android/audioformat_jni.c \
+   audio_output/android/audioformat_jni.h
+
+libvlc_android_dynamicsprocessing_jni_la_SOURCES = \
+   audio_output/android/dynamicsprocessing_jni.c \
+   audio_output/android/dynamicsprocessing_jni.h
+
+if HAVE_ANDROID
+noinst_LTLIBRARIES += \
+   libvlc_android_audioformat_jni.la \
+   libvlc_android_dynamicsprocessing_jni.la
+endif
+
 libopensles_android_plugin_la_SOURCES = audio_output/android/opensles.c
-libopensles_android_plugin_la_LIBADD = libandroid_utils.la $(LIBDL) $(LIBM)
+libopensles_android_plugin_la_LIBADD = libandroid_env.la $(LIBDL) $(LIBM)
 
 libandroid_audiotrack_plugin_la_SOURCES = audio_output/android/audiotrack.c 
audio_output/android/device.h
-libandroid_audiotrack_plugin_la_LIBADD = libandroid_utils.la
+libandroid_audiotrack_plugin_la_LIBADD = libandroid_env.la \
+   libvlc_android_audioformat_jni.la \
+   libvlc_android_dynamic

[vlc-commits] [Git][videolan/vlc][master] 13 commits: android: display: reorder to avoid forward declarations

2023-03-07 Thread Thomas Guillem (@tguillem)


Thomas Guillem pushed to branch master at VideoLAN / VLC


Commits:
65f1716f by Thomas Guillem at 2023-03-07T10:27:37+00:00
android: display: reorder to avoid forward declarations

No functional changes.

- - - - -
46e666ce by Thomas Guillem at 2023-03-07T10:27:37+00:00
android: display: remove the "android-display-chroma" option

- - - - -
37bd843d by Thomas Guillem at 2023-03-07T10:27:37+00:00
android: display: remove unused define

- - - - -
a44e152f by Thomas Guillem at 2023-03-07T10:27:37+00:00
android: display: disable software rendering

Software rendering is done via OpenGL.

Subtitles are still rendered via the native_window_api_t API.

- - - - -
eb0321af by Thomas Guillem at 2023-03-07T10:27:37+00:00
android: display: remove unused p_jsurface

- - - - -
c612e9d2 by Thomas Guillem at 2023-03-07T10:27:37+00:00
Revert "vout/android: display: clear surface with OpenGL"

This reverts commit e66c9b7c6b7cd356df6cad1b5579e2e5d3ba905b and
158ab9157f1eef7258e2ad326b0ff1192c1ebdc8.

Fixes #26976

- - - - -
c81a0d74 by Thomas Guillem at 2023-03-07T10:27:37+00:00
android: window: reorder code to avoid forward declaration

Also remove useless comments.

No functional changes.

- - - - -
e46dcf5b by Thomas Guillem at 2023-03-07T10:27:37+00:00
window: android: specify the surface id

This will allow to use EGL on the subtitle surface.

No functional changes.

- - - - -
e6b31327 by Thomas Guillem at 2023-03-07T10:27:37+00:00
android: display: use new setVideoLayout API

That add the ability to update only size, crop or sar.

- - - - -
29a2a1e8 by Thomas Guillem at 2023-03-07T10:27:37+00:00
android: display: rename p_awh

- - - - -
fea2930b by Thomas Guillem at 2023-03-07T10:27:37+00:00
android: display: remove subtitle support

- - - - -
a77fb96f by Thomas Guillem at 2023-03-07T10:27:37+00:00
android: display: add OpenGL subtitles support

- - - - -
f907ad15 by Thomas Guillem at 2023-03-07T10:27:37+00:00
android: display: only draw subpictures when needed

This avoid to acquire the GL context and swap. This can save 4-10ms when
not displaying any subtitles.

- - - - -


5 changed files:

- include/vlc_window.h
- modules/video_output/Makefile.am
- modules/video_output/android/display.c
- modules/video_output/android/window.c
- modules/video_output/opengl/egl.c


Changes:

=
include/vlc_window.h
=
@@ -394,7 +394,7 @@ typedef struct vlc_window {
 void *hwnd;  /**< Win32 window handle */
 uint32_t xid;/**< X11 windows ID */
 void *nsobject;  /**< macOS/iOS view object */
-void *anativewindow; /**< Android native window */
+int  android_id; /**< AWindow_ID */
 struct wl_surface *wl;   /**< Wayland surface (client pointer) */
 void *dcomp_visual;  /**<  Win32 direct composition visual */
 uint32_t crtc;   /**< KMS CRTC identifier */
@@ -413,6 +413,7 @@ typedef struct vlc_window {
 struct wl_display *wl; /**< Wayland display (client pointer) */
 void* dcomp_device; /**< DirectComposition device */
 int  drm_fd; /**< KMS DRM device */
+void* anativewindow; /**< Android native window */
 } display;
 
 const struct vlc_window_operations *ops; /**< operations handled by the


=
modules/video_output/Makefile.am
=
@@ -304,7 +304,8 @@ libandroid_window_plugin_la_SOURCES = 
video_output/android/window.c \
 libandroid_window_plugin_la_LIBADD = libandroid_utils.la $(LIBDL)
 
 libandroid_display_plugin_la_SOURCES = video_output/android/display.c
-libandroid_display_plugin_la_LIBADD = libandroid_utils.la $(LIBDL)
+libandroid_display_plugin_la_CFLAGS = $(AM_CFLAGS) $(GLES2_CFLAGS) 
-DUSE_OPENGL_ES2
+libandroid_display_plugin_la_LIBADD = libvlc_opengles.la
 
 libglinterop_android_plugin_la_SOURCES = video_output/opengl/interop_android.c 
\
video_output/opengl/interop.h


=
modules/video_output/android/display.c
=
@@ -31,891 +31,429 @@
 #include 
 #include 
 #include 
-#include 
-#include 
-
-#include  /* for ClearSurface */
-#include   /* for ClearSurface */
-
-#include 
 
+#include 
+#include 
 #include "utils.h"
+#include "../opengl/gl_api.h"
+#include "../opengl/sub_renderer.h"
 
-/*
- * Module descriptor
- */
-#define USE_ANWP
-#define CHROMA_TEXT "Chroma used"
-#define CHROMA_LONGTEXT \
-"Force use of a specific chroma for output. Default is RGB32."
-
-#define CFG_PREFIX "android-display-"
-static int Open(vout_display_t *vd,
-video_format_t *fmtp, vlc_video_context *context);
-static void Close(vout_display_t *vd);
-static void SubpicturePrepare(vout_display_t *vd, subpicture_

[vlc-commits] [Git][videolan/libvlcpp][master] Media: Remove `thumbnailRequestCancel`

2023-01-30 Thread Thomas Guillem (@tguillem)


Thomas Guillem pushed to branch master at VideoLAN / libvlcpp


Commits:
e1a03b37 by Alaric Senat at 2023-01-30T14:16:44+01:00
Media: Remove `thumbnailRequestCancel`

Cancelling usage have been merged with `thumbnailRequestDestroy`.

Refs videolan/vlc!3153

- - - - -


1 changed file:

- vlcpp/Media.hpp


Changes:

=
vlcpp/Media.hpp
=
@@ -933,18 +933,12 @@ public:
 }
 
 /**
- * @brief thumbnailCancel cancels a thumbnailing request
+ * @brief thumbnailRequestDestroy Destroy and cancel a thumbnailing request
  * @param request An opaque thumbnail request object.
  *
- * Cancelling the request will still cause onThumbnailGenerated callback
- * to be invoked, with nullptr as the picture instance.
- * If the request is cancelled after its completion, the behavior is 
undefined.
+ * This will also cancel the thumbnail request, no events will be emitted 
after
+ * this call.
  */
-void thumbnailRequestCancel( ThumbnailRequest* request )
-{
-libvlc_media_thumbnail_request_cancel( request );
-}
-
 void thumbnailRequestDestroy( ThumbnailRequest* request )
 {
 libvlc_media_thumbnail_request_destroy( request );



View it on GitLab: 
https://code.videolan.org/videolan/libvlcpp/-/commit/e1a03b37cb104f4086e2a49aedc18339f31b4d6c

-- 
View it on GitLab: 
https://code.videolan.org/videolan/libvlcpp/-/commit/e1a03b37cb104f4086e2a49aedc18339f31b4d6c
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] [Git][videolan/libvlcpp][master] MediaPlayer: adapt with recent LibVLC changes

2022-12-13 Thread Thomas Guillem (@tguillem)


Thomas Guillem pushed to branch master at VideoLAN / libvlcpp


Commits:
0116906d by Thomas Guillem at 2022-12-13T11:44:32+01:00
MediaPlayer: adapt with recent LibVLC changes

Replace libvlc_audio_XXX_channel with libvlc_audio_XXX_stereomode

The values come from an enum and are mostly compatible with older values.

Add mixMode/setMixMode functions.

- - - - -


2 changed files:

- .gitlab-ci.yml
- vlcpp/MediaPlayer.hpp


Changes:

=
.gitlab-ci.yml
=
@@ -1,6 +1,6 @@
 variables:
   VLC30_IMAGE: registry.videolan.org/medialibrary:20201009131431
-  VLC40_IMAGE: registry.videolan.org/libvlcpp-unstable:20220727093032
+  VLC40_IMAGE: registry.videolan.org/libvlcpp-unstable:20221213095400
 
 .common_build:
   rules:


=
vlcpp/MediaPlayer.hpp
=
@@ -1032,7 +1032,6 @@ public:
 {
 return libvlc_audio_set_track(*this, i_track) == 0;
 }
-#endif
 
 /**
  * Get current audio channel.
@@ -1057,6 +1056,47 @@ public:
 {
 return libvlc_audio_set_channel(*this, channel) == 0;
 }
+#else // libvlc 4.0
+/**
+ * Get current audio stereo mode.
+ *
+ * \return the audio stereo mode
+ */
+libvlc_audio_output_stereomode_t stereoMode()
+{
+return libvlc_audio_get_stereomode(*this);
+}
+
+/**
+ * Set current audio stereo mode.
+ *
+ * \param mode the audio stereo mode
+ */
+bool setStereoMode(libvlc_audio_output_stereomode_t mode)
+{
+return libvlc_audio_set_stereomode(*this, mode) == 0;
+}
+
+/**
+ * Get current audio mix mode.
+ *
+ * \return the audio mix mode
+ */
+libvlc_audio_output_mixmode_t mixMode()
+{
+return libvlc_audio_get_mixmode(*this);
+}
+
+/**
+ * Set current audio mix mode.
+ *
+ * \param mode the audio mix mode
+ */
+bool setMixMode(libvlc_audio_output_mixmode_t mode)
+{
+return libvlc_audio_set_mixmode(*this, mode) == 0;
+}
+#endif // libvlc 4.0
 
 /**
  * Get current audio delay.



View it on GitLab: 
https://code.videolan.org/videolan/libvlcpp/-/commit/0116906d78ef4d8a02c38ff51e83cfb48923a017

-- 
View it on GitLab: 
https://code.videolan.org/videolan/libvlcpp/-/commit/0116906d78ef4d8a02c38ff51e83cfb48923a017
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] [Git][videolan/vlc][master] 2 commits: modules: remove the directsound plugin

2022-09-16 Thread Thomas Guillem (@tguillem)


Thomas Guillem pushed to branch master at VideoLAN / VLC


Commits:
e529574d by Thomas Guillem at 2022-09-16T08:09:34+00:00
modules: remove the directsound plugin

DirectSound is obsolete after Windows 7.
VLC 4.0 will target Windows 7.

Fixes #27321

- - - - -
5372eef6 by Thomas Guillem at 2022-09-16T08:09:34+00:00
qt: remove the directsound preferences

Refs #27321

- - - - -


5 changed files:

- NEWS
- modules/audio_output/Makefile.am
- − modules/audio_output/directsound.c
- modules/gui/qt/dialogs/preferences/simple_preferences.cpp
- po/POTFILES.in


Changes:

=
NEWS
=
@@ -33,6 +33,7 @@ Core:
 Audio output:
  * ALSA: HDMI passthrough support.
Use --alsa-passthrough to configure S/PDIF or HDMI passthrough.
+ * Remove the DirectSound plugin (API obsolete after Windows 7)
 
 Demuxer:
  * Support for HEIF image and grid image formats


=
modules/audio_output/Makefile.am
=
@@ -73,13 +73,6 @@ aout_LTLIBRARIES += libwinstore_plugin.la
 endif
 endif
 
-libdirectsound_plugin_la_SOURCES = audio_output/directsound.c \
-   audio_output/windows_audio_common.h
-libdirectsound_plugin_la_LIBADD = -ldsound $(LIBCOM)
-if HAVE_WIN32_DESKTOP
-aout_LTLIBRARIES += libdirectsound_plugin.la
-endif
-
 libkai_plugin_la_SOURCES = audio_output/kai.c
 libkai_plugin_la_LIBADD = $(KAI_LIBS)
 if HAVE_KAI


=
modules/audio_output/directsound.c deleted
=
@@ -1,1175 +0,0 @@
-/*
- * directsound.c: DirectSound audio output plugin for VLC
- *
- * Copyright (C) 2001-2009 VLC authors and VideoLAN
- *
- * Authors: Gildas Bazin 
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program 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 Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation, 
Inc.,
- * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- */
-
-/*
- * Preamble
- */
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include 
-#include 
-
-#include 
-#include 
-#include 
-#include 
-
-#include "audio_output/windows_audio_common.h"
-#include "audio_output/mmdevice.h"
-#include 
-
-#define DS_BUF_SIZE (6*1024*1024)
-
-static int  Open( vlc_object_t * );
-static void Close( vlc_object_t * );
-static HRESULT StreamStart( aout_stream_t *, audio_sample_format_t *,
-const GUID * );
-static void * PlayedDataEraser( void * );
-/* Speaker setup override options list */
-static const char *const speaker_list[] = { N_("Windows default"), N_("Mono"), 
N_("Stereo"),
-N_("Quad"), N_("5.1"), N_("7.1") };
-
-/*
- * Module descriptor
- */
-#define DEVICE_TEXT N_("Output device")
-#define DEVICE_LONGTEXT N_("Select your audio output device")
-
-#define SPEAKER_TEXT N_("Speaker configuration")
-#define SPEAKER_LONGTEXT N_("Select speaker configuration you want to use. " \
-"This option doesn't upmix! So NO e.g. Stereo -> 5.1 conversion." )
-
-#define VOLUME_TEXT N_("Audio volume")
-#define VOLUME_LONGTEXT N_("Audio volume in hundredths of decibels (dB).")
-
-vlc_module_begin ()
-set_description( N_("DirectX audio output") )
-set_shortname( "DirectX" )
-set_capability( "audio output", 100 )
-set_subcategory( SUBCAT_AUDIO_AOUT )
-add_shortcut( "directx", "aout_directx", "directsound", "dsound" )
-
-add_string( "directx-audio-device", NULL,
- DEVICE_TEXT, DEVICE_LONGTEXT )
-add_bool( "directx-audio-float32", true, FLOAT_TEXT,
-  FLOAT_LONGTEXT )
-add_string( "directx-audio-speaker", "Windows default",
- SPEAKER_TEXT, SPEAKER_LONGTEXT )
-change_string_list( speaker_list, speaker_list )
-add_float( "directx-volume", 1.0f,
- VOLUME_TEXT, VOLUME_LONGTEXT )
-change_float_range( 0.f, 2.f )
-
-set_cal

[vlc-commits] [Git][videolan/vlc][master] 3 commits: pulse: get pa_timing_info once

2022-09-15 Thread Thomas Guillem (@tguillem)


Thomas Guillem pushed to branch master at VideoLAN / VLC


Commits:
c96003ac by Thomas Guillem at 2022-09-15T09:41:26+00:00
pulse: get pa_timing_info once

And always check if valid.

- - - - -
d2b51cd9 by Thomas Guillem at 2022-09-15T09:41:26+00:00
pulse: check for write_index_corrupt

Like it was done in the previous TimeGet() (via vlc_pa_get_latency()).

- - - - -
dc40e5f3 by Thomas Guillem at 2022-09-15T09:41:26+00:00
pulse: don't report timing if paused

Fixes #27137

- - - - -


1 changed file:

- modules/audio_output/pulse.c


Changes:

=
modules/audio_output/pulse.c
=
@@ -310,6 +310,16 @@ static void stream_latency_cb(pa_stream *s, void *userdata)
 if (pa_stream_is_corked(s) > 0)
 stream_start(s, aout, sys->last_date);
 
+const pa_timing_info *ti = pa_stream_get_timing_info(s);
+if (unlikely(ti == NULL) || !ti->playing)
+return;
+
+if (ti->write_index_corrupt)
+{
+msg_Dbg(aout, "write index corrupt");
+return;
+}
+
 if (pa_stream_is_corked(s) == 0)
 {
 pa_usec_t rt;
@@ -319,7 +329,6 @@ static void stream_latency_cb(pa_stream *s, void *userdata)
 {
 /* Subtract the timestamp of the timing_info from the monotonic
  * time */
-const pa_timing_info *ti = pa_stream_get_timing_info(s);
 pa_usec_t ti_age_us = pa_timeval_age(&ti->timestamp);
 vlc_tick_t system_ts = vlc_tick_now()
  - VLC_TICK_FROM_US(ti_age_us);
@@ -336,9 +345,7 @@ static void stream_latency_cb(pa_stream *s, void *userdata)
  * transport_usec, sink_usec), but the current read index
  * should always be superior or equal. */
 const pa_sample_spec *ss = pa_stream_get_sample_spec(s);
-const pa_timing_info *ti = pa_stream_get_timing_info(s);
-if (ti != NULL && !ti->read_index_corrupt)
-assert(pa_bytes_to_usec(ti->read_index, ss) >= 
sys->flush_rt);
+assert(pa_bytes_to_usec(ti->read_index, ss) >= sys->flush_rt);
 }
 #endif
 }



View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/compare/0773a89ed61faf9a933d4c715d2773d71e866598...dc40e5f3aee4b493e97122db8498a188764420b7

-- 
View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/compare/0773a89ed61faf9a933d4c715d2773d71e866598...dc40e5f3aee4b493e97122db8498a188764420b7
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits

[vlc-commits] [Git][videolan/vlc][master] decoder: fix aout_stream_NotifyLatency data-races

2022-08-11 Thread Thomas Guillem (@tguillem)


Thomas Guillem pushed to branch master at VideoLAN / VLC


Commits:
839dee68 by Thomas Guillem at 2022-08-12T05:44:30+00:00
decoder: fix aout_stream_NotifyLatency data-races

Fixes #27204

- - - - -


1 changed file:

- src/input/decoder.c


Changes:

=
src/input/decoder.c
=
@@ -132,6 +132,7 @@ struct vlc_input_decoder_t
 /* If p_aout is valid, then p_astream is valid too */
 audio_output_t *p_aout;
 vlc_aout_stream *p_astream;
+bool b_astream_update_latency;
 
 vout_thread_t   *p_vout;
 bool vout_started;
@@ -270,6 +271,7 @@ static int DecoderThread_Reload( vlc_input_decoder_t 
*p_owner,
 // no need to lock, the decoder and ModuleThread are dead
 p_owner->p_aout = NULL;
 p_owner->p_astream = NULL;
+p_owner->b_astream_update_latency = false;
 if( p_aout )
 {
 assert( p_astream );
@@ -343,7 +345,12 @@ static void aout_stream_NotifyLatency(void *data)
 {
 /* Wake the DecoderThread in order to update the audio latency via
  * vlc_aout_stream_UpdateLatency() */
-vlc_fifo_Signal(data);
+vlc_input_decoder_t *owner = data;
+
+vlc_fifo_Lock(owner->p_fifo);
+owner->b_astream_update_latency = true;
+vlc_fifo_Signal(owner->p_fifo);
+vlc_fifo_Unlock(owner->p_fifo);
 }
 
 static int ModuleThread_UpdateAudioFormat( decoder_t *p_dec )
@@ -362,6 +369,7 @@ static int ModuleThread_UpdateAudioFormat( decoder_t *p_dec 
)
 vlc_mutex_lock( &p_owner->lock );
 p_owner->p_astream = NULL;
 p_owner->p_aout = NULL; // the DecoderThread should not use the old 
aout anymore
+p_owner->b_astream_update_latency = false;
 vlc_mutex_unlock( &p_owner->lock );
 vlc_aout_stream_Delete( p_astream );
 
@@ -410,7 +418,7 @@ static int ModuleThread_UpdateAudioFormat( decoder_t *p_dec 
)
 .str_id = p_owner->psz_id,
 .replay_gain = &p_dec->fmt_out.audio_replay_gain,
 .notify_latency_cb = aout_stream_NotifyLatency,
-.notify_latency_data = p_owner->p_fifo,
+.notify_latency_data = p_owner,
 };
 p_astream = vlc_aout_stream_New( p_aout, &cfg );
 if( p_astream == NULL )
@@ -1620,6 +1628,20 @@ static void DecoderThread_ChangeRate( 
vlc_input_decoder_t *p_owner, float rate )
 vlc_mutex_unlock( &p_owner->lock );
 }
 
+static void DecoderThread_UpdateAudioLatency( vlc_input_decoder_t *p_owner )
+{
+decoder_t *p_dec = &p_owner->dec;
+
+/* Update the audio latency after a possible long wait in order to update
+ * the audio clock as soon as possible. */
+assert( p_dec->fmt_in.i_cat == AUDIO_ES );
+
+vlc_mutex_lock( &p_owner->lock );
+if( p_owner->p_astream != NULL )
+vlc_aout_stream_UpdateLatency( p_owner->p_astream );
+vlc_mutex_unlock( &p_owner->lock );
+}
+
 static void DecoderThread_ChangeDelay( vlc_input_decoder_t *p_owner, 
vlc_tick_t delay )
 {
 decoder_t *p_dec = &p_owner->dec;
@@ -1726,6 +1748,16 @@ static void *DecoderThread( void *p_data )
 continue;
 }
 
+if( p_owner->b_astream_update_latency )
+{
+vlc_fifo_Unlock( p_owner->p_fifo );
+
+DecoderThread_UpdateAudioLatency( p_owner );
+
+vlc_fifo_Lock( p_owner->p_fifo );
+p_owner->b_astream_update_latency = false;
+}
+
 if( rate != p_owner->request_rate )
 {
 rate = p_owner->request_rate;
@@ -1767,13 +1799,6 @@ static void *DecoderThread( void *p_data )
 p_owner->b_idle = true;
 vlc_cond_signal( &p_owner->wait_acknowledge );
 vlc_fifo_Wait( p_owner->p_fifo );
-
-/* Update the audio latency after a possible long wait in order
- * to update the audio clock as soon as possible. */
-if( p_owner->dec.fmt_in.i_cat == AUDIO_ES &&
-p_owner->p_astream != NULL )
-vlc_aout_stream_UpdateLatency( p_owner->p_astream );
-
 p_owner->b_idle = false;
 continue;
 }
@@ -1877,6 +1902,7 @@ CreateDecoder( vlc_object_t *p_parent, const struct 
vlc_input_decoder_cfg *cfg )
 p_owner->cbs_userdata = cfg->cbs_data;
 p_owner->p_aout = NULL;
 p_owner->p_astream = NULL;
+p_owner->b_astream_update_latency = false;
 p_owner->p_vout = NULL;
 p_owner->vout_started = false;
 p_owner->i_spu_channel = VOUT_SPU_CHANNEL_INVALID;



View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/commit/839dee68cacef9bf6af57b71af40e415f98362ce

-- 
View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/commit/839dee68cacef9bf6af57b71af40e415f98362ce
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance___
vlc-commits mail

[vlc-commits] [Git][videolan/vlc][master] 17 commits: threads: add queued mutex objects

2022-08-08 Thread Thomas Guillem (@tguillem)


Thomas Guillem pushed to branch master at VideoLAN / VLC


Commits:
943ba827 by Rémi Denis-Courmont at 2022-08-08T20:36:51+02:00
threads: add queued mutex objects

- - - - -
c49d6438 by Denis Charmet at 2022-08-08T20:36:51+02:00
threads: add vlc_queuedmutex_held()

- - - - -
fbb50c15 by Denis Charmet at 2022-08-08T20:39:57+02:00
vout: switch display_lock to vlc_queuedmutex_t for fairness

- - - - -
fbf2de8d by Denis Charmet at 2022-08-08T20:40:01+02:00
vout: protect clock with an independant vlc_mutex_t

- - - - -
316fb563 by Romain Vimont at 2022-08-08T20:40:01+02:00
vout: interrupt wait on UI resize request

On resize, the UI thread waits for the end of any current rendering at
the old size before returning.

To limit its waiting, interrupt the wait between prepare() and display()
on the vout thread to complete the rendering as soon as possible. As a
consequence, the display() call might be performed early (before its
expected PTS).

Refs !324

- - - - -
37d7278d by Romain Vimont at 2022-08-08T20:40:01+02:00
vout: re-render ASAP after interruption

If vlc_clock_Wait() has been interrupted to release the display_lock
quickly, then the next rendering must be performed ASAP, without waiting
for any deadline.

- - - - -
4f8e91bb by Denis Charmet at 2022-08-08T20:40:01+02:00
vout: interrupt wait on UI viewpoint request

- - - - -
7c49e1c4 by Denis Charmet at 2022-08-08T20:40:01+02:00
input: compress viewpoint input events

- - - - -
ce96e232 by Denis Charmet at 2022-08-08T20:40:01+02:00
vout: add resize compressor helper

- - - - -
97f42e53 by Denis Charmet at 2022-08-08T20:40:01+02:00
vout: win32: asynchronously resize window

- - - - -
5aabba88 by Denis Charmet at 2022-08-08T20:40:01+02:00
vout: win32: asynchronously resize drawable

- - - - -
2cdfdf51 by Denis Charmet at 2022-08-08T20:40:01+02:00
qt: asynchronously resize windows

While this reverts 721a085d766a7e4faa796c4ac81dab0e02682a74
ReportSize is effectively called from another thread context.
It greatly improves resize reactivity.

- - - - -
b20aa073 by Denis Charmet at 2022-08-08T20:40:02+02:00
skins2: add vout window asynchronous resize

- - - - -
34f09854 by Denis Charmet at 2022-08-08T20:40:02+02:00
vout: macosx: compress vout window resize events

- - - - -
da46c38e by Denis Charmet at 2022-08-08T20:40:02+02:00
vout: android: asynchronously resize vout window

- - - - -
4e588c6e by Denis Charmet at 2022-08-08T20:40:02+02:00
vout: apple: asynchronously resize VideoUIView

- - - - -
56918c6c by Denis Charmet at 2022-08-09T02:10:52+02:00
xcb: compress resize events

- - - - -


17 changed files:

- include/vlc_threads.h
- modules/gui/qt/maininterface/videosurface.cpp
- modules/gui/qt/maininterface/videosurface.hpp
- modules/gui/skins2/Makefile.am
- modules/gui/skins2/src/vout_window.cpp
- modules/gui/skins2/src/vout_window.hpp
- modules/video_output/Makefile.am
- modules/video_output/android/window.c
- modules/video_output/apple/VLCVideoUIView.m
- + modules/video_output/wasync_resize_compressor.h
- modules/video_output/win32/drawable.c
- modules/video_output/win32/window.c
- modules/video_output/window_macosx.m
- modules/video_output/xcb/window.c
- src/input/input.c
- src/misc/threads.c
- src/video_output/video_output.c


Changes:

=
include/vlc_threads.h
=
@@ -561,6 +561,50 @@ VLC_API void vlc_latch_wait(vlc_latch_t *);
 
 /** @} */
 
+/*
+ * Queued mutex
+ *
+ * A queued mutex is a type of thread-safe mutual exclusion lock that is
+ * acquired in strict FIFO order.
+ *
+ * In most cases, a regular mutex (\ref vlc_mutex_t) should be used instead.
+ * There are important differences:
+ * - A queued mutex is generally slower, especially on the fast path.
+ * - A queued mutex cannot be combined with a condition variable.
+ *   Indeed, the scheduling policy of the condition variable would typically
+ *   conflict with that of the queued mutex, leading to a dead lock.
+ * - The try-lock operation is not implemented.
+ */
+typedef struct {
+atomic_uint head;
+atomic_uint tail;
+atomic_ulong owner;
+} vlc_queuedmutex_t;
+
+#define VLC_STATIC_QUEUEDMUTEX { ATOMIC_VAR_INIT(0), ATOMIC_VAR_INIT(0), 
ATOMIC_VAR_INIT(0) }
+
+void vlc_queuedmutex_init(vlc_queuedmutex_t *m);
+
+void vlc_queuedmutex_lock(vlc_queuedmutex_t *m);
+
+void vlc_queuedmutex_unlock(vlc_queuedmutex_t *m);
+
+/**
+ * Checks if a queued mutex is locked.
+ *
+ * This function checks if the calling thread holds a given queued mutual
+ * exclusion lock. It has no side effects and is essentially intended for
+ * run-time debugging.
+ *
+ * @note To assert that the calling thread holds a lock, the helper macro
+ * vlc_queuedmutex_assert() should be used instead of this function.
+ *
+ * @retval false the mutex is not locked by the calling thread
+ * @retval true the mutex is locked by the calling thread
+ */
+bool vlc_queuedmutex_held(vlc_queuedmutex_t *m);
+
+#define vlc_queuedmutex_assert(m) assert(vlc_queu

[vlc-commits] [Git][videolan/vlc][master] 12 commits: vlc_fixups: don't declare swab() on Android NDK25

2022-08-03 Thread Thomas Guillem (@tguillem)


Thomas Guillem pushed to branch master at VideoLAN / VLC


Commits:
d5e1dd70 by Thomas Guillem at 2022-08-03T07:18:28+00:00
vlc_fixups: don't declare swab() on Android NDK25

Fix build on Android NDK25, where swab() is a static inline function
defined in .

- - - - -
9e4252a5 by Thomas Guillem at 2022-08-03T07:18:28+00:00
contrib: x264: with build with Android NDK25

Cross tools changed from ${ARCH}-linux-android${API}-${TOOL} to
llvm-${TOOL).

Example: aarch64-linux-android21-strings to llvm-strings.

- - - - -
b10f0705 by Thomas Guillem at 2022-08-03T07:18:28+00:00
contrib: libplacebo: fix build with Android NDK25

execinfo.h is present but not necessary the functions (backtrace())
since it depends on the configured ANDROID_API.

It's not a clean and "upstreamable" patch, but the execinfo code 
is gone
upstream, so this patch is only temporary.

- - - - -
03f8817f by Thomas Guillem at 2022-08-03T07:18:28+00:00
contrib: gnutls: fix build with Android NDK25

It needs the same patch than appleos. Maybe we should check for
aarch64 instead.

- - - - -
e196a6ff by Thomas Guillem at 2022-08-03T07:18:28+00:00
contrib: rav1e: fix build on Android NDK25

I have absolutely no idea where "lgcc" is added between 
rav1e/cargo/cargo-c.

- - - - -
74222f93 by Thomas Guillem at 2022-08-03T07:18:28+00:00
contrib: libaribcaption: update Hash

 - Fix Android build with NDK25
 - Fix va_list reuse
 - Add aribcc_renderer_set_merge_region_images()
 - Add aribcc_renderer_try_render()

- - - - -
7be5d4d8 by Thomas Guillem at 2022-08-03T07:18:28+00:00
contrib: vpx: fix build with NDK25

Disable neon_asm since it rely on arm-linux-androideabi-as (removed in
NDK25).

Temporary commit.

- - - - -
46dcd6ea by Thomas Guillem at 2022-08-03T07:18:28+00:00
contrib: ffmpeg: fix relocation out of range error on AArch64

ld: error: 
/home/tom/work/git/vlc-android/vlc/contrib/aarch64-linux-android/lib/libavcodec.a(videodsp.o):(function
 ff_prefetch_aarch64: .text+0x10): relocation R_AARCH64_CONDBR19 out of range: 
13363404 is not in [-1048576, 1048575]; references ff_prefetch_aarch64
>>> referenced by videodsp.S:26 (libavcodec/aarch64/videodsp.S:26)
>>> defined in 
/home/tom/work/git/vlc-android/vlc/contrib/aarch64-linux-android/lib/libavcodec.a(videodsp.o)
clang++: error: linker command failed with exit code 1 (use -v to see 
invocation)

Backport an existing patch from the master branch.

- - - - -
96b76894 by Thomas Guillem at 2022-08-03T07:18:28+00:00
contrib: ffmpeg: enable back x86_64 asm on Android

Since relocation issues are now fixed.

- - - - -
047cc58a by Thomas Guillem at 2022-08-03T07:18:28+00:00
contrib: x264: enable back x86_64 asm on Android

Since relocation issues are now fixed.

- - - - -
4386bd5f by Thomas Guillem at 2022-08-03T07:18:28+00:00
contrib: vpx: enable back i386/x86_64 asm on Android

Since relocation issues are now fixed.

- - - - -
488ee616 by Thomas Guillem at 2022-08-03T07:18:28+00:00
ci: android: use last image and last build script

Last image that contains the NDK25.

- - - - -


11 changed files:

- + contrib/src/ffmpeg/0001-lavc-aarch64-fix-relocation-out-of-range-error.patch
- contrib/src/ffmpeg/rules.mak
- contrib/src/gnutls/rules.mak
- contrib/src/libaribcaption/rules.mak
- + contrib/src/libplacebo/fix-android-build.patch
- contrib/src/libplacebo/rules.mak
- contrib/src/rav1e/rules.mak
- contrib/src/vpx/rules.mak
- contrib/src/x264/rules.mak
- extras/ci/gitlab-ci.yml
- include/vlc_fixups.h


Changes:

=
contrib/src/ffmpeg/0001-lavc-aarch64-fix-relocation-out-of-range-error.patch
=
@@ -0,0 +1,35 @@
+From 378ad2f8fd7c5b5d9d1b3170282ce6b8a289ba07 Mon Sep 17 00:00:00 2001
+From: Zhao Zhili 
+Date: Mon, 13 Sep 2021 15:24:09 +0800
+Subject: [PATCH] lavc/aarch64: fix relocation out of range error
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Use a temporary label instead of global function symbol for b.gt.
+
+Signed-off-by: Martin Storsjö 
+---
+ libavcodec/aarch64/videodsp.S | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/libavcodec/aarch64/videodsp.S b/libavcodec/aarch64/videodsp.S
+index 24067cc2af..fe2da0658e 100644
+--- a/libavcodec/aarch64/videodsp.S
 b/libavcodec/aarch64/videodsp.S
+@@ -19,10 +19,11 @@
+ #include "libavutil/aarch64/asm.S"
+ 
+ function ff_prefetch_aarch64, export=1
++1:
+ subsw2,  w2,  #2
+ prfmpldl1strm, [x0]
+ prfmpldl1strm, [x0,  x1]
+ add x0,  x0,  x1,  lsl #1
+-b.gtX(ff_prefetch_aarch64)
++b.gt1b
+ ret
+ endfunc
+-- 
+2.35.1
+


=
contrib/src/ffmpeg/rules.mak
=
@@ -153,9 +153,6 @@ ifdef HAVE_ANDROID
 ifeq ($(ANDROID_ABI), x86)
 FFMPEGCONF +=  --disable-mmx --disable-mmxext --disable-inline-asm
 endif
-ifeq ($(ANDROID_ABI)

[vlc-commits] [Git][videolan/vlc][master] win32: timer: use threadpoolapiset.h

2022-07-13 Thread Thomas Guillem (@tguillem)


Thomas Guillem pushed to branch master at VideoLAN / VLC


Commits:
9fdd9fb1 by Thomas Guillem at 2022-07-13T10:39:51+00:00
win32: timer: use threadpoolapiset.h

New API: 
https://docs.microsoft.com/en-us/windows/win32/procthread/thread-pool-api

This avoid one allocation (that can fail) in vlc_timer_schedule() (that
was handled with a call to abort()).

One remark from the documentation: "If the due time specified by
pftDueTime is relative, the time that the system spends in sleep or
hibernation does not count toward the expiration of the timer. The timer
is signaled when the cumulative amount of elapsed time the system spends
in the waking state equals the timer's relative due time or period. If
the due time specified by pftDueTime is absolute, the time that the
system spends in sleep or hibernation does count toward the expiration
of the timer. If the timer expires while the system is sleeping, the
timer is signaled immediately when the system wakes."

For that reason, the vlc_timer API always use a absolute FILETIME in
SetThreadpoolTimer(). vlc_timer absolute ticks are substracted with
vlc_tick_now() and added to the absolute FILETIME.

- - - - -


1 changed file:

- src/win32/timer.c


Changes:

=
src/win32/timer.c
=
@@ -29,17 +29,19 @@
 
 struct vlc_timer
 {
-HANDLE handle;
+PTP_TIMER t;
 void (*func) (void *);
 void *data;
 };
 
-static void CALLBACK vlc_timer_do (void *val, BOOLEAN timeout)
+static VOID CALLBACK timer_callback(PTP_CALLBACK_INSTANCE instance,
+PVOID context, PTP_TIMER t)
 {
-struct vlc_timer *timer = val;
+(void) instance;
+(void) t; assert(t);
+struct vlc_timer *timer = context;
 
-assert (timeout);
-timer->func (timer->data);
+timer->func(timer->data);
 }
 
 int vlc_timer_create (vlc_timer_t *id, void (*func) (void *), void *data)
@@ -48,48 +50,79 @@ int vlc_timer_create (vlc_timer_t *id, void (*func) (void 
*), void *data)
 
 if (timer == NULL)
 return ENOMEM;
+timer->t = CreateThreadpoolTimer(timer_callback, timer, NULL);
+if (timer->t == NULL)
+{
+free(timer);
+return ENOMEM;
+}
+assert(func);
 timer->func = func;
 timer->data = data;
-timer->handle = INVALID_HANDLE_VALUE;
 *id = timer;
 return 0;
 }
 
 void vlc_timer_destroy (vlc_timer_t timer)
 {
-if (timer->handle != INVALID_HANDLE_VALUE)
-DeleteTimerQueueTimer (NULL, timer->handle, INVALID_HANDLE_VALUE);
-free (timer);
+SetThreadpoolTimer(timer->t, NULL, 0, 0);
+WaitForThreadpoolTimerCallbacks(timer->t, TRUE);
+CloseThreadpoolTimer(timer->t);
+free(timer);
 }
 
 void vlc_timer_schedule (vlc_timer_t timer, bool absolute,
  vlc_tick_t value, vlc_tick_t interval)
 {
-if (timer->handle != INVALID_HANDLE_VALUE)
+if (value == VLC_TIMER_DISARM)
 {
-DeleteTimerQueueTimer (NULL, timer->handle, INVALID_HANDLE_VALUE);
-timer->handle = INVALID_HANDLE_VALUE;
+SetThreadpoolTimer(timer->t, NULL, 0, 0);
+/* Cancel any pending callbacks */
+WaitForThreadpoolTimerCallbacks(timer->t, TRUE);
+return;
 }
-if (value == VLC_TIMER_DISARM)
-return; /* Disarm */
 
+/* Always use absolute FILETIME (positive) since "the time that the system
+ * spends in sleep or hibernation does count toward the expiration of the
+ * timer. */
+
+/* Convert the tick value to a relative tick. */
 if (absolute)
+value -= vlc_tick_now();
+if (value < 0)
+value = 0;
+
+/* Get the system FILETIME */
+FILETIME time;
+#if (_WIN32_WINNT >= _WIN32_WINNT_WIN8) && (!defined(VLC_WINSTORE_APP) || 
_WIN32_WINNT >= 0x0A00)
+GetSystemTimePreciseAsFileTime(&time);
+#else
+GetSystemTimeAsFileTime(&time);
+#endif
+
+/* Convert it to ULARGE_INTEGER to allow calculation (addition here) */
+ULARGE_INTEGER time_ul = {
+.LowPart = time.dwLowDateTime,
+.HighPart = time.dwHighDateTime,
+};
+
+/* Add the relative tick to the absolute time */
+time_ul.QuadPart += MSFTIME_FROM_VLC_TICK(value);
+
+/* Convert it back to a FILETIME*/
+time.dwLowDateTime = time_ul.u.LowPart;
+time.dwHighDateTime = time_ul.u.HighPart;
+
+DWORD intervaldw;
+if (interval == VLC_TIMER_FIRE_ONCE)
+intervaldw = 0;
+else
 {
-value -= vlc_tick_now ();
-if (value < 0)
-value = 0;
+uint64_t intervalms = MS_FROM_VLC_TICK(interval);
+intervaldw = unlikely(intervalms > UINT32_MAX) ? UINT32_MAX : 
intervalms;
 }
 
-DWORD val= MS_FROM_VLC_TICK(value);
-DWORD interv = MS_FROM_VLC_TICK(interval);
-if (val == 0 && value != 0)
-val = 1; /* rounding error */
-if (interv == 0 && interval != 0)
-interv = 1; /* rounding error */
-
-if (!CreateTimerQueueTimer(&timer->handle, NULL,

[vlc-commits] [Git][videolan/vlc][master] Revert "smb2: fix anonymous login"

2022-07-07 Thread Thomas Guillem (@tguillem)


Thomas Guillem pushed to branch master at VideoLAN / VLC


Commits:
06692b49 by Thomas Guillem at 2022-07-07T10:45:42+00:00
Revert "smb2: fix anonymous login"

This reverts commit 205963ad09401ab3cbe5bf92c7f9b109092f87f4.

According to git blame on libsmb2, anonymous login was always enabled
with a NULL password.

I don't know what happened when I tested this reverted commit, I may
have mix up VLC or/and smb/smb2/dsm builds.

For future reference, see libsmb2/lib/ntlmssp.c:
...
encode_ntlm_auth(...)
{
...
if (auth_data->password == NULL) {
anonymous = 1;
goto encode;
}
...
}

Fixes #27113

- - - - -


1 changed file:

- modules/access/smb2.c


Changes:

=
modules/access/smb2.c
=
@@ -687,8 +687,8 @@ vlc_smb2_connect_open_share(stream_t *access, const char 
*url,
 if (!username)
 {
 username = "Guest";
-/* An empty password enable ntlmssp anonymous login */
-password = "";
+/* A NULL password enable ntlmssp anonymous login */
+password = NULL;
 }
 
 struct vlc_access_cache_entry *cache_entry =



View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/commit/06692b49ceda37d05fb3e7764efbecf731a11773

-- 
View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/commit/06692b49ceda37d05fb3e7764efbecf731a11773
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits

[vlc-commits] [Git][videolan/vlc][master] 5 commits: smb2: vlc_smb2_resolve: return an error code

2022-06-07 Thread Thomas Guillem (@tguillem)


Thomas Guillem pushed to branch master at VideoLAN / VLC


Commits:
cbf16982 by Thomas Guillem at 2022-06-07T12:47:13+00:00
smb2: vlc_smb2_resolve: return an error code

- - - - -
99a4deaf by Thomas Guillem at 2022-06-07T12:47:13+00:00
smb2: forward the vlc_interrupt_unregister() return value

- - - - -
bb33734c by Thomas Guillem at 2022-06-07T12:47:13+00:00
smb2: vlc_smb2_resolve: return -EINTR when interrupted

- - - - -
fea7a18a by Thomas Guillem at 2022-06-07T12:47:13+00:00
smb2: handle vlc_smb2_resolve interruption

- - - - -
797e1f3b by Thomas Guillem at 2022-06-07T12:47:13+00:00
smb2: explicitly handle -EINTR

Even if it is redundant with vlc_killed() (but not all APIs return
-EINTR when killed).

- - - - -


1 changed file:

- modules/access/smb2.c


Changes:

=
modules/access/smb2.c
=
@@ -65,16 +65,26 @@ netbios_ns_interrupt_register(netbios_ns *ns)
 vlc_interrupt_register(netbios_ns_interrupt_callback, ns);
 }
 
-static inline void
+static inline int
 netbios_ns_interrupt_unregister(void)
 {
-vlc_interrupt_unregister();
+return vlc_interrupt_unregister();
 }
 
 #else
 
-#define netbios_ns_interrupt_register( ns ) do {} while (0)
-#define netbios_ns_interrupt_unregister() do {} while (0)
+static inline void
+netbios_ns_interrupt_register(netbios_ns *ns)
+{
+(void) ns;
+}
+
+static inline int
+netbios_ns_interrupt_unregister(void)
+{
+return 0;
+}
+
 #endif
 
 #endif
@@ -763,18 +773,19 @@ error:
 return op.error_status;
 }
 
-static char *
-vlc_smb2_resolve(stream_t *access, const char *host, unsigned port)
+static int
+vlc_smb2_resolve(stream_t *access, const char *host, unsigned port,
+ char **out_host)
 {
 (void) access;
 if (!host)
-return NULL;
+return -ENOENT;
 
 #ifdef HAVE_DSM
 /* Test if the host is an IP */
 struct in_addr addr;
 if (inet_pton(AF_INET, host, &addr) == 1)
-return NULL;
+return -ENOENT;
 
 /* Test if the host can be resolved */
 struct addrinfo *info = NULL;
@@ -782,28 +793,38 @@ vlc_smb2_resolve(stream_t *access, const char *host, 
unsigned port)
 {
 freeaddrinfo(info);
 /* Let smb2 resolve it */
-return NULL;
+return -ENOENT;
 }
 
 /* Test if the host is a netbios name */
-char *out_host = NULL;
 netbios_ns *ns = netbios_ns_new();
 if (!ns)
-return NULL;
+return -ENOMEM;
+
+int ret = -ENOENT;
 netbios_ns_interrupt_register(ns);
 uint32_t ip4_addr;
 if (netbios_ns_resolve(ns, host, NETBIOS_FILESERVER, &ip4_addr) == 0)
 {
 char ip[INET_ADDRSTRLEN];
 if (inet_ntop(AF_INET, &ip4_addr, ip, sizeof(ip)))
-out_host = strdup(ip);
+{
+*out_host = strdup(ip);
+ret = 0;
+}
+}
+if (netbios_ns_interrupt_unregister() == EINTR)
+{
+if (unlikely(ret == 0))
+free(*out_host);
+netbios_ns_destroy(ns);
+return -EINTR;
 }
-netbios_ns_interrupt_unregister();
 netbios_ns_destroy(ns);
-return out_host;
+return ret;
 #else
 (void) port;
-return NULL;
+return -ENOENT;
 #endif
 }
 
@@ -826,13 +847,16 @@ Open(vlc_object_t *p_obj)
 if (sys->encoded_url.psz_path == NULL)
 sys->encoded_url.psz_path = (char *) "/";
 
-char *resolved_host = vlc_smb2_resolve(access, sys->encoded_url.psz_host,
-   sys->encoded_url.i_port);
+char *resolved_host = NULL;
+ret = vlc_smb2_resolve(access, sys->encoded_url.psz_host,
+   sys->encoded_url.i_port, &resolved_host);
 
 /* smb2_* functions need a decoded url. Re compose the url from the
  * modified sys->encoded_url (with the resolved host). */
 char *url;
-if (resolved_host != NULL)
+if (ret == -EINTR)
+goto error;
+else if (ret == 0)
 {
 vlc_url_t resolved_url = sys->encoded_url;
 resolved_url.psz_host = resolved_host;
@@ -928,7 +952,7 @@ error:
  * case of network error (EIO) or when the user asked to cancel it
  * (vlc_killed()). Indeed, in these cases, it is useless to try next smb
  * modules. */
-return vlc_killed() || ret == -EIO ? VLC_ETIMEOUT : VLC_EGENERIC;
+return ret == -EINTR || ret == -EIO || vlc_killed() ? VLC_ETIMEOUT : 
VLC_EGENERIC;
 }
 
 static void



View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/compare/24aa25bdeec2c2f600d418450550456b295bcb4f...797e1f3b979fca463030608db1513a81228c624c

-- 
View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/compare/24aa25bdeec2c2f600d418450550456b295bcb4f...797e1f3b979fca463030608db1513a81228c624c
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.or

[vlc-commits] [Git][videolan/vlc][master] 4 commits: dsm: forward the vlc_interrupt_unregister() return value

2022-06-07 Thread Thomas Guillem (@tguillem)


Thomas Guillem pushed to branch master at VideoLAN / VLC


Commits:
26af6121 by Thomas Guillem at 2022-06-07T09:10:49+02:00
dsm: forward the vlc_interrupt_unregister() return value

- - - - -
bdc351df by Thomas Guillem at 2022-06-07T09:10:49+02:00
dsm: handle missing smb_session interruptions

- - - - -
30eb1b27 by Thomas Guillem at 2022-06-07T09:10:49+02:00
dsm: abort if netbios_ns_inverse is interrupted

- - - - -
7ea6ce34 by Thomas Guillem at 2022-06-07T09:10:49+02:00
contrib: libdsm: update to 0.4.3

Fix connect() not interruptible on Linux.

Fixes #27027

- - - - -


3 changed files:

- contrib/src/libdsm/SHA512SUMS
- contrib/src/libdsm/rules.mak
- modules/access/dsm/access.c


Changes:

=
contrib/src/libdsm/SHA512SUMS
=
@@ -1 +1 @@
-9ee82c8812a807054ebe3ceb2a6ba37c36d188052cfbd7f5ba5b435ede8f6bee09690fb0d0c94e1e4d0022bbbdfa2837f09c69ccc00d17f79efe002cc158825a
  libdsm-0.4.2.tar.xz
+4abe2318aa5d63397404ce87fc42be30d364dffef3bdf6e081a2bb3ac4f011f39fa8acb5ba06361e94795a308df321b077e7a3cf2ec10d5e1e6c9b912cbbd8ba
  libdsm-0.4.3.tar.xz


=
contrib/src/libdsm/rules.mak
=
@@ -1,6 +1,6 @@
 # libdsm
 
-LIBDSM_VERSION := 0.4.2
+LIBDSM_VERSION := 0.4.3
 LIBDSM_URL := 
https://github.com/videolabs/libdsm/releases/download/v$(LIBDSM_VERSION)/libdsm-$(LIBDSM_VERSION).tar.xz
 
 ifeq ($(call need_pkg,"libdsm >= 0.2.0"),)


=
modules/access/dsm/access.c
=
@@ -160,10 +160,10 @@ smb_session_interrupt_register( access_sys_t *sys )
 vlc_interrupt_register( smb_session_interrupt_callback, sys->p_session );
 }
 
-static inline void
+static inline int
 smb_session_interrupt_unregister( void )
 {
-vlc_interrupt_unregister();
+return vlc_interrupt_unregister();
 }
 
 static void
@@ -178,18 +178,37 @@ netbios_ns_interrupt_register( netbios_ns *ns )
 vlc_interrupt_register( netbios_ns_interrupt_callback, ns );
 }
 
-static inline void
+static inline int
 netbios_ns_interrupt_unregister( void )
 {
-vlc_interrupt_unregister();
+return vlc_interrupt_unregister();
 }
 
 #else
 
-#define smb_session_interrupt_register( sys ) do {} while (0)
-#define smb_session_interrupt_unregister() do {} while(0)
-#define netbios_ns_interrupt_register( ns ) do {} while (0)
-#define netbios_ns_interrupt_unregister() do {} while (0)
+static inline void
+smb_session_interrupt_register( access_sys_t *sys )
+{
+(void) sys;
+}
+
+static inline int
+smb_session_interrupt_unregister( void )
+{
+return 0;
+}
+
+static inline void
+netbios_ns_interrupt_register( netbios_ns *ns )
+{
+(void) ns;
+}
+
+static inline int
+netbios_ns_interrupt_unregister( void )
+{
+return 0;
+}
 
 #endif
 
@@ -250,11 +269,13 @@ static int Open( vlc_object_t *p_this )
 if( smb_stat_get( st, SMB_STAT_ISDIR ) )
 {
 smb_fclose( p_sys->p_session, p_sys->i_fd );
-smb_session_interrupt_unregister();
+if (smb_session_interrupt_unregister() == EINTR)
+goto error;
 return BrowserInit( p_access );
 }
 
-smb_session_interrupt_unregister();
+if (smb_session_interrupt_unregister() == EINTR)
+goto error;
 
 msg_Dbg( p_access, "Successfully opened smb://%s", p_access->psz_location 
);
 
@@ -337,7 +358,11 @@ static int get_address( stream_t *p_access )
 
 int ret = netbios_ns_resolve( p_ns, p_sys->url.psz_host,
   NETBIOS_FILESERVER, &ip4_addr);
-netbios_ns_interrupt_unregister();
+if (netbios_ns_interrupt_unregister() == EINTR)
+{
+netbios_ns_destroy( p_ns );
+return -EINTR;
+}
 netbios_ns_destroy( p_ns );
 
 if( ret == 0 )
@@ -374,6 +399,11 @@ static int get_address( stream_t *p_access )
 const char *psz_nbt = netbios_ns_inverse( p_ns, p_sys->addr.s_addr );
 
 netbios_ns_interrupt_unregister();
+if (netbios_ns_interrupt_unregister() == EINTR)
+{
+netbios_ns_destroy( p_ns );
+return -EINTR;
+}
 netbios_ns_destroy( p_ns );
 
 if( psz_nbt != NULL )
@@ -511,7 +541,8 @@ static int login( stream_t *p_access )
 goto error;
 }
 
-smb_session_interrupt_unregister();
+if (smb_session_interrupt_unregister() == EINTR)
+goto error;
 
 if( connect_err == EACCES )
 {
@@ -676,7 +707,8 @@ static ssize_t Read( stream_t *p_access, void *p_buffer, 
size_t i_len )
 
 smb_session_interrupt_register( p_sys );
 i_read = smb_fread( p_sys->p_session, p_sys->i_fd, p_buffer, i_len );
-smb_session_interrupt_unregister();
+if (smb_session_interrupt_unregister() == EINTR)
+errno = EINTR;
 
 if( i_read < 0 )
 {



View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/compare/329bd3c8a3d73b77263b5d98e4e0d2a9e3f9e638...7ea6ce343341a4170234364f80987bbd7f64d005

-- 
View

[vlc-commits] [Git][videolan/vlc][master] input_item: category: use a vlc_list

2022-04-21 Thread Thomas Guillem (@tguillem)


Thomas Guillem pushed to branch master at VideoLAN / VLC


Commits:
80dd05f9 by Thomas Guillem at 2022-04-21T11:59:15+00:00
input_item: category: use a vlc_list

Instead of the legacy array.

- - - - -


7 changed files:

- include/vlc_input_item.h
- modules/control/cli/player.c
- modules/gui/macosx/panels/VLCInformationWindowController.m
- modules/gui/ncurses.c
- modules/gui/qt/dialogs/mediainfo/info_panels.cpp
- modules/lua/libs/input.c
- src/input/item.c


Changes:

=
include/vlc_input_item.h
=
@@ -53,6 +53,7 @@ struct info_category_t
 {
 char   *psz_name;  /**< Name of this category */
 struct vlc_list infos; /**< Infos in the category */
+struct vlc_list node;  /**< node, to put this category in a list */
 };
 
 /**
@@ -97,8 +98,7 @@ struct input_item_t
 vlc_tick_t i_duration;   /**< Duration in vlc ticks */
 
 
-inti_categories; /**< Number of info categories */
-info_category_t **pp_categories; /**< Pointer to the first info category */
+struct vlc_list categories;  /**< List of categories */
 
 int i_es;/**< Number of es format descriptions */
 es_format_t **es;/**< Es formats */


=
modules/control/cli/player.c
=
@@ -508,9 +508,9 @@ static int PlayerItemInfo(struct cli_client *cl, const char 
*const *args,
 if (item != NULL)
 {
 vlc_mutex_lock(&item->lock);
-for (int i = 0; i < item->i_categories; i++)
+info_category_t *category;
+vlc_list_foreach(category, &item->categories, node)
 {
-info_category_t *category = item->pp_categories[i];
 info_t *info;
 
 if (info_category_IsHidden(category))


=
modules/gui/macosx/panels/VLCInformationWindowController.m
=
@@ -352,8 +352,8 @@
 // build list of streams
 NSMutableArray *streams = [NSMutableArray array];
 
-for (int i = 0; i < p_input->i_categories; i++) {
-info_category_t *cat = p_input->pp_categories[i];
+info_category_t *cat;
+vlc_list_foreach(cat, &p_input->categories, node) {
 info_t *info;
 
 if (info_category_IsHidden(cat))


=
modules/gui/ncurses.c
=
@@ -649,8 +649,8 @@ static int DrawInfo(intf_thread_t *intf)
 return 0;
 
 vlc_mutex_lock(&item->lock);
-for (int i = 0; i < item->i_categories; i++) {
-info_category_t *p_category = item->pp_categories[i];
+info_category_t *p_category;
+vlc_list_foreach(p_category, &item->categories, node) {
 info_t *p_info;
 
 if (info_category_IsHidden(p_category))


=
modules/gui/qt/dialogs/mediainfo/info_panels.cpp
=
@@ -500,15 +500,16 @@ void InfoPanel::update( input_item_t *p_item)
 
 vlc_mutex_locker locker( &p_item->lock );
 
-for( int i = 0; i< p_item->i_categories ; i++)
+info_category_t *cat;
+vlc_list_foreach(cat, &p_item->categories, node)
 {
-if (info_category_IsHidden(p_item->pp_categories[i]))
+if (info_category_IsHidden(cat))
 continue;
 
-struct vlc_list *const head = &p_item->pp_categories[i]->infos;
+struct vlc_list *const head = &cat->infos;
 
 current_item = new QTreeWidgetItem();
-current_item->setText( 0, qfu(p_item->pp_categories[i]->psz_name) );
+current_item->setText( 0, qfu(cat->psz_name) );
 InfoTree->addTopLevelItem( current_item );
 
 for (info_t *info = vlc_list_first_entry_or_null(head, info_t, node);


=
modules/lua/libs/input.c
=
@@ -62,13 +62,17 @@ static input_item_t* vlclua_input_item_get_internal( 
lua_State *L );
 static int vlclua_input_item_info( lua_State *L )
 {
 input_item_t *p_item = vlclua_input_item_get_internal( L );
-int i_cat;
 int i;
-i_cat = p_item->i_categories;
+int i_cat = 0;
+
+info_category_t *p_category;
+vlc_list_foreach( p_category, &p_item->categories, node )
+i_cat++;
+
 lua_createtable( L, 0, i_cat );
-for( i = 0; i < i_cat; i++ )
+
+vlc_list_foreach( p_category, &p_item->categories, node )
 {
-info_category_t *p_category = p_item->pp_categories[i];
 info_t *p_info;
 
 if (info_category_IsHidden(p_category))


=
src/input/item.c
=
@@ -483,9 +483,9 @@ void input_item_Release( input_item_t *p_item )
 vlc_epg_Delete( p_item->pp_epg[i] );
 TAB_CLEAN( p_item->i_epg, p_item->pp_epg );
 
-for( int i = 0; i < p_item->i_categories; i++ )
-info_category_

[vlc-commits] [Git][videolan/vlc][master] 5 commits: smb2: homogenize status and error functions

2022-04-20 Thread Thomas Guillem (@tguillem)


Thomas Guillem pushed to branch master at VideoLAN / VLC


Commits:
e9acccac by Thomas Guillem at 2022-04-20T12:11:47+00:00
smb2: homogenize status and error functions

- - - - -
93b55c9f by Thomas Guillem at 2022-04-20T12:11:47+00:00
smb2: rework error handling from smb2_service_fd

- - - - -
0d51ab8a by Thomas Guillem at 2022-04-20T12:11:47+00:00
smb2: return errno directly

No changes since this function is only checked for != 0 (for now).

- - - - -
5264a625 by Thomas Guillem at 2022-04-20T12:11:47+00:00
smb2: also clear op->smb2 in case of error

op->smb2 won't be used in case of error but it is cleaner like that.

- - - - -
960ef3f8 by Thomas Guillem at 2022-04-20T12:11:47+00:00
smb2: destroy the context in case or errors from smb2_generic_cb

Errors can also be reported via generic cbs, that will cause the
vlc_smb2_mainloop to abort. In that case, we should destroy the smb2
context to fix the issue mentioned by 924c951518f02dd05436d46323301702df516f4f

- - - - -


1 changed file:

- modules/access/smb2.c


Changes:

=
modules/access/smb2.c
=
@@ -155,7 +155,7 @@ vlc_smb2_op_reset(struct vlc_smb2_op *op, struct 
smb2_context **smb2p)
 }
 
 static int
-smb2_check_status(struct vlc_smb2_op *op, int status, const char *psz_func)
+smb2_check_status(struct vlc_smb2_op *op, const char *psz_func, int status)
 {
 if (status < 0)
 {
@@ -178,17 +178,17 @@ smb2_set_error(struct vlc_smb2_op *op, const char 
*psz_func, int err)
 if (op->log && err != -EINTR)
 vlc_error(op->log, "%s failed: %d, %s", psz_func, err, 
smb2_get_error(op->smb2));
 
-if (err != 0)
+/* Don't override if set via smb2_check_status */
+if (op->error_status == 0)
 op->error_status = err;
-else if (op->error_status == 0) /* don't override if set via 
smb2_check_status */
-op->error_status = -EINVAL;
 
 smb2_destroy_context(op->smb2);
+op->smb2 = NULL;
 *op->smb2p = NULL;
 }
 
 #define VLC_SMB2_CHECK_STATUS(op, status) \
-smb2_check_status(op, status, __func__)
+smb2_check_status(op, __func__, status)
 
 #define VLC_SMB2_SET_ERROR(op, func, err) \
 smb2_set_error(op, func, err)
@@ -221,7 +221,7 @@ vlc_smb2_mainloop(struct vlc_smb2_op *op)
 else if (ret == 0)
 {
 if (smb2_service_fd(op->smb2, -1, 0) < 0)
-VLC_SMB2_SET_ERROR(op, "smb2_service", 0);
+VLC_SMB2_SET_ERROR(op, "smb2_service", -EINVAL);
 }
 else
 {
@@ -229,13 +229,22 @@ vlc_smb2_mainloop(struct vlc_smb2_op *op)
 {
 if (p_fds[i].revents
  && smb2_service_fd(op->smb2, p_fds[i].fd, p_fds[i].revents) < 
0)
-VLC_SMB2_SET_ERROR(op, "smb2_service", 0);
+VLC_SMB2_SET_ERROR(op, "smb2_service", -EINVAL);
 }
 }
 }
 
-int ret = op->error_status == 0 ? 0 : -1;
-return ret;
+if (op->error_status != 0 && op->smb2 != NULL)
+{
+/* An error was signalled from a smb2 cb. Destroy the smb2 context now
+ * since this call might still trigger callbacks using the current op
+ * (that is allocated on the stack). */
+smb2_destroy_context(op->smb2);
+op->smb2 = NULL;
+*op->smb2p = NULL;
+}
+
+return op->error_status;
 }
 
 #define VLC_SMB2_GENERIC_CB() \



View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/compare/38891c2dc35b7903c39cef2f43730da3a2a50a42...960ef3f8ef74e352d5e3caa42f49cce8a686c8b3

-- 
View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/compare/38891c2dc35b7903c39cef2f43730da3a2a50a42...960ef3f8ef74e352d5e3caa42f49cce8a686c8b3
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits

[vlc-commits] [Git][videolan/vlc][master] 4 commits: aout: filters: use an intermediate struct to hold filters

2022-04-20 Thread Thomas Guillem (@tguillem)


Thomas Guillem pushed to branch master at VideoLAN / VLC


Commits:
278efe44 by Thomas Guillem at 2022-04-19T09:55:04+02:00
aout: filters: use an intermediate struct to hold filters

In order to hold more variables per filter, cf. next commits.

- - - - -
d48a8808 by Thomas Guillem at 2022-04-19T09:55:04+02:00
aout: filters: factorize filter destroy

- - - - -
f834379e by Thomas Guillem at 2022-04-19T09:55:04+02:00
aout: filters: only create a clock when necessary

Only the visualisation aout filters need the clock for the vout (for
now).

Create one slave clock per visualisation aout filter instead of always
creating one for all visualisation aout filters.

- - - - -
38891c2d by Thomas Guillem at 2022-04-19T09:55:04+02:00
aout: filters: move the vout ownership to aout_filters

So that the aout_filters keep a strong reference on the vout it created
in order to control it.

- - - - -


4 changed files:

- include/vlc_aout.h
- modules/visualization/goom.c
- modules/visualization/visual/visual.c
- src/audio_output/filters.c


Changes:

=
include/vlc_aout.h
=
@@ -585,6 +585,14 @@ VLC_API block_t *aout_FiltersDrain(aout_filters_t *);
 VLC_API void aout_FiltersFlush(aout_filters_t *);
 VLC_API void aout_FiltersChangeViewpoint(aout_filters_t *, const 
vlc_viewpoint_t *vp);
 
+/**
+ * Create a vout from an "visualization" audio filter.
+ *
+ * @warning Can only be called once, from the probe function (Open).
+ *
+ * @return a valid vout or NULL in case of error, the returned vout should not
+ * be freed via vout_Close().
+ */
 VLC_API vout_thread_t *aout_filter_GetVout(filter_t *, const video_format_t *);
 
 /** @} */


=
modules/visualization/goom.c
=
@@ -353,8 +353,6 @@ static void Close( filter_t *p_filter )
 vlc_join( p_thread->thread, NULL );
 
 /* Free data */
-vout_Close( p_thread->p_vout );
-
 while( p_thread->i_blocks-- )
 {
 block_Release( p_thread->pp_blocks[p_thread->i_blocks] );


=
modules/visualization/visual/visual.c
=
@@ -405,7 +405,6 @@ static void Close( filter_t * p_filter )
 
 vlc_queue_Kill(&p_sys->queue, &p_sys->dead);
 vlc_join( p_sys->thread, NULL );
-vout_Close( p_sys->p_vout );
 
 /* Free the list */
 for( int i = 0; i < p_sys->i_effect; i++ )


=
src/audio_output/filters.c
=
@@ -40,6 +40,20 @@
 #include "aout_internal.h"
 #include "../video_output/vout_internal.h" /* for vout_Request */
 
+struct aout_filter
+{
+filter_t *f;
+vlc_clock_t *clock;
+vout_thread_t *vout;
+};
+
+static inline void aout_filter_Init(struct aout_filter *tab, filter_t *f)
+{
+tab->f = f;
+tab->clock = NULL;
+tab->vout = NULL;
+}
+
 filter_t *aout_filter_Create(vlc_object_t *obj, const filter_owner_t *restrict 
owner,
  const char *type, const char *name,
  const audio_sample_format_t *infmt,
@@ -109,18 +123,27 @@ static filter_t *FindResampler (vlc_object_t *obj,
 return filter;
 }
 
+static void aout_FilterDestroy(filter_t *filter)
+{
+filter_Close(filter);
+module_unneed(filter, filter->p_module);
+vlc_object_delete(filter);
+}
+
 /**
  * Destroys a chain of audio filters.
  */
-static void aout_FiltersPipelineDestroy(filter_t *const *filters, unsigned n)
+static void aout_FiltersPipelineDestroy(struct aout_filter *tab, unsigned n)
 {
 for( unsigned i = 0; i < n; i++ )
 {
-filter_t *p_filter = filters[i];
+filter_t *p_filter = tab[i].f;
 
-filter_Close( p_filter );
-module_unneed( p_filter, p_filter->p_module );
-vlc_object_delete(p_filter);
+aout_FilterDestroy(p_filter);
+if (tab[i].vout != NULL)
+vout_Close(tab[i].vout);
+if (tab[i].clock != NULL)
+vlc_clock_Delete(tab[i].clock);
 }
 }
 
@@ -149,14 +172,14 @@ static filter_t *TryFormat (vlc_object_t *obj, 
vlc_fourcc_t codec,
  * @param outfmt output audio format
  * @return 0 on success, -1 on failure
  */
-static int aout_FiltersPipelineCreate(vlc_object_t *obj, filter_t **filters,
+static int aout_FiltersPipelineCreate(vlc_object_t *obj, struct aout_filter 
*tab,
   unsigned *count, unsigned max,
  const audio_sample_format_t *restrict infmt,
  const audio_sample_format_t *restrict outfmt)
 {
 aout_FormatsPrint (obj, "conversion:", infmt, outfmt);
 max -= *count;
-filters += *count;
+tab += *count;
 
 /* There is a lot of second guessing on what the conversion plugins can
  * and cannot do. This seems hardly avoidable, the conversion problem need
@@ -188,7 +211,7 @@ static int aout_FiltersPipelineCreat

[vlc-commits] [Git][videolan/vlc][master] 2 commits: aout: move vlc_aout_stream_RequestRetiming up

2022-04-06 Thread Thomas Guillem (@tguillem)


Thomas Guillem pushed to branch master at VideoLAN / VLC


Commits:
b92f4f50 by Thomas Guillem at 2022-04-06T12:24:18+00:00
aout: move vlc_aout_stream_RequestRetiming up

To avoid forward declarations (in the next commit).

- - - - -
02293b1d by Thomas Guillem at 2022-04-06T12:24:18+00:00
aout: remove timing_report event

Not used by any modules, and not thread-safe.

- - - - -


4 changed files:

- include/vlc_aout.h
- src/audio_output/aout_internal.h
- src/audio_output/dec.c
- src/audio_output/output.c


Changes:

=
include/vlc_aout.h
=
@@ -125,7 +125,6 @@
  */
 
 struct vlc_audio_output_events {
-void (*timing_report)(audio_output_t *, vlc_tick_t system_now, vlc_tick_t 
pts);
 void (*drained_report)(audio_output_t *);
 void (*volume_report)(audio_output_t *, float);
 void (*mute_report)(audio_output_t *, bool);


=
src/audio_output/aout_internal.h
=
@@ -152,8 +152,6 @@ void vlc_aout_stream_NotifyDrained(vlc_aout_stream *stream);
 void vlc_aout_stream_NotifyGain(vlc_aout_stream *stream, float gain);
 
 void vlc_aout_stream_RequestRestart(vlc_aout_stream *stream, unsigned);
-void vlc_aout_stream_RequestRetiming(vlc_aout_stream *stream, vlc_tick_t 
system_ts,
- vlc_tick_t audio_ts);
 
 void aout_InputRequestRestart(audio_output_t *aout);
 


=
src/audio_output/dec.c
=
@@ -365,59 +365,8 @@ static void stream_Silence (vlc_aout_stream *stream, 
vlc_tick_t length, vlc_tick
 aout->play(aout, block, system_pts);
 }
 
-static void stream_Synchronize(vlc_aout_stream *stream, vlc_tick_t system_now,
-   vlc_tick_t dec_pts)
-{
-/**
- * Depending on the drift between the actual and intended playback times,
- * the audio core may ignore the drift, trigger upsampling or downsampling,
- * insert silence or even discard samples.
- * Future VLC versions may instead adjust the input rate.
- *
- * The audio output plugin is responsible for estimating its actual
- * playback time, or rather the estimated time when the next sample will
- * be played. (The actual playback time is always the current time, that is
- * to say vlc_tick_now(). It is not an useful statistic.)
- *
- * Most audio output plugins can estimate the delay until playback of
- * the next sample to be written to the buffer, or equally the time until
- * all samples in the buffer will have been played. Then:
- *pts = vlc_tick_now() + delay
- */
-vlc_tick_t delay;
-audio_output_t *aout = aout_stream_aout(stream);
-
-if (aout_TimeGet(aout, &delay) != 0)
-return; /* nothing can be done if timing is unknown */
-
-if (stream->sync.discontinuity)
-{
-/* Chicken-egg situation for most aout modules that can't be started
- * deferred (all except PulseAudio). These modules will start to play
- * data immediately and ignore the given play_date (that take the clock
- * jitter into account). We don't want to let 
vlc_aout_stream_RequestRetiming()
- * handle the first silence (from the "Early audio output" case) since
- * this function will first update the clock without taking the jitter
- * into account. Therefore, we manually insert silence that correspond
- * to the clock jitter value before updating the clock.
- */
-vlc_tick_t play_date =
-vlc_clock_ConvertToSystem(stream->sync.clock, system_now + delay,
-  dec_pts, stream->sync.rate);
-vlc_tick_t jitter = play_date - system_now;
-if (jitter > 0)
-{
-stream_Silence(stream, jitter, dec_pts - delay);
-if (aout_TimeGet(aout, &delay) != 0)
-return;
-}
-}
-
-vlc_aout_stream_RequestRetiming(stream, system_now + delay, dec_pts);
-}
-
-void vlc_aout_stream_RequestRetiming(vlc_aout_stream *stream, vlc_tick_t 
system_ts,
- vlc_tick_t audio_ts)
+static void stream_RequestRetiming(vlc_aout_stream *stream, vlc_tick_t 
system_ts,
+   vlc_tick_t audio_ts)
 {
 aout_owner_t *owner = aout_stream_owner(stream);
 audio_output_t *aout = aout_stream_aout(stream);
@@ -521,6 +470,57 @@ void vlc_aout_stream_RequestRetiming(vlc_aout_stream 
*stream, vlc_tick_t system_
 }
 }
 
+static void stream_Synchronize(vlc_aout_stream *stream, vlc_tick_t system_now,
+   vlc_tick_t dec_pts)
+{
+/**
+ * Depending on the drift between the actual and intended playback times,
+ * the audio core may ignore the drift, trigger upsampling or downsampling,
+ * insert silence or even discard samples.
+ * Future VLC versions may instead adjust the i

[vlc-commits] [Git][videolan/vlc][master] 5 commits: pulse: use vlc_pa_get_latency() directly when draining

2022-04-06 Thread Thomas Guillem (@tguillem)


Thomas Guillem pushed to branch master at VideoLAN / VLC


Commits:
0ee0dcf3 by Thomas Guillem at 2022-04-06T07:39:59+00:00
pulse: use vlc_pa_get_latency() directly when draining

TimeGet() check the corked state, but the stream is always uncorked here.

- - - - -
f3e0be3a by Thomas Guillem at 2022-04-06T07:39:59+00:00
pulse: move drain_trigger_cb up

To avoid forward declaration in a future commit.

- - - - -
bfde0977 by Thomas Guillem at 2022-04-06T07:39:59+00:00
pulse: add TriggerDrain()

- - - - -
08486a0b by Thomas Guillem at 2022-04-06T07:39:59+00:00
pulse: fix drain with small samples

vlc_pa_get_latency() might return an invalid tick ("no timing info")
when the stream was just uncorked from the Drain callback.

To fix this issue, setup the drain timer from the latency callback when
the stream is draining.

- - - - -
da102673 by Thomas Guillem at 2022-04-06T07:39:59+00:00
pulse: fix drain report if no samples

Report that the stream is drained if play was never called or in case of
overflow.

- - - - -


1 changed file:

- modules/audio_output/pulse.c


Changes:

=
modules/audio_output/pulse.c
=
@@ -67,6 +67,7 @@ typedef struct
 pa_threaded_mainloop *mainloop; /**< PulseAudio thread */
 pa_time_event *trigger; /**< Deferred stream trigger */
 pa_time_event *drain_trigger; /**< Drain stream trigger */
+bool draining;
 pa_cvolume cvolume; /**< actual sink input volume */
 vlc_tick_t last_date; /**< Play system timestamp of last buffer */
 
@@ -85,6 +86,37 @@ static void VolumeReport(audio_output_t *aout)
 aout_VolumeReport(aout, (float)volume / PA_VOLUME_NORM);
 }
 
+static void drain_trigger_cb(pa_mainloop_api *api, pa_time_event *e,
+  const struct timeval *tv, void *userdata)
+{
+audio_output_t *aout = userdata;
+aout_sys_t *sys = aout->sys;
+
+assert(sys->drain_trigger == e);
+
+vlc_pa_rttime_free(sys->mainloop, sys->drain_trigger);
+sys->drain_trigger = NULL;
+sys->draining = false;
+
+aout_DrainedReport(aout);
+(void) api; (void) e; (void) tv;
+}
+
+static int TriggerDrain(audio_output_t *aout)
+{
+aout_sys_t *sys = aout->sys;
+assert(sys->drain_trigger == NULL);
+
+vlc_tick_t delay = vlc_pa_get_latency(aout, sys->context, sys->stream);
+if (delay == VLC_TICK_INVALID)
+return VLC_EGENERIC;
+
+delay += pa_rtclock_now();
+sys->drain_trigger = pa_context_rttime_new(sys->context, delay,
+   drain_trigger_cb, aout);
+return sys->drain_trigger ? VLC_SUCCESS : VLC_ENOMEM;
+}
+
 /*** Sink ***/
 static void sink_add_cb(pa_context *ctx, const pa_sink_info *i, int eol,
 void *userdata)
@@ -258,7 +290,11 @@ static void stream_latency_cb(pa_stream *s, void *userdata)
 
 /* This callback is _never_ called while paused. */
 if (sys->last_date == VLC_TICK_INVALID)
+{
+if (sys->draining && sys->drain_trigger == NULL)
+TriggerDrain(aout);
 return; /* nothing to do if buffers are (still) empty */
+}
 if (pa_stream_is_corked(s) > 0)
 stream_start(s, aout, sys->last_date);
 }
@@ -561,6 +597,7 @@ static void Flush(audio_output_t *aout)
 {
 vlc_pa_rttime_free(sys->mainloop, sys->drain_trigger);
 sys->drain_trigger = NULL;
+sys->draining = false;
 }
 
 pa_operation *op = pa_stream_flush(s, NULL, NULL);
@@ -572,21 +609,6 @@ static void Flush(audio_output_t *aout)
 pa_threaded_mainloop_unlock(sys->mainloop);
 }
 
-static void drain_trigger_cb(pa_mainloop_api *api, pa_time_event *e,
-  const struct timeval *tv, void *userdata)
-{
-audio_output_t *aout = userdata;
-aout_sys_t *sys = aout->sys;
-
-assert(sys->drain_trigger == e);
-
-vlc_pa_rttime_free(sys->mainloop, sys->drain_trigger);
-sys->drain_trigger = NULL;
-
-aout_DrainedReport(aout);
-(void) api; (void) e; (void) tv;
-}
-
 static void Drain(audio_output_t *aout)
 {
 aout_sys_t *sys = aout->sys;
@@ -611,21 +633,18 @@ static void Drain(audio_output_t *aout)
 pa_operation *op = pa_stream_drain(s, NULL, NULL);
 if (op != NULL)
 pa_operation_unref(op);
-sys->last_date = VLC_TICK_INVALID;
 
-/* XXX: Loosy drain emulation.
- * See #18141: drain callback is never received */
-assert(sys->drain_trigger == NULL);
-vlc_tick_t delay;
-if (TimeGet(aout, &delay) == 0)
+if (sys->last_date == VLC_TICK_INVALID)
+aout_DrainedReport(aout);
+else
 {
-delay += pa_rtclock_now();
-sys->drain_trigger = pa_context_rttime_new(sys->context, delay,
-   drain_trigger_cb, aout);
-}
+sys->last_date = VLC_TICK_INVALID;
 
-if (sys->drain_trigger == NULL)
-aout_DrainedReport(aout);
+/* XXX: Loosy drain emulation.
+ * See #1

[vlc-commits] [Git][videolan/vlc][master] dsm: fix interrupt context mismatch

2022-03-15 Thread Thomas Guillem (@tguillem)


Thomas Guillem pushed to branch master at VideoLAN / VLC


Commits:
6b4b7225 by Thomas Guillem at 2022-03-15T14:26:22+00:00
dsm: fix interrupt context mismatch

The dsm interrupt context was also registered when calling the
credential API that can end up in keystore modules that need to register
an interrupt context. To fix this issue, register the interrupt context
only before dsm calls.

- - - - -


1 changed file:

- modules/access/dsm/access.c


Changes:

=
modules/access/dsm/access.c
=
@@ -226,20 +226,16 @@ static int Open( vlc_object_t *p_this )
 
 get_path( p_access );
 
-smb_session_interrupt_register( p_sys );
-
 if( login( p_access ) != VLC_SUCCESS )
 {
 msg_Err( p_access, "Unable to open file with path %s (in share %s)",
  p_sys->psz_path, p_sys->psz_share );
-smb_session_interrupt_unregister();
 goto error;
 }
 
 /* If there is no shares, browse them */
 if( !p_sys->psz_share )
 {
-smb_session_interrupt_unregister();
 return BrowserInit( p_access );
 }
 
@@ -248,6 +244,8 @@ static int Open( vlc_object_t *p_this )
 msg_Dbg( p_access, "Path: Share name = %s, path = %s", p_sys->psz_share,
  p_sys->psz_path );
 
+smb_session_interrupt_register( p_sys );
+
 st = smb_stat_fd( p_sys->p_session, p_sys->i_fd );
 if( smb_stat_get( st, SMB_STAT_ISDIR ) )
 {
@@ -468,8 +466,11 @@ static int login( stream_t *p_access )
 {
 struct dsm_cache_context *context = cache_entry->context;
 
+smb_session_interrupt_register( p_sys );
 int ret = smb_fopen( context->session, context->tid,
  p_sys->psz_path, SMB_MOD_RO, &p_sys->i_fd );
+smb_session_interrupt_unregister();
+
 if( ret == DSM_SUCCESS )
 {
 p_sys->cache_entry = cache_entry;
@@ -484,6 +485,8 @@ static int login( stream_t *p_access )
 }
 }
 
+smb_session_interrupt_register( p_sys );
+
 /* Now that we have the required data, let's establish a session */
 int status = smb_session_connect( p_sys->p_session, p_sys->netbios_name,
   p_sys->addr.s_addr, SMB_TRANSPORT_TCP );
@@ -492,13 +495,19 @@ static int login( stream_t *p_access )
 msg_Err( p_access, "Unable to connect/negotiate SMB session");
 /* FIXME: libdsm wrongly return network error when the server can't
  * handle the SMBv1 protocol */
+smb_session_interrupt_unregister();
 goto error;
 }
 
 /* Try to authenticate on the remote machine */
 int connect_err = smb_connect( p_access, psz_login, psz_password, 
psz_domain );
 if( connect_err == ENOENT )
+{
+smb_session_interrupt_unregister();
 goto error;
+}
+
+smb_session_interrupt_unregister();
 
 if( connect_err == EACCES )
 {
@@ -518,7 +527,10 @@ static int login( stream_t *p_access )
 psz_password = credential.psz_password;
 psz_domain = credential.psz_realm ? credential.psz_realm
   : p_sys->netbios_name;
+
+smb_session_interrupt_register( p_sys );
 connect_err = smb_connect( p_access, psz_login, psz_password, 
psz_domain );
+smb_session_interrupt_unregister();
 }
 
 if( connect_err != 0 )



View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/commit/6b4b7225e5ba757ecc4ca38eb6de2e21a43a9c6d

-- 
View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/commit/6b4b7225e5ba757ecc4ca38eb6de2e21a43a9c6d
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits

[vlc-commits] [Git][videolan/vlc][3.0.x] 2 commits: nfs: fix pf_read return values

2022-03-08 Thread Thomas Guillem (@tguillem)


Thomas Guillem pushed to branch 3.0.x at VideoLAN / VLC


Commits:
4063c515 by Thomas Guillem at 2022-03-07T09:20:04+01:00
nfs: fix pf_read return values

0 should be returned in case of EOS or error, -1 means EAGAIN.

/me blames me for not reading the documentation.

(cherry picked from commit 59a3d85dd2bf642a81c95f91ef320cf4164d5671)
Signed-off-by: Thomas Guillem 

- - - - -
8bff7178 by Thomas Guillem at 2022-03-07T09:21:03+01:00
smb2: fix pf_read return values

0 should be returned in case of EOS or error, -1 means EAGAIN.

/me blames me for not reading the documentation.

(cherry picked from commit 249a76b921b1a742ae9d4fa459ea7107bca08482)
Signed-off-by: Thomas Guillem 

- - - - -


2 changed files:

- modules/access/nfs.c
- modules/access/smb2.c


Changes:

=
modules/access/nfs.c
=
@@ -214,11 +214,11 @@ FileRead(stream_t *p_access, void *p_buf, size_t i_len)
p_access) < 0)
 {
 msg_Err(p_access, "nfs_read_async failed");
-return -1;
+return 0;
 }
 
 if (vlc_nfs_mainloop(p_access, nfs_read_finished_cb) < 0)
-return -1;
+return 0;
 
 return p_sys->res.read.i_len;
 }


=
modules/access/smb2.c
=
@@ -283,10 +283,7 @@ FileRead(stream_t *access, void *buf, size_t len)
 {
 struct access_sys *sys = access->p_sys;
 
-if (sys->error_status != 0)
-return -1;
-
-if (sys->eof)
+if (sys->eof || sys->error_status != 0)
 return 0;
 
 /* Limit the read size since smb2_read_async() will complete only after
@@ -300,11 +297,11 @@ FileRead(stream_t *access, void *buf, size_t len)
 smb2_read_cb, access) < 0)
 {
 VLC_SMB2_SET_ERROR(access, "smb2_read_async", 1);
-return -1;
+return 0;
 }
 
 if (vlc_smb2_mainloop(access, false) < 0)
-return -1;
+return 0;
 
 return sys->res.read.len;
 }



View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/compare/583426556280120843d8de5d5986663a3b43568f...8bff7178c720dd0c4df56a8dc34bd86fac7801e8

-- 
View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/compare/583426556280120843d8de5d5986663a3b43568f...8bff7178c720dd0c4df56a8dc34bd86fac7801e8
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits

[vlc-commits] [Git][videolan/vlc][master] 2 commits: decoder: change DeleteDecoder arguments

2022-01-05 Thread Thomas Guillem (@tguillem)


Thomas Guillem pushed to branch master at VideoLAN / VLC


Commits:
905f468e by Thomas Guillem at 2022-01-05T16:23:03+00:00
decoder: change DeleteDecoder arguments

Use the category from the i_cat argument instead of dec->fmt_in.i_cat

Refs #26271

- - - - -
2c65888b by Thomas Guillem at 2022-01-05T16:23:03+00:00
decoder: fix possible output leak when the codec is unsupported

dec->fmt_in.i_cat might be UNKNOWN_ES when the codec is not supported
leading to an output leak from DeleteDecoder() since the category
specific code is not reached.

Fixes #26271

- - - - -


1 changed file:

- src/input/decoder.c


Changes:

=
src/input/decoder.c
=
@@ -1961,13 +1961,12 @@ CreateDecoder( vlc_object_t *p_parent, const 
es_format_t *fmt,
  * \param p_dec the decoder object
  * \return nothing
  */
-static void DeleteDecoder( vlc_input_decoder_t *p_owner )
+static void DeleteDecoder( vlc_input_decoder_t *p_owner, enum 
es_format_category_e i_cat )
 {
 decoder_t *p_dec = &p_owner->dec;
 msg_Dbg( p_dec, "killing decoder fourcc `%4.4s'",
  (char*)&p_dec->fmt_in.i_codec );
 
-const enum es_format_category_e i_cat =p_dec->fmt_in.i_cat;
 decoder_Clean( p_dec );
 if ( p_owner->out_pool )
 {
@@ -2093,7 +2092,8 @@ decoder_New( vlc_object_t *p_parent, const es_format_t 
*fmt, const char *psz_id,
 {
 DecoderUnsupportedCodec( p_dec, fmt, !p_sout );
 
-DeleteDecoder( p_owner );
+/* Don't use dec->fmt_in.i_cat since it may not be initialized here. */
+DeleteDecoder( p_owner, fmt->i_cat );
 return NULL;
 }
 
@@ -2125,7 +2125,7 @@ decoder_New( vlc_object_t *p_parent, const es_format_t 
*fmt, const char *psz_id,
 if( vlc_clone( &p_owner->thread, DecoderThread, p_owner, i_priority ) )
 {
 msg_Err( p_dec, "cannot spawn decoder thread" );
-DeleteDecoder( p_owner );
+DeleteDecoder( p_owner, p_dec->fmt_in.i_cat );
 return NULL;
 }
 
@@ -2227,7 +2227,7 @@ void vlc_input_decoder_Delete( vlc_input_decoder_t 
*p_owner )
 }
 
 /* Delete decoder */
-DeleteDecoder( p_owner );
+DeleteDecoder( p_owner, p_dec->fmt_in.i_cat );
 }
 
 /**



View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/compare/bce57ed795b288901d7b6f50d46fe74c667e6792...2c65888b0f1697031e0caf79818a55149fb756b4

-- 
View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/compare/bce57ed795b288901d7b6f50d46fe74c667e6792...2c65888b0f1697031e0caf79818a55149fb756b4
You're receiving this email because of your account on code.videolan.org.


___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits

[vlc-commits] [Git][videolan/vlc][master] 2 commits: resource: don't send the started event more than one time

2021-12-22 Thread Thomas Guillem (@tguillem)


Thomas Guillem pushed to branch master at VideoLAN / VLC


Commits:
e045c859 by Thomas Guillem at 2021-12-22T14:21:03+00:00
resource: don't send the started event more than one time

Refs #26394

- - - - -
c00bec8b by Thomas Guillem at 2021-12-22T14:21:03+00:00
resource: remove duplicated code

This code is already handled in vout_Request().

Fixes #26394

- - - - -


1 changed file:

- src/input/resource.c


Changes:

=
src/input/resource.c
=
@@ -494,17 +494,6 @@ vout_thread_t *input_resource_RequestVout(input_resource_t 
*p_resource,
 return dcfg.vout;
 }
 
-if (vout_rsc->started)
-{
-assert(cfg->vout != NULL);
-int ret = vout_ChangeSource(dcfg.vout, dcfg.fmt);
-if (ret == 0)
-{
-vlc_mutex_unlock(&p_resource->lock);
-return dcfg.vout;
-}
-}
-
 if (vout_Request(&dcfg, vctx, p_resource->p_input)) {
 if (vout_rsc->started && vout_state != NULL)
 *vout_state = INPUT_RESOURCE_VOUT_STOPPED;
@@ -515,9 +504,12 @@ vout_thread_t *input_resource_RequestVout(input_resource_t 
*p_resource,
 return NULL;
 }
 
-vout_rsc->started = true;
-if (vout_state != NULL)
-*vout_state = INPUT_RESOURCE_VOUT_STARTED;
+if (!vout_rsc->started)
+{
+vout_rsc->started = true;
+if (vout_state != NULL)
+*vout_state = INPUT_RESOURCE_VOUT_STARTED;
+}
 
 DisplayVoutTitle(p_resource, cfg->vout, &vout_rsc->psz_prev_title);
 



View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/compare/52a789ea8197ff22ccb37d42dce1a825cedadb83...c00bec8bc7adb3fa36c0ff23d6883fc4d2b1bf91

-- 
View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/compare/52a789ea8197ff22ccb37d42dce1a825cedadb83...c00bec8bc7adb3fa36c0ff23d6883fc4d2b1bf91
You're receiving this email because of your account on code.videolan.org.


___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits

[vlc-commits] [Git][videolan/vlc][master] 2 commits: vdpau: don't use the VAAPI backend

2021-12-16 Thread Thomas Guillem (@tguillem)


Thomas Guillem pushed to branch master at VideoLAN / VLC


Commits:
db9d5ef7 by Thomas Guillem at 2021-12-16T15:03:36+00:00
vdpau: don't use the VAAPI backend

And favor our original VAAPI backend.

Fixes #26361

- - - - -
6eac337a by Thomas Guillem at 2021-12-16T15:03:36+00:00
vdpau: remove useless vlc_obj_free

- - - - -


1 changed file:

- modules/video_output/opengl/interop_vdpau.c


Changes:

=
modules/video_output/opengl/interop_vdpau.c
=
@@ -223,8 +223,19 @@ DecoderDeviceOpen(vlc_decoder_device *device, 
vout_window_t *window)
 
 if (vdp_get_x11(window->display.x11, -1,
 &sys->vdp, &sys->device) != VDP_STATUS_OK)
+return VLC_EGENERIC;
+
+const char *infos;
+VdpStatus status = vdp_get_information_string(sys->vdp, &infos);
+/* Favor original backends. Example: don't use a VAAPI backend when we
+ * have VAAPI decoder devices. */
+if (status != VDP_STATUS_OK
+ || strstr(infos, "VAAPI") != NULL)
 {
-vlc_obj_free(VLC_OBJECT(device), sys);
+if (status == VDP_STATUS_OK)
+msg_Dbg(device, "Not using '%s', favor a decdev with a compatible 
backend",
+infos);
+vdp_release_x11(sys->vdp);
 return VLC_EGENERIC;
 }
 



View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/compare/c926b2ce5457cdacfd5bce0d1e1861e79c8291c4...6eac337aaa069bf336543ee784ffdbbdc070c208

-- 
View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/compare/c926b2ce5457cdacfd5bce0d1e1861e79c8291c4...6eac337aaa069bf336543ee784ffdbbdc070c208
You're receiving this email because of your account on code.videolan.org.


___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits

[vlc-commits] [Git][videolan/vlc][master] test: media: don't check directory size

2021-12-16 Thread Thomas Guillem (@tguillem)


Thomas Guillem pushed to branch master at VideoLAN / VLC


Commits:
c926b2ce by Thomas Guillem at 2021-12-16T14:18:50+00:00
test: media: don't check directory size

Fixes #26367

- - - - -


1 changed file:

- test/libvlc/media.c


Changes:

=
test/libvlc/media.c
=
@@ -244,10 +244,8 @@ static void subitem_added(const libvlc_event_t *event, 
void *user_data)
 
 ret = libvlc_media_get_stat(m, libvlc_media_stat_size, &value);
 assert(ret == 1);
-/* All files size are 0, directory size is either 4096 or 0 */
-if (libvlc_media_get_type(m) == libvlc_media_type_directory)
-assert(value == 4096 || value == 0);
-else
+/* All files size are 0, directory size depends on the FS. */
+if (libvlc_media_get_type(m) != libvlc_media_type_directory)
 assert(value == 0);
 
 ret = libvlc_media_get_stat(m, libvlc_media_stat_mtime, &value);



View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/commit/c926b2ce5457cdacfd5bce0d1e1861e79c8291c4

-- 
View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/commit/c926b2ce5457cdacfd5bce0d1e1861e79c8291c4
You're receiving this email because of your account on code.videolan.org.


___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits

[vlc-commits] [Git][videolan/vlc][master] avcodec: fix invalid version check

2021-12-10 Thread Thomas Guillem (@tguillem)


Thomas Guillem pushed to branch master at VideoLAN / VLC


Commits:
4cbe5862 by Thomas Guillem at 2021-12-10T12:47:32+00:00
avcodec: fix invalid version check

Regression from 8cf02acd84a1e099e15037d7c1e4dce6edf9

This restore hw decoding with multiple threads (the default behavior).

- - - - -


1 changed file:

- modules/codec/avcodec/video.c


Changes:

=
modules/codec/avcodec/video.c
=
@@ -1622,7 +1622,7 @@ no_reuse:
 if (!can_hwaccel)
 return swfmt;
 
-#if LIBAVCODEC_VERSION_CHECK(57, 83, 101)
+#if !LIBAVCODEC_VERSION_CHECK(57, 83, 101)
 if (p_context->active_thread_type)
 {
 msg_Warn(p_dec, "thread type %d: disabling hardware acceleration",



View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/commit/4cbe586250e560d7e047535a14f49d8d074dee13

-- 
View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/commit/4cbe586250e560d7e047535a14f49d8d074dee13
You're receiving this email because of your account on code.videolan.org.


___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits

[vlc-commits] [Git][videolan/vlc][master] avcodec: vaapi: handle the hw_frames_ctx initialization by VLC

2021-12-06 Thread Thomas Guillem (@tguillem)


Thomas Guillem pushed to branch master at VideoLAN / VLC


Commits:
07ed2871 by Thomas Guillem at 2021-12-06T08:03:51+00:00
avcodec: vaapi: handle the hw_frames_ctx initialization by VLC

It's not allowed to modify ctx->hw_device_ctx after avcodec_open2().
Therefore, we need to create the hw_frames_ctx ourselves from it, and from
the get_format() callback. It can be easily done with the
avcodec_get_hw_frames_parameters() helper.

The surface frame count is now known from the Create() function,
therefore, the semaphore can be directly initialized, removing the need
for the pool_sem_init dirty hack.

- - - - -


1 changed file:

- modules/codec/avcodec/vaapi.c


Changes:

=
modules/codec/avcodec/vaapi.c
=
@@ -53,8 +53,7 @@
 struct vaapi_vctx
 {
 VADisplay va_dpy;
-AVBufferRef *hwdev_ref;
-bool pool_sem_init;
+AVBufferRef *hwframes_ref;
 vlc_sem_t pool_sem;
 };
 
@@ -139,8 +138,6 @@ static void vaapi_dec_pic_context_destroy(picture_context_t 
*context)
 struct vaapi_vctx *vaapi_vctx =
 vlc_video_context_GetPrivate(pic_ctx->ctx.s.vctx, 
VLC_VIDEO_CONTEXT_VAAPI);
 
-assert(vaapi_vctx->pool_sem_init);
-
 av_frame_free(&pic_ctx->avframe);
 
 if (!pic_ctx->cloned)
@@ -173,24 +170,9 @@ static picture_context_t 
*vaapi_dec_pic_context_copy(picture_context_t *src)
 static int Get(vlc_va_t *va, picture_t *pic, AVCodecContext *ctx, AVFrame 
*frame)
 {
 vlc_video_context *vctx = va->sys;
-AVHWFramesContext *hwframes = (AVHWFramesContext*)ctx->hw_frames_ctx->data;
 struct vaapi_vctx *vaapi_vctx =
 vlc_video_context_GetPrivate(vctx, VLC_VIDEO_CONTEXT_VAAPI);
 
-assert(ctx->hw_frames_ctx);
-
-/* The pool size can only be known after the hw context has been
- * initialized (internally by ffmpeg), so between Create() and the first
- * Get() */
-if (!vaapi_vctx->pool_sem_init)
-{
-vlc_sem_init(&vaapi_vctx->pool_sem,
- hwframes->initial_pool_size +
- ctx->thread_count +
- 3 /* cf. ff_decode_get_hw_frames_ctx */);
-vaapi_vctx->pool_sem_init = true;
-}
-
 /* If all frames are out, wait for a frame to be released. */
 vlc_sem_wait(&vaapi_vctx->pool_sem);
 
@@ -231,7 +213,7 @@ static void vaapi_ctx_destroy(void *priv)
 {
 struct vaapi_vctx *vaapi_vctx = priv;
 
-av_buffer_unref(&vaapi_vctx->hwdev_ref);
+av_buffer_unref(&vaapi_vctx->hwframes_ref);
 }
 
 static const struct vlc_va_operations ops = { Get, Delete, };
@@ -261,43 +243,77 @@ static int Create(vlc_va_t *va, AVCodecContext *ctx, enum 
AVPixelFormat hwfmt,
 
 AVBufferRef *hwdev_ref = av_hwdevice_ctx_alloc(AV_HWDEVICE_TYPE_VAAPI);
 if (hwdev_ref == NULL)
-goto error;
+return VLC_EGENERIC;
 
 AVHWDeviceContext *hwdev_ctx = (void *) hwdev_ref->data;
 AVVAAPIDeviceContext *vadev_ctx = hwdev_ctx->hwctx;
 vadev_ctx->display = va_dpy;
 
 if (av_hwdevice_ctx_init(hwdev_ref) < 0)
-goto error;
+{
+av_buffer_unref(&hwdev_ref);
+return VLC_EGENERIC;
+}
+
+AVBufferRef *hwframes_ref;
+int ret = avcodec_get_hw_frames_parameters(ctx, hwdev_ref, hwfmt, 
&hwframes_ref);
+av_buffer_unref(&hwdev_ref);
+if (ret < 0)
+{
+msg_Err(va, "avcodec_get_hw_frames_parameters failed: %d", ret);
+return VLC_EGENERIC;
+}
+
+AVHWFramesContext *hwframes_ctx = (AVHWFramesContext*)hwframes_ref->data;
+
+if (hwframes_ctx->initial_pool_size)
+{
+// cf. ff_decode_get_hw_frames_ctx()
+// We guarantee 4 base work surfaces. The function above guarantees 1
+// (the absolute minimum), so add the missing count.
+hwframes_ctx->initial_pool_size += 3;
+}
+
+ret = av_hwframe_ctx_init(hwframes_ref);
+if (ret < 0)
+{
+msg_Err(va, "av_hwframe_ctx_init failed: %d", ret);
+av_buffer_unref(&hwframes_ref);
+return VLC_EGENERIC;
+}
+
+ctx->hw_frames_ctx = av_buffer_ref(hwframes_ref);
+if (!ctx->hw_frames_ctx)
+{
+av_buffer_unref(&hwframes_ref);
+return VLC_EGENERIC;
+}
 
 vlc_video_context *vctx =
 vlc_video_context_Create(dec_device, VLC_VIDEO_CONTEXT_VAAPI,
  sizeof(struct vaapi_vctx), &vaapi_ctx_ops);
 if (vctx == NULL)
-goto error;
+{
+av_buffer_unref(&hwframes_ref);
+av_buffer_unref(&ctx->hw_frames_ctx);
+return VLC_EGENERIC;
+}
 
 struct vaapi_vctx *vaapi_vctx =
 vlc_video_context_GetPrivate(vctx, VLC_VIDEO_CONTEXT_VAAPI);
 
 vaapi_vctx->va_dpy = va_dpy;
-vaapi_vctx->hwdev_ref = hwdev_ref;
-vaapi_vctx->pool_sem_init = false;
+vaapi_vctx->hwframes_ref = hwframes_ref;
+vlc_sem_init(&vaapi_vctx->pool_sem, hwframes_ctx->initial_pool_size);
 
 msg_Info(va, "Using %s", vaQueryVendorString(va_dpy));
 
 fmt_out->i_chroma =

[vlc-commits] [Git][videolan/vlc][master] Deleted 2 commits: display: remove unnecessary #include

2021-12-01 Thread Thomas Guillem (@tguillem)


Thomas Guillem pushed to branch master at VideoLAN / VLC


WARNING: The push did not contain any new commits, but force pushed to delete 
the commits and changes below.


Deleted commits:
de2518b1 by Rémi Denis-Courmont at 2021-11-30T22:00:37+02:00
display: remove unnecessary #include

- - - - -
2ddcadde by Rémi Denis-Courmont at 2021-11-30T22:00:37+02:00
window: split generic and vout-specific code

- - - - -


6 changed files:

- src/Makefile.am
- src/video_output/display.c
- src/video_output/video_output.c
- + src/video_output/video_window.c
- src/video_output/window.h → src/video_output/video_window.h
- src/video_output/window.c


Changes:

=
src/Makefile.am
=
@@ -329,8 +329,9 @@ libvlccore_la_SOURCES = \
video_output/vout_subpictures.c \
video_output/vout_spuregion_helper.h \
video_output/vout_wrapper.h \
+   video_output/video_window.c \
+   video_output/video_window.h \
video_output/window.c \
-   video_output/window.h \
video_output/opengl.c \
video_output/vout_intf.c \
video_output/vout_internal.h \


=
src/video_output/display.c
=
@@ -41,7 +41,6 @@
 #include 
 
 #include "display.h"
-#include "window.h"
 #include "vout_internal.h"
 
 /*


=
src/video_output/video_output.c
=
@@ -55,7 +55,7 @@
 #include "vout_internal.h"
 #include "display.h"
 #include "snapshot.h"
-#include "window.h"
+#include "video_window.h"
 #include "../misc/variables.h"
 #include "../clock/clock.h"
 #include "statistic.h"


=
src/video_output/video_window.c
=
@@ -0,0 +1,242 @@
+/*
+ * video_window.c: vout-specific window management
+ *
+ * Copyright © 2014-2021 Rémi Denis-Courmont
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include "video_window.h"
+#include "vout_internal.h"
+
+#define DOUBLE_CLICK_TIME VLC_TICK_FROM_MS(300)
+
+struct vout_window_ack_data {
+vout_window_t *window;
+vout_window_ack_cb callback;
+unsigned width;
+unsigned height;
+void *opaque;
+};
+
+static void vout_window_Ack(void *data)
+{
+struct vout_window_ack_data *cb_data = data;
+
+if (cb_data->callback != NULL)
+cb_data->callback(cb_data->window, cb_data->width, cb_data->height,
+  cb_data->opaque);
+}
+
+typedef struct vout_display_window
+{
+vout_thread_t *vout;
+vlc_mouse_t mouse;
+vlc_tick_t last_left_press;
+} vout_display_window_t;
+
+static void vout_display_window_ResizeNotify(vout_window_t *window,
+ unsigned width, unsigned height,
+ vout_window_ack_cb cb,
+ void *opaque)
+{
+vout_display_window_t *state = window->owner.sys;
+vout_thread_t *vout = state->vout;
+struct vout_window_ack_data data = { window, cb, width, height, opaque };
+
+msg_Dbg(window, "resized to %ux%u", width, height);
+vout_ChangeDisplaySize(vout, width, height, vout_window_Ack, &data);
+}
+
+static void vout_display_window_CloseNotify(vout_window_t *window)
+{
+/* TODO: Nowhere to dispatch to currently.
+ * Needs callback to ES output to deselect ES? */
+msg_Err(window, "window closed");
+}
+
+static void vout_display_window_StateNotify(vout_window_t *window,
+unsigned window_state)
+{
+vout_display_window_t *state = window->owner.sys;
+vout_thread_t *vout = state->vout;
+
+static const char states[][8] = {
+[VOUT_WINDOW_STATE_NORMAL] = "normal",
+[VOUT_WINDOW_STATE_ABOVE] = "above",
+   

[vlc-commits] [Git][videolan/vlc][3.0.x] audiotrack: disable DynamicsProcessing before Android 12

2021-10-25 Thread Thomas Guillem (@tguillem)


Thomas Guillem pushed to branch 3.0.x at VideoLAN / VLC


Commits:
c900a218 by Thomas Guillem at 2021-10-26T06:28:52+00:00
audiotrack: disable DynamicsProcessing before Android 12

cf. videolan/vlc-android#2221

(cherry picked from commit 639b9d93c194ff5f7473aac7603db16c80d94d76)
Signed-off-by: Thomas Guillem 

- - - - -


1 changed file:

- modules/audio_output/audiotrack.c


Changes:

=
modules/audio_output/audiotrack.c
=
@@ -227,6 +227,8 @@ static struct
 struct {
 jint ENCODING_PCM_8BIT;
 jint ENCODING_PCM_16BIT;
+jint ENCODING_PCM_32BIT;
+bool has_ENCODING_PCM_32BIT;
 jint ENCODING_PCM_FLOAT;
 bool has_ENCODING_PCM_FLOAT;
 jint ENCODING_AC3;
@@ -408,6 +410,9 @@ InitJNIFields( audio_output_t *p_aout, JNIEnv* env )
 GET_CLASS( "android/media/AudioFormat", true );
 GET_CONST_INT( AudioFormat.ENCODING_PCM_8BIT, "ENCODING_PCM_8BIT", true );
 GET_CONST_INT( AudioFormat.ENCODING_PCM_16BIT, "ENCODING_PCM_16BIT", true 
);
+GET_CONST_INT( AudioFormat.ENCODING_PCM_32BIT, "ENCODING_PCM_32BIT", false 
);
+jfields.AudioFormat.has_ENCODING_PCM_32BIT = field != NULL;
+
 #ifdef AUDIOTRACK_USE_FLOAT
 GET_CONST_INT( AudioFormat.ENCODING_PCM_FLOAT, "ENCODING_PCM_FLOAT",
false );
@@ -463,16 +468,24 @@ InitJNIFields( audio_output_t *p_aout, JNIEnv* env )
 jfields.AudioManager.has_ERROR_DEAD_OBJECT = field != NULL;
 GET_CONST_INT( AudioManager.STREAM_MUSIC, "STREAM_MUSIC", true );
 
-GET_CLASS( "android/media/audiofx/DynamicsProcessing", false );
-if( clazz )
+/* Don't use DynamicsProcessing before Android 12 since it may crash
+ * randomly, cf. videolan/vlc-android#2221.
+ *
+ * ENCODING_PCM_32BIT is available on API 31, so test its availability to
+ * check if we are running Android 12 */
+if( jfields.AudioFormat.has_ENCODING_PCM_32BIT )
 {
-jfields.DynamicsProcessing.clazz = (jclass) (*env)->NewGlobalRef( env, 
clazz );
-CHECK_EXCEPTION( "NewGlobalRef", true );
-GET_ID( GetMethodID, DynamicsProcessing.ctor, "", "(I)V", true );
-GET_ID( GetMethodID, DynamicsProcessing.setInputGainAllChannelsTo,
-"setInputGainAllChannelsTo", "(F)V", true );
-GET_ID( GetMethodID, DynamicsProcessing.setEnabled,
-"setEnabled", "(Z)I", true );
+GET_CLASS( "android/media/audiofx/DynamicsProcessing", false );
+if( clazz )
+{
+jfields.DynamicsProcessing.clazz = (jclass) (*env)->NewGlobalRef( 
env, clazz );
+CHECK_EXCEPTION( "NewGlobalRef", true );
+GET_ID( GetMethodID, DynamicsProcessing.ctor, "", "(I)V", 
true );
+GET_ID( GetMethodID, DynamicsProcessing.setInputGainAllChannelsTo,
+"setInputGainAllChannelsTo", "(F)V", true );
+GET_ID( GetMethodID, DynamicsProcessing.setEnabled,
+"setEnabled", "(Z)I", true );
+}
 }
 
 #undef CHECK_EXCEPTION



View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/commit/c900a2183f8988f32e60afdcae3aa398387295f1

-- 
View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/commit/c900a2183f8988f32e60afdcae3aa398387295f1
You're receiving this email because of your account on code.videolan.org.


___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits

[vlc-commits] [Git][videolan/vlc][master] macosx: fixup user-provided URIs

2021-08-31 Thread Thomas Guillem (@tguillem)


Thomas Guillem pushed to branch master at VideoLAN / VLC


Commits:
cc6a5a73 by Marvin Scholz at 2021-08-31T14:58:03+00:00
macosx: fixup user-provided URIs

Fixup user-provided URIs, similar to what most browser nowadays do.

Fix #21661

- - - - -


1 changed file:

- modules/gui/macosx/windows/VLCOpenWindowController.m


Changes:

=
modules/gui/macosx/windows/VLCOpenWindowController.m
=
@@ -1009,9 +1009,20 @@ NSString *const VLCOpenTextFieldWasClicked = 
@"VLCOpenTextFieldWasClicked";
 mrlString = [mrlString stringByAppendingFormat: @":%i", port];
 }
 }
-} else
+} else {
 mrlString = [_netHTTPURLTextField stringValue];
 
+// Fixup the user-provided URI
+const char *orig_uri = [mrlString UTF8String];
+if (orig_uri == NULL)
+return;
+char *fixed_uri = vlc_uri_fixup(orig_uri);
+if (fixed_uri) {
+mrlString = [[NSString alloc] initWithUTF8String:fixed_uri];
+free(fixed_uri);
+}
+}
+
 [self setMRL: mrlString];
 }
 



View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/commit/cc6a5a7370467e7f0fb51578f06f68dfe19dca3b

-- 
View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/commit/cc6a5a7370467e7f0fb51578f06f68dfe19dca3b
You're receiving this email because of your account on code.videolan.org.


___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits

[vlc-commits] [Git][videolan/vlc][master] 9 commits: core: add tracing API

2021-08-31 Thread Thomas Guillem (@tguillem)


Thomas Guillem pushed to branch master at VideoLAN / VLC


Commits:
ee52a2e1 by Nicolas LeQuec at 2021-08-31T12:35:56+00:00
core: add tracing API

Tracing system is independant from the logging system and load modules with a 
"tracer" capability.
The tracer module is loaded at the initialisation of a libvlc instance.

- - - - -
fa32b560 by Nicolas LeQuec at 2021-08-31T12:35:56+00:00
src/object: add vlc_object_get_tracer function

- - - - -
d66f36af by Nicolas LeQuec at 2021-08-31T12:35:56+00:00
libvlc: integrate vlc_tracer API

- - - - -
0bf5330a by Nicolas LeQuec at 2021-08-31T12:35:56+00:00
src/clock: add a tracer field to the main clock

- - - - -
fcafe8a5 by Nicolas LeQuec at 2021-08-31T12:35:56+00:00
logger: add new trace module

Add a trace module that stores the traces in a file or displays them
in stdout with a json notation.

- - - - -
66fe08f3 by Nicolas LeQuec at 2021-08-31T12:35:56+00:00
libvlc-module: add the tracer module

- - - - -
a7edba07 by Nicolas LeQuec at 2021-08-31T12:35:56+00:00
src/decoder: add new field psz_id

In traces, it's useful to have the id of the decoder used.

- - - - -
8218c474 by Nicolas LeQuec at 2021-08-31T12:35:56+00:00
src/clock: add new field track_str_id

In traces, it's useful to have the str_id of the elementary stream read.
It can be obtained through the clock.

- - - - -
f55348fd by Nicolas LeQuec at 2021-08-31T12:35:56+00:00
logs: fit trace messages with the new trace API

Use of the previouly created trace API to collect data from demuxer, decoder 
and video_output.
Fields "type", "id", and "stream" are then used 
by a script to identify data and name curves to
display.
Here is the link of the script project: 
https://gitlab.com/videolabs/public/vlc-pa

- - - - -


16 changed files:

- include/vlc_objects.h
- + include/vlc_tracer.h
- modules/logger/Makefile.am
- + modules/logger/json.c
- src/Makefile.am
- src/clock/clock.c
- src/clock/clock.h
- src/input/decoder.c
- src/input/decoder.h
- src/input/es_out.c
- src/libvlc-module.c
- src/libvlc.c
- src/libvlc.h
- src/libvlccore.sym
- src/misc/objects.c
- + src/misc/tracer.c


Changes:

=
include/vlc_objects.h
=
@@ -29,6 +29,7 @@
  */
 
 struct vlc_logger;
+struct vlc_tracer;
 struct vlc_object_internals;
 struct vlc_object_marker;
 
@@ -161,6 +162,13 @@ static inline struct vlc_logger 
*vlc_object_logger(vlc_object_t *obj)
 }
 #define vlc_object_logger(o) vlc_object_logger(VLC_OBJECT(o))
 
+ /**
+ * Get tracer of a vlc instance from an object.
+ *
+ * \return the tracer of a vlc instance from an object (NULL if none).
+ */
+VLC_API struct vlc_tracer *vlc_object_get_tracer(vlc_object_t *obj);
+
 /**
  * Tries to get the name of module bound to an object.
  *


=
include/vlc_tracer.h
=
@@ -0,0 +1,188 @@
+/*
+ * vlc_tracer.h: tracing interface
+ * This library provides basic functions for threads to interact with user
+ * interface, such as trace output.
+ *
+ * Copyright (C) 2021 VLC authors and VideoLAN
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ */
+
+#ifndef VLC_TRACES_H
+#define VLC_TRACES_H
+
+#include 
+
+/**
+ * \defgroup traces Tracing
+ * \ingroup os
+ * \brief Message traces
+ *
+ * Functions for modules to emit traces.
+ *
+ * @{
+ * \file
+ * Tracing functions
+ */
+
+/**
+ * Trace message values
+ */
+enum vlc_tracer_value
+{
+VLC_TRACER_INT,
+VLC_TRACER_STRING
+};
+
+typedef union
+{
+int64_t integer;
+const char *string;
+} vlc_tracer_value_t;
+
+/**
+ * Trace message
+ */
+struct vlc_tracer_entry
+{
+const char *key;/**< Key to identify the value */
+vlc_tracer_value_t value;   /**< Trace value */
+enum vlc_tracer_value type; /**< Type of the value */
+};
+
+struct vlc_tracer;
+
+/**
+ * Trace logging callback signature.
+ *
+ * va-args can only be \ref vlc_tracer_entry and the va-args list
+ * should be ended by a \ref vlc_tracer_entry with a NULL key.
+ * \param data data pointer as provide

[vlc-commits] [Git][videolan/vlc][master] 4 commits: es_out: refactor es_out_id_t list matching

2021-08-03 Thread Thomas Guillem (@tguillem)


Thomas Guillem pushed to branch master at VideoLAN / VLC


Commits:
55a4c763 by Thomas Guillem at 2021-08-03T10:48:40+00:00
es_out: refactor es_out_id_t list matching

- - - - -
45891bc0 by Thomas Guillem at 2021-08-03T10:48:40+00:00
es_out: fix ES unselect order from EsOutSelectList

1/ Unselect all ESes not matching the list
2/ Select all ESes matching the list

This avoids having more than one ESes selected when avoidable. Having
more than one ESes selected is supported for VIDEO_ES and SPU_ES but not
for AUDIO_ES (EXCLUSIVE policy).

This commit fixes the EXCLUSIVE policy that was not respected by
EsOutSelectList().

- - - - -
24caf912 by Thomas Guillem at 2021-08-03T10:48:40+00:00
es_out: refactor str_ids matching code

- - - - -
c8fa3af6 by Thomas Guillem at 2021-08-03T10:48:40+00:00
es_out: fix ES unselect order from EsOutSelectListFromProps

1/ Unselect all ESes not matching the list
2/ Select all ESes matching the list

This avoids having more than one ESes selected when avoidable. Having
more than one ESes selected is supported for VIDEO_ES and SPU_ES but not
for AUDIO_ES (EXCLUSIVE policy).

This commit fixes the EXCLUSIVE policy that was not respected by
EsOutSelectListFromProps().

- - - - -


1 changed file:

- src/input/es_out.c


Changes:

=
src/input/es_out.c
=
@@ -2570,27 +2570,37 @@ static bool EsOutSelectHasExplicitParams( const 
es_out_es_props_t *p_esprops )
 return p_esprops->str_ids || p_esprops->i_channel >= 0;
 }
 
+static bool EsOutIdMatchStrIds( const es_out_id_t *es, char *str_ids )
+{
+char *saveptr;
+
+for( const char *str_id = strtok_r( str_ids, ",", &saveptr );
+ str_id != NULL ;
+ str_id = strtok_r( NULL, ",", &saveptr ) )
+{
+if( strcmp( str_id, es->id.str_id ) == 0 )
+return true;
+}
+
+return false;
+}
+
 static bool EsOutSelectMatchExplicitParams( const es_out_es_props_t *p_esprops,
 const es_out_id_t *es )
 {
 /* user designated by ID ES have higher prio than everything */
 if( p_esprops->str_ids )
 {
-char *saveptr, *str_ids = strdup( p_esprops->str_ids );
+/* EsOutIdMatchStrIds will modify str_ids */
+char *str_ids = strdup( p_esprops->str_ids );
 if( str_ids )
 {
-for( const char *str_id = strtok_r( str_ids, ",", &saveptr );
- str_id != NULL ;
- str_id = strtok_r( NULL, ",", &saveptr ) )
-{
-if( strcmp( str_id, es->id.str_id ) == 0 )
-{
-free( str_ids );
-return true;
-}
-}
+bool matching = EsOutIdMatchStrIds( es, str_ids );
+free( str_ids );
+
+if( matching )
+return true;
 }
-free( str_ids );
 }
 
 /* then channel index */
@@ -2743,6 +2753,7 @@ static void EsOutSelectListFromProps( es_out_t *out, enum 
es_format_category_e c
 {
 es_out_sys_t *p_sys = container_of(out, es_out_sys_t, out);
 es_out_es_props_t *esprops = GetPropsByCat( p_sys, cat );
+es_out_id_t *other;
 if( !esprops || !esprops->str_ids )
 return;
 
@@ -2750,48 +2761,51 @@ static void EsOutSelectListFromProps( es_out_t *out, 
enum es_format_category_e c
 if( !buffer )
 return;
 
-bool unselect_others = false;
-es_out_id_t *other;
+/* Unselect all ES that are not on the str_ids list.
+ * This step need to be done before the selection step, specially
+ * for the EXCLUSIVE ES policy. Indeed, having multiple ES selected is not
+ * supported for this policy. */
+foreach_es_then_es_slaves(other)
+{
+if( other->fmt.i_cat != cat )
+continue;
+
+/* EsOutIdMatchStrIds will modify str_ids */
+strcpy( buffer, esprops->str_ids );
+if( !EsOutIdMatchStrIds( other, buffer ) && EsIsSelected( other ) ) 
+EsOutUnselectEs( out, other, other->p_pgrm == p_sys->p_pgrm );
+}
+
+/* Now, select all ES from the str_ids list */
 foreach_es_then_es_slaves( other )
 {
 if( other->fmt.i_cat != cat )
 continue;
 
-bool select = false;
-if( !unselect_others )
+/* EsOutIdMatchStrIds will modify str_ids */
+strcpy( buffer, esprops->str_ids );
+if( EsOutIdMatchStrIds( other, buffer ) && !EsIsSelected( other ) )
 {
-/* strtok_r will modify str_ids */
-strcpy( buffer, esprops->str_ids );
-char *saveptr;
-for( const char *str_id = strtok_r( buffer, ",", &saveptr );
- str_id != NULL;
- str_id = strtok_r( NULL, ",", &saveptr ) )
-{
-if( strcmp( other->id.str_id, str_id ) == 0 )
-{
-select = true;
-break;
-

[vlc-commits] [Git][videolan/vlc][master] 3 commits: es_out: rename clock_source

2021-07-29 Thread Thomas Guillem (@tguillem)


Thomas Guillem pushed to branch master at VideoLAN / VLC


Commits:
1a18940b by Thomas Guillem at 2021-07-29T13:53:21+00:00
es_out: rename clock_source

To avoid confusion with pgrm->active_clock_source.

- - - - -
88ad68a9 by Thomas Guillem at 2021-07-29T13:53:21+00:00
es_out: restore the previous ES_OUT_SET_PCR behavior

ES_OUT_SET_PCR can now be called anytime (even from the open cb) and
from any threads. The behavior was changed in
800482fbd2a1d3169a920f7b883590a6ff23949a.

This fixes assert with asynchronous accesses like pulse that could
configure the clock without being started by the input (via
ES_OUT_PRIV_SET_MODE)

Fixes #25947

- - - - -
03ec78a0 by Thomas Guillem at 2021-07-29T13:53:21+00:00
es_out: log the active clock source

- - - - -


1 changed file:

- src/input/es_out.c


Changes:

=
src/input/es_out.c
=
@@ -182,7 +182,7 @@ typedef struct
 struct vlc_list programs;
 es_out_pgrm_t *p_pgrm;  /* Master program */
 
-enum vlc_clock_master_source clock_source;
+enum vlc_clock_master_source user_clock_source;
 
 /* all es */
 int i_id;
@@ -562,7 +562,7 @@ es_out_t *input_EsOutNew( input_thread_t *p_input, 
input_source_t *main_source,
 
 p_sys->i_group_id = var_GetInteger( p_input, "program" );
 
-p_sys->clock_source = clock_source_Inherit( VLC_OBJECT(p_input) );
+p_sys->user_clock_source = clock_source_Inherit( VLC_OBJECT(p_input) );
 
 p_sys->i_pause_date = -1;
 
@@ -1312,11 +1312,11 @@ static void EsOutProgramHandleClockSource( es_out_t 
*out, es_out_pgrm_t *p_pgrm
  * open callback or midstream (from the demux callback). Therefore, we
  * can't handle the clock source selection after the program is created
  * since input_CanPaceControl() might not be initialized. To fix this
- * issue, handle clock source selection when the first PCR is sent (from
- * ES_OUT_SET_PCR). */
+ * issue, handle clock source selection after/when the es_out is activated
+ * (from ES_OUT_PRIV_SET_MODE) or when a program is created. */
 assert( p_sys->b_active );
 
-switch( p_sys->clock_source )
+switch( p_sys->user_clock_source )
 {
 case VLC_CLOCK_MASTER_AUTO:
 if (input_CanPaceControl(p_input))
@@ -1338,9 +1338,24 @@ static void EsOutProgramHandleClockSource( es_out_t 
*out, es_out_pgrm_t *p_pgrm
 break;
 }
 default:
-p_pgrm->active_clock_source = p_sys->clock_source;
+p_pgrm->active_clock_source = p_sys->user_clock_source;
 break;
 }
+
+const char *clock_source_str;
+switch( p_pgrm->active_clock_source )
+{
+case VLC_CLOCK_MASTER_AUDIO:clock_source_str = "audio"; break;
+case VLC_CLOCK_MASTER_INPUT:clock_source_str = "input"; break;
+case VLC_CLOCK_MASTER_MONOTONIC:clock_source_str = "monotonic"; break;
+
+case VLC_CLOCK_MASTER_AUTO:
+default:
+vlc_assert_unreachable();
+}
+
+msg_Dbg( p_input, "program(%d): using clock source: '%s'\n",
+ p_pgrm->i_id, clock_source_str );
 }
 
 /* EsOutIsGroupSticky
@@ -1498,6 +1513,9 @@ static es_out_pgrm_t *EsOutProgramAdd( es_out_t *out, 
input_source_t *source, in
 return NULL;
 }
 
+if( p_sys->b_active )
+EsOutProgramHandleClockSource( out, p_pgrm );
+
 if( p_sys->b_paused )
 input_clock_ChangePause( p_pgrm->p_input_clock, p_sys->b_paused, 
p_sys->i_pause_date );
 const vlc_tick_t pts_delay = p_sys->i_pts_delay + p_sys->i_pts_jitter
@@ -2274,7 +2292,7 @@ static void EsOutCreateDecoder( es_out_t *out, 
es_out_id_t *p_es )
 assert( p_es->p_pgrm );
 
 enum es_format_category_e clock_source_cat;
-switch( p_sys->clock_source )
+switch( p_sys->user_clock_source )
 {
 case VLC_CLOCK_MASTER_AUTO:
 case VLC_CLOCK_MASTER_AUDIO:
@@ -3308,12 +3326,6 @@ static int EsOutVaControlLocked( es_out_t *out, 
input_source_t *source,
 if( !p_pgrm )
 return VLC_EGENERIC;
 
-if( p_pgrm->active_clock_source == VLC_CLOCK_MASTER_AUTO )
-{
-EsOutProgramHandleClockSource( out, p_pgrm );
-assert( p_pgrm->active_clock_source != VLC_CLOCK_MASTER_AUTO );
-}
-
 i_pcr = va_arg( args, vlc_tick_t );
 if( i_pcr == VLC_TICK_INVALID )
 {
@@ -3654,6 +3666,19 @@ static int EsOutVaPrivControlLocked( es_out_t *out, int 
query, va_list args )
 p_sys->b_active = i_mode != ES_OUT_MODE_NONE;
 p_sys->i_mode = i_mode;
 
+if( p_sys->b_active && i_mode != ES_OUT_MODE_END )
+{
+es_out_pgrm_t *p_pgrm;
+vlc_list_foreach(p_pgrm, &p_sys->programs, node)
+{
+if( p_pgrm->active_clock_source == VLC_CLOCK_MASTER_AUTO )
+{
+EsOutProgramHandleClockSource( out, p_pgrm );
+assert( p_pgrm->active_

[vlc-commits] [Git][videolan/vlc][master] Revert "es_out: reset main clocks when terminating"

2021-07-19 Thread Thomas Guillem (@tguillem)


Thomas Guillem pushed to branch master at VideoLAN / VLC


Commits:
9768497d by Thomas Guillem at 2021-07-16T16:22:06+02:00
Revert "es_out: reset main clocks when terminating"

This reverts commit 36596846205e64cb0c529586c50a4f3789a5c206.

This was a really bad idea. There was 50/50 chance to improve close
speed or to make it worse. Indeed, resetting the clock means that the
next output update create its own reference point. That point has the
same chance to be after or before the previous point.

- - - - -


1 changed file:

- src/input/es_out.c


Changes:

=
src/input/es_out.c
=
@@ -3636,18 +3636,6 @@ static int EsOutVaPrivControlLocked( es_out_t *out, int 
query, va_list args )
 p_sys->b_active = i_mode != ES_OUT_MODE_NONE;
 p_sys->i_mode = i_mode;
 
-if( i_mode == ES_OUT_MODE_NONE )
-{
-/* Reset main clocks before unselecting every ESes. This will speed
- * up audio and video output termination. Indeed, they won't wait
- * for a specific PTS conversion. This may also unblock outputs in
- * case of a corrupted sample with a PTS very far in the future.
- * */
-es_out_pgrm_t *pgrm;
-vlc_list_foreach(pgrm, &p_sys->programs, node)
-vlc_clock_main_Reset(pgrm->p_main_clock);
-}
-
 /* Reapply policy mode */
 es_out_id_t *es;
 



View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/commit/9768497d03f7172623a204199843b1b73fb7d2e8

-- 
View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/commit/9768497d03f7172623a204199843b1b73fb7d2e8
You're receiving this email because of your account on code.videolan.org.


___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits