From gitlab at videolan.org Sat Apr 1 11:39:09 2023 From: gitlab at videolan.org (Jean-Baptiste Kempf (@jbk)) Date: Sat, 01 Apr 2023 13:39:09 +0200 Subject: [vlc-commits] [Git][videolan/vlc][master] 2 commits: player: input: change ES delay without controls Message-ID: <642817dd41b15_4a52ea8b74431328a6@gitlab.mail> Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC Commits: 5e4dbfac by Alexandre Janniaux at 2023-04-01T11:08:07+00:00 player: input: change ES delay without controls When setting delay, audio output flushing and picture drops can happen and lead to unpleasant result, like stuttering, on both outputs. Since the delay was set by an input command, demux could send a bit of data to play before the delay was really applied, leading to this effect even when starting the playback. This commit alone doesn't fix the issue, but it ensures that delay is synchronously set before the start of the input when it's not running yet, mimicking the other input methods allowing to apply a control synchronously when the input is not yet running. Co-authored-by: Thomas Guillem <thomas at gllm.fr> Refs #27918 - - - - - 1718facc by Alexandre Janniaux at 2023-04-01T11:08:07+00:00 player: use input_SetEsCatDelay instead of control input_SetEsCatDelay will apply the delay synchronously if the input is not running yet, or push a control to apply it from the input thread otherwise. Co-authored-by: Thomas Guillem <thomas at gllm.fr> Refs #27918 - - - - - 4 changed files: - src/input/input.c - src/input/input_internal.h - src/player/input.c - src/player/player.c Changes: ===================================== src/input/input.c ===================================== @@ -1862,6 +1862,31 @@ void input_SetProgramId(input_thread_t *input, int group_id) } } +int input_SetEsCatDelay(input_thread_t *input, enum es_format_category_e cat, + vlc_tick_t delay) +{ + input_thread_private_t *sys = input_priv(input); + /* A failure can only happen in the input_ControlPush section. */ + int ret = VLC_SUCCESS; + + if (!sys->is_running && !sys->is_stopped) + { + /* Not running, send the control synchronously since we are sure that + * it won't block */ + es_out_SetDelay(sys->p_es_out_display, cat, delay); + } + else + { + const input_control_param_t param = { + .cat_delay = { cat, delay } + }; + ret = input_ControlPush(input, INPUT_CONTROL_SET_CATEGORY_DELAY, + ¶m); + } + + return ret; +} + void input_SetEsCatIds(input_thread_t *input, enum es_format_category_e cat, const char *str_ids) { ===================================== src/input/input_internal.h ===================================== @@ -625,6 +625,26 @@ static inline int input_ControlPushEsHelper( input_thread_t *p_input, int i_type */ void input_SetProgramId(input_thread_t *input, int group_id); +/** + * Set the default delay applied to the given category. + * + * Set the default delay for the given \p es_format_category_e synchronously + * if the input is not running yet, otherwise push a control to signal to the + * input which delay should be updated. + * + * @param input Any input to change the delay for. + * @param cat The ES category to apply the delay to. + * @param delay The delay to apply to the category, a positive delay shifting + * the track to the future. + * @return VLC_SUCCESS when the delay has been applied, or signal an error + * otherwise. + * + * @note This function can be called before start or while running. + * @note This function is not thread-safe, the caller should handle the locking. + */ +int input_SetEsCatDelay(input_thread_t *input, enum es_format_category_e cat, + vlc_tick_t delay); + /** * Set the list of string ids to enable for a category * ===================================== src/player/input.c ===================================== @@ -1023,12 +1023,7 @@ vlc_player_input_New(vlc_player_t *player, input_item_t *item) input->cat_delays[i] = cat_delays[i]; if (cat_delays[i] != 0) { - const input_control_param_t param = { - .cat_delay = { i, cat_delays[i] } - }; - int ret = input_ControlPush(input->thread, - INPUT_CONTROL_SET_CATEGORY_DELAY, - ¶m); + int ret = input_SetEsCatDelay(input->thread, i, cat_delays[i]); if (ret == VLC_SUCCESS) vlc_player_SendEvent(player, on_category_delay_changed, i, cat_delays[i]); ===================================== src/player/player.c ===================================== @@ -1663,9 +1663,7 @@ vlc_player_SetCategoryDelay(vlc_player_t *player, enum es_format_category_e cat, delay = *cat_delay; } - const input_control_param_t param = { .cat_delay = { cat, delay } }; - int ret = input_ControlPush(input->thread, INPUT_CONTROL_SET_CATEGORY_DELAY, - ¶m); + int ret = input_SetEsCatDelay(input->thread, cat, delay); if (ret == VLC_SUCCESS) { vlc_player_osd_Message(player, _("%s delay: %i ms"), View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/181e91d00132d57205936d1cd6844b08756b0b4c...1718faccc63808e40ded77ad3c90939e9339d890 -- View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/181e91d00132d57205936d1cd6844b08756b0b4c...1718faccc63808e40ded77ad3c90939e9339d890 You're receiving this email because of your account on code.videolan.org. VideoLAN code repository instance From gitlab at videolan.org Sat Apr 1 18:20:26 2023 From: gitlab at videolan.org (Jean-Baptiste Kempf (@jbk)) Date: Sat, 01 Apr 2023 20:20:26 +0200 Subject: [vlc-commits] [Git][videolan/vlc][master] qt: preserve interface window geometry in all cases Message-ID: <642875eae2e5b_4a52ea8b7443152912@gitlab.mail> Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC Commits: b87b0168 by Fatih Uzunoglu at 2023-04-01T18:03:56+00:00 qt: preserve interface window geometry in all cases preserve the interface geometry when going into fullscreen, in order to restore it later (when exiting the fullscreen mode). - - - - - 1 changed file: - modules/gui/qt/maininterface/video_window_handler.cpp Changes: ===================================== modules/gui/qt/maininterface/video_window_handler.cpp ===================================== @@ -119,6 +119,8 @@ void VideoWindowHandler::setVideoFullScreen( bool fs ) m_videoFullScreen = fs; if( fs ) { + m_lastWinGeometry = m_window->geometry(); + int numscreen = var_InheritInteger( m_intf, "qt-fullscreen-screennumber" ); auto screenList = QApplication::screens(); @@ -135,7 +137,6 @@ void VideoWindowHandler::setVideoFullScreen( bool fs ) /* To be sure window is on proper-screen in xinerama */ if( !screenres.contains( m_window->position() ) ) { - m_lastWinGeometry = m_window->geometry(); m_window->setPosition(screenres.x(), screenres.y() ); } } View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/b87b016859f9e5a6163db17976cb719eaa9bc87c -- View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/b87b016859f9e5a6163db17976cb719eaa9bc87c You're receiving this email because of your account on code.videolan.org. VideoLAN code repository instance From gitlab at videolan.org Sat Apr 1 20:31:19 2023 From: gitlab at videolan.org (Jean-Baptiste Kempf (@jbk)) Date: Sat, 01 Apr 2023 22:31:19 +0200 Subject: [vlc-commits] [Git][videolan/vlc][master] qml: fix navigation to empty label in video views Message-ID: <64289497e0198_4a52249e1a831559dc@gitlab.mail> Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC Commits: 6e190241 by Prince Gupta at 2023-04-01T20:13:39+00:00 qml: fix navigation to empty label in video views - - - - - 1 changed file: - modules/gui/qt/medialibrary/qml/VideoAllSubDisplay.qml Changes: ===================================== modules/gui/qt/medialibrary/qml/VideoAllSubDisplay.qml ===================================== @@ -89,9 +89,11 @@ VideoAll { function setCurrentItemFocus(reason) { if (headerItem && headerItem.focus) - headerItem.forceActiveFocus(reason) + headerItem.forceActiveFocus(reason) // continue watching section + else if (currentItem.setCurrentItemFocus) + currentItem.setCurrentItemFocus(reason) // grid or list view else - currentItem.setCurrentItemFocus(reason) + currentItem.forceActiveFocus(reason) // empty label } // VideoAll events reimplementation View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/6e1902417d5727d6cc65e0a00977e13b2a95059d -- View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/6e1902417d5727d6cc65e0a00977e13b2a95059d You're receiving this email because of your account on code.videolan.org. VideoLAN code repository instance From gitlab at videolan.org Sun Apr 2 07:02:48 2023 From: gitlab at videolan.org (Jean-Baptiste Kempf (@jbk)) Date: Sun, 02 Apr 2023 09:02:48 +0200 Subject: [vlc-commits] [Git][videolan/vlc][master] 4 commits: qml/ControlLayout: Code cleanup Message-ID: <6429289853c19_4a52de05aec31628b4@gitlab.mail> Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC Commits: 00058ecc by Benjamin Arnaud at 2023-04-02T06:37:47+00:00 qml/ControlLayout: Code cleanup No functionnal changes - - - - - dce53de9 by Benjamin Arnaud at 2023-04-02T06:37:47+00:00 qml/ControlLayout: Ensure 'item(s)' are valid - - - - - 9476171d by Benjamin Arnaud at 2023-04-02T06:37:47+00:00 qml/ControlLayout: Code cleanup No functional changes - - - - - 8909317b by Benjamin Arnaud at 2023-04-02T06:37:47+00:00 qml/PlayerControlLayout: Code cleanup No functional changes - - - - - 2 changed files: - modules/gui/qt/player/qml/ControlLayout.qml - modules/gui/qt/player/qml/PlayerControlLayout.qml Changes: ===================================== modules/gui/qt/player/qml/ControlLayout.qml ===================================== @@ -30,43 +30,69 @@ import "qrc:///widgets/" as Widgets FocusScope { id: controlLayout - signal requestLockUnlockAutoHide(bool lock) - - property alias model: repeater.model + // Properties readonly property real minimumWidth: { - var minimumWidth = 0 var count = repeater.count + if (count === 0) + return 0 + + var size = 0 + for (var i = 0; i < count; ++i) { var item = repeater.itemAt(i) - if (item.minimumWidth !== undefined) - minimumWidth += item.minimumWidth + if (item.minimumWidth === undefined) + size += item.implicitWidth else - minimumWidth += item.implicitWidth + size += item.minimumWidth } - minimumWidth += ((count - 1) * playerControlLayout.spacing) - - return minimumWidth + return size + ((count - 1) * playerControlLayout.spacing) } property bool rightAligned: false + property var altFocusAction: Navigation.defaultNavigationUp + + readonly property ColorContext colorContext: ColorContext { + id: theme + colorSet: ColorContext.Window + } + + // Aliases + + property alias model: repeater.model + + // Signals + + signal requestLockUnlockAutoHide(bool lock) + + // Settings + + implicitWidth: minimumWidth + implicitHeight: rowLayout.implicitHeight + Navigation.navigable: { for (var i = 0; i < repeater.count; ++i) { - if (repeater.itemAt(i).item.focus) { + var item = repeater.itemAt(i).item + + if (item && item.focus) { return true } } return false } - implicitWidth: minimumWidth - implicitHeight: rowLayout.implicitHeight + // Events - property var altFocusAction: Navigation.defaultNavigationUp + Component.onCompleted: { + visibleChanged.connect(_handleFocus) + activeFocusChanged.connect(_handleFocus) + } + + // Functions function _handleFocus() { if (typeof activeFocus === "undefined") @@ -76,15 +102,7 @@ FocusScope { altFocusAction() } - Component.onCompleted: { - visibleChanged.connect(_handleFocus) - activeFocusChanged.connect(_handleFocus) - } - - readonly property ColorContext colorContext: ColorContext { - id: theme - colorSet: ColorContext.Window - } + // Children RowLayout { id: rowLayout @@ -113,17 +131,33 @@ FocusScope { delegate: Loader { id: loader + // Properties + + property int minimumWidth: { + if (expandable) + return item.minimumWidth + else if (item) + return item.implicitWidth + else + return 0 + } + + readonly property bool expandable: (item && item.minimumWidth !== undefined) + + // Settings + source: PlayerControlbarControls.control(model.id).source focus: (index === 0) - Layout.alignment: Qt.AlignVCenter | (rightAligned ? Qt.AlignRight : Qt.AlignLeft) - Layout.minimumWidth: minimumWidth Layout.fillWidth: expandable - Layout.maximumWidth: item.implicitWidth - readonly property real minimumWidth: (expandable ? item.minimumWidth : item.implicitWidth) - readonly property bool expandable: (item.minimumWidth !== undefined) + Layout.minimumWidth: minimumWidth + + // NOTE: -1 resets to the implicit maximum width. + Layout.maximumWidth: (item) ? item.implicitWidth : -1 + + Layout.alignment: Qt.AlignVCenter | (rightAligned ? Qt.AlignRight : Qt.AlignLeft) BindingCompat { delayed: true // this is important @@ -132,6 +166,8 @@ FocusScope { value: (loader.x + minimumWidth <= rowLayout.width) } + // Events + Component.onCompleted: repeater.countChanged.connect(controlLayout._handleFocus) onActiveFocusChanged: { @@ -140,22 +176,6 @@ FocusScope { } } - Connections { - target: item - - enabled: loader.status === Loader.Ready - - onEnabledChanged: { - if (activeFocus && !item.enabled) // Loader has focus but item is not enabled - recoverFocus() - } - - onVisibleChanged: { - if (activeFocus && !item.visible) - recoverFocus() - } - } - onLoaded: { // control should not request focus if they are not enabled: item.focus = Qt.binding(function() { return item.enabled && item.visible }) @@ -182,28 +202,58 @@ FocusScope { } } + // Connections + + Connections { + target: item + + enabled: loader.status === Loader.Ready + + onEnabledChanged: { + if (activeFocus && !item.enabled) // Loader has focus but item is not enabled + recoverFocus() + } + + onVisibleChanged: { + if (activeFocus && !item.visible) + recoverFocus() + } + } + + // Functions + function applyNavigation() { + if (item == null) return + var itemLeft = repeater.itemAt(index - 1) var itemRight = repeater.itemAt(index + 1) if (itemLeft) { - var componentLeft = itemLeft.item; + var componentLeft = itemLeft.item - item.Navigation.leftItem = componentLeft + if (componentLeft) + { + item.Navigation.leftItem = componentLeft - componentLeft.Navigation.rightItem = item + componentLeft.Navigation.rightItem = item + } } if (itemRight) { - var componentRight = itemRight.item; + var componentRight = itemRight.item - item.Navigation.rightItem = componentRight + if (componentRight) + { + item.Navigation.rightItem = componentRight - componentRight.Navigation.leftItem = item + componentRight.Navigation.leftItem = item + } } } function removeNavigation() { + if (item == null) return + var itemLeft = repeater.itemAt(index - 1) // NOTE: The current item was removed from the repeater so we test against the @@ -223,21 +273,9 @@ FocusScope { } } - function _focusIfFocusable(_loader) { - if (!!_loader && !!_loader.item && _loader.item.focus) { - if (item.focusReason !== undefined) - _loader.item.forceActiveFocus(item.focusReason) - else { - console.warn("focusReason is not available in %1!".arg(item)) - _loader.item.forceActiveFocus() - } - return true - } else { - return false - } - } - function recoverFocus(_index) { + if (item == null) return + if (!controlLayout.visible) return @@ -270,6 +308,22 @@ FocusScope { controlLayout.altFocusAction() } } + + // Private + + function _focusIfFocusable(_loader) { + if (!!_loader && !!_loader.item && _loader.item.focus) { + if (item.focusReason !== undefined) + _loader.item.forceActiveFocus(item.focusReason) + else { + console.warn("focusReason is not available in %1!".arg(item)) + _loader.item.forceActiveFocus() + } + return true + } else { + return false + } + } } } ===================================== modules/gui/qt/player/qml/PlayerControlLayout.qml ===================================== @@ -26,26 +26,21 @@ import "qrc:///widgets/" as Widgets FocusScope { id: playerControlLayout - implicitWidth: layoutLoader_left.implicitWidth + layoutLoader_center.implicitWidth + layoutLoader_right.implicitWidth + 2 * layoutSpacing - implicitHeight: VLCStyle.maxControlbarControlHeight + // Properties property real defaultSize: VLCStyle.icon_normal // default size for IconToolButton based controls property real spacing: VLCStyle.margin_normal // spacing between controls + property real layoutSpacing: VLCStyle.margin_xxlarge // spacing between layouts (left, center, and right) property int identifier: -1 + readonly property PlayerControlbarModel model: { if (!!MainCtx.controlbarProfileModel.currentModel) - MainCtx.controlbarProfileModel.currentModel.getModel(identifier) + return MainCtx.controlbarProfileModel.currentModel.getModel(identifier) else - null - } - - signal requestLockUnlockAutoHide(bool lock) - - Component.onCompleted: { - console.assert(identifier >= 0) + return null } readonly property ColorContext colorContext: ColorContext { @@ -53,11 +48,28 @@ FocusScope { colorSet: ColorContext.Window } + // Signals + + signal requestLockUnlockAutoHide(bool lock) + + // Settings + + implicitWidth: loaderLeft.implicitWidth + loaderCenter.implicitWidth + + loaderRight.implicitWidth + 2 * layoutSpacing + + implicitHeight: VLCStyle.maxControlbarControlHeight + + // Events + + Component.onCompleted: console.assert(identifier >= 0) + + // Children + Loader { - id: layoutLoader_left + id: loaderLeft anchors { - right: layoutLoader_center.left + right: loaderCenter.left left: parent.left top: parent.top bottom: parent.bottom @@ -66,8 +78,7 @@ FocusScope { rightMargin: layoutSpacing - spacing } - active: !!playerControlLayout.model - && !!playerControlLayout.model.left + active: !!playerControlLayout.model && !!playerControlLayout.model.left focus: true @@ -79,19 +90,19 @@ FocusScope { ctx: MainCtx } - Navigation.parentItem: playerControlLayout - Navigation.rightItem: layoutLoader_center.item - focus: true altFocusAction: Navigation.defaultNavigationRight + Navigation.parentItem: playerControlLayout + Navigation.rightItem: loaderCenter.item + onRequestLockUnlockAutoHide: playerControlLayout.requestLockUnlockAutoHide(lock) } } Loader { - id: layoutLoader_center + id: loaderCenter anchors { horizontalCenter: parent.horizontalCenter @@ -99,8 +110,7 @@ FocusScope { bottom: parent.bottom } - active: !!playerControlLayout.model - && !!playerControlLayout.model.center + active: !!playerControlLayout.model && !!playerControlLayout.model.center width: (parent.width < implicitWidth) ? parent.width : implicitWidth @@ -113,23 +123,23 @@ FocusScope { ctx: MainCtx } - Navigation.parentItem: playerControlLayout - Navigation.leftItem: layoutLoader_left.item - Navigation.rightItem: layoutLoader_right.item - focus: true altFocusAction: Navigation.defaultNavigationUp + Navigation.parentItem: playerControlLayout + Navigation.leftItem: loaderLeft.item + Navigation.rightItem: loaderRight.item + onRequestLockUnlockAutoHide: playerControlLayout.requestLockUnlockAutoHide(lock) } } Loader { - id: layoutLoader_right + id: loaderRight anchors { - left: layoutLoader_center.right + left: loaderCenter.right right: parent.right top: parent.top bottom: parent.bottom @@ -138,8 +148,7 @@ FocusScope { leftMargin: layoutSpacing - spacing } - active: !!playerControlLayout.model - && !!playerControlLayout.model.right + active: !!playerControlLayout.model && !!playerControlLayout.model.right sourceComponent: ControlLayout { model: ControlListFilter { @@ -151,13 +160,13 @@ FocusScope { rightAligned: true - Navigation.parentItem: playerControlLayout - Navigation.leftItem: layoutLoader_center.item - focus: true altFocusAction: Navigation.defaultNavigationLeft + Navigation.parentItem: playerControlLayout + Navigation.leftItem: loaderCenter.item + onRequestLockUnlockAutoHide: playerControlLayout.requestLockUnlockAutoHide(lock) } } View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/6e1902417d5727d6cc65e0a00977e13b2a95059d...8909317baf97ab643cc4cfbc5e3d0275d555b742 -- View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/6e1902417d5727d6cc65e0a00977e13b2a95059d...8909317baf97ab643cc4cfbc5e3d0275d555b742 You're receiving this email because of your account on code.videolan.org. VideoLAN code repository instance From gitlab at videolan.org Sun Apr 2 09:41:43 2023 From: gitlab at videolan.org (Jean-Baptiste Kempf (@jbk)) Date: Sun, 02 Apr 2023 11:41:43 +0200 Subject: [vlc-commits] [Git][videolan/vlc][master] meson: add gettext support Message-ID: <64294dd7b1556_4a5319aa18831677a3@gitlab.mail> Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC Commits: e8b6a932 by Marvin Scholz at 2023-04-02T08:37:15+00:00 meson: add gettext support While runtime gettext support was already working, this adds the missing piece of build integrations. With these changes, three new targets are now available to manage translation files: - vlc-pot: Regenerates the .pot files using xgettext - vlc-update-po: Regenerates the .po files from the current .pot files - vlc-gmo: Builds (but not installs) the translations - - - - - 2 changed files: - meson.build - + po/meson.build Changes: ===================================== meson.build ===================================== @@ -173,6 +173,8 @@ intl_dep = dependency('intl', required: get_option('nls')) if intl_dep.found() cdata.set('HAVE_GETTEXT', 1) cdata.set('ENABLE_NLS', 1) + + subdir('po') endif # Domain name i18n support via GNU libidn ===================================== po/meson.build ===================================== @@ -0,0 +1,18 @@ +i18n = import('i18n') + +add_project_arguments(f'-DGETTEXT_PACKAGE="@vlc_package_name@"', + language: ['c', 'cpp', 'objc']) +i18n.gettext(vlc_package_name, + args: [ + '--keyword=_', + '--keyword=N_', + '--keyword=_NS', + '--keyword=qtr', + '--keyword=Q_', + '--language=C++', + '--keyword=vlc_ngettext:1,2', + '--keyword=vlc_pgettext:1c,2', + '--keyword=_PNS:1c,2', + '--add-comments=xgettext:', + '--from-code=UTF-8', + ]) View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/e8b6a9324d0048cdede41cbb99db8a483eff016e -- View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/e8b6a9324d0048cdede41cbb99db8a483eff016e You're receiving this email because of your account on code.videolan.org. VideoLAN code repository instance From gitlab at videolan.org Mon Apr 3 14:22:31 2023 From: gitlab at videolan.org (Steve Lhomme (@robUx4)) Date: Mon, 03 Apr 2023 16:22:31 +0200 Subject: [vlc-commits] [Git][videolan/vlc][master] 6 commits: opengl: filter_draw: add assertion for GL errors Message-ID: <642ae127b0591_4a532f17dcc325968@gitlab.mail> Steve Lhomme pushed to branch master at VideoLAN / VLC Commits: 55e0a35a by Alexandre Janniaux at 2023-04-03T14:02:28+00:00 opengl: filter_draw: add assertion for GL errors Ensure that draw commands are not leading to any error later in the pipeline. - - - - - 8f9ec06e by Alexandre Janniaux at 2023-04-03T14:02:28+00:00 opengl: filter_mock: add assertions for GL errors Ensure that draw commands are not leading to any error later in the pipeline. - - - - - 8bc819a2 by Alexandre Janniaux at 2023-04-03T14:02:28+00:00 opengl: interop: add assertions for GL errors Ensure that draw commands are not leading to any error later in the pipeline. - - - - - 9f1683bd by Alexandre Janniaux at 2023-04-03T14:02:28+00:00 opengl: renderer: add assertions for GL errors Ensure that draw commands are not leading to any error later in the pipeline. - - - - - e0f4d15e by Alexandre Janniaux at 2023-04-03T14:02:28+00:00 opengl: interop: handle GLES2 case during runtime Fix a future issue when using the code against a GLES2 provider, where the detection was done at build time instead of runtime. The build time check is needed to prevent using non-existant function and defines, but the runtime check will be needed whenever OpenGL headers are available. With the work allowing to use the opengl filter with a gles2 provider on Linux with OpenGL available (not merged), it leads to: $ MESA_DEBUG=1 ./vlc -vv ~/Video/dog_meme.mp4 --video-filter='opengl{filter=mock{mask},gles=any}' Mesa: User error: GL_INVALID_ENUM in glTexParameter(pname=GL_TEXTURE_PRIORITY) Mesa: User error: GL_INVALID_OPERATION in unsupported function called (unsupported extension or deprecated function?) -> GL_ASSERT_NOERROR triggers Oddly, it was not reproduced with `-V gles2`, but only because the interop code is built into the convenience libvlc_opengles.la with the USE_OPENGL_ES2 define, which is what is currently disabling this code. - - - - - 66a8ad52 by Alexandre Janniaux at 2023-04-03T14:02:28+00:00 video_filter: opengl: remove stray line feed - - - - - 5 changed files: - modules/video_filter/opengl.c - modules/video_output/opengl/filter_draw.c - modules/video_output/opengl/filter_mock.c - modules/video_output/opengl/interop.c - modules/video_output/opengl/renderer.c Changes: ===================================== modules/video_filter/opengl.c ===================================== @@ -191,7 +191,7 @@ static int Open( vlc_object_t *obj ) if (sys->gl == NULL) { - msg_Err(obj, "Failed to create opengl context\n"); + msg_Err(obj, "Failed to create opengl context"); goto gl_create_failure; } ===================================== modules/video_output/opengl/filter_draw.c ===================================== @@ -109,6 +109,7 @@ Draw(struct vlc_gl_filter *filter, const struct vlc_gl_picture *pic, vt->Clear(GL_COLOR_BUFFER_BIT); vt->DrawArrays(GL_TRIANGLE_STRIP, 0, 4); + GL_ASSERT_NOERROR(vt); return VLC_SUCCESS; } ===================================== modules/video_output/opengl/filter_mock.c ===================================== @@ -168,6 +168,7 @@ DrawBlend(struct vlc_gl_filter *filter, const struct vlc_gl_picture *pic, vt->DrawArrays(GL_TRIANGLES, 0, 3); vt->Disable(GL_BLEND); + GL_ASSERT_NOERROR(vt); return VLC_SUCCESS; } @@ -206,6 +207,7 @@ DrawMask(struct vlc_gl_filter *filter, const struct vlc_gl_picture *pic, vt->Clear(GL_COLOR_BUFFER_BIT); vt->DrawArrays(GL_TRIANGLES, 0, 3); + GL_ASSERT_NOERROR(vt); return VLC_SUCCESS; } @@ -265,6 +267,7 @@ DrawPlane(struct vlc_gl_filter *filter, const struct vlc_gl_picture *pic, vt->Clear(GL_COLOR_BUFFER_BIT); vt->DrawArrays(GL_TRIANGLE_STRIP, 0, 4); + GL_ASSERT_NOERROR(vt); return VLC_SUCCESS; } ===================================== modules/video_output/opengl/interop.c ===================================== @@ -64,9 +64,12 @@ vlc_gl_interop_GenerateTextures(const struct vlc_gl_interop *interop, priv->gl.BindTexture(interop->tex_target, textures[i]); #if !defined(USE_OPENGL_ES2) - /* Set the texture parameters */ - priv->gl.TexParameterf(interop->tex_target, GL_TEXTURE_PRIORITY, 1.0); - priv->gl.TexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); + if (interop->gl->api_type == VLC_OPENGL) + { + /* Set the texture parameters */ + priv->gl.TexParameterf(interop->tex_target, GL_TEXTURE_PRIORITY, 1.0); + priv->gl.TexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); + } #endif priv->gl.TexParameteri(interop->tex_target, GL_TEXTURE_MAG_FILTER, GL_LINEAR); @@ -74,6 +77,7 @@ vlc_gl_interop_GenerateTextures(const struct vlc_gl_interop *interop, priv->gl.TexParameteri(interop->tex_target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); priv->gl.TexParameteri(interop->tex_target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); } + GL_ASSERT_NOERROR(&priv->gl); if (interop->ops->allocate_textures != NULL) { ===================================== modules/video_output/opengl/renderer.c ===================================== @@ -712,6 +712,7 @@ Draw(struct vlc_gl_filter *filter, const struct vlc_gl_picture *pic, const opengl_vtable_t *vt = renderer->vt; vt->Clear(GL_COLOR_BUFFER_BIT); + GL_ASSERT_NOERROR(vt); vt->UseProgram(renderer->program_id); @@ -751,6 +752,7 @@ Draw(struct vlc_gl_filter *filter, const struct vlc_gl_picture *pic, renderer->var.ZoomMatrix); vt->DrawElements(GL_TRIANGLES, renderer->nb_indices, GL_UNSIGNED_SHORT, 0); + GL_ASSERT_NOERROR(vt); return VLC_SUCCESS; } View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/e8b6a9324d0048cdede41cbb99db8a483eff016e...66a8ad52e8aacfdaf6583be72e1361b7f9b07231 -- View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/e8b6a9324d0048cdede41cbb99db8a483eff016e...66a8ad52e8aacfdaf6583be72e1361b7f9b07231 You're receiving this email because of your account on code.videolan.org. VideoLAN code repository instance From gitlab at videolan.org Mon Apr 3 14:54:52 2023 From: gitlab at videolan.org (Jean-Baptiste Kempf (@jbk)) Date: Mon, 03 Apr 2023 16:54:52 +0200 Subject: [vlc-commits] [Git][videolan/vlc][master] 2 commits: egl_pbuffer: use eglMakeCurrent directly Message-ID: <642ae8bcd3f08_4a52de1558c32631bc@gitlab.mail> Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC Commits: c9a8d6dc by Alexandre Janniaux at 2023-04-03T14:28:02+00:00 egl_pbuffer: use eglMakeCurrent directly MakeCurrent() (triggered by vlc_gl_MakeCurrent) can have different behaviour than just eglMakeCurrent() to match the VLC API semantic. However, we'll need to reset the default framebuffer from this function for this very VLC semantic, whereas the default framebuffer is not yet existing when calling this function from Open. By using eglMakeCurrent(), we allow future behaviour change to handle this correctly. - - - - - 81ec5619 by Alexandre Janniaux at 2023-04-03T14:28:02+00:00 egl_pbuffer: setup default framebuffer on MakeCurrent Ensure that the default framebuffer is setup during MakeCurrent(), so that any vlc_gl_t client can expect the state to be correct after calling vlc_gl_MakeCurrent() and without changing it. It seems that the default framebuffer was not always kept, leading to GL_INVALID_FRAMEBUFFER errors on Linux with a MESA egl_pbuffer (GBM backend) GLES2 implementation: $ MESA_DEBUG=1 ./vlc -vv ~/Video/dog_meme.mp4 --video-filter='opengl{filter=mock{mask},gles=any}' ... Mesa: User error: GL_INVALID_FRAMEBUFFER_OPERATION in glClear(incomplete framebuffer) Mesa: User error: GL_INVALID_FRAMEBUFFER_OPERATION in glDrawArrays vlc: ../../modules/video_output/opengl/filter_draw.c:112: Draw: Assertion `!"GL_INVALID_FRAMEBUFFER_OPERATION"' failed. - - - - - 1 changed file: - modules/video_filter/egl_pbuffer.c Changes: ===================================== modules/video_filter/egl_pbuffer.c ===================================== @@ -84,6 +84,11 @@ static int MakeCurrent (vlc_gl_t *gl) return VLC_EGENERIC; sys->current = true; + + const opengl_vtable_t *vt = &sys->api.vt; + vt->BindBuffer(GL_PIXEL_PACK_BUFFER, sys->pixelbuffers[sys->current_flip]); + vt->BindFramebuffer(GL_FRAMEBUFFER, sys->framebuffers[sys->current_flip]); + return VLC_SUCCESS; } @@ -434,12 +439,16 @@ static int Open(vlc_gl_t *gl, unsigned width, unsigned height, gl->ops = &gl_ops; gl->offscreen_vflip = true; - vlc_gl_MakeCurrent(gl); + eglMakeCurrent(sys->display, sys->surface, sys->surface, + sys->context); + + int ret = vlc_gl_api_Init(&sys->api, gl); if (ret != VLC_SUCCESS) { msg_Err(gl, "Failed to initialize gl_api"); - vlc_gl_ReleaseCurrent(gl); + eglMakeCurrent(sys->display, sys->surface, sys->surface, + EGL_NO_CONTEXT); goto error2; } @@ -471,8 +480,8 @@ static int Open(vlc_gl_t *gl, unsigned width, unsigned height, sys->current_flip = BUFFER_COUNT - 1; BindDrawFramebuffer(sys); - - vlc_gl_ReleaseCurrent(gl); + eglMakeCurrent(sys->display, sys->surface, sys->surface, + EGL_NO_CONTEXT); return VLC_SUCCESS; View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/66a8ad52e8aacfdaf6583be72e1361b7f9b07231...81ec561923e267f96b4fba3aeb120fcd501690d9 -- View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/66a8ad52e8aacfdaf6583be72e1361b7f9b07231...81ec561923e267f96b4fba3aeb120fcd501690d9 You're receiving this email because of your account on code.videolan.org. VideoLAN code repository instance From gitlab at videolan.org Mon Apr 3 15:19:44 2023 From: gitlab at videolan.org (Jean-Baptiste Kempf (@jbk)) Date: Mon, 03 Apr 2023 17:19:44 +0200 Subject: [vlc-commits] [Git][videolan/vlc][master] mp4: fix format string Message-ID: <642aee904900a_4a52f3c9c203267791@gitlab.mail> Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC Commits: dc397a76 by R?mi Denis-Courmont at 2023-04-03T14:56:21+00:00 mp4: fix format string The 3rd formatted value has a type of vlc_tick_t, a.k.a. int64_t, not necessary long. - - - - - 1 changed file: - modules/demux/mp4/mp4.c Changes: ===================================== modules/demux/mp4/mp4.c ===================================== @@ -1854,7 +1854,8 @@ static int Seek( demux_t *p_demux, vlc_tick_t i_date, bool b_accurate ) } } - msg_Dbg( p_demux, "seeking with %"PRId64 "ms %s to %ld", MS_FROM_VLC_TICK(i_date - i_start), + msg_Dbg( p_demux, "seeking with %"PRId64 "ms %s to %"PRId64, + MS_FROM_VLC_TICK(i_date - i_start), !b_accurate ? "alignment" : "preroll (use input-fast-seek to avoid)", i_date ); for( i_track = 0; i_track < p_sys->i_tracks; i_track++ ) View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/dc397a76c1a8ff536c82050074c21b5418c856de -- View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/dc397a76c1a8ff536c82050074c21b5418c856de You're receiving this email because of your account on code.videolan.org. VideoLAN code repository instance From gitlab at videolan.org Tue Apr 4 08:01:38 2023 From: gitlab at videolan.org (Thomas Guillem (@tguillem)) Date: Tue, 04 Apr 2023 10:01:38 +0200 Subject: [vlc-commits] [Git][videolan/vlc][master] 12 commits: lib: set libvlc_media_parse_local > 0 Message-ID: <642bd96288aaf_17088853c50124083@gitlab.mail> 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_FETCH_LOCAL|META_REQUEST_OPTION_FETCH_NETWORK, + META_REQUEST_OPTION_DO_INTERACT = 0x20, } input_item_meta_request_option_t; /* status of the on_preparse_ended() callback */ @@ -495,24 +496,17 @@ enum input_item_preparse_status ITEM_PREPARSE_DONE }; -typedef struct input_preparser_callbacks_t { +struct vlc_metadata_cbs { void (*on_preparse_ended)(input_item_t *, enum input_item_preparse_status status, void *userdata); - void (*on_subtree_added)(input_item_t *, input_item_node_t *subtree, void *userdata); -} input_preparser_callbacks_t; - -typedef struct input_fetcher_callbacks_t { void (*on_art_fetch_ended)(input_item_t *, bool fetched, void *userdata); -} input_fetcher_callbacks_t; + void (*on_subtree_added)(input_item_t *, input_item_node_t *subtree, void *userdata); +}; VLC_API int libvlc_MetadataRequest( libvlc_int_t *, input_item_t *, input_item_meta_request_option_t, - const input_preparser_callbacks_t *cbs, + const struct vlc_metadata_cbs *cbs, void *cbs_userdata, int, void * ); -VLC_API int libvlc_ArtRequest(libvlc_int_t *, input_item_t *, - input_item_meta_request_option_t, - const input_fetcher_callbacks_t *cbs, - void *cbs_userdata ); VLC_API void libvlc_MetadataCancel( libvlc_int_t *, void * ); /****************** ===================================== src/preparser/preparser.h ? include/vlc_preparser.h ===================================== @@ -1,7 +1,7 @@ /***************************************************************************** * preparser.h ***************************************************************************** - * Copyright (C) 1999-2008 VLC authors and VideoLAN + * Copyright (C) 1999-2023 VLC authors and VideoLAN * * Authors: Samuel Hocevar * Cl?ment Stenac @@ -21,10 +21,19 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. *****************************************************************************/ -#ifndef _INPUT_PREPARSER_H -#define _INPUT_PREPARSER_H 1 +#ifndef VLC_PREPARSER_H +#define VLC_PREPARSER_H 1 #include + +/** + * @defgroup vlc_preparser Preparser + * @ingroup input + * @{ + * @file + * VLC Preparser API + */ + /** * Preparser opaque structure. * @@ -32,60 +41,69 @@ * an asynchronous way. * It will also issue art fetching requests. */ -typedef struct input_preparser_t input_preparser_t; +typedef struct vlc_preparser_t vlc_preparser_t; /** * This function creates the preparser object and thread. + * + * @param obj the parent object + * @return a valid preparser object or NULL in case of error */ -input_preparser_t *input_preparser_New( vlc_object_t * ); +VLC_API vlc_preparser_t *vlc_preparser_New( vlc_object_t *obj ); /** - * This function enqueues the provided item to be preparsed. + * This function enqueues the provided item to be preparsed or fetched. * * The input item is retained until the preparsing is done or until the * preparser object is deleted. * + * @param preparser the preparser object + * @param item a valid item to preparse + * @param option preparse flag, cf @ref input_item_meta_request_option_t + * @param cbs callback to listen to events (can't be NULL) + * @param cbs_userdata opaque pointer used by the callbacks * @param timeout maximum time allowed to preparse the item. If -1, the default * "preparse-timeout" option will be used as a timeout. If 0, it will wait * indefinitely. If > 0, the timeout will be used (in milliseconds). * @param id unique id provided by the caller. This is can be used to cancel - * the request with input_preparser_Cancel() + * the request with vlc_preparser_Cancel() * @returns VLC_SUCCESS if the item was scheduled for preparsing, an error code * otherwise * If this returns an error, the on_preparse_ended will *not* be invoked */ -int input_preparser_Push( input_preparser_t *, input_item_t *, - input_item_meta_request_option_t, - const input_preparser_callbacks_t *cbs, - void *cbs_userdata, - int timeout, void *id ); - -void input_preparser_fetcher_Push( input_preparser_t *, input_item_t *, - input_item_meta_request_option_t, - const input_fetcher_callbacks_t *cbs, - void *cbs_userdata ); +VLC_API int vlc_preparser_Push( vlc_preparser_t *preparser, input_item_t *item, + input_item_meta_request_option_t option, + const struct vlc_metadata_cbs *cbs, + void *cbs_userdata, + int timeout, void *id ); /** * This function cancel all preparsing requests for a given id * - * @param id unique id given to input_preparser_Push() + * @param preparser the preparser object + * @param id unique id given to vlc_preparser_Push() */ -void input_preparser_Cancel( input_preparser_t *, void *id ); +VLC_API void vlc_preparser_Cancel( vlc_preparser_t *preparser, void *id ); /** * This function destroys the preparser object and thread. * + * @param preparser the preparser object * All pending input items will be released. */ -void input_preparser_Delete( input_preparser_t * ); +VLC_API void vlc_preparser_Delete( vlc_preparser_t *preparser ); /** * This function deactivates the preparser * * All pending requests will be removed, and it will block until the currently * running entity has finished (if any). + * + * @param preparser the preparser object */ -void input_preparser_Deactivate( input_preparser_t * ); +VLC_API void vlc_preparser_Deactivate( vlc_preparser_t *preparser ); + +/** @} vlc_preparser */ #endif ===================================== lib/media.c ===================================== @@ -820,7 +820,7 @@ libvlc_media_get_filestat( libvlc_media_t *p_md, unsigned type, uint64_t *out ) return 1; } -static const input_preparser_callbacks_t input_preparser_callbacks = { +static const struct vlc_metadata_cbs preparser_callbacks = { .on_preparse_ended = input_item_preparse_ended, .on_subtree_added = input_item_subtree_added, }; @@ -839,7 +839,7 @@ int libvlc_media_parse_request(libvlc_instance_t *inst, libvlc_media_t *media, libvlc_int_t *libvlc = inst->p_libvlc_int; input_item_t *item = media->p_input_item; - input_item_meta_request_option_t parse_scope = META_REQUEST_OPTION_SCOPE_LOCAL; + input_item_meta_request_option_t parse_scope = 0; int ret; unsigned int ref = atomic_load_explicit(&media->worker_count, memory_order_relaxed); @@ -853,19 +853,21 @@ int libvlc_media_parse_request(libvlc_instance_t *inst, libvlc_media_t *media, memory_order_relaxed, memory_order_relaxed)); + if (parse_flag & libvlc_media_parse_local) + parse_scope |= META_REQUEST_OPTION_SCOPE_LOCAL; if (parse_flag & libvlc_media_parse_network) parse_scope |= META_REQUEST_OPTION_SCOPE_NETWORK; + if (parse_flag & libvlc_media_parse_forced) + parse_scope |= META_REQUEST_OPTION_SCOPE_FORCED; if (parse_flag & libvlc_media_fetch_local) parse_scope |= META_REQUEST_OPTION_FETCH_LOCAL; if (parse_flag & libvlc_media_fetch_network) parse_scope |= META_REQUEST_OPTION_FETCH_NETWORK; if (parse_flag & libvlc_media_do_interact) parse_scope |= META_REQUEST_OPTION_DO_INTERACT; - if (parse_flag & libvlc_media_no_skip) - parse_scope |= META_REQUEST_OPTION_NO_SKIP; ret = libvlc_MetadataRequest(libvlc, item, parse_scope, - &input_preparser_callbacks, media, + &preparser_callbacks, media, timeout, media); if (ret != VLC_SUCCESS) { ===================================== modules/gui/macosx/library/VLCInputItem.m ===================================== @@ -81,7 +81,7 @@ static void cb_preparse_ended(input_item_t *p_item, enum input_item_preparse_sta }); } -static const struct input_preparser_callbacks_t preparseCallbacks = { +static const struct vlc_metadata_cbs preparseCallbacks = { cb_preparse_ended, cb_subtree_added, }; ===================================== modules/gui/qt/player/player_controller.cpp ===================================== @@ -1126,7 +1126,7 @@ PlayerController::PlayerController( qt_intf_t *_p_intf ) connect( &d_ptr->m_position_timer, &QTimer::timeout, this, &PlayerController::updatePositionFromTimer ); connect( &d_ptr->m_time_timer, &QTimer::timeout, this, &PlayerController::updateTimeFromTimer ); - input_fetcher_cbs.on_art_fetch_ended = onArtFetchEnded_callback; + input_preparser_cbs.on_art_fetch_ended = onArtFetchEnded_callback; } PlayerController::~PlayerController() @@ -1850,10 +1850,10 @@ void PlayerController::requestArtUpdate( input_item_t *p_item, bool b_forced ) if ( status & ( ITEM_ART_NOTFOUND|ITEM_ART_FETCHED ) ) return; } - libvlc_ArtRequest( vlc_object_instance(d->p_intf), p_item, - (b_forced) ? META_REQUEST_OPTION_FETCH_ANY - : META_REQUEST_OPTION_FETCH_LOCAL, - &input_fetcher_cbs, this ); + libvlc_MetadataRequest( vlc_object_instance(d->p_intf), p_item, + (b_forced) ? META_REQUEST_OPTION_FETCH_ANY + : META_REQUEST_OPTION_FETCH_LOCAL, + &input_preparser_cbs, this, 0, NULL ); } } ===================================== modules/gui/qt/player/player_controller.hpp ===================================== @@ -487,7 +487,7 @@ private: QSignalMapper *menusAudioMapper; //used by VLCMenuBar /* updateArt gui request */ - input_fetcher_callbacks_t input_fetcher_cbs; + struct vlc_metadata_cbs input_preparser_cbs; static void onArtFetchEnded_callback(input_item_t *, bool fetched, void *userdata); void onArtFetchEnded(input_item_t *, bool fetched); }; ===================================== src/Makefile.am ===================================== @@ -92,6 +92,7 @@ pluginsinclude_HEADERS = \ ../include/vlc_playlist_export.h \ ../include/vlc_plugin.h \ ../include/vlc_probe.h \ + ../include/vlc_preparser.h \ ../include/vlc_queue.h \ ../include/vlc_rand.h \ ../include/vlc_renderer_discovery.h \ @@ -260,7 +261,6 @@ libvlccore_la_SOURCES = \ preparser/fetcher.c \ preparser/fetcher.h \ preparser/preparser.c \ - preparser/preparser.h \ input/item.c \ input/access.c \ clock/clock_internal.c \ ===================================== src/libvlc.c ===================================== @@ -36,11 +36,11 @@ #endif #include +#include #include "../lib/libvlc_internal.h" #include "modules/modules.h" #include "config/configuration.h" -#include "preparser/preparser.h" #include "media_source/media_source.h" #include /* sprintf() */ @@ -230,7 +230,7 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc, /* * Meta data handling */ - priv->parser = input_preparser_New(VLC_OBJECT(p_libvlc)); + priv->parser = vlc_preparser_New(VLC_OBJECT(p_libvlc)); if( !priv->parser ) goto error; @@ -343,7 +343,7 @@ void libvlc_InternalCleanup( libvlc_int_t *p_libvlc ) libvlc_priv_t *priv = libvlc_priv (p_libvlc); if (priv->parser != NULL) - input_preparser_Deactivate(priv->parser); + vlc_preparser_Deactivate(priv->parser); /* Ask the interfaces to stop and destroy them */ msg_Dbg( p_libvlc, "removing all interfaces" ); @@ -376,7 +376,7 @@ void libvlc_InternalCleanup( libvlc_int_t *p_libvlc ) #endif if (priv->parser != NULL) - input_preparser_Delete(priv->parser); + vlc_preparser_Delete(priv->parser); if (priv->main_playlist) vlc_playlist_Delete(priv->main_playlist); @@ -452,7 +452,7 @@ static void GetFilenames( libvlc_int_t *p_vlc, unsigned n, int vlc_MetadataRequest(libvlc_int_t *libvlc, input_item_t *item, input_item_meta_request_option_t i_options, - const input_preparser_callbacks_t *cbs, + const struct vlc_metadata_cbs *cbs, void *cbs_userdata, int timeout, void *id) { @@ -461,7 +461,7 @@ int vlc_MetadataRequest(libvlc_int_t *libvlc, input_item_t *item, if (unlikely(priv->parser == NULL)) return VLC_ENOMEM; - return input_preparser_Push( priv->parser, item, i_options, cbs, + return vlc_preparser_Push( priv->parser, item, i_options, cbs, cbs_userdata, timeout, id ); } @@ -472,7 +472,7 @@ int vlc_MetadataRequest(libvlc_int_t *libvlc, input_item_t *item, */ int libvlc_MetadataRequest(libvlc_int_t *libvlc, input_item_t *item, input_item_meta_request_option_t i_options, - const input_preparser_callbacks_t *cbs, + const struct vlc_metadata_cbs *cbs, void *cbs_userdata, int timeout, void *id) { @@ -490,26 +490,6 @@ int libvlc_MetadataRequest(libvlc_int_t *libvlc, input_item_t *item, return vlc_MetadataRequest(libvlc, item, i_options, cbs, cbs_userdata, timeout, id); } -/** - * Requests retrieving/downloading art for an input item. - * The retrieval is performed asynchronously. - */ -int libvlc_ArtRequest(libvlc_int_t *libvlc, input_item_t *item, - input_item_meta_request_option_t i_options, - const input_fetcher_callbacks_t *cbs, - void *cbs_userdata) -{ - libvlc_priv_t *priv = libvlc_priv(libvlc); - assert(i_options & META_REQUEST_OPTION_FETCH_ANY); - - if (unlikely(priv->parser == NULL)) - return VLC_ENOMEM; - - input_preparser_fetcher_Push(priv->parser, item, i_options, - cbs, cbs_userdata); - return VLC_SUCCESS; -} - /** * Cancels extraction of the meta data for an input item. * @@ -523,5 +503,5 @@ void libvlc_MetadataCancel(libvlc_int_t *libvlc, void *id) if (unlikely(priv->parser == NULL)) return; - input_preparser_Cancel(priv->parser, id); + vlc_preparser_Cancel(priv->parser, id); } ===================================== src/libvlc.h ===================================== @@ -186,7 +186,7 @@ typedef struct libvlc_priv_t vlc_keystore *p_memory_keystore; ///< memory keystore intf_thread_t *interfaces; ///< Linked-list of interfaces vlc_playlist_t *main_playlist; - struct input_preparser_t *parser; ///< Input item meta data handler + struct vlc_preparser_t *parser; ///< Input item meta data handler vlc_media_source_provider_t *media_source_provider; vlc_actions_t *actions; ///< Hotkeys handler struct vlc_medialibrary_t *p_media_library; ///< Media library instance @@ -208,7 +208,7 @@ void intf_DestroyAll( libvlc_int_t * ); int vlc_MetadataRequest(libvlc_int_t *libvlc, input_item_t *item, input_item_meta_request_option_t i_options, - const input_preparser_callbacks_t *cbs, + const struct vlc_metadata_cbs *cbs, void *cbs_userdata, int timeout, void *id); ===================================== src/libvlccore.sym ===================================== @@ -243,7 +243,6 @@ libvlc_Quit libvlc_SetExitHandler libvlc_MetadataRequest libvlc_MetadataCancel -libvlc_ArtRequest vlc_UrlParse vlc_UrlParseFixup vlc_UrlClean @@ -1027,3 +1026,8 @@ vlc_executor_WaitIdle vlc_input_attachment_Release vlc_input_attachment_New vlc_input_attachment_Hold +vlc_preparser_New +vlc_preparser_Push +vlc_preparser_Cancel +vlc_preparser_Delete +vlc_preparser_Deactivate ===================================== src/media_source/media_tree.c ===================================== @@ -334,7 +334,7 @@ vlc_media_tree_Remove(vlc_media_tree_t *tree, input_item_t *media) return true; } -static const input_preparser_callbacks_t input_preparser_callbacks = { +static const struct vlc_metadata_cbs preparser_callbacks = { .on_subtree_added = media_subtree_changed, .on_preparse_ended = media_subtree_preparse_ended }; @@ -348,12 +348,12 @@ vlc_media_tree_Preparse(vlc_media_tree_t *tree, libvlc_int_t *libvlc, VLC_UNUSED(libvlc); VLC_UNUSED(media); VLC_UNUSED(id); - VLC_UNUSED(input_preparser_callbacks); + VLC_UNUSED(preparser_callbacks); #else media->i_preparse_depth = 1; vlc_MetadataRequest(libvlc, media, META_REQUEST_OPTION_SCOPE_ANY | META_REQUEST_OPTION_DO_INTERACT, - &input_preparser_callbacks, tree, 0, id); + &preparser_callbacks, tree, 0, id); #endif } ===================================== src/meson.build ===================================== @@ -121,7 +121,6 @@ libvlccore_sources_base = files( 'preparser/fetcher.c', 'preparser/fetcher.h', 'preparser/preparser.c', - 'preparser/preparser.h', 'input/item.c', 'input/access.c', 'clock/clock_internal.c', ===================================== src/playlist/preparse.c ===================================== @@ -106,7 +106,7 @@ on_preparse_ended(input_item_t *media, vlc_playlist_Unlock(playlist); } -static const input_preparser_callbacks_t input_preparser_callbacks = { +static const struct vlc_metadata_cbs preparser_callbacks = { .on_preparse_ended = on_preparse_ended, .on_subtree_added = on_subtree_added, }; @@ -117,13 +117,13 @@ vlc_playlist_Preparse(vlc_playlist_t *playlist, input_item_t *input) #ifdef TEST_PLAYLIST VLC_UNUSED(playlist); VLC_UNUSED(input); - VLC_UNUSED(input_preparser_callbacks); + VLC_UNUSED(preparser_callbacks); #else /* vlc_MetadataRequest is not exported */ vlc_MetadataRequest(playlist->libvlc, input, META_REQUEST_OPTION_SCOPE_LOCAL | META_REQUEST_OPTION_FETCH_LOCAL, - &input_preparser_callbacks, playlist, -1, NULL); + &preparser_callbacks, playlist, -1, NULL); #endif } ===================================== src/preparser/fetcher.h ===================================== @@ -34,6 +34,10 @@ */ typedef struct input_fetcher_t input_fetcher_t; +typedef struct input_fetcher_callbacks_t { + void (*on_art_fetch_ended)(input_item_t *, bool fetched, void *userdata); +} input_fetcher_callbacks_t; + /** * This function creates the fetcher object and thread. */ ===================================== src/preparser/preparser.c ===================================== @@ -25,13 +25,13 @@ #include #include #include +#include #include "input/input_interface.h" #include "input/input_internal.h" -#include "preparser.h" #include "fetcher.h" -struct input_preparser_t +struct vlc_preparser_t { vlc_object_t* owner; input_fetcher_t* fetcher; @@ -45,10 +45,10 @@ struct input_preparser_t struct task { - input_preparser_t *preparser; + vlc_preparser_t *preparser; input_item_t *item; input_item_meta_request_option_t options; - const input_preparser_callbacks_t *cbs; + const struct vlc_metadata_cbs *cbs; void *userdata; void *id; vlc_tick_t timeout; @@ -59,18 +59,19 @@ struct task vlc_sem_t fetch_ended; atomic_int preparse_status; atomic_bool interrupted; + bool art_fetched; struct vlc_runnable runnable; /**< to be passed to the executor */ - struct vlc_list node; /**< node of input_preparser_t.submitted_tasks */ + struct vlc_list node; /**< node of vlc_preparser_t.submitted_tasks */ }; static void RunnableRun(void *); static struct task * -TaskNew(input_preparser_t *preparser, input_item_t *item, +TaskNew(vlc_preparser_t *preparser, input_item_t *item, input_item_meta_request_option_t options, - const input_preparser_callbacks_t *cbs, void *userdata, + const struct vlc_metadata_cbs *cbs, void *userdata, void *id, vlc_tick_t timeout) { assert(timeout >= 0); @@ -86,6 +87,7 @@ TaskNew(input_preparser_t *preparser, input_item_t *item, task->userdata = userdata; task->id = id; task->timeout = timeout; + task->art_fetched = false; input_item_Hold(item); @@ -109,7 +111,7 @@ TaskDelete(struct task *task) } static void -PreparserAddTask(input_preparser_t *preparser, struct task *task) +PreparserAddTask(vlc_preparser_t *preparser, struct task *task) { vlc_mutex_lock(&preparser->lock); vlc_list_append(&task->node, &preparser->submitted_tasks); @@ -117,7 +119,7 @@ PreparserAddTask(input_preparser_t *preparser, struct task *task) } static void -PreparserRemoveTask(input_preparser_t *preparser, struct task *task) +PreparserRemoveTask(vlc_preparser_t *preparser, struct task *task) { vlc_mutex_lock(&preparser->lock); vlc_list_remove(&task->node); @@ -127,7 +129,15 @@ PreparserRemoveTask(input_preparser_t *preparser, struct task *task) static void NotifyPreparseEnded(struct task *task) { - if (task->cbs && task->cbs->on_preparse_ended) { + if (task->cbs == NULL) + return; + + if (task->options & META_REQUEST_OPTION_FETCH_ANY + && task->cbs->on_art_fetch_ended) + task->cbs->on_art_fetch_ended(task->item, task->art_fetched, + task->userdata); + + if (task->cbs->on_preparse_ended) { int status = atomic_load_explicit(&task->preparse_status, memory_order_relaxed); task->cbs->on_preparse_ended(task->item, status, task->userdata); @@ -172,6 +182,7 @@ OnArtFetchEnded(input_item_t *item, bool fetched, void *userdata) VLC_UNUSED(fetched); struct task *task = userdata; + task->art_fetched = fetched; vlc_sem_post(&task->fetch_ended); } @@ -240,10 +251,14 @@ RunnableRun(void *userdata) vlc_tick_t deadline = task->timeout ? vlc_tick_now() + task->timeout : VLC_TICK_INVALID; - if (atomic_load(&task->interrupted)) - goto end; + if (task->options & (META_REQUEST_OPTION_SCOPE_ANY| + META_REQUEST_OPTION_SCOPE_FORCED)) + { + if (atomic_load(&task->interrupted)) + goto end; - Parse(task, deadline); + Parse(task, deadline); + } if (atomic_load(&task->interrupted)) goto end; @@ -257,7 +272,7 @@ RunnableRun(void *userdata) end: NotifyPreparseEnded(task); - input_preparser_t *preparser = task->preparser; + vlc_preparser_t *preparser = task->preparser; PreparserRemoveTask(preparser, task); TaskDelete(task); } @@ -273,9 +288,9 @@ Interrupt(struct task *task) vlc_sem_post(&task->preparse_ended); } -input_preparser_t* input_preparser_New( vlc_object_t *parent ) +vlc_preparser_t* vlc_preparser_New( vlc_object_t *parent ) { - input_preparser_t* preparser = malloc( sizeof *preparser ); + vlc_preparser_t* preparser = malloc( sizeof *preparser ); if (!preparser) return NULL; @@ -308,9 +323,9 @@ input_preparser_t* input_preparser_New( vlc_object_t *parent ) return preparser; } -int input_preparser_Push( input_preparser_t *preparser, +int vlc_preparser_Push( vlc_preparser_t *preparser, input_item_t *item, input_item_meta_request_option_t i_options, - const input_preparser_callbacks_t *cbs, void *cbs_userdata, + const struct vlc_metadata_cbs *cbs, void *cbs_userdata, int timeout_ms, void *id ) { if( atomic_load( &preparser->deactivated ) ) @@ -323,7 +338,7 @@ int input_preparser_Push( input_preparser_t *preparser, item->b_preparse_interact = true; vlc_mutex_unlock( &item->lock ); - if (!(i_options & META_REQUEST_OPTION_NO_SKIP)) + if (!(i_options & META_REQUEST_OPTION_SCOPE_FORCED)) { switch( i_type ) { @@ -335,9 +350,16 @@ int input_preparser_Push( input_preparser_t *preparser, break; /* fallthrough */ default: - if (cbs && cbs->on_preparse_ended) - cbs->on_preparse_ended(item, ITEM_PREPARSE_SKIPPED, cbs_userdata); - return VLC_SUCCESS; + if( ( i_options & META_REQUEST_OPTION_FETCH_ANY ) == 0 ) + { + /* Nothing to do (no preparse and not fetch), notify it */ + if (cbs && cbs->on_preparse_ended) + cbs->on_preparse_ended(item, ITEM_PREPARSE_SKIPPED, + cbs_userdata); + return VLC_SUCCESS; + } + /* Continue without parsing (but fetching) */ + i_options &= ~META_REQUEST_OPTION_SCOPE_ANY; } } @@ -354,16 +376,7 @@ int input_preparser_Push( input_preparser_t *preparser, return VLC_SUCCESS; } -void input_preparser_fetcher_Push( input_preparser_t *preparser, - input_item_t *item, input_item_meta_request_option_t options, - const input_fetcher_callbacks_t *cbs, void *cbs_userdata ) -{ - if( preparser->fetcher ) - input_fetcher_Push( preparser->fetcher, item, options, - cbs, cbs_userdata ); -} - -void input_preparser_Cancel( input_preparser_t *preparser, void *id ) +void vlc_preparser_Cancel( vlc_preparser_t *preparser, void *id ) { vlc_mutex_lock(&preparser->lock); @@ -389,16 +402,16 @@ void input_preparser_Cancel( input_preparser_t *preparser, void *id ) vlc_mutex_unlock(&preparser->lock); } -void input_preparser_Deactivate( input_preparser_t* preparser ) +void vlc_preparser_Deactivate( vlc_preparser_t* preparser ) { atomic_store( &preparser->deactivated, true ); - input_preparser_Cancel(preparser, NULL); + vlc_preparser_Cancel(preparser, NULL); } -void input_preparser_Delete( input_preparser_t *preparser ) +void vlc_preparser_Delete( vlc_preparser_t *preparser ) { - /* In case input_preparser_Deactivate() has not been called */ - input_preparser_Cancel(preparser, NULL); + /* In case vlc_preparser_Deactivate() has not been called */ + vlc_preparser_Cancel(preparser, NULL); vlc_executor_Delete(preparser->executor); ===================================== test/libvlc/media.c ===================================== @@ -169,7 +169,7 @@ static void test_input_metadata_timeout(libvlc_instance_t *vlc, int timeout, vlc_sem_t sem; vlc_sem_init (&sem, 0); - const struct input_preparser_callbacks_t cbs = { + const struct vlc_metadata_cbs cbs = { .on_preparse_ended = input_item_preparse_timeout, }; i_ret = libvlc_MetadataRequest(vlc->p_libvlc_int, p_item, View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/dc397a76c1a8ff536c82050074c21b5418c856de...bc056eb4803b31b3e701c604560bc7384cde471f -- View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/dc397a76c1a8ff536c82050074c21b5418c856de...bc056eb4803b31b3e701c604560bc7384cde471f You're receiving this email because of your account on code.videolan.org. VideoLAN code repository instance From gitlab at videolan.org Tue Apr 4 11:51:23 2023 From: gitlab at videolan.org (Steve Lhomme (@robUx4)) Date: Tue, 04 Apr 2023 13:51:23 +0200 Subject: [vlc-commits] [Git][videolan/vlc][master] 6 commits: direct3d11: fix fallback output when best selection fails Message-ID: <642c0f3bec2bd_170888a66ddc1766d6@gitlab.mail> Steve Lhomme pushed to branch master at VideoLAN / VLC Commits: b1bc1224 by Steve Lhomme at 2023-04-04T11:31:52+00:00 direct3d11: fix fallback output when best selection fails Passing false (0) would result in no format being ever selected. - - - - - f2480265 by Steve Lhomme at 2023-04-04T11:31:52+00:00 direct3d11: simplify decoder_format usage No need to use the textureFormat when we know it's nullptr. - - - - - 7334ebb8 by Steve Lhomme at 2023-04-04T11:31:52+00:00 d3d11va: lock the device when creating resources - - - - - e5d53949 by Steve Lhomme at 2023-04-04T11:31:52+00:00 d3d11_processor: allow usage from C++ The ID3D11VideoContext_VideoProcessorBlt define is only set with COBJMACROS. We don't need it as the code should not be compiled if it's not available. - - - - - 3082be67 by Steve Lhomme at 2023-04-04T11:31:52+00:00 d3d11_fmt: add a function to allocate a texture for a picture - - - - - d65736cd by Steve Lhomme at 2023-04-04T11:31:52+00:00 d3d11: use a specific object to handle the rendering fence - - - - - 7 changed files: - modules/codec/avcodec/d3d11va.c - modules/hw/d3d11/d3d11_processor.h - modules/video_chroma/d3d11_fmt.c - modules/video_chroma/d3d11_fmt.h - modules/video_output/win32/d3d11_quad.cpp - modules/video_output/win32/d3d11_quad.h - modules/video_output/win32/direct3d11.cpp Changes: ===================================== modules/codec/avcodec/d3d11va.c ===================================== @@ -509,6 +509,7 @@ static int DxCreateDecoderSurfaces(vlc_va_t *va, int codec_id, vlc_va_sys_t *sys = va->sys; HRESULT hr; + d3d11_device_lock(sys->d3d_dev); void *pv; hr = ID3D11Device_QueryInterface( sys->d3d_dev->d3ddevice, &IID_ID3D10Multithread, &pv); if (SUCCEEDED(hr)) { @@ -525,6 +526,7 @@ static int DxCreateDecoderSurfaces(vlc_va_t *va, int codec_id, isXboxHardware(sys->d3d_dev)) { msg_Warn(va, "%dx%d resolution not supported by your hardware", fmt->i_width, fmt->i_height); + d3d11_device_unlock(sys->d3d_dev); return VLC_EGENERIC; } #endif @@ -554,6 +556,7 @@ static int DxCreateDecoderSurfaces(vlc_va_t *va, int codec_id, hr = ID3D11Device_CreateTexture2D( sys->d3d_dev->d3ddevice, &texDesc, NULL, &p_texture ); if (FAILED(hr)) { msg_Err(va, "CreateTexture2D %zu failed. (hr=0x%lX)", surface_count, hr); + d3d11_device_unlock(sys->d3d_dev); return VLC_EGENERIC; } @@ -568,6 +571,7 @@ static int DxCreateDecoderSurfaces(vlc_va_t *va, int codec_id, if (FAILED(hr)) { msg_Err(va, "CreateVideoDecoderOutputView %d failed. (hr=0x%lX)", surface_idx, hr); ID3D11Texture2D_Release(p_texture); + d3d11_device_unlock(sys->d3d_dev); return VLC_EGENERIC; } @@ -593,6 +597,7 @@ static int DxCreateDecoderSurfaces(vlc_va_t *va, int codec_id, hr = ID3D11VideoDevice_GetVideoDecoderConfigCount( sys->d3ddec, &decoderDesc, &cfg_count ); if (FAILED(hr)) { msg_Err(va, "GetVideoDecoderConfigCount failed. (hr=0x%lX)", hr); + d3d11_device_unlock(sys->d3d_dev); return VLC_EGENERIC; } @@ -602,6 +607,7 @@ static int DxCreateDecoderSurfaces(vlc_va_t *va, int codec_id, hr = ID3D11VideoDevice_GetVideoDecoderConfig( sys->d3ddec, &decoderDesc, i, &cfg_list[i] ); if (FAILED(hr)) { msg_Err(va, "GetVideoDecoderConfig failed. (hr=0x%lX)", hr); + d3d11_device_unlock(sys->d3d_dev); return VLC_EGENERIC; } } @@ -635,6 +641,7 @@ static int DxCreateDecoderSurfaces(vlc_va_t *va, int codec_id, } if (cfg_score <= 0) { msg_Err(va, "Failed to find a supported decoder configuration"); + d3d11_device_unlock(sys->d3d_dev); return VLC_EGENERIC; } @@ -644,8 +651,10 @@ static int DxCreateDecoderSurfaces(vlc_va_t *va, int codec_id, if (FAILED(hr)) { msg_Err(va, "ID3D11VideoDevice_CreateVideoDecoder failed. (hr=0x%lX)", hr); sys->hw.decoder = NULL; + d3d11_device_unlock(sys->d3d_dev); return VLC_EGENERIC; } + d3d11_device_unlock(sys->d3d_dev); sys->hw.decoder = decoder; msg_Dbg(va, "DxCreateDecoderSurfaces succeed"); ===================================== modules/hw/d3d11/d3d11_processor.h ===================================== @@ -27,7 +27,10 @@ #include "../../video_chroma/d3d11_fmt.h" -#ifdef ID3D11VideoContext_VideoProcessorBlt +#ifdef __cplusplus +extern "C" { +#endif + typedef struct { ID3D11VideoDevice *d3dviddev; @@ -46,6 +49,9 @@ void D3D11_ReleaseProcessor(d3d11_processor_t *); HRESULT D3D11_Assert_ProcessorInput(vlc_object_t *, d3d11_processor_t *, picture_sys_d3d11_t *); #define D3D11_Assert_ProcessorInput(a,b,c) D3D11_Assert_ProcessorInput(VLC_OBJECT(a),b,c) + +#ifdef __cplusplus +} #endif #endif /* VLC_D3D11_PROCESSOR_H */ ===================================== modules/video_chroma/d3d11_fmt.c ===================================== @@ -983,32 +983,24 @@ picture_context_t *d3d11_pic_context_copy(picture_context_t *ctx) return &pic_ctx->s; } -picture_t *D3D11_AllocPicture(vlc_object_t *obj, - const video_format_t *fmt, vlc_video_context *vctx_out, - bool shared, const d3d_format_t *cfg) +int D3D11_PictureFill(vlc_object_t *obj, picture_t *pic, + vlc_video_context *vctx_out, + bool shared, const d3d_format_t *cfg) { if (unlikely(cfg == NULL)) - return NULL; + return VLC_EINVAL; struct d3d11_pic_context *pic_ctx = calloc(1, sizeof(*pic_ctx)); if (unlikely(pic_ctx == NULL)) - return NULL; + return VLC_ENOMEM; pic_ctx->picsys.sharedHandle = INVALID_HANDLE_VALUE; - picture_t *pic = picture_NewFromFormat( fmt ); - if (unlikely(pic == NULL)) - { - free(pic_ctx); - return NULL; - } - d3d11_decoder_device_t *dev_sys = GetD3D11OpaqueContext(vctx_out); if (AllocateTextures(obj, &dev_sys->d3d_dev, cfg, - fmt, shared, pic_ctx->picsys.texture, NULL) != VLC_SUCCESS) + &pic->format, shared, pic_ctx->picsys.texture, NULL) != VLC_SUCCESS) { - picture_Release(pic); free(pic_ctx); - return NULL; + return VLC_EGENERIC; } D3D11_AllocateResourceView(vlc_object_logger(obj), dev_sys->d3d_dev.d3ddevice, cfg, pic_ctx->picsys.texture, 0, pic_ctx->picsys.renderSrc); @@ -1035,5 +1027,22 @@ picture_t *D3D11_AllocPicture(vlc_object_t *obj, vlc_video_context_Hold(vctx_out), }; pic->context = &pic_ctx->s; + return VLC_SUCCESS; +} + +picture_t *D3D11_AllocPicture(vlc_object_t *obj, + const video_format_t *fmt, vlc_video_context *vctx_out, + bool shared, const d3d_format_t *cfg) +{ + picture_t *pic = picture_NewFromFormat( fmt ); + if (unlikely(pic == NULL)) + return NULL; + + if (D3D11_PictureFill(obj, pic, vctx_out, shared, cfg) != VLC_SUCCESS) + { + picture_Release(pic); + return NULL; + } + return pic; } ===================================== modules/video_chroma/d3d11_fmt.h ===================================== @@ -206,7 +206,10 @@ picture_context_t *d3d11_pic_context_copy(picture_context_t *); picture_t *D3D11_AllocPicture(vlc_object_t *, const video_format_t *, vlc_video_context *, - bool, const d3d_format_t *); + bool shared, const d3d_format_t *); +int D3D11_PictureFill(vlc_object_t *, + picture_t *, vlc_video_context *, + bool shared, const d3d_format_t *); void D3D11_PictureAttach(picture_t *, ID3D11Texture2D *textures, const d3d_format_t *cfg); ===================================== modules/video_output/win32/d3d11_quad.cpp ===================================== @@ -370,3 +370,59 @@ void d3d11_quad_t::UpdateViewport(const RECT *rect, const d3d_format_t *display) vlc_assert_unreachable(); } } + +#ifdef HAVE_D3D11_4_H +HRESULT D3D11_InitFence(d3d11_device_t & d3d_dev, d3d11_gpu_fence & fence) +{ + HRESULT hr; + ComPtr d3ddev5; + hr = d3d_dev.d3ddevice->QueryInterface(IID_GRAPHICS_PPV_ARGS(&d3ddev5)); + if (FAILED(hr)) + goto error; + hr = d3ddev5->CreateFence(fence.renderFence, D3D11_FENCE_FLAG_NONE, IID_GRAPHICS_PPV_ARGS(&fence.d3dRenderFence)); + if (FAILED(hr)) + goto error; + hr = d3d_dev.d3dcontext->QueryInterface(IID_GRAPHICS_PPV_ARGS(&fence.d3dcontext4)); + if (FAILED(hr)) + goto error; + fence.renderFinished = CreateEvent(nullptr, TRUE, FALSE, nullptr); + if (unlikely(fence.renderFinished == nullptr)) + goto error; + return S_OK; +error: + fence.d3dRenderFence.Reset(); + fence.d3dcontext4.Reset(); + CloseHandle(fence.renderFinished); + return hr; +} + +void D3D11_ReleaseFence(d3d11_gpu_fence & fence) +{ + if (fence.d3dcontext4.Get()) + { + fence.d3dRenderFence.Reset(); + fence.d3dcontext4.Reset(); + CloseHandle(fence.renderFinished); + fence.renderFinished = nullptr; + } +} + +int D3D11_WaitFence(d3d11_gpu_fence & fence) +{ + if (fence.d3dcontext4.Get()) + { + if (fence.renderFence == UINT64_MAX) + fence.renderFence = 0; + else + fence.renderFence++; + + ResetEvent(fence.renderFinished); + fence.d3dRenderFence->SetEventOnCompletion(fence.renderFence, fence.renderFinished); + fence.d3dcontext4->Signal(fence.d3dRenderFence.Get(), fence.renderFence); + + WaitForSingleObject(fence.renderFinished, INFINITE); + return VLC_SUCCESS; + } + return VLC_ENOTSUP; +} +#endif // HAVE_D3D11_4_H ===================================== modules/video_output/win32/d3d11_quad.h ===================================== @@ -25,12 +25,30 @@ #include "../../video_chroma/d3d11_fmt.h" #include "d3d11_shaders.h" +#ifdef HAVE_D3D11_4_H +# include +#endif #define PS_CONST_LUMI_BOUNDS 0 #define VS_CONST_VIEWPOINT 1 typedef bool (*d3d11_select_plane_t)(void *opaque, size_t plane_index, ID3D11RenderTargetView **); +#ifdef HAVE_D3D11_4_H +struct d3d11_gpu_fence +{ + Microsoft::WRL::ComPtr d3dRenderFence; + Microsoft::WRL::ComPtr d3dcontext4; + UINT64 renderFence = 0; + HANDLE renderFinished = nullptr; +}; + +HRESULT D3D11_InitFence(d3d11_device_t &, d3d11_gpu_fence &); +int D3D11_WaitFence(d3d11_gpu_fence &); +void D3D11_ReleaseFence(d3d11_gpu_fence &); +#endif + + void D3D11_RenderQuad(d3d11_device_t *, d3d11_quad_t *, d3d11_vertex_shader_t *, ID3D11ShaderResourceView *resourceViews[DXGI_MAX_SHADER_VIEW], d3d11_select_plane_t selectPlane, void *selectOpaque); ===================================== modules/video_output/win32/direct3d11.cpp ===================================== @@ -40,9 +40,6 @@ #include #include "../../video_chroma/d3d11_fmt.h" -#ifdef HAVE_D3D11_4_H -#include -#endif #include "d3d11_quad.h" #include "d3d11_shaders.h" @@ -92,10 +89,7 @@ typedef struct vout_display_sys_t d3d11_quad_t picQuad; #ifdef HAVE_D3D11_4_H - ComPtr d3dRenderFence; - ComPtr d3dcontext4; - UINT64 renderFence = 0; - HANDLE renderFinished = NULL; + d3d11_gpu_fence fence; #endif picture_sys_d3d11_t stagingSys; @@ -628,23 +622,15 @@ static void PreparePicture(vout_display_t *vd, picture_t *picture, subpicture_t } #ifdef HAVE_D3D11_4_H - if (sys->d3dcontext4.Get()) + if (sys->log_level >= 4) { - vlc_tick_t render_start; - if (sys->log_level >= 4) - render_start = vlc_tick_now(); - if (sys->renderFence == UINT64_MAX) - sys->renderFence = 0; - else - sys->renderFence++; - - ResetEvent(sys->renderFinished); - sys->d3dRenderFence->SetEventOnCompletion(sys->renderFence, sys->renderFinished); - sys->d3dcontext4->Signal(sys->d3dRenderFence.Get(), sys->renderFence); - - WaitForSingleObject(sys->renderFinished, INFINITE); - if (sys->log_level >= 4) - msg_Dbg(vd, "waited %" PRId64 " ms for the render fence", MS_FROM_VLC_TICK(vlc_tick_now() - render_start)); + vlc_tick_t render_start = vlc_tick_now(); + D3D11_WaitFence(sys->fence); + msg_Dbg(vd, "waited %" PRId64 " ms for the render fence", MS_FROM_VLC_TICK(vlc_tick_now() - render_start)); + } + else + { + D3D11_WaitFence(sys->fence); } #endif } @@ -829,7 +815,7 @@ static int SetupOutputFormat(vout_display_t *vd, video_format_t *fmt, vlc_video_ sys->picQuad.generic.textureFormat = GetDirectRenderingFormat(vd, fmt->i_chroma); // look for any pixel format that we can handle with enough pixels per channel - const d3d_format_t *decoder_format = NULL; + const d3d_format_t *decoder_format = nullptr; if ( !sys->picQuad.generic.textureFormat ) { uint8_t bits_per_channel; @@ -891,24 +877,22 @@ static int SetupOutputFormat(vout_display_t *vd, video_format_t *fmt, vlc_video_ /* look for a decoder format that can be decoded but not used in shaders */ if ( is_d3d11_opaque(fmt->i_chroma) ) decoder_format = GetDirectDecoderFormat(vd, fmt->i_chroma); - else - decoder_format = sys->picQuad.generic.textureFormat; bool is_rgb = !vlc_fourcc_IsYUV(fmt->i_chroma); sys->picQuad.generic.textureFormat = GetDisplayFormatByDepth(vd, bits_per_channel, widthDenominator, heightDenominator, - decoder_format!=NULL, + decoder_format!=nullptr, is_rgb ? DXGI_RGB_FORMAT : DXGI_YUV_FORMAT); if (!sys->picQuad.generic.textureFormat) sys->picQuad.generic.textureFormat = GetDisplayFormatByDepth(vd, bits_per_channel, widthDenominator, heightDenominator, - decoder_format!=NULL, + decoder_format!=nullptr, is_rgb ? DXGI_YUV_FORMAT : DXGI_RGB_FORMAT); } // look for any pixel format that we can handle if ( !sys->picQuad.generic.textureFormat ) - sys->picQuad.generic.textureFormat = GetDisplayFormatByDepth(vd, 0, 0, 0, false, false); + sys->picQuad.generic.textureFormat = GetDisplayFormatByDepth(vd, 0, 0, 0, false, DXGI_YUV_FORMAT|DXGI_RGB_FORMAT); if ( !sys->picQuad.generic.textureFormat ) { @@ -1075,39 +1059,13 @@ static int Direct3D11CreateFormatResources(vout_display_t *vd, const video_forma return UpdateStaging(vd, fmt); } -#ifdef HAVE_D3D11_4_H -static HRESULT InitRenderFence(vout_display_sys_t *sys) -{ - HRESULT hr; - ComPtr d3ddev5; - hr = sys->d3d_dev->d3ddevice->QueryInterface(IID_GRAPHICS_PPV_ARGS(&d3ddev5)); - if (FAILED(hr)) - goto error; - hr = d3ddev5->CreateFence(sys->renderFence, D3D11_FENCE_FLAG_NONE, IID_GRAPHICS_PPV_ARGS(&sys->d3dRenderFence)); - if (FAILED(hr)) - goto error; - hr = sys->d3d_dev->d3dcontext->QueryInterface(IID_GRAPHICS_PPV_ARGS(&sys->d3dcontext4)); - if (FAILED(hr)) - goto error; - sys->renderFinished = CreateEvent(NULL, TRUE, FALSE, NULL); - if (unlikely(sys->renderFinished == NULL)) - goto error; - return S_OK; -error: - sys->d3dRenderFence.Reset(); - sys->d3dcontext4.Reset(); - CloseHandle(sys->renderFinished); - return hr; -} -#endif // HAVE_D3D11_4_H - static int Direct3D11CreateGenericResources(vout_display_t *vd) { vout_display_sys_t *sys = static_cast(vd->sys); HRESULT hr; #ifdef HAVE_D3D11_4_H - hr = InitRenderFence(sys); + hr = D3D11_InitFence(*sys->d3d_dev, sys->fence); if (SUCCEEDED(hr)) { msg_Dbg(vd, "using GPU render fence"); @@ -1225,13 +1183,7 @@ static void Direct3D11DestroyResources(vout_display_t *vd) D3D11_ReleaseVertexShader(&sys->projectionVShader); #ifdef HAVE_D3D11_4_H - if (sys->d3dcontext4.Get()) - { - sys->d3dRenderFence.Reset(); - sys->d3dcontext4.Reset(); - CloseHandle(sys->renderFinished); - sys->renderFinished = NULL; - } + D3D11_ReleaseFence(sys->fence); #endif msg_Dbg(vd, "Direct3D11 resources destroyed"); View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/bc056eb4803b31b3e701c604560bc7384cde471f...d65736cd202d620a6832a1f06d7144037de6b95f -- View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/bc056eb4803b31b3e701c604560bc7384cde471f...d65736cd202d620a6832a1f06d7144037de6b95f You're receiving this email because of your account on code.videolan.org. VideoLAN code repository instance From gitlab at videolan.org Tue Apr 4 13:14:08 2023 From: gitlab at videolan.org (Jean-Baptiste Kempf (@jbk)) Date: Tue, 04 Apr 2023 15:14:08 +0200 Subject: [vlc-commits] [Git][videolan/vlc][master] 6 commits: frame: remove unused label Message-ID: <642c22a0c01b4_17088811b080419457c@gitlab.mail> Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC Commits: 6dad92bf by R?mi Denis-Courmont at 2023-04-04T12:03:15+00:00 frame: remove unused label - - - - - cbe2dfa7 by R?mi Denis-Courmont at 2023-04-04T12:03:15+00:00 frame: use vlc_frame_heap_Alloc() for vlc_frame_Alloc() There are no particular reasons to allocate the frame structure and the frame buffer together. In fact, this prevents the effective use of aligned allocation functions for the buffer, and reduces the effectiveness of the address sanitiser. This is also no longer necessary for vlc_frame_Realloc() to work; the function now works optimally regardless of how the frame was allocated. The ad-hoc overflow check is also dropped, as it is unnecessary whence size is always smaller than 2^28. - - - - - d9bf20cf by R?mi Denis-Courmont at 2023-04-04T12:03:15+00:00 frame: use aligned_alloc() where available - - - - - b98765d5 by R?mi Denis-Courmont at 2023-04-04T12:03:15+00:00 frame: add vlc_frame_New() - - - - - 0c3bc60e by R?mi Denis-Courmont at 2023-04-04T12:03:15+00:00 lib: use block_New() - - - - - 9ae9734d by R?mi Denis-Courmont at 2023-04-04T12:03:15+00:00 frame: use vlc_frame_New() - - - - - 5 changed files: - include/vlc_block.h - include/vlc_frame.h - lib/picture.c - src/libvlccore.sym - src/misc/frame.c Changes: ===================================== include/vlc_block.h ===================================== @@ -79,6 +79,7 @@ #define vlc_block_callbacks vlc_frame_callbacks #define block_Init vlc_frame_Init +#define block_New vlc_frame_New #define block_Alloc vlc_frame_Alloc #define block_TryRealloc vlc_frame_TryRealloc #define block_Realloc vlc_frame_Realloc ===================================== include/vlc_frame.h ===================================== @@ -159,6 +159,24 @@ VLC_API vlc_frame_t *vlc_frame_Init(vlc_frame_t *frame, const struct vlc_frame_callbacks *cbs, void *base, size_t length); +/** + * Creates a custom frame. + * + * This function initialize a frame of timed data allocated by custom means. + * This allows passing data without copying even if the data has been allocated + * with unusual means or outside of LibVLC. + * + * Normally, frames are allocated and initialized by vlc_frame_Alloc() instead. + * + * @param cbs structure of custom callbacks to handle the frame [IN] + * @param base start address of the frame data + * @param length byte length of the frame data + * + * @return the created frame, or NULL on memory error. + */ +VLC_API vlc_frame_t *vlc_frame_New(const struct vlc_frame_callbacks *cbs, + void *base, size_t length); + /** * Allocates a frame. * ===================================== lib/picture.c ===================================== @@ -108,7 +108,8 @@ static libvlc_picture_t* libvlc_picture_from_attachment( input_attachment_t* att libvlc_picture_t *pic = malloc( sizeof( *pic ) ); if ( unlikely( pic == NULL ) ) return NULL; - pic->converted = malloc( sizeof( *pic->converted ) ); + pic->converted = block_New(&block_cbs, attachment->p_data, + attachment->i_data); if ( unlikely( pic->converted == NULL ) ) { free(pic); @@ -117,8 +118,6 @@ static libvlc_picture_t* libvlc_picture_from_attachment( input_attachment_t* att vlc_atomic_rc_init( &pic->rc ); pic->attachment = vlc_input_attachment_Hold( attachment ); pic->time = VLC_TICK_INVALID; - block_Init( pic->converted, &block_cbs, attachment->p_data, - attachment->i_data); video_format_Init( &pic->fmt, fcc ); switch ( fcc ) { ===================================== src/libvlccore.sym ===================================== @@ -53,6 +53,7 @@ vlc_frame_GetAncillary vlc_frame_heap_Alloc vlc_frame_Init vlc_frame_mmap_Alloc +vlc_frame_New vlc_frame_shm_Alloc vlc_frame_Realloc vlc_frame_Release ===================================== src/misc/frame.c ===================================== @@ -72,6 +72,16 @@ void vlc_frame_CopyProperties(vlc_frame_t *restrict dst, const vlc_frame_t *src) dst->i_length = src->i_length; } +vlc_frame_t *vlc_frame_New(const struct vlc_frame_callbacks *cbs, + void *buf, size_t size) +{ + vlc_frame_t *f = malloc(sizeof (*f)); + if (unlikely(f == NULL)) + return NULL; + + return vlc_frame_Init(f, cbs, buf, size); +} + vlc_frame_t *vlc_frame_Init(vlc_frame_t *restrict f, const struct vlc_frame_callbacks *cbs, void *buf, size_t size) { @@ -91,18 +101,6 @@ vlc_frame_t *vlc_frame_Init(vlc_frame_t *restrict f, const struct vlc_frame_call return f; } -static void vlc_frame_generic_Release (vlc_frame_t *frame) -{ - /* That is always true for frames allocated with vlc_frame_Alloc(). */ - assert (frame->p_start == (unsigned char *)(frame + 1)); - free (frame); -} - -static const struct vlc_frame_callbacks vlc_frame_generic_cbs = -{ - vlc_frame_generic_Release, -}; - /** Initial memory alignment of data frame. * @note This must be a multiple of sizeof(void*) and a power of two. * libavcodec AVX optimizations require at least 32-bytes. */ @@ -119,22 +117,34 @@ vlc_frame_t *vlc_frame_Alloc (size_t size) return NULL; } + static_assert ((VLC_FRAME_PADDING % VLC_FRAME_ALIGN) == 0, + "VLC_FRAME_PADDING must be a multiple of VLC_FRAME_ALIGN"); + /* 2 * VLC_FRAME_PADDING: pre + post padding */ - const size_t alloc = sizeof (vlc_frame_t) + VLC_FRAME_ALIGN + (2 * VLC_FRAME_PADDING) - + size; - if (unlikely(alloc <= size)) + size_t capacity = (2 * VLC_FRAME_PADDING) + size; + unsigned char *buf; +#ifdef HAVE_ALIGNED_ALLOC + capacity += (-size) % VLC_FRAME_ALIGN; + buf = aligned_alloc(VLC_FRAME_ALIGN, capacity); +#else + capacity += VLC_FRAME_ALIGN; + buf = malloc(capacity); +#endif + if (unlikely(buf == NULL)) return NULL; - vlc_frame_t *f = malloc (alloc); - if (unlikely(f == NULL)) - return NULL; + vlc_frame_t *f = vlc_frame_heap_Alloc(buf, capacity); + if (likely(f != NULL)) { +#ifndef HAVE_ALIGNED_ALLOC + /* Alignment */ + buf += (-(uintptr_t)(void *)buf) % (uintptr_t)VLC_FRAME_ALIGN; +#endif + /* Header reserve */ + buf += VLC_FRAME_PADDING; + f->p_buffer = buf; + f->i_buffer = size; + } - vlc_frame_Init(f, &vlc_frame_generic_cbs, f + 1, alloc - sizeof (*f)); - static_assert ((VLC_FRAME_PADDING % VLC_FRAME_ALIGN) == 0, - "VLC_FRAME_PADDING must be a multiple of VLC_FRAME_ALIGN"); - f->p_buffer += VLC_FRAME_PADDING + VLC_FRAME_ALIGN - 1; - f->p_buffer = (void *)(((uintptr_t)f->p_buffer) & ~(VLC_FRAME_ALIGN - 1)); - f->i_buffer = size; return f; } @@ -261,14 +271,10 @@ static const struct vlc_frame_callbacks vlc_frame_heap_cbs = vlc_frame_t *vlc_frame_heap_Alloc (void *addr, size_t length) { - vlc_frame_t *frame = malloc (sizeof (*frame)); - if (frame == NULL) - { - free (addr); - return NULL; - } - - return vlc_frame_Init(frame, &vlc_frame_heap_cbs, addr, length); + vlc_frame_t *frame = vlc_frame_New(&vlc_frame_heap_cbs, addr, length); + if (unlikely(frame == NULL)) + free(addr); + return frame; } #ifdef HAVE_MMAP @@ -293,18 +299,14 @@ vlc_frame_t *vlc_frame_mmap_Alloc (void *addr, size_t length) long page_mask = sysconf(_SC_PAGESIZE) - 1; size_t left = ((uintptr_t)addr) & page_mask; size_t right = (-length) & page_mask; - - vlc_frame_t *frame = malloc (sizeof (*frame)); - if (frame == NULL) - { - munmap (addr, length); - return NULL; - } - - vlc_frame_Init(frame, &vlc_frame_mmap_cbs, - ((char *)addr) - left, left + length + right); - frame->p_buffer = addr; - frame->i_buffer = length; + vlc_frame_t *frame = vlc_frame_New(&vlc_frame_mmap_cbs, + ((char *)addr) - left, + left + length + right); + if (likely(frame != NULL)) { + frame->p_buffer = addr; + frame->i_buffer = length; + } else + munmap(addr, length); return frame; } #else @@ -367,14 +369,11 @@ static const struct vlc_frame_callbacks vlc_frame_shm_cbs = vlc_frame_t *vlc_frame_shm_Alloc (void *addr, size_t length) { - vlc_frame_t *frame = malloc (sizeof (*frame)); + vlc_frame_t *frame = vlc_frame_New(&vlc_frame_shm_cbs, (uint8_t *)addr, + length); if (unlikely(frame == NULL)) - { - shmdt (addr); - return NULL; - } - - return vlc_frame_Init(frame, &vlc_frame_shm_cbs, (uint8_t *)addr, length); + shmdt(addr); + return frame; } #else vlc_frame_t *vlc_frame_shm_Alloc (void *addr, size_t length) @@ -521,8 +520,8 @@ vlc_frame_t *vlc_frame_File(int fd, bool write) vlc_frame_Release (frame); frame = NULL; errno = EIO; - goto done; } +done: #else // !_WIN32 for (size_t i = 0; i < length;) { @@ -536,7 +535,6 @@ vlc_frame_t *vlc_frame_File(int fd, bool write) i += len; } #endif // !_WIN32 -done: vlc_cleanup_pop (); return frame; } View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/d65736cd202d620a6832a1f06d7144037de6b95f...9ae9734db433605b540afa8a56ce26a672235015 -- View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/d65736cd202d620a6832a1f06d7144037de6b95f...9ae9734db433605b540afa8a56ce26a672235015 You're receiving this email because of your account on code.videolan.org. VideoLAN code repository instance From gitlab at videolan.org Tue Apr 4 15:08:56 2023 From: gitlab at videolan.org (Jean-Baptiste Kempf (@jbk)) Date: Tue, 04 Apr 2023 17:08:56 +0200 Subject: [vlc-commits] [Git][videolan/vlc][master] gstdecode: fix FTBFS with braces inside case Message-ID: <642c3d8868c4b_17088812061642153ea@gitlab.mail> Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC Commits: d02a131e by Johannes Kauffmann at 2023-04-04T14:52:09+00:00 gstdecode: fix FTBFS with braces inside case Fixes #27980 - - - - - 1 changed file: - modules/codec/gstreamer/gstdecode.c Changes: ===================================== modules/codec/gstreamer/gstdecode.c ===================================== @@ -200,10 +200,11 @@ static gboolean autoplug_query_cb( GstElement *p_bin, GstPad *p_pad, switch( GST_QUERY_TYPE ( p_query ) ){ case GST_QUERY_CAPS: return gst_vlc_video_sink_query_caps( p_query ); - case GST_QUERY_ALLOCATION: + case GST_QUERY_ALLOCATION: { GstBaseSink *p_bsink = GST_BASE_SINK_CAST( p_sys->p_decode_out ); GstBaseSinkClass *p_bclass = GST_BASE_SINK_GET_CLASS( p_bsink ); return p_bclass->propose_allocation( p_bsink, p_query ); + } default: return FALSE; } View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/d02a131e03960d364ac73ef1cba4ca03e876b626 -- View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/d02a131e03960d364ac73ef1cba4ca03e876b626 You're receiving this email because of your account on code.videolan.org. VideoLAN code repository instance From gitlab at videolan.org Wed Apr 5 06:12:58 2023 From: gitlab at videolan.org (Steve Lhomme (@robUx4)) Date: Wed, 05 Apr 2023 08:12:58 +0200 Subject: [vlc-commits] [Git][videolan/vlc][master] demux: avi: fix unwanted padding in odd sized samples Message-ID: <642d116ae1d4a_17088811b757824203e@gitlab.mail> Steve Lhomme pushed to branch master at VideoLAN / VLC Commits: 32705bd3 by Francois Cartegnie at 2023-04-05T05:45:30+00:00 demux: avi: fix unwanted padding in odd sized samples regression by c8fe3d812c277821ade872e334e78acc19deaf03 - - - - - 1 changed file: - modules/demux/avi/avi.c Changes: ===================================== modules/demux/avi/avi.c ===================================== @@ -850,7 +850,7 @@ error: *****************************************************************************/ static block_t * ReadFrame( demux_t *p_demux, const avi_track_t *tk, - uint32_t i_header, uint32_t i_size ) + uint32_t i_header, uint32_t i_osize ) { /* skip header */ if( i_header ) @@ -862,7 +862,7 @@ static block_t * ReadFrame( demux_t *p_demux, const avi_track_t *tk, } /* read size padded on word boundary */ - i_size = __EVEN(i_size); + uint32_t i_size = __EVEN(i_osize); if( i_size == 0 ) return block_Alloc(0); /* vlc_stream_Block can't read/alloc 0 sized */ @@ -871,6 +871,9 @@ static block_t * ReadFrame( demux_t *p_demux, const avi_track_t *tk, if ( !p_frame ) return p_frame; + if( i_osize == i_size - 1 ) + p_frame->i_buffer--; + if( tk->bihprops.i_stride > INT32_MAX - 3 ) { p_frame->i_buffer = 0; View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/32705bd3675e8fb87eb3c5d827f91a5ae8d0bc3f -- View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/32705bd3675e8fb87eb3c5d827f91a5ae8d0bc3f You're receiving this email because of your account on code.videolan.org. VideoLAN code repository instance From gitlab at videolan.org Wed Apr 5 06:48:27 2023 From: gitlab at videolan.org (Steve Lhomme (@robUx4)) Date: Wed, 05 Apr 2023 08:48:27 +0200 Subject: [vlc-commits] [Git][videolan/vlc][master] 2 commits: d3d11_fmt: add a helper to find a hardware/software based d3d_format_t Message-ID: <642d19bb7c242_17088811c6c6c2453be@gitlab.mail> Steve Lhomme pushed to branch master at VideoLAN / VLC Commits: 230fdf54 by Steve Lhomme at 2023-04-05T06:31:54+00:00 d3d11_fmt: add a helper to find a hardware/software based d3d_format_t - - - - - 1b02bcda by Steve Lhomme at 2023-04-05T06:31:54+00:00 d3d11: use D3D11_RenderFormat to get render d3d_formats - - - - - 9 changed files: - modules/access/screen/dxgi.cpp - modules/codec/avcodec/d3d11va.c - modules/codec/mft.cpp - modules/hw/d3d11/d3d11_decoder.cpp - modules/hw/d3d11/d3d11_deinterlace.c - modules/hw/d3d11/d3d11_filters.c - modules/hw/d3d11/d3d11_surface.c - modules/video_chroma/d3d11_fmt.h - modules/video_output/win32/direct3d11.cpp Changes: ===================================== modules/access/screen/dxgi.cpp ===================================== @@ -245,13 +245,7 @@ int screen_InitCaptureDXGI(demux_t *p_demux) DXGI_OUTDUPL_DESC outDesc; p_data->duplication->GetDesc(&outDesc); - for (p_data->output_format = DxgiGetRenderFormatList(); - p_data->output_format->name != nullptr; ++p_data->output_format) - { - if (p_data->output_format->formatTexture == outDesc.ModeDesc.Format && - is_d3d11_opaque(p_data->output_format->fourcc)) - break; - } + p_data->output_format = D3D11_RenderFormat(outDesc.ModeDesc.Format ,true); if (unlikely(!p_data->output_format->name)) { msg_Err(p_demux, "Unknown texture format %d", outDesc.ModeDesc.Format); ===================================== modules/codec/avcodec/d3d11va.c ===================================== @@ -369,20 +369,6 @@ static int DxGetInputList(vlc_va_t *va, input_list_t *p_list) return VLC_SUCCESS; } -static const d3d_format_t *D3D11_FindDXGIFormat(DXGI_FORMAT dxgi) -{ - for (const d3d_format_t *output_format = DxgiGetRenderFormatList(); - output_format->name != NULL; ++output_format) - { - if (output_format->formatTexture == dxgi && - is_d3d11_opaque(output_format->fourcc)) - { - return output_format; - } - } - return NULL; -} - static int DxSetupOutput(vlc_va_t *va, const directx_va_mode_t *mode, const video_format_t *fmt) { vlc_va_sys_t *sys = va->sys; @@ -427,8 +413,8 @@ static int DxSetupOutput(vlc_va_t *va, const directx_va_mode_t *mode, const vide } if (decoder_format == NULL || decoder_format->formatTexture != DXGI_FORMAT_NV12) - processorInput[idx++] = D3D11_FindDXGIFormat(DXGI_FORMAT_NV12); - processorInput[idx++] = D3D11_FindDXGIFormat(DXGI_FORMAT_420_OPAQUE); + processorInput[idx++] = D3D11_RenderFormat(DXGI_FORMAT_NV12 ,true); + processorInput[idx++] = D3D11_RenderFormat(DXGI_FORMAT_420_OPAQUE ,true); processorInput[idx++] = NULL; /* */ ===================================== modules/codec/mft.cpp ===================================== @@ -925,16 +925,7 @@ static int ProcessOutputStream(decoder_t *p_dec, DWORD stream_id, bool & keep_re p_dec->fmt_out.video.i_width = desc.Width; p_dec->fmt_out.video.i_height = desc.Height; - for (const d3d_format_t *output_format = DxgiGetRenderFormatList(); - output_format->name != NULL; ++output_format) - { - if (output_format->formatTexture == desc.Format && - is_d3d11_opaque(output_format->fourcc)) - { - p_sys->cfg = output_format; - break; - } - } + p_sys->cfg = D3D11_RenderFormat(desc.Format ,true); p_dec->fmt_out.i_codec = p_sys->cfg->fourcc; p_dec->fmt_out.video.i_chroma = p_sys->cfg->fourcc; ===================================== modules/hw/d3d11/d3d11_decoder.cpp ===================================== @@ -112,13 +112,7 @@ static int DecodeFrame( decoder_t *p_dec, block_t *p_block ) D3D11_TEXTURE2D_DESC outDesc; src_sys->texture[0]->GetDesc(&outDesc); - for (p_sys->output_format = DxgiGetRenderFormatList(); - p_sys->output_format->name != nullptr; ++p_sys->output_format) - { - if (p_sys->output_format->formatTexture == outDesc.Format && - is_d3d11_opaque(p_sys->output_format->fourcc)) - break; - } + p_sys->output_format = D3D11_RenderFormat(outDesc.Format ,true); if (unlikely(!p_sys->output_format->name)) { msg_Err(p_dec, "Unknown texture format %d", outDesc.Format); ===================================== modules/hw/d3d11/d3d11_deinterlace.c ===================================== @@ -254,16 +254,7 @@ int D3D11OpenDeinterlace(filter_t *filter) d3d11_decoder_device_t *dev_sys = GetD3D11OpaqueContext( filter->vctx_in ); sys->d3d_dev = &dev_sys->d3d_dev; - for (const d3d_format_t *output_format = DxgiGetRenderFormatList(); - output_format->name != NULL; ++output_format) - { - if (output_format->formatTexture == vctx_sys->format && - is_d3d11_opaque(output_format->fourcc)) - { - sys->output_format = output_format; - break; - } - } + sys->output_format = D3D11_RenderFormat(vctx_sys->format ,true); if (unlikely(sys->output_format == NULL)) goto error; ===================================== modules/hw/d3d11/d3d11_filters.c ===================================== @@ -188,17 +188,7 @@ static picture_t *AllocPicture( filter_t *p_filter ) { d3d11_video_context_t *vctx_sys = GetD3D11ContextPrivate( p_filter->vctx_out ); - const d3d_format_t *cfg = NULL; - for (const d3d_format_t *output_format = DxgiGetRenderFormatList(); - output_format->name != NULL; ++output_format) - { - if (output_format->formatTexture == vctx_sys->format && - is_d3d11_opaque(output_format->fourcc)) - { - cfg = output_format; - break; - } - } + const d3d_format_t *cfg = D3D11_RenderFormat(vctx_sys->format ,true); if (unlikely(cfg == NULL)) return NULL; ===================================== modules/hw/d3d11/d3d11_surface.c ===================================== @@ -613,17 +613,7 @@ static picture_t *AllocateCPUtoGPUTexture(filter_t *p_filter, filter_sys_t *p_sy d3d11_video_context_t *vctx_sys = GetD3D11ContextPrivate( p_filter->vctx_out ); - const d3d_format_t *cfg = NULL; - for (const d3d_format_t *output_format = DxgiGetRenderFormatList(); - output_format->name != NULL; ++output_format) - { - if (output_format->formatTexture == vctx_sys->format && - !is_d3d11_opaque(output_format->fourcc)) - { - cfg = output_format; - break; - } - } + const d3d_format_t *cfg = D3D11_RenderFormat(vctx_sys->format ,false); if (unlikely(cfg == NULL)) return NULL; ===================================== modules/video_chroma/d3d11_fmt.h ===================================== @@ -151,6 +151,21 @@ void AcquireD3D11PictureSys(picture_sys_d3d11_t *p_sys); void ReleaseD3D11PictureSys(picture_sys_d3d11_t *p_sys); +static inline const d3d_format_t *D3D11_RenderFormat(DXGI_FORMAT opaque, bool gpu_based) +{ + for (const d3d_format_t *output_format = DxgiGetRenderFormatList(); + output_format->name != NULL; ++output_format) + { + if (output_format->formatTexture == opaque && + is_d3d11_opaque(output_format->fourcc) == gpu_based) + { + return output_format; + } + } + return NULL; +} + + /* map texture planes to resource views */ int D3D11_AllocateResourceView(struct vlc_logger *obj, ID3D11Device *d3ddevice, const d3d_format_t *format, ===================================== modules/video_output/win32/direct3d11.cpp ===================================== @@ -186,16 +186,7 @@ static int UpdateDisplayFormat(vout_display_t *vd, const video_format_t *fmt) display_info_t new_display = { }; - for (const d3d_format_t *output_format = DxgiGetRenderFormatList(); - output_format->name != NULL; ++output_format) - { - if (output_format->formatTexture == (DXGI_FORMAT)out.dxgi_format && - !is_d3d11_opaque(output_format->fourcc)) - { - new_display.pixelFormat = output_format; - break; - } - } + new_display.pixelFormat = D3D11_RenderFormat((DXGI_FORMAT)out.dxgi_format, false); if (unlikely(new_display.pixelFormat == NULL)) { msg_Err(vd, "Could not find the output format."); @@ -798,16 +789,7 @@ static int SetupOutputFormat(vout_display_t *vd, video_format_t *fmt, vlc_video_ if (vtcx_sys != NULL && D3D11_DeviceSupportsFormat( sys->d3d_dev, vtcx_sys->format, D3D11_FORMAT_SUPPORT_SHADER_LOAD )) { - for (const d3d_format_t *output_format = DxgiGetRenderFormatList(); - output_format->name != NULL; ++output_format) - { - if (output_format->formatTexture == vtcx_sys->format && - is_d3d11_opaque(output_format->fourcc)) - { - sys->picQuad.generic.textureFormat = output_format; - break; - } - } + sys->picQuad.generic.textureFormat = D3D11_RenderFormat(vtcx_sys->format ,true); } // look for the requested pixel format first View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/32705bd3675e8fb87eb3c5d827f91a5ae8d0bc3f...1b02bcdade10d023df77bafebc87d416de6ea674 -- View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/32705bd3675e8fb87eb3c5d827f91a5ae8d0bc3f...1b02bcdade10d023df77bafebc87d416de6ea674 You're receiving this email because of your account on code.videolan.org. VideoLAN code repository instance From gitlab at videolan.org Wed Apr 5 08:09:53 2023 From: gitlab at videolan.org (Steve Lhomme (@robUx4)) Date: Wed, 05 Apr 2023 10:09:53 +0200 Subject: [vlc-commits] [Git][videolan/vlc][master] avcodec: only set the i_codec when the i_chroma is valid Message-ID: <642d2cd15722c_17088811b0804252474@gitlab.mail> Steve Lhomme pushed to branch master at VideoLAN / VLC Commits: 8618e521 by Steve Lhomme at 2023-04-05T07:49:30+00:00 avcodec: only set the i_codec when the i_chroma is valid If it's not set yet, it will be set later. We only need to know the value before we call decoder_UpdateVideoOutput(). - - - - - 1 changed file: - modules/codec/avcodec/video.c Changes: ===================================== modules/codec/avcodec/video.c ===================================== @@ -574,12 +574,8 @@ int InitVideoDec( vlc_object_t *obj ) p_sys->framedrop = FRAMEDROP_NONE; /* Set output properties */ - if( GetVlcChroma( &p_dec->fmt_out.video, p_context->pix_fmt ) != VLC_SUCCESS ) - { - /* we are doomed. but not really, because most codecs set their pix_fmt later on */ - p_dec->fmt_out.i_codec = VLC_CODEC_I420; - } - p_dec->fmt_out.i_codec = p_dec->fmt_out.video.i_chroma; + if (GetVlcChroma( &p_dec->fmt_out.video, p_context->pix_fmt ) == VLC_SUCCESS) + p_dec->fmt_out.i_codec = p_dec->fmt_out.video.i_chroma; p_dec->fmt_out.video.orientation = p_dec->fmt_in->video.orientation; View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/8618e521d8a20e7e374c0f3e843c92f110576308 -- View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/8618e521d8a20e7e374c0f3e843c92f110576308 You're receiving this email because of your account on code.videolan.org. VideoLAN code repository instance From gitlab at videolan.org Wed Apr 5 08:43:07 2023 From: gitlab at videolan.org (Steve Lhomme (@robUx4)) Date: Wed, 05 Apr 2023 10:43:07 +0200 Subject: [vlc-commits] [Git][videolan/vlc][master] fourcc: fix YUV with alpha not being considered YUV formats Message-ID: <642d349b27eb5_170888b070842549b3@gitlab.mail> Steve Lhomme pushed to branch master at VideoLAN / VLC Commits: 2fe0daaa by Steve Lhomme at 2023-04-05T08:10:17+00:00 fourcc: fix YUV with alpha not being considered YUV formats All 4:4:4 YUV formats with alpha are already part of the table thanks to VLC_CODEC_YUV_PLANAR_444_ALPHA. - - - - - 1 changed file: - src/misc/fourcc.c Changes: ===================================== src/misc/fourcc.c ===================================== @@ -562,6 +562,8 @@ static const vlc_fourcc_t p_list_YUV[] = { VLC_CODEC_NVDEC_OPAQUE_16B, VLC_CODEC_NVDEC_OPAQUE_444, VLC_CODEC_NVDEC_OPAQUE_444_16B, + VLC_CODEC_YUV420A, + VLC_CODEC_YUV422A, 0, }; View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/2fe0daaac2aa5417a83aee0439996630c0853252 -- View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/2fe0daaac2aa5417a83aee0439996630c0853252 You're receiving this email because of your account on code.videolan.org. VideoLAN code repository instance From gitlab at videolan.org Wed Apr 5 09:25:53 2023 From: gitlab at videolan.org (Steve Lhomme (@robUx4)) Date: Wed, 05 Apr 2023 11:25:53 +0200 Subject: [vlc-commits] [Git][videolan/vlc][master] tracer: json: remove write-only temporary variable Message-ID: <642d3ea15454c_170888120758c2649d3@gitlab.mail> Steve Lhomme pushed to branch master at VideoLAN / VLC Commits: fef5c66e by Alexandre Janniaux at 2023-04-05T09:12:06+00:00 tracer: json: remove write-only temporary variable - - - - - 1 changed file: - modules/logger/json.c Changes: ===================================== modules/logger/json.c ===================================== @@ -220,8 +220,6 @@ static const struct vlc_tracer_operations *Open(vlc_object_t *obj, if (unlikely(sys == NULL)) return NULL; - const struct vlc_tracer_operations *ops = &json_ops; - const char *filename = JSON_FILENAME; char *path = var_InheritString(obj, "json-tracer-file"); @@ -256,7 +254,7 @@ static const struct vlc_tracer_operations *Open(vlc_object_t *obj, setvbuf(sys->stream, NULL, _IOLBF, 0); *sysp = sys; - return ops; + return &json_ops; } #define LOGFILE_NAME_TEXT N_("Log filename") View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/fef5c66edb73dc71a97aeae59daffd1e4585c5b4 -- View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/fef5c66edb73dc71a97aeae59daffd1e4585c5b4 You're receiving this email because of your account on code.videolan.org. VideoLAN code repository instance From gitlab at videolan.org Wed Apr 5 09:56:32 2023 From: gitlab at videolan.org (Steve Lhomme (@robUx4)) Date: Wed, 05 Apr 2023 11:56:32 +0200 Subject: [vlc-commits] [Git][videolan/vlc][master] 4 commits: preparser: remove from the executor list the earliest possible Message-ID: <642d45d0e5f72_1708888b4c027529a@gitlab.mail> Steve Lhomme pushed to branch master at VideoLAN / VLC Commits: 3459103b by Thomas Guillem at 2023-04-05T09:28:42+00:00 preparser: remove from the executor list the earliest possible Remove from the list immediately after we are done with the executor. This will be needed by the next commit. - - - - - f4f2ef45 by Thomas Guillem at 2023-04-05T09:28:42+00:00 preparser: don't wait for the fetcher Let the preparser thread parse the next item, while the current one is being art fetched, ie. don't block the preparser thread while fetching arts. - - - - - ec26295b by Thomas Guillem at 2023-04-05T09:28:42+00:00 preparser: remove task->art_fetched It can now be used directly. - - - - - 0c5eb699 by Thomas Guillem at 2023-04-05T09:28:42+00:00 input: remove always true arg in input_item_SetPreparsed() - - - - - 4 changed files: - src/input/es_out.c - src/input/input_interface.h - src/input/item.c - src/preparser/preparser.c Changes: ===================================== src/input/es_out.c ===================================== @@ -1929,7 +1929,7 @@ static void EsOutMeta( es_out_t *p_out, const vlc_meta_t *p_meta, const vlc_meta } free( psz_alloc ); - input_item_SetPreparsed( p_item, true ); + input_item_SetPreparsed( p_item ); input_SendEventMeta( p_input ); /* TODO handle sout meta ? */ ===================================== src/input/input_interface.h ===================================== @@ -29,7 +29,7 @@ /********************************************************************** * Item metadata **********************************************************************/ -void input_item_SetPreparsed( input_item_t *p_i, bool b_preparsed ); +void input_item_SetPreparsed( input_item_t *p_i ); void input_item_SetArtNotFound( input_item_t *p_i, bool b_not_found ); void input_item_SetArtFetched( input_item_t *p_i, bool b_art_fetched ); void input_item_SetEpg( input_item_t *p_item, const vlc_epg_t *p_epg, bool ); ===================================== src/input/item.c ===================================== @@ -65,18 +65,14 @@ void input_item_SetErrorWhenReading( input_item_t *p_i, bool b_error ) .u.input_item_error_when_reading_changed.new_value = b_error } ); } } -void input_item_SetPreparsed( input_item_t *p_i, bool b_preparsed ) +void input_item_SetPreparsed( input_item_t *p_i ) { bool b_send_event = false; vlc_mutex_lock( &p_i->lock ); int status = vlc_meta_GetStatus(p_i->p_meta); - int new_status; - if( b_preparsed ) - new_status = status | ITEM_PREPARSED; - else - new_status = status & ~ITEM_PREPARSED; + int new_status = status | ITEM_PREPARSED; if( status != new_status ) { vlc_meta_SetStatus(p_i->p_meta, new_status); ===================================== src/preparser/preparser.c ===================================== @@ -56,10 +56,8 @@ struct task input_item_parser_id_t *parser; vlc_sem_t preparse_ended; - vlc_sem_t fetch_ended; atomic_int preparse_status; atomic_bool interrupted; - bool art_fetched; struct vlc_runnable runnable; /**< to be passed to the executor */ @@ -87,13 +85,11 @@ TaskNew(vlc_preparser_t *preparser, input_item_t *item, task->userdata = userdata; task->id = id; task->timeout = timeout; - task->art_fetched = false; input_item_Hold(item); task->parser = NULL; vlc_sem_init(&task->preparse_ended, 0); - vlc_sem_init(&task->fetch_ended, 0); atomic_init(&task->preparse_status, ITEM_PREPARSE_SKIPPED); atomic_init(&task->interrupted, false); @@ -127,14 +123,14 @@ PreparserRemoveTask(vlc_preparser_t *preparser, struct task *task) } static void -NotifyPreparseEnded(struct task *task) +NotifyPreparseEnded(struct task *task, bool art_fetched) { if (task->cbs == NULL) return; if (task->options & META_REQUEST_OPTION_FETCH_ANY && task->cbs->on_art_fetch_ended) - task->cbs->on_art_fetch_ended(task->item, task->art_fetched, + task->cbs->on_art_fetch_ended(task->item, art_fetched, task->userdata); if (task->cbs->on_preparse_ended) { @@ -182,9 +178,12 @@ OnArtFetchEnded(input_item_t *item, bool fetched, void *userdata) VLC_UNUSED(fetched); struct task *task = userdata; - task->art_fetched = fetched; - vlc_sem_post(&task->fetch_ended); + if (!atomic_load(&task->interrupted)) + input_item_SetPreparsed(task->item); + + NotifyPreparseEnded(task, fetched); + TaskDelete(task); } static const input_fetcher_callbacks_t input_fetcher_callbacks = { @@ -223,22 +222,16 @@ Parse(struct task *task, vlc_tick_t deadline) input_item_parser_id_Release(task->parser); } -static void +static int Fetch(struct task *task) { input_fetcher_t *fetcher = task->preparser->fetcher; if (!fetcher || !(task->options & META_REQUEST_OPTION_FETCH_ANY)) - return; + return VLC_ENOENT; - int ret = - input_fetcher_Push(fetcher, task->item, - task->options & META_REQUEST_OPTION_FETCH_ANY, - &input_fetcher_callbacks, task); - if (ret != VLC_SUCCESS) - return; - - /* Wait until the end of fetching (fetching is not interruptible) */ - vlc_sem_wait(&task->fetch_ended); + return input_fetcher_Push(fetcher, task->item, + task->options & META_REQUEST_OPTION_FETCH_ANY, + &input_fetcher_callbacks, task); } static void @@ -247,6 +240,7 @@ RunnableRun(void *userdata) vlc_thread_set_name("vlc-run-prepars"); struct task *task = userdata; + vlc_preparser_t *preparser = task->preparser; vlc_tick_t deadline = task->timeout ? vlc_tick_now() + task->timeout : VLC_TICK_INVALID; @@ -255,25 +249,29 @@ RunnableRun(void *userdata) META_REQUEST_OPTION_SCOPE_FORCED)) { if (atomic_load(&task->interrupted)) + { + PreparserRemoveTask(preparser, task); goto end; + } Parse(task, deadline); } + PreparserRemoveTask(preparser, task); + if (atomic_load(&task->interrupted)) goto end; - Fetch(task); + int ret = Fetch(task); - if (atomic_load(&task->interrupted)) - goto end; + if (ret == VLC_SUCCESS) + return; /* Remove the task and notify from the fetcher callback */ - input_item_SetPreparsed(task->item, true); + if (!atomic_load(&task->interrupted)) + input_item_SetPreparsed(task->item); end: - NotifyPreparseEnded(task); - vlc_preparser_t *preparser = task->preparser; - PreparserRemoveTask(preparser, task); + NotifyPreparseEnded(task, false); TaskDelete(task); } @@ -389,7 +387,7 @@ void vlc_preparser_Cancel( vlc_preparser_t *preparser, void *id ) vlc_executor_Cancel(preparser->executor, &task->runnable); if (canceled) { - NotifyPreparseEnded(task); + NotifyPreparseEnded(task, false); vlc_list_remove(&task->node); TaskDelete(task); } View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/fef5c66edb73dc71a97aeae59daffd1e4585c5b4...0c5eb69958622bbcbad01a853d23c0d21da135b2 -- View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/fef5c66edb73dc71a97aeae59daffd1e4585c5b4...0c5eb69958622bbcbad01a853d23c0d21da135b2 You're receiving this email because of your account on code.videolan.org. VideoLAN code repository instance From gitlab at videolan.org Wed Apr 5 11:05:40 2023 From: gitlab at videolan.org (Steve Lhomme (@robUx4)) Date: Wed, 05 Apr 2023 13:05:40 +0200 Subject: [vlc-commits] [Git][videolan/vlc][master] demux: subtitle: add missing TS_0 offset Message-ID: <642d5604a0ae1_170888a3fee428568@gitlab.mail> Steve Lhomme pushed to branch master at VideoLAN / VLC Commits: 6dc0701b by Francois Cartegnie at 2023-04-05T10:39:56+00:00 demux: subtitle: add missing TS_0 offset - - - - - 1 changed file: - modules/demux/subtitle.c Changes: ===================================== modules/demux/subtitle.c ===================================== @@ -1028,8 +1028,8 @@ static int ParseMicroDvd( vlc_object_t *p_obj, subs_properties_t *p_props, } /* */ - p_subtitle->i_start = i_start * p_props->i_microsecperframe; - p_subtitle->i_stop = i_stop >= 0 ? (i_stop * p_props->i_microsecperframe) : -1; + p_subtitle->i_start = VLC_TICK_0 + i_start * p_props->i_microsecperframe; + p_subtitle->i_stop = i_stop >= 0 ? (VLC_TICK_0 + i_stop * p_props->i_microsecperframe) : -1; p_subtitle->psz_text = psz_text; return VLC_SUCCESS; } @@ -1185,10 +1185,10 @@ static int subtitle_ParseSubViewerTiming( subtitle_t *p_subtitle, &h1, &m1, &s1, &d1, &h2, &m2, &s2, &d2) == 8 ) { p_subtitle->i_start = vlc_tick_from_sec( h1 * 3600 + m1 * 60 + s1) + - VLC_TICK_FROM_MS( d1 ); + VLC_TICK_FROM_MS( d1 ) + VLC_TICK_0; p_subtitle->i_stop = vlc_tick_from_sec( h2 * 3600 + m2 * 60 + s2 ) + - VLC_TICK_FROM_MS( d2 ); + VLC_TICK_FROM_MS( d2 ) + VLC_TICK_0; return VLC_SUCCESS; } return VLC_EGENERIC; @@ -1287,9 +1287,9 @@ static int ParseSSA( vlc_object_t *p_obj, subs_properties_t *p_props, } p_subtitle->i_start = vlc_tick_from_sec( h1 * 3600 + m1 * 60 + s1 ) + - VLC_TICK_FROM_MS( c1 * 10 ); + VLC_TICK_FROM_MS( c1 * 10 ) + VLC_TICK_0; p_subtitle->i_stop = vlc_tick_from_sec( h2 * 3600 + m2 * 60 + s2 ) + - VLC_TICK_FROM_MS( c2 * 10 ); + VLC_TICK_FROM_MS( c2 * 10 ) + VLC_TICK_0; p_subtitle->psz_text = psz_text; return VLC_SUCCESS; } @@ -1338,7 +1338,7 @@ static int ParseVplayer( vlc_object_t *p_obj, subs_properties_t *p_props, if( sscanf( s, "%d:%d:%d%*c%[^\r\n]", &h1, &m1, &s1, psz_text ) == 4 ) { - p_subtitle->i_start = vlc_tick_from_sec( h1 * 3600 + m1 * 60 + s1 ); + p_subtitle->i_start = VLC_TICK_0 + vlc_tick_from_sec( h1 * 3600 + m1 * 60 + s1 ); p_subtitle->i_stop = -1; break; } @@ -1455,7 +1455,7 @@ static int ParseSami( vlc_object_t *p_obj, subs_properties_t *p_props, } } - p_subtitle->i_start = VLC_TICK_FROM_MS(i_start); + p_subtitle->i_start = VLC_TICK_0 + VLC_TICK_FROM_MS(i_start); p_subtitle->i_stop = -1; p_subtitle->psz_text = strdup( text ); @@ -1500,7 +1500,7 @@ static int ParseDVDSubtitle(vlc_object_t *p_obj, subs_properties_t *p_props, &h1, &m1, &s1, &c1 ) == 4 ) { p_subtitle->i_start = vlc_tick_from_sec( h1 * 3600 + m1 * 60 + s1 ) + - VLC_TICK_FROM_MS( c1 * 10 ); + VLC_TICK_FROM_MS( c1 * 10 ) + VLC_TICK_0; p_subtitle->i_stop = -1; break; } @@ -1570,8 +1570,8 @@ static int ParseMPL2(vlc_object_t *p_obj, subs_properties_t *p_props, if( sscanf( s, "[%d][] %[^\r\n]", &i_start, psz_text ) == 2 || sscanf( s, "[%d][%d] %[^\r\n]", &i_start, &i_stop, psz_text ) == 3) { - p_subtitle->i_start = VLC_TICK_FROM_MS(i_start * 100); - p_subtitle->i_stop = i_stop >= 0 ? VLC_TICK_FROM_MS(i_stop * 100) : -1; + p_subtitle->i_start = VLC_TICK_0 + VLC_TICK_FROM_MS(i_start * 100); + p_subtitle->i_stop = i_stop >= 0 ? VLC_TICK_0 + VLC_TICK_FROM_MS(i_stop * 100) : -1; break; } free( psz_text ); @@ -1621,13 +1621,13 @@ static int ParseAQT(vlc_object_t *p_obj, subs_properties_t *p_props, text_t *txt /* Starting of a subtitle */ if( i_firstline ) { - p_subtitle->i_start = t * p_props->i_microsecperframe; + p_subtitle->i_start = VLC_TICK_0 + t * p_props->i_microsecperframe; i_firstline = 0; } /* We have been too far: end of the subtitle, begin of next */ else { - p_subtitle->i_stop = t * p_props->i_microsecperframe; + p_subtitle->i_stop = VLC_TICK_0 + t * p_props->i_microsecperframe; break; } } @@ -1674,8 +1674,8 @@ static int ParsePJS(vlc_object_t *p_obj, subs_properties_t *p_props, if( sscanf (s, "%d,%d,\"%[^\n\r]", &t1, &t2, psz_text ) == 3 ) { /* 1/10th of second ? Frame based ? FIXME */ - p_subtitle->i_start = 10 * t1; - p_subtitle->i_stop = 10 * t2; + p_subtitle->i_start = VLC_TICK_0 + 10 * t1; + p_subtitle->i_stop = VLC_TICK_0 + 10 * t2; /* Remove latest " */ psz_text[ strlen(psz_text) - 1 ] = '\0'; @@ -1758,9 +1758,9 @@ static int ParseMPSub( vlc_object_t *p_obj, subs_properties_t *p_props, { float f2 = vlc_strtof_c( psz_temp, NULL ); p_props->mpsub.f_total += f1 * p_props->mpsub.i_factor; - p_subtitle->i_start = llroundf(10000.f * p_props->mpsub.f_total); + p_subtitle->i_start = VLC_TICK_0 + llroundf(10000.f * p_props->mpsub.f_total); p_props->mpsub.f_total += f2 * p_props->mpsub.i_factor; - p_subtitle->i_stop = llroundf(10000.f * p_props->mpsub.f_total); + p_subtitle->i_stop = VLC_TICK_0 + llroundf(10000.f * p_props->mpsub.f_total); break; } } @@ -1827,18 +1827,18 @@ static int ParseJSS( vlc_object_t *p_obj, subs_properties_t *p_props, if( sscanf( s, "%d:%d:%d.%d %d:%d:%d.%d %[^\n\r]", &h1, &m1, &s1, &f1, &h2, &m2, &s2, &f2, psz_text ) == 9 ) { - p_subtitle->i_start = vlc_tick_from_sec( ( h1 *3600 + m1 * 60 + s1 ) + + p_subtitle->i_start = VLC_TICK_0 + vlc_tick_from_sec( ( h1 *3600 + m1 * 60 + s1 ) + (int64_t)( ( f1 + p_props->jss.i_time_shift ) / p_props->jss.i_time_resolution ) ); - p_subtitle->i_stop = vlc_tick_from_sec( ( h2 *3600 + m2 * 60 + s2 ) + + p_subtitle->i_stop = VLC_TICK_0 + vlc_tick_from_sec( ( h2 *3600 + m2 * 60 + s2 ) + (int64_t)( ( f2 + p_props->jss.i_time_shift ) / p_props->jss.i_time_resolution ) ); break; } /* Short time lines */ else if( sscanf( s, "@%d @%d %[^\n\r]", &f1, &f2, psz_text ) == 3 ) { - p_subtitle->i_start = + p_subtitle->i_start = VLC_TICK_0 + vlc_tick_from_sec( (f1 + p_props->jss.i_time_shift ) / p_props->jss.i_time_resolution ); - p_subtitle->i_stop = + p_subtitle->i_stop = VLC_TICK_0 + vlc_tick_from_sec( (f2 + p_props->jss.i_time_shift ) / p_props->jss.i_time_resolution ); break; } @@ -2064,8 +2064,8 @@ static int ParsePSB( vlc_object_t *p_obj, subs_properties_t *p_props, if( sscanf( s, "{%d:%d:%d}{%d:%d:%d}%[^\r\n]", &h1, &m1, &s1, &h2, &m2, &s2, psz_text ) == 7 ) { - p_subtitle->i_start = vlc_tick_from_sec( h1 * 3600 + m1 * 60 + s1 ); - p_subtitle->i_stop = vlc_tick_from_sec( h2 * 3600 + m2 * 60 + s2 ); + p_subtitle->i_start = VLC_TICK_0 + vlc_tick_from_sec( h1 * 3600 + m1 * 60 + s1 ); + p_subtitle->i_stop = VLC_TICK_0 + vlc_tick_from_sec( h2 * 3600 + m2 * 60 + s2 ); break; } free( psz_text ); @@ -2139,10 +2139,10 @@ static int ParseRealText( vlc_object_t *p_obj, subs_properties_t *p_props, /* Get the times */ int64_t i_time = ParseRealTime( psz_begin, &h1, &m1, &s1, &f1 ); - p_subtitle->i_start = i_time >= 0 ? i_time : 0; + p_subtitle->i_start = VLC_TICK_0 + (i_time >= 0 ? i_time : 0); i_time = ParseRealTime( psz_end, &h2, &m2, &s2, &f2 ); - p_subtitle->i_stop = i_time >= 0 ? i_time : -1; + p_subtitle->i_stop = VLC_TICK_0 + (i_time >= 0 ? i_time : -1); break; } } @@ -2211,7 +2211,7 @@ static int ParseDKS( vlc_object_t *p_obj, subs_properties_t *p_props, if( sscanf( s, "[%d:%d:%d]%[^\r\n]", &h1, &m1, &s1, psz_text ) == 4 ) { - p_subtitle->i_start = vlc_tick_from_sec( h1 * 3600 + m1 * 60 + s1 ); + p_subtitle->i_start = VLC_TICK_0 + vlc_tick_from_sec( h1 * 3600 + m1 * 60 + s1 ); s = TextGetLine( txt ); if( !s ) @@ -2260,7 +2260,7 @@ static int ParseSubViewer1( vlc_object_t *p_obj, subs_properties_t *p_props, if( sscanf( s, "[%d:%d:%d]", &h1, &m1, &s1 ) == 3 ) { - p_subtitle->i_start = vlc_tick_from_sec( h1 * 3600 + m1 * 60 + s1 ); + p_subtitle->i_start = VLC_TICK_0 + vlc_tick_from_sec( h1 * 3600 + m1 * 60 + s1 ); s = TextGetLine( txt ); if( !s ) @@ -2313,10 +2313,10 @@ static int ParseCommonSBV( vlc_object_t *p_obj, subs_properties_t *p_props, &h2, &m2, &s2, &d2 ) == 8 ) { p_subtitle->i_start = vlc_tick_from_sec( h1 * 3600 + m1 * 60 + s1 ) + - VLC_TICK_FROM_MS( d1 ); + VLC_TICK_FROM_MS( d1 ) + VLC_TICK_0; p_subtitle->i_stop = vlc_tick_from_sec( h2 * 3600 + m2 * 60 + s2 ) + - VLC_TICK_FROM_MS( d2 ); + VLC_TICK_FROM_MS( d2 ) + VLC_TICK_0; if( p_subtitle->i_start < p_subtitle->i_stop ) break; } View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/6dc0701b983082cd8fc7155ca608a8ceff2a0af6 -- View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/6dc0701b983082cd8fc7155ca608a8ceff2a0af6 You're receiving this email because of your account on code.videolan.org. VideoLAN code repository instance From gitlab at videolan.org Thu Apr 6 06:27:00 2023 From: gitlab at videolan.org (Tristan Matthews (@tmatth)) Date: Thu, 06 Apr 2023 08:27:00 +0200 Subject: [vlc-commits] [Git][videolan/vlc][master] 4 commits: fourcc: add QOI Message-ID: <642e66349597e_1708883270648343328@gitlab.mail> Tristan Matthews pushed to branch master at VideoLAN / VLC Commits: b710e792 by Tristan Matthews at 2023-04-05T09:51:06-04:00 fourcc: add QOI QOI - The ?Quite OK Image Format? for fast, lossless image compression See: https://github.com/phoboslab/qoi - - - - - cd2f48d4 by Tristan Matthews at 2023-04-05T09:51:06-04:00 avcodec: fourcc: map QOI image format - - - - - 78d148d0 by Tristan Matthews at 2023-04-05T09:51:06-04:00 mime: add image/qoi - - - - - 7ffc36f0 by Tristan Matthews at 2023-04-05T09:51:06-04:00 image: add qoi - - - - - 5 changed files: - include/vlc_fourcc.h - modules/codec/avcodec/fourcc.c - src/misc/fourcc_list.h - src/misc/image.c - src/misc/mime.c Changes: ===================================== include/vlc_fourcc.h ===================================== @@ -93,6 +93,7 @@ #define VLC_CODEC_TRUEMOTION2 VLC_FOURCC('T','M','2','0') #define VLC_CODEC_QTRLE VLC_FOURCC('r','l','e',' ') #define VLC_CODEC_QDRAW VLC_FOURCC('q','d','r','w') +#define VLC_CODEC_QOI VLC_FOURCC('q','o','i','f') #define VLC_CODEC_QPEG VLC_FOURCC('Q','P','E','G') #define VLC_CODEC_ULTI VLC_FOURCC('U','L','T','I') #define VLC_CODEC_VIXL VLC_FOURCC('V','I','X','L') ===================================== modules/codec/avcodec/fourcc.c ===================================== @@ -113,6 +113,9 @@ static const struct vlc_avcodec_fourcc video_codecs[] = { VLC_CODEC_LCL_MSZH, AV_CODEC_ID_MSZH }, { VLC_CODEC_LCL_ZLIB, AV_CODEC_ID_ZLIB }, { VLC_CODEC_QTRLE, AV_CODEC_ID_QTRLE }, +#if LIBAVCODEC_VERSION_CHECK(59, 33, 100) + { VLC_CODEC_QOI, AV_CODEC_ID_QOI }, +#endif { VLC_CODEC_TSCC, AV_CODEC_ID_TSCC }, { VLC_CODEC_ULTI, AV_CODEC_ID_ULTI }, { VLC_CODEC_QDRAW, AV_CODEC_ID_QDRAW }, ===================================== src/misc/fourcc_list.h ===================================== @@ -625,6 +625,9 @@ static const staticentry_t p_list_video[] = { B(VLC_CODEC_QDRAW, "Apple QuickDraw Video"), A("qdrw"), + B(VLC_CODEC_QOI, "Quite OK Image Format"), + A("qoif"), + B(VLC_CODEC_QPEG, "QPEG Video"), A("QPEG"), A("Q1.0"), ===================================== src/misc/image.c ===================================== @@ -607,6 +607,7 @@ static const struct { VLC_FOURCC('x','c','f',' '), "xcf" }, { VLC_CODEC_PCX, "pcx" }, { VLC_CODEC_GIF, "gif" }, + { VLC_CODEC_QOI, "qoi" }, { VLC_CODEC_SVG, "svg" }, { VLC_CODEC_TIFF, "tif" }, { VLC_CODEC_TIFF, "tiff" }, @@ -652,6 +653,7 @@ static const struct { VLC_CODEC_BPG, "image/bpg" }, { VLC_CODEC_PCX, "image/pcx" }, { VLC_CODEC_PNG, "image/png" }, + { VLC_CODEC_QOI, "image/qoi" }, { VLC_CODEC_SVG, "image/svg+xml" }, { VLC_CODEC_TIFF, "image/tiff" }, { VLC_CODEC_TARGA, "image/x-tga" }, ===================================== src/misc/mime.c ===================================== @@ -51,6 +51,7 @@ static const struct { ".jpg", "image/jpeg" }, { ".jpeg", "image/jpeg" }, { ".png", "image/png" }, + { ".qoi", "image/qoi" }, { ".pct", "image/x-pict" }, /* same as modules/mux/mpjpeg.c here: */ { ".mpjpeg","multipart/x-mixed-replace; boundary=7b3cc56e5f51db803f790dad720ed50a" }, View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/6dc0701b983082cd8fc7155ca608a8ceff2a0af6...7ffc36f0e946cc49d8aed83a702f9e77a1e7061d -- View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/6dc0701b983082cd8fc7155ca608a8ceff2a0af6...7ffc36f0e946cc49d8aed83a702f9e77a1e7061d You're receiving this email because of your account on code.videolan.org. VideoLAN code repository instance From gitlab at videolan.org Thu Apr 6 08:35:34 2023 From: gitlab at videolan.org (Steve Lhomme (@robUx4)) Date: Thu, 06 Apr 2023 10:35:34 +0200 Subject: [vlc-commits] [Git][videolan/vlc][master] 3 commits: qt: Add the 'qt-safe-area' option Message-ID: <642e845631cc4_17088811c6c6c368476@gitlab.mail> Steve Lhomme pushed to branch master at VideoLAN / VLC Commits: 0f784508 by Benjamin Arnaud at 2023-04-06T08:14:26+00:00 qt: Add the 'qt-safe-area' option - - - - - bba3eed2 by Benjamin Arnaud at 2023-04-06T08:14:26+00:00 qt/mainctx: Add the 'safeArea' property - - - - - 5d7fa7f6 by Benjamin Arnaud at 2023-04-06T08:14:26+00:00 qml/VLCStyle: Add the 'safeArea' support - - - - - 4 changed files: - modules/gui/qt/maininterface/mainctx.cpp - modules/gui/qt/maininterface/mainctx.hpp - modules/gui/qt/qt.cpp - modules/gui/qt/style/VLCStyle.qml Changes: ===================================== modules/gui/qt/maininterface/mainctx.cpp ===================================== @@ -310,6 +310,8 @@ void MainCtx::loadPrefs(const bool callSignals) loadFromVLCOption(m_pinVideoControls, "qt-pin-controls", &MainCtx::pinVideoControlsChanged); loadFromVLCOption(m_pinOpacity, "qt-fs-opacity", &MainCtx::pinOpacityChanged); + + loadFromVLCOption(m_safeArea, "qt-safe-area", &MainCtx::safeAreaChanged); } void MainCtx::loadFromSettingsImpl(const bool callSignals) ===================================== modules/gui/qt/maininterface/mainctx.hpp ===================================== @@ -178,6 +178,7 @@ class MainCtx : public QObject Q_PROPERTY(QScreen* screen READ screen NOTIFY screenChanged) Q_PROPERTY(bool useGlobalShortcuts READ getUseGlobalShortcuts WRITE setUseGlobalShortcuts NOTIFY useGlobalShortcutsChanged FINAL) Q_PROPERTY(int maxVolume READ maxVolume NOTIFY maxVolumeChanged FINAL) + Q_PROPERTY(float safeArea READ safeArea NOTIFY safeAreaChanged FINAL) Q_PROPERTY(CSDButtonModel *csdButtonModel READ csdButtonModel CONSTANT FINAL) @@ -266,6 +267,8 @@ public: void setUseGlobalShortcuts(bool useGlobalShortcuts ); inline int maxVolume() const { return m_maxVolume; }; + inline float safeArea() const { return m_safeArea; }; + bool hasEmbededVideo() const; VideoSurfaceProvider* getVideoSurfaceProvider() const; void setVideoSurfaceProvider(VideoSurfaceProvider* videoSurfaceProvider);; @@ -377,6 +380,8 @@ protected: int m_maxVolume = 125; + float m_safeArea = 0.0; + std::unique_ptr m_csdButtonModel; public slots: @@ -469,6 +474,8 @@ signals: void maxVolumeChanged(); + void safeAreaChanged(); + private: void loadPrefs(bool callSignals); void loadFromSettingsImpl(bool callSignals); ===================================== modules/gui/qt/qt.cpp ===================================== @@ -227,6 +227,11 @@ static void ShowDialog ( intf_thread_t *, int, int, intf_dialog_args_t * ); #define SMOOTH_SCROLLING_TEXT N_( "Use smooth scrolling in Flickable based views" ) #define SMOOTH_SCROLLING_LONGTEXT N_( "Deactivating this option will disable smooth scrolling in Flickable based views (such as the Playqueue)" ) +#define SAFE_AREA_TEXT N_( "Safe area for the user interface" ) +#define SAFE_AREA_LONGTEXT N_( "Sets the safe area percentage between 0.0 and 100 when you want " \ + "to ensure the visibility of the user interface on a constrained " \ + "viewport" ) + static const int initial_prefs_view_list[] = { 0, 1, 2 }; static const char *const initial_prefs_view_list_texts[] = { N_("Simple"), N_("Advanced"), N_("Expert") }; @@ -393,6 +398,8 @@ vlc_module_begin () add_bool( "qt-smooth-scrolling", true, SMOOTH_SCROLLING_TEXT, SMOOTH_SCROLLING_LONGTEXT ) + add_float_with_range( "qt-safe-area", 0, 0, 100.0, SAFE_AREA_TEXT, SAFE_AREA_LONGTEXT ) + cannot_unload_broken_library() add_submodule () ===================================== modules/gui/qt/style/VLCStyle.qml ===================================== @@ -230,8 +230,8 @@ QtObject { readonly property bool isScreenSmall: appWidth <= smallWidth //global application margin "safe area" - readonly property int applicationHorizontalMargin: 0 - readonly property int applicationVerticalMargin: 0 + readonly property int applicationHorizontalMargin: MainCtx.safeArea * appWidth / 100 + readonly property int applicationVerticalMargin: applicationHorizontalMargin readonly property int globalToolbar_height: dp(40, scale) readonly property int localToolbar_height: dp(48, scale) View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/7ffc36f0e946cc49d8aed83a702f9e77a1e7061d...5d7fa7f67afeea843a031e90aa90433ba4eee7fb -- View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/7ffc36f0e946cc49d8aed83a702f9e77a1e7061d...5d7fa7f67afeea843a031e90aa90433ba4eee7fb You're receiving this email because of your account on code.videolan.org. VideoLAN code repository instance From gitlab at videolan.org Thu Apr 6 11:02:11 2023 From: gitlab at videolan.org (Steve Lhomme (@robUx4)) Date: Thu, 06 Apr 2023 13:02:11 +0200 Subject: [vlc-commits] [Git][videolan/vlc][master] 2 commits: meson: fix MFT linking with external libraries Message-ID: <642ea6b38dbc1_170888a3fee4377697@gitlab.mail> Steve Lhomme pushed to branch master at VideoLAN / VLC Commits: f1f5e270 by Steve Lhomme at 2023-04-06T08:36:16+00:00 meson: fix MFT linking with external libraries The module needs to use 'dependencies' for such dependencies. - - - - - cb8268f2 by Steve Lhomme at 2023-04-06T08:36:16+00:00 meson: fix D3D11 vout linking with external libraries The module needs to use 'dependencies' for such dependencies. - - - - - 2 changed files: - modules/codec/meson.build - modules/video_output/win32/meson.build Changes: ===================================== modules/codec/meson.build ===================================== @@ -645,9 +645,9 @@ if host_system == 'windows' install: false ) - mft_link_with = [ cc.find_library('mfplat'), d3d11_common_lib ] + mft_deps = [ cc.find_library('mfplat') ] if get_option('winstore_app') - mft_link_with += [ cc.find_library('d3d11') ] + mft_deps += [ cc.find_library('d3d11') ] endif vlc_modules += { 'name' : 'mft', @@ -660,7 +660,8 @@ if host_system == 'windows' '../packetizer/h264_nal.c', '../packetizer/hevc_nal.c' ), - 'link_with' : mft_link_with + 'link_with' : [ d3d11_common_lib ], + 'dependencies' : mft_deps } endif ===================================== modules/video_output/win32/meson.build ===================================== @@ -5,8 +5,9 @@ # Direct3D11 video output d3d11_sources = files('direct3d11.cpp', 'd3d11_quad.cpp', 'd3d11_shaders.cpp', 'd3d_shaders.c', 'd3d_dynamic_shader.c', 'd3d11_swapchain.cpp', 'dxgi_swapchain.cpp', 'common.c') d3d11_link_with = [ d3d11_common_lib ] +d3d11_deps = [] if get_option('winstore_app') - d3d11_link_with += [ + d3d11_deps += [ cc.find_library('d3d11'), cc.find_library('d3dcompiler_47') ] @@ -18,7 +19,8 @@ endif vlc_modules += { 'name' : 'direct3d11', 'sources' : d3d11_sources, - 'link_with' : d3d11_link_with + 'link_with' : d3d11_link_with, + 'dependencies' : d3d11_deps } if have_win_desktop View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/5d7fa7f67afeea843a031e90aa90433ba4eee7fb...cb8268f268088301d081382377d6ad875db4d092 -- View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/5d7fa7f67afeea843a031e90aa90433ba4eee7fb...cb8268f268088301d081382377d6ad875db4d092 You're receiving this email because of your account on code.videolan.org. VideoLAN code repository instance From gitlab at videolan.org Thu Apr 6 11:27:10 2023 From: gitlab at videolan.org (Steve Lhomme (@robUx4)) Date: Thu, 06 Apr 2023 13:27:10 +0200 Subject: [vlc-commits] [Git][videolan/vlc][master] access/dshow: only use the includes we need Message-ID: <642eac8ec1cc6_17088833609543819d6@gitlab.mail> Steve Lhomme pushed to branch master at VideoLAN / VLC Commits: 953ff5b6 by Steve Lhomme at 2023-04-06T11:06:42+00:00 access/dshow: only use the includes we need We don't need a special vlc_dshow.h including a lot of things. - - - - - 5 changed files: - modules/access/Makefile.am - modules/access/dshow/crossbar.cpp - modules/access/dshow/dshow.cpp - modules/access/dshow/filter.cpp - ? modules/access/dshow/vlc_dshow.h Changes: ===================================== modules/access/Makefile.am ===================================== @@ -166,7 +166,7 @@ if HAVE_V4L2 access_LTLIBRARIES += libv4l2_plugin.la endif -libdshow_plugin_la_SOURCES = access/dshow/vlc_dshow.h access/dshow/dshow.cpp access/dshow/access.h \ +libdshow_plugin_la_SOURCES = access/dshow/dshow.cpp access/dshow/access.h \ access/dshow/filter.cpp access/dshow/filter.h access/dshow/crossbar.cpp ../src/win32/mta_holder.h libdshow_plugin_la_CPPFLAGS = $(AM_CPPFLAGS) -DSTRSAFE_NO_DEPRECATE libdshow_plugin_la_CXXFLAGS = $(AM_CXXFLAGS) $(LIBCOMCXXFLAGS) ===================================== modules/access/dshow/crossbar.cpp ===================================== @@ -33,7 +33,6 @@ #include #include "access.h" -#include "vlc_dshow.h" namespace dshow { ===================================== modules/access/dshow/dshow.cpp ===================================== @@ -45,11 +45,12 @@ #include /* FromWide */ #include -#include "vlc_dshow.h" #include "access.h" #include "filter.h" +#include + #include "../src/win32/mta_holder.h" namespace dshow { ===================================== modules/access/dshow/filter.cpp ===================================== @@ -38,10 +38,11 @@ #include "access.h" #include "filter.h" -#include "vlc_dshow.h" #include +#include + #include namespace dshow { ===================================== modules/access/dshow/vlc_dshow.h deleted ===================================== @@ -1,376 +0,0 @@ -/***************************************************************************** - * vlc_dshow.h : DirectShow access module for vlc - ***************************************************************************** - * Copyright (C) 2002, 2004, 2010-2011 VLC authors and VideoLAN - * - * Author: 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., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. - *****************************************************************************/ - -/***************************************************************************** - * Preamble - *****************************************************************************/ -#ifndef VLC_DSHOW_H -#define VLC_DSHOW_H - -#ifdef __MINGW32__ -# include <_mingw.h> -#endif - -#include -#include -#include -#include -#include -#include -#include -#include - -#ifndef __MINGW64_VERSION_MAJOR - -#include - -namespace dshow { - -/***************************************************************************** - * DirectShow GUIDs. - *****************************************************************************/ - -/* IAM */ -DEFINE_GUID(IID_IAMBufferNegotiation ,0x56ed71a0, 0xaf5f, 0x11d0, 0xb3, 0xf0, 0x00, 0xaa, 0x00, 0x37, 0x61, 0xc5); -DEFINE_GUID(IID_IAMTVAudio ,0x83EC1C30, 0x23D1, 0x11d1, 0x99, 0xE6, 0x00, 0xA0, 0xC9, 0x56, 0x02, 0x66); -DEFINE_GUID(IID_IAMCrossbar ,0xC6E13380, 0x30AC, 0x11d0, 0xA1, 0x8C, 0x00, 0xA0, 0xC9, 0x11, 0x89, 0x56); -DEFINE_GUID(IID_IAMTVTuner ,0x211A8766, 0x03AC, 0x11d1, 0x8D, 0x13, 0x00, 0xAA, 0x00, 0xBD, 0x83, 0x39); - -/* Video Format -MEDIASUBTYPEs and FORMAT */ -DEFINE_GUID(MEDIASUBTYPE_ARGB32 ,0x773c9ac0, 0x3274, 0x11d0, 0xb7, 0x24, 0x0, 0xaa, 0x0, 0x6c, 0x1a, 0x1); -/* Packed YUV formats */ -DEFINE_GUID(MEDIASUBTYPE_YUYV ,0x56595559, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71); -/* Planar YUV formats */ -DEFINE_GUID(MEDIASUBTYPE_IYUV ,0x56555949, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71); /* identical to YV12 */ -DEFINE_GUID(MEDIASUBTYPE_I420 ,0x30323449, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71); -/* MPEG2 formats */ -DEFINE_GUID(MEDIASUBTYPE_MPEG2_VIDEO ,0xe06d8026, 0xdb46, 0x11cf, 0xb4, 0xd1, 0x00, 0x80, 0x5f, 0x6c, 0xbb, 0xea); -DEFINE_GUID(MEDIASUBTYPE_MPEG2_PROGRAM ,0xe06d8022, 0xdb46, 0x11cf, 0xb4, 0xd1, 0x00, 0x80, 0x5f, 0x6c, 0xbb, 0xea); -DEFINE_GUID(MEDIASUBTYPE_MPEG2_TRANSPORT ,0xe06d8023, 0xdb46, 0x11cf, 0xb4, 0xd1, 0x00, 0x80, 0x5f, 0x6c, 0xbb, 0xea); -DEFINE_GUID(FORMAT_MPEG2Video ,0xe06d80e3, 0xdb46, 0x11cf, 0xb4, 0xd1, 0x00, 0x80, 0x5f, 0x6c, 0xbb, 0xea); - -/* float */ -DEFINE_GUID(MEDIASUBTYPE_IEEE_FLOAT ,0x00000003, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71); - - -/**************************************************************************** - * The following should be in ks.h and ksmedia.h, but since they are not in - * the current version of Mingw, we will be defined here. - ****************************************************************************/ - -/* http://msdn.microsoft.com/en-us/library/ff567297%28VS.85%29.aspx */ -typedef enum { - KS_AnalogVideo_None = 0x00000000, - KS_AnalogVideo_NTSC_M = 0x00000001, - KS_AnalogVideo_NTSC_M_J = 0x00000002, - KS_AnalogVideo_NTSC_433 = 0x00000004, - KS_AnalogVideo_PAL_B = 0x00000010, - KS_AnalogVideo_PAL_D = 0x00000020, - KS_AnalogVideo_PAL_G = 0x00000040, - KS_AnalogVideo_PAL_H = 0x00000080, - KS_AnalogVideo_PAL_I = 0x00000100, - KS_AnalogVideo_PAL_M = 0x00000200, - KS_AnalogVideo_PAL_N = 0x00000400, - KS_AnalogVideo_PAL_60 = 0x00000800, - KS_AnalogVideo_SECAM_B = 0x00001000, - KS_AnalogVideo_SECAM_D = 0x00002000, - KS_AnalogVideo_SECAM_G = 0x00004000, - KS_AnalogVideo_SECAM_H = 0x00008000, - KS_AnalogVideo_SECAM_K = 0x00010000, - KS_AnalogVideo_SECAM_K1 = 0x00020000, - KS_AnalogVideo_SECAM_L = 0x00040000, - KS_AnalogVideo_SECAM_L1 = 0x00080000, - KS_AnalogVideo_PAL_N_COMBO = 0x00100000 -} KS_AnalogVideoStandard; - -/* http://msdn.microsoft.com/en-us/library/ff567800%28VS.85%29.aspx and following */ -typedef enum { - KSPROPERTY_TUNER_CAPS, // R -overall device capabilities - KSPROPERTY_TUNER_MODE_CAPS, // R -capabilities in this mode - KSPROPERTY_TUNER_MODE, // RW -set a mode (TV, FM, AM, DSS) - KSPROPERTY_TUNER_STANDARD, // R -get TV standard (only if TV mode) - KSPROPERTY_TUNER_FREQUENCY, // RW -set/get frequency - KSPROPERTY_TUNER_INPUT, // RW -select an input - KSPROPERTY_TUNER_STATUS, // R -tuning status - - /* Optional */ - KSPROPERTY_TUNER_IF_MEDIUM, // R O-Medium for IF or Transport Pin - - /* Mandatory for Vista and + */ - KSPROPERTY_TUNER_SCAN_CAPS, // R -overall device capabilities for scanning - - /* Optional ones */ - KSPROPERTY_TUNER_SCAN_STATUS, // R -status of scan - KSPROPERTY_TUNER_STANDARD_MODE, // RW -autodetect mode for signal standard - KSPROPERTY_TUNER_NETWORKTYPE_SCAN_CAPS // R -network type specific tuner capabilities -} KSPROPERTY_TUNER; - -/* http://msdn.microsoft.com/en-us/library/ff567689%28v=VS.85%29.aspx */ -typedef enum { - KS_TUNER_TUNING_EXACT = 1, // Tunes directly to the right freq - KS_TUNER_TUNING_FINE, // Comprehensive search to the right freq - KS_TUNER_TUNING_COARSE, // Fast search -}KS_TUNER_TUNING_FLAGS; - -/* http://msdn.microsoft.com/en-us/library/ff567687%28v=VS.85%29.aspx */ -typedef enum { - KS_TUNER_STRATEGY_PLL = 0X01, // Phase locked loop (PLL) offset tuning - KS_TUNER_STRATEGY_SIGNAL_STRENGTH = 0X02, // Signal strength tuning - KS_TUNER_STRATEGY_DRIVER_TUNES = 0X04, // Driver tunes -}KS_TUNER_STRATEGY; - -/* http://msdn.microsoft.com/en-us/library/ff562676%28VS.85%29.aspx */ -typedef struct { - union { - struct { - GUID Set; - ULONG Id; - ULONG Flags; - }; - LONGLONG Alignment; - }; -} KSIDENTIFIER, *PKSIDENTIFIER; - -typedef KSIDENTIFIER KSPROPERTY, *PKSPROPERTY; - -/* http://msdn.microsoft.com/en-us/library/ff565872%28v=VS.85%29.aspx */ -typedef struct { - KSPROPERTY Property; - ULONG Mode; // KSPROPERTY_TUNER_MODE_* - ULONG StandardsSupported; // KS_AnalogVideo_* (if Mode is TV or DSS) - ULONG MinFrequency; // Hz - ULONG MaxFrequency; // Hz - ULONG TuningGranularity; // Hz - ULONG NumberOfInputs; // number of inputs - ULONG SettlingTime; // milliSeconds - ULONG Strategy; // KS_TUNER_STRATEGY -} KSPROPERTY_TUNER_MODE_CAPS_S, *PKSPROPERTY_TUNER_MODE_CAPS_S; - -/* http://msdn.microsoft.com/en-us/library/ff565839%28v=VS.85%29.aspx */ -typedef struct { - KSPROPERTY Property; - ULONG Frequency; // Hz - ULONG LastFrequency; // Hz (last tuned) - ULONG TuningFlags; // KS_TUNER_TUNING_FLAGS - ULONG VideoSubChannel; // DSS - ULONG AudioSubChannel; // DSS - ULONG Channel; // VBI decoders - ULONG Country; // VBI decoders -} KSPROPERTY_TUNER_FREQUENCY_S, *PKSPROPERTY_TUNER_FREQUENCY_S; - -/* http://msdn.microsoft.com/en-us/library/ff565918%28v=VS.85%29.aspx */ -typedef struct { - KSPROPERTY Property; - ULONG Standard; // KS_AnalogVideo_* -} KSPROPERTY_TUNER_STANDARD_S, *PKSPROPERTY_TUNER_STANDARD_S; -/* End of ks */ - - -/* Define missing interfaces from wine's header */ -/* http://msdn.microsoft.com/en-us/library/dd373441%28v=vs.85%29.aspx */ -typedef enum tagAMTunerModeType { - AMTUNER_MODE_DEFAULT = 0x0000, - AMTUNER_MODE_TV = 0x0001, - AMTUNER_MODE_FM_RADIO = 0x0002, - AMTUNER_MODE_AM_RADIO = 0x0004, - AMTUNER_MODE_DSS = 0x0008 -} AMTunerModeType; - -#define AMPROPERTY_PIN_CATEGORY 0 -typedef enum tagAMTunerSubChannel { - AMTUNER_SUBCHAN_NO_TUNE = -2, - AMTUNER_SUBCHAN_DEFAULT = -1 -} AMTunerSubChannel; - -/* http://msdn.microsoft.com/en-us/library/dd407232%28v=vs.85%29.aspx */ -typedef enum tagTunerInputType { - TunerInputCable = 0, - TunerInputAntenna = TunerInputCable + 1 -} TunerInputType; - -typedef enum tagAMTunerEventType { - AMTUNER_EVENT_CHANGED = 0x1 -} AMTunerEventType; - -/* http://msdn.microsoft.com/en-us/library/dd377421%28v=vs.85%29.aspx */ -typedef enum tagPhysicalConnectorType { - PhysConn_Video_Tuner = 1, - PhysConn_Video_Composite, - PhysConn_Video_SVideo, - PhysConn_Video_RGB, - PhysConn_Video_YRYBY, - PhysConn_Video_SerialDigital, - PhysConn_Video_ParallelDigital, - PhysConn_Video_SCSI, - PhysConn_Video_AUX, - PhysConn_Video_1394, - PhysConn_Video_USB, - PhysConn_Video_VideoDecoder, - PhysConn_Video_VideoEncoder, - PhysConn_Video_SCART, - PhysConn_Video_Black, - PhysConn_Audio_Tuner = 4096, /* 0x1000 */ - PhysConn_Audio_Line, - PhysConn_Audio_Mic, - PhysConn_Audio_AESDigital, - PhysConn_Audio_SPDIFDigital, - PhysConn_Audio_SCSI, - PhysConn_Audio_AUX, - PhysConn_Audio_1394, - PhysConn_Audio_USB, - PhysConn_Audio_AudioDecoder -} PhysicalConnectorType; - -/* http://msdn.microsoft.com/en-us/library/dd407352%28v=vs.85%29.aspx */ -typedef struct _VIDEO_STREAM_CONFIG_CAPS { - GUID guid; - ULONG VideoStandard; - SIZE InputSize; - SIZE MinCroppingSize; - SIZE MaxCroppingSize; - int CropGranularityX; - int CropGranularityY; - int CropAlignX; - int CropAlignY; - SIZE MinOutputSize; - SIZE MaxOutputSize; - int OutputGranularityX; - int OutputGranularityY; - int StretchTapsX; - int StretchTapsY; - int ShrinkTapsX; - int ShrinkTapsY; - LONGLONG MinFrameInterval; - LONGLONG MaxFrameInterval; - LONG MinBitsPerSecond; - LONG MaxBitsPerSecond; -} VIDEO_STREAM_CONFIG_CAPS; - -/* http://msdn.microsoft.com/en-us/library/dd317597%28v=vs.85%29.aspx */ -typedef struct _AUDIO_STREAM_CONFIG_CAPS { - GUID guid; - ULONG MinimumChannels; - ULONG MaximumChannels; - ULONG ChannelsGranularity; - ULONG MinimumBitsPerSample; - ULONG MaximumBitsPerSample; - ULONG BitsPerSampleGranularity; - ULONG MinimumSampleFrequency; - ULONG MaximumSampleFrequency; - ULONG SampleFrequencyGranularity; -} AUDIO_STREAM_CONFIG_CAPS; - -/* http://msdn.microsoft.com/en-us/library/dd389142%28v=vs.85%29.aspx */ -#undef INTERFACE -#define INTERFACE IAMBufferNegotiation -DECLARE_INTERFACE_(IAMBufferNegotiation, IUnknown) -{ - STDMETHOD(QueryInterface) (THIS_ REFIID, PVOID*) PURE; - STDMETHOD_(ULONG,AddRef )(THIS); - STDMETHOD_(ULONG,Release )(THIS); - STDMETHOD(SuggestAllocatorProperties )(THIS_ const ALLOCATOR_PROPERTIES *); - STDMETHOD(GetAllocatorProperties )(THIS_ ALLOCATOR_PROPERTIES *); -}; - -/* http://msdn.microsoft.com/en-us/library/dd389171%28v=vs.85%29.aspx */ -#undef INTERFACE -#define INTERFACE IAMCrossbar -DECLARE_INTERFACE_(IAMCrossbar, IUnknown) -{ - STDMETHOD(QueryInterface) (THIS_ REFIID, PVOID*) PURE; - STDMETHOD_(ULONG, AddRef) (THIS); - STDMETHOD_(ULONG, Release) (THIS); - STDMETHOD(get_PinCounts) (THIS_ long *, long *); - STDMETHOD(CanRoute) (THIS_ long, long); - STDMETHOD(Route) (THIS_ long, long); - STDMETHOD(get_IsRoutedTo) (THIS_ long, long *); - STDMETHOD(get_CrossbarPinInfo) (THIS_ BOOL, long, long *, long *); -}; - -/* http://msdn.microsoft.com/en-us/library/dd375945%28v=vs.85%29.aspx */ -#undef INTERFACE -#define INTERFACE IAMTunerNotification -DECLARE_INTERFACE_( IAMTunerNotification, IUnknown) -{ - STDMETHOD(QueryInterface) (THIS_ REFIID, PVOID*) PURE; - STDMETHOD_(ULONG, AddRef) (THIS); - STDMETHOD_(ULONG, Release) (THIS); - STDMETHOD(OnEvent) (THIS_ AMTunerEventType); -}; - -/* http://msdn.microsoft.com/en-us/library/dd375971%28v=vs.85%29.aspx */ -#undef INTERFACE -#define INTERFACE IAMTVTuner -DECLARE_INTERFACE_(IAMTVTuner, IUnknown) -{ - STDMETHOD(QueryInterface) (THIS_ REFIID, PVOID*) PURE; - STDMETHOD_(ULONG, AddRef) (THIS); - STDMETHOD_(ULONG, Release) (THIS); - STDMETHOD(put_Channel) (THIS_ long, long, long); - STDMETHOD(get_Channel) (THIS_ long *, long *, long *); - STDMETHOD(ChannelMinMax) (THIS_ long *, long *); - STDMETHOD(put_CountryCode) (THIS_ long); - STDMETHOD(get_CountryCode) (THIS_ long *); - STDMETHOD(put_TuningSpace) (THIS_ long); - STDMETHOD(get_TuningSpace) (THIS_ long *); - STDMETHOD(Logon) (THIS_ HANDLE); - STDMETHOD(Logout) (IAMTVTuner *); - STDMETHOD(SignalPresen) (THIS_ long *); - STDMETHOD(put_Mode) (THIS_ AMTunerModeType); - STDMETHOD(get_Mode) (THIS_ AMTunerModeType *); - STDMETHOD(GetAvailableModes) (THIS_ long *); - STDMETHOD(RegisterNotificationCallBack) (THIS_ IAMTunerNotification *, long); - STDMETHOD(UnRegisterNotificationCallBack) (THIS_ IAMTunerNotification *); - STDMETHOD(get_AvailableTVFormats) (THIS_ long *); - STDMETHOD(get_TVFormat) (THIS_ long *); - STDMETHOD(AutoTune) (THIS_ long, long *); - STDMETHOD(StoreAutoTune) (IAMTVTuner *); - STDMETHOD(get_NumInputConnections) (THIS_ long *); - STDMETHOD(put_InputType) (THIS_ long, TunerInputType); - STDMETHOD(get_InputType) (THIS_ long, TunerInputType *); - STDMETHOD(put_ConnectInput) (THIS_ long); - STDMETHOD(get_ConnectInput) (THIS_ long *); - STDMETHOD(get_VideoFrequency) (THIS_ long *); - STDMETHOD(get_AudioFrequency) (THIS_ long *); -}; - -/* http://msdn.microsoft.com/en-us/library/dd375962%28v=vs.85%29.aspx */ -#undef INTERFACE -#define INTERFACE IAMTVAudio -DECLARE_INTERFACE_(IAMTVAudio, IUnknown) -{ - STDMETHOD(QueryInterface) (THIS_ REFIID, PVOID*) PURE; - STDMETHOD_(ULONG, AddRef) (THIS); - STDMETHOD_(ULONG, Release) (THIS); - STDMETHOD(GetHardwareSupportedTVAudioModes) (THIS_ long *); - STDMETHOD(GetAvailableTVAudioModes) (THIS_ long *); - STDMETHOD(get_TVAudioMode) (THIS_ long *); - STDMETHOD(put_TVAudioMode) (THIS_ long); - STDMETHOD(RegisterNotificationCallBack) (THIS_ IAMTunerNotification*, long); - STDMETHOD(UnRegisterNotificationCallBack) (THIS_ IAMTunerNotification*); -}; - -} // namespace - -#endif /* __MINGW64_VERSION_MAJOR */ -#endif /* VLC_DSHOW_H */ View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/953ff5b6621f2f22b484bcdc6ba13e07193c1b3a -- View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/953ff5b6621f2f22b484bcdc6ba13e07193c1b3a You're receiving this email because of your account on code.videolan.org. VideoLAN code repository instance From gitlab at videolan.org Thu Apr 6 15:59:09 2023 From: gitlab at videolan.org (Steve Lhomme (@robUx4)) Date: Thu, 06 Apr 2023 17:59:09 +0200 Subject: [vlc-commits] [Git][videolan/vlc][master] meson: replace deprecated get_pkgconfig_variable method Message-ID: <642eec4d541d6_170888325f384407766@gitlab.mail> Steve Lhomme pushed to branch master at VideoLAN / VLC Commits: 6c687c20 by Marvin Scholz at 2023-04-06T15:43:10+00:00 meson: replace deprecated get_pkgconfig_variable method - - - - - 1 changed file: - modules/meson.build Changes: ===================================== modules/meson.build ===================================== @@ -53,10 +53,10 @@ if (host_system != 'darwin' and host_system != 'windows') or get_option('xcb').e if have_wayland wayland_scanner = find_program( - wayland_scanner_dep.get_pkgconfig_variable('wayland_scanner'), + wayland_scanner_dep.get_variable(pkgconfig: 'wayland_scanner'), native: true ) - wayland_protocols_dir = wayland_protocols_dep.get_pkgconfig_variable('pkgdatadir') + wayland_protocols_dir = wayland_protocols_dep.get_variable(pkgconfig: 'pkgdatadir') endif else have_wayland = false View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/6c687c20eceb2e68e438b53c29ddbc58ef368eb5 -- View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/6c687c20eceb2e68e438b53c29ddbc58ef368eb5 You're receiving this email because of your account on code.videolan.org. VideoLAN code repository instance From gitlab at videolan.org Thu Apr 6 17:25:08 2023 From: gitlab at videolan.org (Steve Lhomme (@robUx4)) Date: Thu, 06 Apr 2023 19:25:08 +0200 Subject: [vlc-commits] [Git][videolan/vlc][master] compat: always use _aligned_malloc/_aligned_free on Windows Message-ID: <642f00743a075_1708884eca6684111e1@gitlab.mail> Steve Lhomme pushed to branch master at VideoLAN / VLC Commits: d91e21ae by Steve Lhomme at 2023-04-06T17:12:47+00:00 compat: always use _aligned_malloc/_aligned_free on Windows We don't need the mingw custom code. It's available in msvcrt.dll and UCRT. It's better to use the same code between mingw and MSVC builds. - - - - - 2 changed files: - compat/aligned_alloc.c - include/vlc_fixups.h Changes: ===================================== compat/aligned_alloc.c ===================================== @@ -56,9 +56,7 @@ void *aligned_alloc(size_t align, size_t size) #elif defined(HAVE_MEMALIGN) return memalign(align, size); -#elif defined (_WIN32) && defined(__MINGW32__) - return __mingw_aligned_malloc(size, align); -#elif defined (_WIN32) && defined(_MSC_VER) +#elif defined (_WIN32) return _aligned_malloc(size, align); #else /* align must be valid/supported */ ===================================== include/vlc_fixups.h ===================================== @@ -396,9 +396,7 @@ void *aligned_alloc(size_t, size_t); } /* extern "C" */ #endif -#if defined (_WIN32) && defined(__MINGW32__) -#define aligned_free(ptr) __mingw_aligned_free(ptr) -#elif defined (_WIN32) && defined(_MSC_VER) +#if defined (_WIN32) #define aligned_free(ptr) _aligned_free(ptr) #else #define aligned_free(ptr) free(ptr) View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/d91e21aec08133479a38686a1ace84638731a4f4 -- View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/d91e21aec08133479a38686a1ace84638731a4f4 You're receiving this email because of your account on code.videolan.org. VideoLAN code repository instance From gitlab at videolan.org Thu Apr 6 18:40:03 2023 From: gitlab at videolan.org (Steve Lhomme (@robUx4)) Date: Thu, 06 Apr 2023 20:40:03 +0200 Subject: [vlc-commits] [Git][videolan/vlc][master] 8 commits: demux: avi: exclude SPU from invalid timescale Message-ID: <642f1203b5a53_17088811c6c6c41427b@gitlab.mail> Steve Lhomme pushed to branch master at VideoLAN / VLC Commits: 60f17ae9 by Francois Cartegnie at 2023-04-06T18:25:00+00:00 demux: avi: exclude SPU from invalid timescale refs #17475 - - - - - 4b8b108f by Francois Cartegnie at 2023-04-06T18:25:00+00:00 demux: avi: set XSUB source size - - - - - c56dcec0 by Francois Cartegnie at 2023-04-06T18:25:00+00:00 demux: avi: add defines - - - - - 72955a1d by Francois Cartegnie at 2023-04-06T18:25:00+00:00 demux: avi: remove unused index member - - - - - b82343fe by Francois Cartegnie at 2023-04-06T18:25:00+00:00 demux: avi: reorder members - - - - - 50dac82b by Francois Cartegnie at 2023-04-06T18:25:00+00:00 demux: avi: reduce loops variables scope - - - - - a2310c67 by Francois Cartegnie at 2023-04-06T18:25:00+00:00 demux: avi: remove stack array - - - - - bc5da140 by Francois Cartegnie at 2023-04-06T18:25:00+00:00 demux: avi: fix and improve Xsub * Properly set timings on samples. * Demux accordingly to timings * Seek approximatively instead of reloading all samples. refs #17475 - - - - - 2 changed files: - modules/demux/avi/avi.c - modules/demux/avi/libavi.h Changes: ===================================== modules/demux/avi/avi.c ===================================== @@ -121,9 +121,8 @@ typedef struct typedef struct { - vlc_fourcc_t i_id; - uint32_t i_flags; uint64_t i_pos; + uint32_t i_flags; uint32_t i_length; uint64_t i_lengthtotal; @@ -145,8 +144,8 @@ typedef struct bool b_activated; bool b_eof; - unsigned int i_rate; - unsigned int i_scale; + unsigned int i_rate; /* for audio & video */ + unsigned int i_scale;/* for audio & video */ unsigned int i_samplesize; struct bitmapinfoheader_properties bihprops; @@ -158,6 +157,9 @@ typedef struct int i_dv_audio_rate; es_out_id_t *p_es_dv_audio; + /* SPU specific */ + vlc_tick_t i_last_embedded_endtime; + vlc_tick_t i_next_embedded_time; /* Avi Index */ avi_index_t idx; @@ -169,6 +171,17 @@ typedef struct unsigned int i_blockno; unsigned int i_blocksize; + struct + { + bool b_ok; + + int64_t i_toread; + + int64_t i_posf; /* where we will read : + if i_idxposb == 0 : beginning of chunk (+8 to access data) + else : point on data directly */ + } demuxctx; + } avi_track_t; typedef struct @@ -224,6 +237,8 @@ static void AVI_IndexLoad ( demux_t * ); static void AVI_IndexCreate ( demux_t * ); static void AVI_ExtractSubtitle( demux_t *, unsigned int i_stream, avi_chunk_list_t *, avi_chunk_STRING_t * ); +static avi_track_t * AVI_GetVideoTrackForXsub( demux_sys_t * ); +static int AVI_SeekSubtitleTrack( demux_sys_t *, avi_track_t * ); static void AVI_DvHandleAudio( demux_t *, avi_track_t *, block_t * ); @@ -267,6 +282,45 @@ static bool IsQNAPCodec(uint32_t biCompression) } } +#define XSUB_HEADER_SIZE 0x1B +static int ExtractXsubSampleInfo( const uint8_t *p_buf, + vlc_tick_t *pi_start, vlc_tick_t *pi_end ) +{ + unsigned t[8]; + char buffer[XSUB_HEADER_SIZE + 1]; + memcpy( buffer, p_buf, XSUB_HEADER_SIZE ); + buffer[XSUB_HEADER_SIZE] = '\0'; + if( sscanf( buffer, "[%u:%2u:%2u.%3u-%u:%2u:%2u.%3u]", + &t[0], &t[1], &t[2], &t[3], &t[4], &t[5], &t[6], &t[7] ) != 8 ) + return VLC_EGENERIC; + *pi_start = vlc_tick_from_sec( t[0] * 3600 + t[1] * 60 + t[2] ) + + VLC_TICK_FROM_MS(t[3]); + *pi_end = vlc_tick_from_sec( t[4] * 3600 + t[5] * 60 + t[6] ) + + VLC_TICK_FROM_MS(t[7]); + return VLC_SUCCESS; +} + +static int AVI_PeekSample( stream_t *s, size_t i_skip, + const uint8_t **pp_peek, size_t i_peek ) +{ + ssize_t i_ret = vlc_stream_Peek( s, pp_peek, i_skip + i_peek ); + *pp_peek += i_skip; + if ( i_ret < 0 || (size_t) i_ret != i_skip + i_peek ) + return VLC_EGENERIC; + return VLC_SUCCESS; +} + +static vlc_tick_t AVI_GetXsubSampleTimeAt( stream_t *s, uint64_t pos ) +{ + const uint8_t *p_peek; + vlc_tick_t i_nzstart, i_nzend; + if( vlc_stream_Seek( s, pos ) != VLC_SUCCESS || + AVI_PeekSample( s, 8, &p_peek, XSUB_HEADER_SIZE ) || + ExtractXsubSampleInfo( p_peek, &i_nzstart, &i_nzend ) ) + return VLC_TICK_INVALID; + return VLC_TICK_0 + i_nzstart; +} + /***************************************************************************** * Close: frees unused data *****************************************************************************/ @@ -484,11 +538,6 @@ static int Open( vlc_object_t * p_this ) tk->i_samplesize = p_strh->i_samplesize; msg_Dbg( p_demux, "stream[%u] rate:%u scale:%u samplesize:%u", i, tk->i_rate, tk->i_scale, tk->i_samplesize ); - if( !tk->i_scale || !tk->i_rate || !(tk->i_rate * CLOCK_FREQ / tk->i_scale) ) - { - free( tk ); - continue; - } switch( p_strh->i_type ) { @@ -608,10 +657,12 @@ static int Open( vlc_object_t * p_this ) case( AVIFOURCC_vids ): { - if( p_vids->p_bih->biCompression == VLC_FOURCC( 'D', 'X', 'S', 'B' ) ) + if( p_vids->p_bih->biCompression == FOURCC_DXSB ) { msg_Dbg( p_demux, "stream[%u] subtitles", i ); es_format_Init( &tk->fmt, SPU_ES, p_vids->p_bih->biCompression ); + tk->fmt.subs.spu.i_original_frame_width = p_vids->p_bih->biWidth; + tk->fmt.subs.spu.i_original_frame_height = p_vids->p_bih->biHeight; break; } @@ -629,7 +680,7 @@ static int Open( vlc_object_t * p_this ) !strncasecmp( (char*)&p_strh->i_handler, "XVID", 4 ) ) { tk->fmt.i_codec = - tk->fmt.i_original_fourcc = VLC_FOURCC( 'X', 'V', 'I', 'D' ); + tk->fmt.i_original_fourcc = FOURCC_XVID; } if( IsQNAPCodec( p_vids->p_bih->biCompression ) ) @@ -693,6 +744,16 @@ static int Open( vlc_object_t * p_this ) free( tk ); continue; } + + if( tk->fmt.i_cat != SPU_ES && + (!tk->i_scale || !tk->i_rate || !(tk->i_rate * CLOCK_FREQ / tk->i_scale)) ) + { + msg_Warn( p_demux, "stream[%u] has invalid timescale", i ); + es_format_Clean(&tk->fmt); + free( tk ); + continue; + } + tk->fmt.i_id = i; if( p_strn && p_strn->p_str ) tk->fmt.psz_description = FromACP( p_strn->p_str ); @@ -874,6 +935,17 @@ static block_t * ReadFrame( demux_t *p_demux, const avi_track_t *tk, if( i_osize == i_size - 1 ) p_frame->i_buffer--; + if( tk->fmt.i_codec == FOURCC_DXSB && p_frame->i_buffer > XSUB_HEADER_SIZE ) + { + vlc_tick_t i_start, i_end; + if( !ExtractXsubSampleInfo( p_frame->p_buffer, &i_start, &i_end ) ) + { + p_frame->i_dts = p_frame->i_pts = VLC_TICK_0 + i_start; + if( i_end > i_start ) + p_frame->i_length = i_start - i_end; + } + } + if( tk->bihprops.i_stride > INT32_MAX - 3 ) { p_frame->i_buffer = 0; @@ -1002,31 +1074,16 @@ static void AVI_SendFrame( demux_t *p_demux, avi_track_t *tk, block_t *p_frame ) ***************************************************************************** * Returns -1 in case of error, 0 in case of EOF, 1 otherwise *****************************************************************************/ -typedef struct -{ - bool b_ok; - - int64_t i_toread; - - int64_t i_posf; /* where we will read : - if i_idxposb == 0 : beginning of chunk (+8 to access data) - else : point on data directly */ -} avi_track_toread_t; - static int Demux_Seekable( demux_t *p_demux ) { demux_sys_t *p_sys = p_demux->p_sys; unsigned int i_track_count = 0; - unsigned int i_track; - /* cannot be more than 100 stream (dcXX or wbXX) */ - avi_track_toread_t toread[100]; - /* detect new selected/unselected streams */ - for( i_track = 0; i_track < p_sys->i_track; i_track++ ) + for( unsigned int i = 0; i < p_sys->i_track; i++ ) { - avi_track_t *tk = p_sys->track[i_track]; + avi_track_t *tk = p_sys->track[i]; bool b = false; es_out_Control( p_demux->out, ES_OUT_GET_ES_STATE, tk->p_es, &b ); @@ -1040,7 +1097,7 @@ static int Demux_Seekable( demux_t *p_demux ) { if( p_sys->b_seekable) { - AVI_TrackSeek( p_demux, i_track, p_sys->i_time ); + AVI_TrackSeek( p_demux, i, p_sys->i_time ); } tk->b_activated = true; } @@ -1072,29 +1129,46 @@ static int Demux_Seekable( demux_t *p_demux ) p_sys->i_time += p_sys->i_read_increment; /* init toread */ - for( i_track = 0; i_track < p_sys->i_track; i_track++ ) + for( unsigned i = 0; i < p_sys->i_track; i++ ) { - avi_track_t *tk = p_sys->track[i_track]; + avi_track_t *tk = p_sys->track[i]; - toread[i_track].b_ok = tk->b_activated && !tk->b_eof; + tk->demuxctx.b_ok = tk->b_activated && !tk->b_eof; if( tk->i_idxposc < tk->idx.i_size ) { - toread[i_track].i_posf = tk->idx.p_entry[tk->i_idxposc].i_pos; + tk->demuxctx.i_posf = tk->idx.p_entry[tk->i_idxposc].i_pos; if( tk->i_idxposb > 0 ) { - toread[i_track].i_posf += 8 + tk->i_idxposb; + tk->demuxctx.i_posf += 8 + tk->i_idxposb; } } else { - toread[i_track].i_posf = -1; + tk->demuxctx.i_posf = -1; + } + + /* Xsub specific. There's no possible chunk/byte<->time */ + if( tk->fmt.i_codec == FOURCC_DXSB ) + { + /* load spu times */ + if( tk->i_next_embedded_time == VLC_TICK_INVALID && tk->demuxctx.i_posf != -1 ) + tk->i_next_embedded_time = AVI_GetXsubSampleTimeAt( + p_demux->s, tk->idx.p_entry[ tk->i_idxposc].i_pos ); + vlc_tick_t i_reftime = tk->i_next_embedded_time != VLC_TICK_INVALID + ? tk->i_next_embedded_time : tk->i_last_embedded_endtime; + if( i_reftime != VLC_TICK_INVALID && + p_sys->i_time - i_reftime > VLC_TICK_FROM_SEC(-2) ) + tk->demuxctx.i_toread = 1; + else + tk->demuxctx.i_toread = -1; + continue; } vlc_tick_t i_dpts = p_sys->i_time - AVI_GetPTS( tk ); if( tk->i_samplesize ) { - toread[i_track].i_toread = AVI_PTSToByte( tk, i_dpts ); + tk->demuxctx.i_toread = AVI_PTSToByte( tk, i_dpts ); } else if ( i_dpts > VLC_TICK_FROM_SEC(-2) ) /* don't send a too early dts (low fps video) */ { @@ -1105,40 +1179,40 @@ static int Demux_Seekable( demux_t *p_demux ) * That does not even work when reading amount < scale / rate */ i_chunks_count++; } - toread[i_track].i_toread = i_chunks_count; + tk->demuxctx.i_toread = i_chunks_count; } else - toread[i_track].i_toread = -1; + tk->demuxctx.i_toread = -1; } for( ;; ) { - avi_track_t *tk; - bool b_done; + bool b_done = true; block_t *p_frame; - int64_t i_pos; - unsigned int i; + int64_t i_pos = -1; + unsigned int i_track = 0; /* search for first chunk to be read */ - for( i = 0, b_done = true, i_pos = -1; i < p_sys->i_track; i++ ) + for( unsigned i = 0; i < p_sys->i_track; i++ ) { - if( !toread[i].b_ok || + avi_track_t *tk = p_sys->track[i]; + if( !tk->demuxctx.b_ok || ( p_sys->b_fastseekable && p_sys->b_interleaved && - AVI_GetDPTS( p_sys->track[i], toread[i].i_toread ) <= -p_sys->i_read_increment ) ) + AVI_GetDPTS( tk, tk->demuxctx.i_toread ) <= -p_sys->i_read_increment ) ) { continue; } - if( toread[i].i_toread > 0 ) + if( tk->demuxctx.i_toread > 0 ) { b_done = false; /* not yet finished */ - if( toread[i].i_posf > 0 ) + if( tk->demuxctx.i_posf > 0 ) { - if( i_pos == -1 || i_pos > toread[i].i_posf ) + if( i_pos == -1 || i_pos > tk->demuxctx.i_posf ) { i_track = i; - i_pos = toread[i].i_posf; + i_pos = tk->demuxctx.i_posf; } } } @@ -1146,9 +1220,10 @@ static int Demux_Seekable( demux_t *p_demux ) if( b_done ) { - for( i = 0; i < p_sys->i_track; i++ ) + for( unsigned i = 0; i < p_sys->i_track; i++ ) { - if( toread[i].b_ok && toread[i].i_toread >= 0 ) + const avi_track_t *tk = p_sys->track[i]; + if( tk->demuxctx.b_ok && tk->demuxctx.i_toread >= 0 ) return VLC_DEMUXER_SUCCESS; } msg_Warn( p_demux, "all tracks have failed, exiting..." ); @@ -1204,11 +1279,10 @@ static int Demux_Seekable( demux_t *p_demux ) else { i_track = avi_pk.i_stream; - tk = p_sys->track[i_track]; + avi_track_t *tk = p_sys->track[i_track]; /* add this chunk to the index */ avi_entry_t index; - index.i_id = avi_pk.i_fourcc; index.i_flags = AVI_GetKeyFlag(tk, avi_pk.i_peek); index.i_pos = avi_pk.i_pos; index.i_length = avi_pk.i_size; @@ -1217,7 +1291,7 @@ static int Demux_Seekable( demux_t *p_demux ) /* do we will read this data ? */ if( i_indexid >= 0 && - AVI_GetDPTS( tk, toread[i_track].i_toread ) > -p_sys->i_read_increment ) + AVI_GetDPTS( tk, tk->demuxctx.i_toread ) > -p_sys->i_read_increment ) { tk->i_idxposc = (unsigned int) i_indexid; tk->i_idxposb = 0; @@ -1243,7 +1317,7 @@ static int Demux_Seekable( demux_t *p_demux ) } /* Set the track to use */ - tk = p_sys->track[i_track]; + avi_track_t *tk = p_sys->track[i_track]; size_t i_size; unsigned i_ck_remaining_bytes = tk->idx.p_entry[tk->i_idxposc].i_length - @@ -1255,7 +1329,7 @@ static int Demux_Seekable( demux_t *p_demux ) int64_t i_toread; /* remaining bytes to read inside the current read increment */ - if( ( i_toread = toread[i_track].i_toread ) <= 0 ) + if( ( i_toread = tk->demuxctx.i_toread ) <= 0 ) { if( tk->i_samplesize > 1 ) { @@ -1283,11 +1357,15 @@ static int Demux_Seekable( demux_t *p_demux ) { msg_Warn( p_demux, "failed reading data" ); tk->b_eof = false; - toread[i_track].b_ok = false; + tk->demuxctx.b_ok = false; continue; } - p_frame->i_pts = VLC_TICK_0 + AVI_GetPTS( tk ); + if( p_frame->i_pts == VLC_TICK_INVALID ) + p_frame->i_pts = VLC_TICK_0 + AVI_GetPTS( tk ); + else + tk->i_last_embedded_endtime = p_frame->i_pts + p_frame->i_length; + if( tk->idx.p_entry[tk->i_idxposc].i_flags&AVIIF_KEYFRAME ) { p_frame->i_flags = BLOCK_FLAG_TYPE_I; @@ -1300,7 +1378,7 @@ static int Demux_Seekable( demux_t *p_demux ) /* advance chunk/byte pointers */ if( tk->i_samplesize ) { - toread[i_track].i_toread -= i_size; + tk->demuxctx.i_toread -= i_size; tk->i_idxposb += i_size; if( tk->i_idxposb >= tk->idx.p_entry[tk->i_idxposc].i_length ) @@ -1317,23 +1395,27 @@ static int Demux_Seekable( demux_t *p_demux ) { tk->i_blockno += tk->i_blocksize > 0 ? ( i_size + tk->i_blocksize - 1 ) / tk->i_blocksize : 1; } - toread[i_track].i_toread--; + else if( tk->fmt.i_cat == SPU_ES ) + { + tk->i_next_embedded_time = VLC_TICK_INVALID; + } + tk->demuxctx.i_toread--; } /* check new chunk and set new read pos */ if( tk->i_idxposc < tk->idx.i_size) { - toread[i_track].i_posf = + tk->demuxctx.i_posf = tk->idx.p_entry[tk->i_idxposc].i_pos; if( tk->i_idxposb > 0 ) { - toread[i_track].i_posf += 8 + tk->i_idxposb; + tk->demuxctx.i_posf += 8 + tk->i_idxposb; } } else /* all chunks read for this track */ { - toread[i_track].i_posf = -1; + tk->demuxctx.i_posf = -1; } AVI_SendFrame( p_demux, tk, p_frame ); @@ -1452,7 +1534,11 @@ static int Demux_UnSeekable( demux_t *p_demux ) { return VLC_DEMUXER_EGENERIC; } - p_frame->i_pts = VLC_TICK_0 + AVI_GetPTS( p_stream ); + + if( p_frame->i_pts == VLC_TICK_INVALID ) + p_frame->i_pts = VLC_TICK_0 + AVI_GetPTS( p_stream ); + else + p_stream->i_last_embedded_endtime = p_frame->i_pts + p_frame->i_length; AVI_SendFrame( p_demux, p_stream, p_frame ); } @@ -1476,6 +1562,7 @@ static int Demux_UnSeekable( demux_t *p_demux ) p_stream->i_blockno += p_stream->i_blocksize > 0 ? ( avi_pk.i_size + p_stream->i_blocksize - 1 ) / p_stream->i_blocksize : 1; } p_stream->i_idxposc++; + p_stream->i_next_embedded_time = VLC_TICK_INVALID; } } @@ -1547,7 +1634,7 @@ static int Seek( demux_t *p_demux, vlc_tick_t i_date, double f_ratio, bool b_acc for( unsigned i = 0; i < p_sys->i_track; i++ ) { avi_track_t *p_track = p_sys->track[i]; - if( !p_track->b_activated ) + if( !p_track->b_activated || p_stream->fmt.i_cat == SPU_ES ) continue; p_stream = p_track; @@ -1905,7 +1992,6 @@ static int AVI_StreamChunkFind( demux_t *p_demux, avi_track_t *tk ) /* add this chunk to the index */ avi_entry_t index; - index.i_id = avi_pk.i_fourcc; index.i_flags = AVI_GetKeyFlag(tk_pk, avi_pk.i_peek); index.i_pos = avi_pk.i_pos; index.i_length = avi_pk.i_size; @@ -2018,6 +2104,9 @@ static int AVI_TrackSeek( demux_t *p_demux, avi_track_t *tk = p_sys->track[i_stream]; vlc_tick_t i_oldpts; + if( tk->fmt.i_cat == SPU_ES ) + return AVI_SeekSubtitleTrack( p_sys, tk ); + i_oldpts = AVI_GetPTS( tk ); if( !tk->i_samplesize ) @@ -2469,7 +2558,6 @@ static int AVI_IndexLoad_idx1( demux_t *p_demux, (i_cat == p_sys->track[i_stream]->fmt.i_cat || i_cat == UNKNOWN_ES ) ) { avi_entry_t index; - index.i_id = p_idx1->entry[i_index].i_fourcc; index.i_flags = p_idx1->entry[i_index].i_flags&(~AVIIF_FIXKEYFRAME); index.i_pos = p_idx1->entry[i_index].i_pos + i_offset; index.i_length = p_idx1->entry[i_index].i_length; @@ -2515,7 +2603,6 @@ static void __Parse_indx( demux_t *p_demux, avi_index_t *p_index, uint64_t *pi_m { for( unsigned i = 0; i < p_indx->i_entriesinuse; i++ ) { - index.i_id = p_indx->i_id; index.i_flags = p_indx->idx.std[i].i_size & 0x80000000 ? 0 : AVIIF_KEYFRAME; index.i_pos = p_indx->i_baseoffset + p_indx->idx.std[i].i_offset - 8; index.i_length = p_indx->idx.std[i].i_size&0x7fffffff; @@ -2528,7 +2615,6 @@ static void __Parse_indx( demux_t *p_demux, avi_index_t *p_index, uint64_t *pi_m { for( unsigned i = 0; i < p_indx->i_entriesinuse; i++ ) { - index.i_id = p_indx->i_id; index.i_flags = p_indx->idx.field[i].i_size & 0x80000000 ? 0 : AVIIF_KEYFRAME; index.i_pos = p_indx->i_baseoffset + p_indx->idx.field[i].i_offset - 8; index.i_length = p_indx->idx.field[i].i_size; @@ -2730,7 +2816,6 @@ static void AVI_IndexCreate( demux_t *p_demux ) avi_track_t *tk = p_sys->track[pk.i_stream]; avi_entry_t index; - index.i_id = pk.i_fourcc; index.i_flags = AVI_GetKeyFlag(tk, pk.i_peek); index.i_pos = pk.i_pos; index.i_length = pk.i_size; @@ -2909,6 +2994,22 @@ static void AVI_DvHandleAudio( demux_t *p_demux, avi_track_t *tk, block_t *p_fra /***************************************************************************** * Subtitles *****************************************************************************/ +/* + Subtitles only exists in a hackish way as AVI is samples rate based and + does not provide any way for variable rate or variable duration content. + + Only 2 subtitles formats: + - Xsub from DivX + Samples are prefixed with a text formatted timestamp containing + start and stop times. + Track index provides sample location. + Chunk position is meaningless. All timings are within sample. + * - Txt + Samples are stored in a similar format as Xsub, but regrouped in a + single sample with metadata header. Location found using track index. + Those are extracted and exposed as attachment. + This track has to be ignored for playback. +*/ static void AVI_ExtractSubtitle( demux_t *p_demux, unsigned int i_stream, avi_chunk_list_t *p_strl, @@ -3041,6 +3142,56 @@ exit: if( p_indx == &ck.indx ) AVI_ChunkClean( p_demux->s, &ck ); } + +static avi_track_t * AVI_GetVideoTrackForXsub( demux_sys_t *p_sys ) +{ + for( unsigned i = 0; i < p_sys->i_track; i++ ) + { + avi_track_t *p_stream = p_sys->track[i]; + if( p_stream->b_activated && + p_stream->fmt.i_cat == VIDEO_ES && + p_stream->idx.i_size ) + return p_stream; + } + return NULL; +} + +static int AVI_SeekSubtitleTrack( demux_sys_t *p_sys, avi_track_t *tk ) +{ + if( tk->fmt.i_codec != FOURCC_DXSB ) + return VLC_EGENERIC; + + const avi_track_t *p_videotk = AVI_GetVideoTrackForXsub( p_sys ); + if( !p_videotk ) + return VLC_EGENERIC; + /* Seek into SPU index using video track */ + + unsigned idx = p_videotk->i_idxposc < p_videotk->idx.i_size + ? p_videotk->i_idxposc : p_videotk->idx.i_size - 1; + uint64_t i_pos = p_videotk->idx.p_entry[idx].i_pos; + /* invalidate sample timestamp */ + tk->i_next_embedded_time = VLC_TICK_INVALID; + tk->i_last_embedded_endtime = VLC_TICK_INVALID; + for( tk->i_idxposc = 0; tk->i_idxposcidx.i_size; tk->i_idxposc++ ) + { + /* match next pos, or closest -256KB sample */ + if( tk->idx.p_entry[tk->i_idxposc].i_pos > i_pos ) + { + tk->b_eof = false; + break; + } + else if( tk->idx.p_entry[tk->i_idxposc].i_pos + (1 << 28) <= i_pos ) + { + tk->b_eof = false; + } + } + tk->b_eof = tk->i_idxposc == tk->idx.i_size; + if(!tk->b_eof) + tk->i_next_block_flags |= BLOCK_FLAG_DISCONTINUITY; + + return VLC_SUCCESS; +} + /***************************************************************************** * Stream management *****************************************************************************/ ===================================== modules/demux/avi/libavi.h ===================================== @@ -364,6 +364,10 @@ int AVI_ChunkFetchIndexes( stream_t *, avi_chunk_t *p_riff ); /* *** codex stuff *** */ +/* DivX */ +#define FOURCC_DXSB VLC_FOURCC('D','X','S','B') /* xsub */ +#define FOURCC_XVID VLC_FOURCC('X','V','I','D') + /* DV */ #define FOURCC_dvsd VLC_FOURCC('d','v','s','d') #define FOURCC_dvhd VLC_FOURCC('d','v','h','d') View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/d91e21aec08133479a38686a1ace84638731a4f4...bc5da1405ea79e7b29f531323e2a440fda24bb4f -- View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/d91e21aec08133479a38686a1ace84638731a4f4...bc5da1405ea79e7b29f531323e2a440fda24bb4f You're receiving this email because of your account on code.videolan.org. VideoLAN code repository instance From gitlab at videolan.org Thu Apr 6 21:53:21 2023 From: gitlab at videolan.org (Jean-Baptiste Kempf (@jbk)) Date: Thu, 06 Apr 2023 23:53:21 +0200 Subject: [vlc-commits] [Git][videolan/vlc][master] 2 commits: gstreamer: fix -Wformat warnings Message-ID: <642f3f5116a9c_170888334eccc4195ac@gitlab.mail> Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC Commits: 7f5485d6 by Johannes Kauffmann at 2023-04-06T21:22:33+00:00 gstreamer: fix -Wformat warnings - - - - - 34e98057 by Johannes Kauffmann at 2023-04-06T21:22:33+00:00 gstreamer: remove extra semicolons - - - - - 4 changed files: - modules/codec/gstreamer/gstvlcpictureplaneallocator.c - modules/codec/gstreamer/gstvlcpictureplaneallocator.h - modules/codec/gstreamer/gstvlcvideopool.c - modules/codec/gstreamer/gstvlcvideosink.c Changes: ===================================== modules/codec/gstreamer/gstvlcpictureplaneallocator.c ===================================== @@ -34,7 +34,7 @@ vlc_fourcc_t GetGstVLCFourcc( const char* ); #define gst_vlc_picture_plane_allocator_parent_class parent_class G_DEFINE_TYPE (GstVlcPicturePlaneAllocator, gst_vlc_picture_plane_allocator, \ - GST_TYPE_ALLOCATOR); + GST_TYPE_ALLOCATOR) static void gst_vlc_picture_plane_allocator_finalize( GObject *p_object ); static GstMemory* gst_vlc_picture_plane_allocator_dummy_alloc( ===================================== modules/codec/gstreamer/gstvlcpictureplaneallocator.h ===================================== @@ -61,7 +61,7 @@ struct _GstVlcPicturePlane struct _GstVlcPicturePlaneAllocator { GstAllocator parent; - picture_t pic_info;; + picture_t pic_info; decoder_t *p_dec; }; ===================================== modules/codec/gstreamer/gstvlcvideopool.c ===================================== @@ -32,7 +32,7 @@ static void gst_vlc_video_pool_finalize( GObject *p_object ); #define gst_vlc_video_pool_parent_class parent_class G_DEFINE_TYPE (GstVlcVideoPool, gst_vlc_video_pool, - GST_TYPE_BUFFER_POOL); + GST_TYPE_BUFFER_POOL) static const gchar** gst_vlc_video_pool_get_options (GstBufferPool *p_pool) { @@ -189,7 +189,7 @@ static void gst_vlc_video_pool_free_buffer( GstBufferPool *p_pool, gst_vlc_picture_plane_allocator_release( p_vpool->p_allocator, p_buffer ); - msg_Dbg( p_vpool->p_dec, "freed buffer %p", p_buffer ); + msg_Dbg( p_vpool->p_dec, "freed buffer %p", (void*)p_buffer ); GST_BUFFER_POOL_CLASS( parent_class )->free_buffer( p_pool, p_buffer ); @@ -223,7 +223,7 @@ static GstFlowReturn gst_vlc_video_pool_alloc_buffer( GstBufferPool *p_pool, p_info->offset, p_info->stride ); } - msg_Dbg( p_vpool->p_dec, "allocated buffer %p", *p_buffer ); + msg_Dbg( p_vpool->p_dec, "allocated buffer %p", (void*)*p_buffer ); return GST_FLOW_OK; } ===================================== modules/codec/gstreamer/gstvlcvideosink.c ===================================== @@ -71,7 +71,7 @@ static void gst_vlc_video_sink_get_property( GObject *p_object, guint prop_id, static void gst_vlc_video_sink_finalize( GObject *p_obj ); #define gst_vlc_video_sink_parent_class parent_class -G_DEFINE_TYPE( GstVlcVideoSink, gst_vlc_video_sink, GST_TYPE_BASE_SINK ); +G_DEFINE_TYPE( GstVlcVideoSink, gst_vlc_video_sink, GST_TYPE_BASE_SINK ) static void gst_vlc_video_sink_class_init( GstVlcVideoSinkClass *p_klass ) { View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/bc5da1405ea79e7b29f531323e2a440fda24bb4f...34e98057dd9dc50b5e33209072441cdc44d20e81 -- View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/bc5da1405ea79e7b29f531323e2a440fda24bb4f...34e98057dd9dc50b5e33209072441cdc44d20e81 You're receiving this email because of your account on code.videolan.org. VideoLAN code repository instance From gitlab at videolan.org Fri Apr 7 07:48:56 2023 From: gitlab at videolan.org (Steve Lhomme (@robUx4)) Date: Fri, 07 Apr 2023 09:48:56 +0200 Subject: [vlc-commits] [Git][videolan/vlc][3.0.x] audiounit: fix surround input on stereo output Message-ID: <642fcae81c356_17088811c6c6c4293fd@gitlab.mail> Steve Lhomme pushed to branch 3.0.x at VideoLAN / VLC Commits: fb75641b by Thomas Guillem at 2023-04-06T08:47:17+02:00 audiounit: fix surround input on stereo output setPreferredOutputNumberOfChannels can fail, don't configure more channels than accepted. The OS will drop the extra channels instead of downmixing it. When I first tested it, the apple TV was configured to always accept surround even with a stereo output (Change Format = Off) but this is not necessarily the case. (cherry picked from commit 6c08c24b075157241eaca3543bb77107a1b9b853) Signed-off-by: Thomas Guillem <thomas at gllm.fr> - - - - - 1 changed file: - modules/audio_output/audiounit_ios.m Changes: ===================================== modules/audio_output/audiounit_ios.m ===================================== @@ -612,6 +612,14 @@ Start(audio_output_t *p_aout, audio_sample_format_t *restrict fmt) (long) [p_sys->avInstance outputNumberOfChannels], p_sys->b_spatial_audio_supported); + if (!p_sys->b_preferred_channels_set && fmt->i_channels > 2) + { + /* Ask the core to downmix to stereo if the preferred number of + * channels can't be set. */ + fmt->i_physical_channels = AOUT_CHANS_STEREO; + aout_FormatPrepare(fmt); + } + p_aout->current_sink_info.headphones = port_type == PORT_TYPE_HEADPHONES; p_sys->au_unit = au_NewOutputInstance(p_aout, kAudioUnitSubType_RemoteIO); View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/fb75641be04c01856e5d190e741e515909f1e49b -- View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/fb75641be04c01856e5d190e741e515909f1e49b You're receiving this email because of your account on code.videolan.org. VideoLAN code repository instance From gitlab at videolan.org Fri Apr 7 08:10:32 2023 From: gitlab at videolan.org (Steve Lhomme (@robUx4)) Date: Fri, 07 Apr 2023 10:10:32 +0200 Subject: [vlc-commits] [Git][videolan/vlc][3.0.x] 2 commits: avcodec: va: pass the software format description to the VA Message-ID: <642fcff894a68_17088835ff0984328b1@gitlab.mail> Steve Lhomme pushed to branch 3.0.x at VideoLAN / VLC Commits: 52939152 by Steve Lhomme at 2023-04-07T07:49:28+00:00 avcodec: va: pass the software format description to the VA The codec profile alone doesn't always give information on the bit depth or chroma subsampling (see HEVC Range Extension). (cherry picked from commit c8a1298cec05f2947a5f9708fcb12c99e20490ca) (edited) edited: * on 3.0 the picture_sys_t is passed to the VA * on 3.0 the directx_sys_t is not const * on 4.0 FindVideoServiceConversion returns the matching decoder GUID Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz> - - - - - e8b689c0 by Steve Lhomme at 2023-04-07T07:49:28+00:00 directx_va: check the bit depth matches what the decoder can handle (cherry picked from commit 53b022588b40e7997564e5b75f416846c22651a2) (rebased) rebased: * in 3.0 the directx_sys_t is not passed as const Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz> - - - - - 9 changed files: - modules/codec/avcodec/d3d11va.c - modules/codec/avcodec/directx_va.c - modules/codec/avcodec/directx_va.h - modules/codec/avcodec/dxva2.c - modules/codec/avcodec/va.c - modules/codec/avcodec/va.h - modules/codec/avcodec/vaapi.c - modules/codec/avcodec/video.c - modules/hw/vdpau/avcodec.c Changes: ===================================== modules/codec/avcodec/d3d11va.c ===================================== @@ -55,7 +55,7 @@ #define D3D_DecoderSurface ID3D11VideoDecoderOutputView #include "directx_va.h" -static int Open(vlc_va_t *, AVCodecContext *, enum PixelFormat, +static int Open(vlc_va_t *, AVCodecContext *, const AVPixFmtDescriptor *, enum PixelFormat, const es_format_t *, picture_sys_t *p_sys); static void Close(vlc_va_t *, void **); @@ -307,7 +307,8 @@ static void Close(vlc_va_t *va, void **ctx) free(sys); } -static int Open(vlc_va_t *va, AVCodecContext *ctx, enum PixelFormat pix_fmt, +static int Open(vlc_va_t *va, AVCodecContext *ctx, const AVPixFmtDescriptor *desc, + enum PixelFormat pix_fmt, const es_format_t *fmt, picture_sys_t *p_sys) { int err = VLC_EGENERIC; @@ -398,7 +399,7 @@ static int Open(vlc_va_t *va, AVCodecContext *ctx, enum PixelFormat pix_fmt, if (err!=VLC_SUCCESS) goto error; - err = directx_va_Setup(va, &sys->dx_sys, ctx, fmt, isXboxHardware(&sys->d3d_dev)); + err = directx_va_Setup(va, &sys->dx_sys, ctx, desc, fmt, isXboxHardware(&sys->d3d_dev)); if (err != VLC_SUCCESS) goto error; ===================================== modules/codec/avcodec/directx_va.c ===================================== @@ -169,6 +169,7 @@ DEFINE_GUID(DXVA_ModeVP9_VLD_Intel, 0x76988a52, 0xdf13, 0x419a, typedef struct { const char *name; const GUID *guid; + int bit_depth; enum AVCodecID codec; const int *p_profiles; // NULL or ends with 0 } directx_va_mode_t; @@ -176,105 +177,106 @@ typedef struct { /* XXX Preferred modes must come first */ static const directx_va_mode_t DXVA_MODES[] = { /* MPEG-1/2 */ - { "MPEG-1 decoder, restricted profile A", &DXVA_ModeMPEG1_A, 0, NULL }, - { "MPEG-2 decoder, restricted profile A", &DXVA_ModeMPEG2_A, 0, NULL }, - { "MPEG-2 decoder, restricted profile B", &DXVA_ModeMPEG2_B, 0, NULL }, - { "MPEG-2 decoder, restricted profile C", &DXVA_ModeMPEG2_C, 0, NULL }, - { "MPEG-2 decoder, restricted profile D", &DXVA_ModeMPEG2_D, 0, NULL }, - - { "MPEG-2 variable-length decoder", &DXVA2_ModeMPEG2_VLD, AV_CODEC_ID_MPEG2VIDEO, PROF_MPEG2_MAIN }, - { "MPEG-2 & MPEG-1 variable-length decoder", &DXVA2_ModeMPEG2and1_VLD, AV_CODEC_ID_MPEG2VIDEO, PROF_MPEG2_MAIN }, - { "MPEG-2 & MPEG-1 variable-length decoder", &DXVA2_ModeMPEG2and1_VLD, AV_CODEC_ID_MPEG1VIDEO, NULL }, - { "MPEG-2 motion compensation", &DXVA2_ModeMPEG2_MoComp, 0, NULL }, - { "MPEG-2 inverse discrete cosine transform", &DXVA2_ModeMPEG2_IDCT, 0, NULL }, + { "MPEG-1 decoder, restricted profile A", &DXVA_ModeMPEG1_A, 8, 0, NULL }, + { "MPEG-2 decoder, restricted profile A", &DXVA_ModeMPEG2_A, 8, 0, NULL }, + { "MPEG-2 decoder, restricted profile B", &DXVA_ModeMPEG2_B, 8, 0, NULL }, + { "MPEG-2 decoder, restricted profile C", &DXVA_ModeMPEG2_C, 8, 0, NULL }, + { "MPEG-2 decoder, restricted profile D", &DXVA_ModeMPEG2_D, 8, 0, NULL }, + + { "MPEG-2 variable-length decoder", &DXVA2_ModeMPEG2_VLD, 8, AV_CODEC_ID_MPEG2VIDEO, PROF_MPEG2_MAIN }, + { "MPEG-2 & MPEG-1 variable-length decoder", &DXVA2_ModeMPEG2and1_VLD, 8, AV_CODEC_ID_MPEG2VIDEO, PROF_MPEG2_MAIN }, + { "MPEG-2 & MPEG-1 variable-length decoder", &DXVA2_ModeMPEG2and1_VLD, 8, AV_CODEC_ID_MPEG1VIDEO, NULL }, + { "MPEG-2 motion compensation", &DXVA2_ModeMPEG2_MoComp, 8, 0, NULL }, + { "MPEG-2 inverse discrete cosine transform", &DXVA2_ModeMPEG2_IDCT, 8, 0, NULL }, /* MPEG-1 http://download.microsoft.com/download/B/1/7/B172A3C8-56F2-4210-80F1-A97BEA9182ED/DXVA_MPEG1_VLD.pdf */ - { "MPEG-1 variable-length decoder, no D pictures", &DXVA2_ModeMPEG1_VLD, 0, NULL }, + { "MPEG-1 variable-length decoder, no D pictures", &DXVA2_ModeMPEG1_VLD, 8, 0, NULL }, /* H.264 http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=3d1c290b-310b-4ea2-bf76-714063a6d7a6 */ - { "H.264 variable-length decoder, film grain technology", &DXVA2_ModeH264_F, AV_CODEC_ID_H264, PROF_H264_HIGH }, - { "H.264 variable-length decoder, no film grain technology", &DXVA2_ModeH264_E, AV_CODEC_ID_H264, PROF_H264_HIGH }, - { "H.264 variable-length decoder, no film grain technology (Intel ClearVideo)", &DXVA_Intel_H264_NoFGT_ClearVideo, AV_CODEC_ID_H264, PROF_H264_HIGH }, - { "H.264 variable-length decoder, no film grain technology, FMO/ASO", &DXVA_ModeH264_VLD_WithFMOASO_NoFGT, AV_CODEC_ID_H264, PROF_H264_HIGH }, - { "H.264 variable-length decoder, no film grain technology, Flash", &DXVA_ModeH264_VLD_NoFGT_Flash, AV_CODEC_ID_H264, PROF_H264_HIGH }, + { "H.264 variable-length decoder, film grain technology", &DXVA2_ModeH264_F, 8, AV_CODEC_ID_H264, PROF_H264_HIGH }, + { "H.264 variable-length decoder, no film grain technology", &DXVA2_ModeH264_E, 8, AV_CODEC_ID_H264, PROF_H264_HIGH }, + { "H.264 variable-length decoder, no film grain technology (Intel ClearVideo)", &DXVA_Intel_H264_NoFGT_ClearVideo, 8, AV_CODEC_ID_H264, PROF_H264_HIGH }, + { "H.264 variable-length decoder, no film grain technology, FMO/ASO", &DXVA_ModeH264_VLD_WithFMOASO_NoFGT, 8, AV_CODEC_ID_H264, PROF_H264_HIGH }, + { "H.264 variable-length decoder, no film grain technology, Flash", &DXVA_ModeH264_VLD_NoFGT_Flash, 8, AV_CODEC_ID_H264, PROF_H264_HIGH }, - { "H.264 inverse discrete cosine transform, film grain technology", &DXVA2_ModeH264_D, 0, NULL }, - { "H.264 inverse discrete cosine transform, no film grain technology", &DXVA2_ModeH264_C, 0, NULL }, - { "H.264 inverse discrete cosine transform, no film grain technology (Intel)", &DXVADDI_Intel_ModeH264_C, 0, NULL }, + { "H.264 inverse discrete cosine transform, film grain technology", &DXVA2_ModeH264_D, 8, 0, NULL }, + { "H.264 inverse discrete cosine transform, no film grain technology", &DXVA2_ModeH264_C, 8, 0, NULL }, + { "H.264 inverse discrete cosine transform, no film grain technology (Intel)", &DXVADDI_Intel_ModeH264_C, 8, 0, NULL }, - { "H.264 motion compensation, film grain technology", &DXVA2_ModeH264_B, 0, NULL }, - { "H.264 motion compensation, no film grain technology", &DXVA2_ModeH264_A, 0, NULL }, - { "H.264 motion compensation, no film grain technology (Intel)", &DXVADDI_Intel_ModeH264_A, 0, NULL }, + { "H.264 motion compensation, film grain technology", &DXVA2_ModeH264_B, 8, 0, NULL }, + { "H.264 motion compensation, no film grain technology", &DXVA2_ModeH264_A, 8, 0, NULL }, + { "H.264 motion compensation, no film grain technology (Intel)", &DXVADDI_Intel_ModeH264_A, 8, 0, NULL }, /* http://download.microsoft.com/download/2/D/0/2D02E72E-7890-430F-BA91-4A363F72F8C8/DXVA_H264_MVC.pdf */ - { "H.264 stereo high profile, mbs flag set", &DXVA_ModeH264_VLD_Stereo_Progressive_NoFGT, 0, NULL }, - { "H.264 stereo high profile", &DXVA_ModeH264_VLD_Stereo_NoFGT, 0, NULL }, - { "H.264 multiview high profile", &DXVA_ModeH264_VLD_Multiview_NoFGT, 0, NULL }, + { "H.264 stereo high profile, mbs flag set", &DXVA_ModeH264_VLD_Stereo_Progressive_NoFGT, 8, 0, NULL }, + { "H.264 stereo high profile", &DXVA_ModeH264_VLD_Stereo_NoFGT, 8, 0, NULL }, + { "H.264 multiview high profile", &DXVA_ModeH264_VLD_Multiview_NoFGT, 8, 0, NULL }, /* SVC http://download.microsoft.com/download/C/8/A/C8AD9F1B-57D1-4C10-85A0-09E3EAC50322/DXVA_SVC_2012_06.pdf */ - { "H.264 scalable video coding, Scalable Baseline Profile", &DXVA_ModeH264_VLD_SVC_Scalable_Baseline, 0, NULL }, - { "H.264 scalable video coding, Scalable Constrained Baseline Profile", &DXVA_ModeH264_VLD_SVC_Restricted_Scalable_Baseline, 0, NULL }, - { "H.264 scalable video coding, Scalable High Profile", &DXVA_ModeH264_VLD_SVC_Scalable_High, 0, NULL }, - { "H.264 scalable video coding, Scalable Constrained High Profile", &DXVA_ModeH264_VLD_SVC_Restricted_Scalable_High_Progressive, 0, NULL }, + { "H.264 scalable video coding, Scalable Baseline Profile", &DXVA_ModeH264_VLD_SVC_Scalable_Baseline, 8, 0, NULL }, + { "H.264 scalable video coding, Scalable Constrained Baseline Profile", &DXVA_ModeH264_VLD_SVC_Restricted_Scalable_Baseline, 8, 0, NULL }, + { "H.264 scalable video coding, Scalable High Profile", &DXVA_ModeH264_VLD_SVC_Scalable_High, 8, 0, NULL }, + { "H.264 scalable video coding, Scalable Constrained High Profile", &DXVA_ModeH264_VLD_SVC_Restricted_Scalable_High_Progressive, 8, 0, NULL }, /* WMV */ - { "Windows Media Video 8 motion compensation", &DXVA2_ModeWMV8_B, 0, NULL }, - { "Windows Media Video 8 post processing", &DXVA2_ModeWMV8_A, 0, NULL }, + { "Windows Media Video 8 motion compensation", &DXVA2_ModeWMV8_B, 8, 0, NULL }, + { "Windows Media Video 8 post processing", &DXVA2_ModeWMV8_A, 8, 0, NULL }, - { "Windows Media Video 9 IDCT", &DXVA2_ModeWMV9_C, 0, NULL }, - { "Windows Media Video 9 motion compensation", &DXVA2_ModeWMV9_B, 0, NULL }, - { "Windows Media Video 9 post processing", &DXVA2_ModeWMV9_A, 0, NULL }, + { "Windows Media Video 9 IDCT", &DXVA2_ModeWMV9_C, 8, 0, NULL }, + { "Windows Media Video 9 motion compensation", &DXVA2_ModeWMV9_B, 8, 0, NULL }, + { "Windows Media Video 9 post processing", &DXVA2_ModeWMV9_A, 8, 0, NULL }, /* VC-1 */ - { "VC-1 variable-length decoder", &DXVA2_ModeVC1_D, AV_CODEC_ID_VC1, NULL }, - { "VC-1 variable-length decoder", &DXVA2_ModeVC1_D, AV_CODEC_ID_WMV3, NULL }, - { "VC-1 variable-length decoder", &DXVA2_ModeVC1_D2010, AV_CODEC_ID_VC1, NULL }, - { "VC-1 variable-length decoder", &DXVA2_ModeVC1_D2010, AV_CODEC_ID_WMV3, NULL }, - { "VC-1 variable-length decoder 2 (Intel)", &DXVA_Intel_VC1_ClearVideo_2, 0, NULL }, - { "VC-1 variable-length decoder (Intel)", &DXVA_Intel_VC1_ClearVideo, 0, NULL }, + { "VC-1 variable-length decoder", &DXVA2_ModeVC1_D, 8, AV_CODEC_ID_VC1, NULL }, + { "VC-1 variable-length decoder", &DXVA2_ModeVC1_D, 8, AV_CODEC_ID_WMV3, NULL }, + { "VC-1 variable-length decoder", &DXVA2_ModeVC1_D2010, 8, AV_CODEC_ID_VC1, NULL }, + { "VC-1 variable-length decoder", &DXVA2_ModeVC1_D2010, 8, AV_CODEC_ID_WMV3, NULL }, + { "VC-1 variable-length decoder 2 (Intel)", &DXVA_Intel_VC1_ClearVideo_2, 8, 0, NULL }, + { "VC-1 variable-length decoder (Intel)", &DXVA_Intel_VC1_ClearVideo, 8, 0, NULL }, - { "VC-1 inverse discrete cosine transform", &DXVA2_ModeVC1_C, 0, NULL }, - { "VC-1 motion compensation", &DXVA2_ModeVC1_B, 0, NULL }, - { "VC-1 post processing", &DXVA2_ModeVC1_A, 0, NULL }, + { "VC-1 inverse discrete cosine transform", &DXVA2_ModeVC1_C, 8, 0, NULL }, + { "VC-1 motion compensation", &DXVA2_ModeVC1_B, 8, 0, NULL }, + { "VC-1 post processing", &DXVA2_ModeVC1_A, 8, 0, NULL }, /* Xvid/Divx: TODO */ - { "MPEG-4 Part 2 nVidia bitstream decoder", &DXVA_nVidia_MPEG4_ASP, 0, NULL }, - { "MPEG-4 Part 2 variable-length decoder, Simple Profile", &DXVA_ModeMPEG4pt2_VLD_Simple, 0, NULL }, - { "MPEG-4 Part 2 variable-length decoder, Simple&Advanced Profile, no GMC", &DXVA_ModeMPEG4pt2_VLD_AdvSimple_NoGMC, 0, NULL }, - { "MPEG-4 Part 2 variable-length decoder, Simple&Advanced Profile, GMC", &DXVA_ModeMPEG4pt2_VLD_AdvSimple_GMC, 0, NULL }, - { "MPEG-4 Part 2 variable-length decoder, Simple&Advanced Profile, Avivo", &DXVA_ModeMPEG4pt2_VLD_AdvSimple_Avivo, 0, NULL }, + { "MPEG-4 Part 2 nVidia bitstream decoder", &DXVA_nVidia_MPEG4_ASP, 8, 0, NULL }, + { "MPEG-4 Part 2 variable-length decoder, Simple Profile", &DXVA_ModeMPEG4pt2_VLD_Simple, 8, 0, NULL }, + { "MPEG-4 Part 2 variable-length decoder, Simple&Advanced Profile, no GMC", &DXVA_ModeMPEG4pt2_VLD_AdvSimple_NoGMC, 8, 0, NULL }, + { "MPEG-4 Part 2 variable-length decoder, Simple&Advanced Profile, GMC", &DXVA_ModeMPEG4pt2_VLD_AdvSimple_GMC, 8, 0, NULL }, + { "MPEG-4 Part 2 variable-length decoder, Simple&Advanced Profile, Avivo", &DXVA_ModeMPEG4pt2_VLD_AdvSimple_Avivo, 8, 0, NULL }, /* HEVC */ - { "HEVC Main profile", &DXVA_ModeHEVC_VLD_Main, AV_CODEC_ID_HEVC, PROF_HEVC_MAIN }, - { "HEVC Main 10 profile", &DXVA_ModeHEVC_VLD_Main10, AV_CODEC_ID_HEVC, PROF_HEVC_MAIN10 }, + { "HEVC Main profile", &DXVA_ModeHEVC_VLD_Main, 8, AV_CODEC_ID_HEVC, PROF_HEVC_MAIN }, + { "HEVC Main 10 profile", &DXVA_ModeHEVC_VLD_Main10, 10, AV_CODEC_ID_HEVC, PROF_HEVC_MAIN10 }, /* H.261 */ - { "H.261 decoder, restricted profile A", &DXVA_ModeH261_A, 0, NULL }, - { "H.261 decoder, restricted profile B", &DXVA_ModeH261_B, 0, NULL }, + { "H.261 decoder, restricted profile A", &DXVA_ModeH261_A, 8, 0, NULL }, + { "H.261 decoder, restricted profile B", &DXVA_ModeH261_B, 8, 0, NULL }, /* H.263 */ - { "H.263 decoder, restricted profile A", &DXVA_ModeH263_A, 0, NULL }, - { "H.263 decoder, restricted profile B", &DXVA_ModeH263_B, 0, NULL }, - { "H.263 decoder, restricted profile C", &DXVA_ModeH263_C, 0, NULL }, - { "H.263 decoder, restricted profile D", &DXVA_ModeH263_D, 0, NULL }, - { "H.263 decoder, restricted profile E", &DXVA_ModeH263_E, 0, NULL }, - { "H.263 decoder, restricted profile F", &DXVA_ModeH263_F, 0, NULL }, + { "H.263 decoder, restricted profile A", &DXVA_ModeH263_A, 8, 0, NULL }, + { "H.263 decoder, restricted profile B", &DXVA_ModeH263_B, 8, 0, NULL }, + { "H.263 decoder, restricted profile C", &DXVA_ModeH263_C, 8, 0, NULL }, + { "H.263 decoder, restricted profile D", &DXVA_ModeH263_D, 8, 0, NULL }, + { "H.263 decoder, restricted profile E", &DXVA_ModeH263_E, 8, 0, NULL }, + { "H.263 decoder, restricted profile F", &DXVA_ModeH263_F, 8, 0, NULL }, /* VPx */ - { "VP8", &DXVA_ModeVP8_VLD, 0, NULL }, + { "VP8", &DXVA_ModeVP8_VLD, 8, 0, NULL }, #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 57, 17, 100 ) && LIBAVCODEC_VERSION_MICRO >= 100 - { "VP9 profile 0", &DXVA_ModeVP9_VLD_Profile0, AV_CODEC_ID_VP9, PROF_VP9_MAIN }, - { "VP9 profile 2", &DXVA_ModeVP9_VLD_10bit_Profile2, AV_CODEC_ID_VP9, PROF_VP9_10 }, + { "VP9 profile 0", &DXVA_ModeVP9_VLD_Profile0, 8, AV_CODEC_ID_VP9, PROF_VP9_MAIN }, + { "VP9 profile 2", &DXVA_ModeVP9_VLD_10bit_Profile2, 10, AV_CODEC_ID_VP9, PROF_VP9_10 }, #else - { "VP9 profile 0", &DXVA_ModeVP9_VLD_Profile0, 0, NULL }, - { "VP9 profile 2", &DXVA_ModeVP9_VLD_10bit_Profile2, 0, NULL }, + { "VP9 profile 0", &DXVA_ModeVP9_VLD_Profile0, 8, 0, NULL }, + { "VP9 profile 2", &DXVA_ModeVP9_VLD_10bit_Profile2, 10, 0, NULL }, #endif - { "VP9 profile Intel", &DXVA_ModeVP9_VLD_Intel, 0, NULL }, + { "VP9 profile Intel", &DXVA_ModeVP9_VLD_Intel, 8, 0, NULL }, - { NULL, NULL, 0, NULL } + { NULL, NULL, 0, 0, NULL } }; -static int FindVideoServiceConversion(vlc_va_t *, directx_sys_t *, const es_format_t *, const AVCodecContext *); +static int FindVideoServiceConversion(vlc_va_t *, directx_sys_t *, const es_format_t *, + const AVCodecContext *, const AVPixFmtDescriptor *); char *directx_va_GetDecoderName(const GUID *guid) { @@ -290,11 +292,12 @@ char *directx_va_GetDecoderName(const GUID *guid) } /* */ -int directx_va_Setup(vlc_va_t *va, directx_sys_t *dx_sys, const AVCodecContext *avctx, +int directx_va_Setup(vlc_va_t *va, directx_sys_t *dx_sys, + const AVCodecContext *avctx, const AVPixFmtDescriptor *desc, const es_format_t *fmt, int flag_xbox) { /* */ - if (FindVideoServiceConversion(va, dx_sys, fmt, avctx)) { + if (FindVideoServiceConversion(va, dx_sys, fmt, avctx, desc)) { msg_Err(va, "FindVideoServiceConversion failed"); return VLC_EGENERIC; } @@ -361,32 +364,32 @@ error: static bool profile_supported(const directx_va_mode_t *mode, const es_format_t *fmt, const AVCodecContext *avctx) { - bool is_supported = mode->p_profiles == NULL; - if (!is_supported) + if (mode->p_profiles == NULL) + return true; + + int profile = fmt->i_profile >= 0 ? fmt->i_profile : avctx->profile; + if (mode->codec == AV_CODEC_ID_H264 && profile == -1) { - int profile = fmt->i_profile >= 0 ? fmt->i_profile : avctx->profile; - if (mode->codec == AV_CODEC_ID_H264 && profile == -1) - { - uint8_t h264_profile; - if ( h264_get_profile_level(fmt, &h264_profile, NULL, NULL) ) - profile = h264_profile; - } - if (mode->codec == AV_CODEC_ID_HEVC && profile == -1) - { - uint8_t hevc_profile; - if (hevc_get_profile_level(fmt, &hevc_profile, NULL, NULL) ) - profile = hevc_profile; - } + uint8_t h264_profile; + if ( h264_get_profile_level(fmt, &h264_profile, NULL, NULL) ) + profile = h264_profile; + } + if (mode->codec == AV_CODEC_ID_HEVC && profile == -1) + { + uint8_t hevc_profile; + if (hevc_get_profile_level(fmt, &hevc_profile, NULL, NULL) ) + profile = hevc_profile; + } - if (profile <= 0) - is_supported = true; - else for (const int *p_profile = &mode->p_profiles[0]; *p_profile != FF_PROFILE_UNKNOWN; ++p_profile) + bool is_supported = false; + if (profile <= 0) + is_supported = true; + else for (const int *p_profile = &mode->p_profiles[0]; *p_profile != FF_PROFILE_UNKNOWN; ++p_profile) + { + if (*p_profile == profile) { - if (*p_profile == profile) - { - is_supported = true; - break; - } + is_supported = true; + break; } } return is_supported; @@ -396,7 +399,8 @@ static bool profile_supported(const directx_va_mode_t *mode, const es_format_t * * Find the best suited decoder mode GUID and render format. */ static int FindVideoServiceConversion(vlc_va_t *va, directx_sys_t *dx_sys, - const es_format_t *fmt, const AVCodecContext *avctx) + const es_format_t *fmt, + const AVCodecContext *avctx, const AVPixFmtDescriptor *desc) { input_list_t p_list = { 0 }; int err = dx_sys->pf_get_input_list(va, &p_list); @@ -427,19 +431,27 @@ static int FindVideoServiceConversion(vlc_va_t *va, directx_sys_t *dx_sys, for (const GUID *g = &p_list.list[0]; !is_supported && g < &p_list.list[p_list.count]; g++) { is_supported = IsEqualGUID(mode->guid, g); } - if ( is_supported ) + if ( !is_supported ) + continue; + + int src_bit_depth = (desc && desc->nb_components) ? desc->comp[0].depth : 8; + if (src_bit_depth != mode->bit_depth) { - is_supported = profile_supported( mode, fmt, avctx ); - if (!is_supported) - { - char *psz_name = directx_va_GetDecoderName(mode->guid); - msg_Warn( va, "Unsupported profile %d for %s ", - fmt->i_profile, psz_name ); - free( psz_name ); - } + char *psz_name = directx_va_GetDecoderName(mode->guid); + msg_Warn( va, "Unsupported bitdepth %d for %s ", + src_bit_depth, psz_name ); + free( psz_name ); + continue; } - if (!is_supported) + + if (!profile_supported( mode, fmt, avctx )) + { + char *psz_name = directx_va_GetDecoderName(mode->guid); + msg_Warn( va, "Unsupported profile %d for %s ", + fmt->i_profile, psz_name ); + free( psz_name ); continue; + } /* */ msg_Dbg(va, "Trying to use '%s' as input", mode->name); ===================================== modules/codec/avcodec/directx_va.h ===================================== @@ -80,7 +80,8 @@ typedef struct int directx_va_Open(vlc_va_t *, directx_sys_t *); void directx_va_Close(vlc_va_t *, directx_sys_t *); -int directx_va_Setup(vlc_va_t *, directx_sys_t *, const AVCodecContext *avctx, const es_format_t *, int flag_xbox); +int directx_va_Setup(vlc_va_t *, directx_sys_t *, const AVCodecContext *, const AVPixFmtDescriptor *, + const es_format_t *, int flag_xbox); char *directx_va_GetDecoderName(const GUID *guid); bool directx_va_canUseDecoder(vlc_va_t *, UINT VendorId, UINT DeviceId, const GUID *pCodec, UINT driverBuild); ===================================== modules/codec/avcodec/dxva2.c ===================================== @@ -43,7 +43,7 @@ #define D3D_DecoderSurface IDirect3DSurface9 #include "directx_va.h" -static int Open(vlc_va_t *, AVCodecContext *, enum PixelFormat, +static int Open(vlc_va_t *, AVCodecContext *, const AVPixFmtDescriptor *, enum PixelFormat, const es_format_t *, picture_sys_t *p_sys); static void Close(vlc_va_t *, void **); @@ -254,7 +254,8 @@ static void Close(vlc_va_t *va, void **ctx) free(sys); } -static int Open(vlc_va_t *va, AVCodecContext *ctx, enum PixelFormat pix_fmt, +static int Open(vlc_va_t *va, AVCodecContext *ctx, const AVPixFmtDescriptor *desc, + enum PixelFormat pix_fmt, const es_format_t *fmt, picture_sys_t *p_sys) { int err = VLC_EGENERIC; @@ -315,7 +316,7 @@ static int Open(vlc_va_t *va, AVCodecContext *ctx, enum PixelFormat pix_fmt, if (err!=VLC_SUCCESS) goto error; - err = directx_va_Setup(va, &sys->dx_sys, ctx, fmt, 0); + err = directx_va_Setup(va, &sys->dx_sys, ctx, desc, fmt, 0); if (err != VLC_SUCCESS) goto error; ===================================== modules/codec/avcodec/va.c ===================================== @@ -96,13 +96,14 @@ static int vlc_va_Start(void *func, va_list ap) { vlc_va_t *va = va_arg(ap, vlc_va_t *); AVCodecContext *ctx = va_arg(ap, AVCodecContext *); + const AVPixFmtDescriptor *src_desc = va_arg(ap, const AVPixFmtDescriptor *); enum PixelFormat pix_fmt = va_arg(ap, enum PixelFormat); const es_format_t *fmt = va_arg(ap, const es_format_t *); picture_sys_t *p_sys = va_arg(ap, picture_sys_t *); - int (*open)(vlc_va_t *, AVCodecContext *, enum PixelFormat, + int (*open)(vlc_va_t *, AVCodecContext *, const AVPixFmtDescriptor *, enum PixelFormat, const es_format_t *, picture_sys_t *) = func; - return open(va, ctx, pix_fmt, fmt, p_sys); + return open(va, ctx, src_desc, pix_fmt, fmt, p_sys); } static void vlc_va_Stop(void *func, va_list ap) @@ -114,7 +115,8 @@ static void vlc_va_Stop(void *func, va_list ap) close(va, hwctx); } -vlc_va_t *vlc_va_New(vlc_object_t *obj, AVCodecContext *avctx, +vlc_va_t *vlc_va_New(vlc_object_t *obj, + AVCodecContext *avctx, const AVPixFmtDescriptor *src_desc, enum PixelFormat pix_fmt, const es_format_t *fmt, picture_sys_t *p_sys) { @@ -125,7 +127,7 @@ vlc_va_t *vlc_va_New(vlc_object_t *obj, AVCodecContext *avctx, char *modlist = var_InheritString(obj, "avcodec-hw"); va->module = vlc_module_load(va, "hw decoder", modlist, true, - vlc_va_Start, va, avctx, pix_fmt, fmt, p_sys); + vlc_va_Start, va, avctx, src_desc, pix_fmt, fmt, p_sys); free(modlist); if (va->module == NULL) { ===================================== modules/codec/avcodec/va.h ===================================== @@ -25,6 +25,7 @@ #ifndef VLC_AVCODEC_VA_H #define VLC_AVCODEC_VA_H 1 +#include typedef struct vlc_va_t vlc_va_t; typedef struct vlc_va_sys_t vlc_va_sys_t; @@ -54,7 +55,7 @@ vlc_fourcc_t vlc_va_GetChroma(enum PixelFormat hwfmt, enum PixelFormat swfmt); * @param fmt VLC format of the content to decode * @return a new VLC object on success, NULL on error. */ -vlc_va_t *vlc_va_New(vlc_object_t *obj, AVCodecContext *, +vlc_va_t *vlc_va_New(vlc_object_t *obj, AVCodecContext *, const AVPixFmtDescriptor *, enum PixelFormat, const es_format_t *fmt, picture_sys_t *p_sys); ===================================== modules/codec/avcodec/vaapi.c ===================================== @@ -151,9 +151,11 @@ static void Delete(vlc_va_t *va, void **hwctx) free(sys); } -static int Create(vlc_va_t *va, AVCodecContext *ctx, enum PixelFormat pix_fmt, +static int Create(vlc_va_t *va, AVCodecContext *ctx, const AVPixFmtDescriptor *desc, + enum PixelFormat pix_fmt, const es_format_t *fmt, picture_sys_t *p_sys) { + VLC_UNUSED(desc); if (pix_fmt != AV_PIX_FMT_VAAPI || p_sys == NULL) return VLC_EGENERIC; ===================================== modules/codec/avcodec/video.c ===================================== @@ -1631,6 +1631,8 @@ no_reuse: AV_PIX_FMT_NONE, }; + const AVPixFmtDescriptor *src_desc = av_pix_fmt_desc_get(swfmt); + for( size_t i = 0; hwfmts[i] != AV_PIX_FMT_NONE; i++ ) { enum PixelFormat hwfmt = AV_PIX_FMT_NONE; @@ -1657,7 +1659,7 @@ no_reuse: picture_t *test_pic = decoder_NewPicture(p_dec); assert(!test_pic || test_pic->format.i_chroma == p_dec->fmt_out.video.i_chroma); - vlc_va_t *va = vlc_va_New(VLC_OBJECT(p_dec), p_context, hwfmt, + vlc_va_t *va = vlc_va_New(VLC_OBJECT(p_dec), p_context, src_desc, hwfmt, &p_dec->fmt_in, test_pic ? test_pic->p_sys : NULL); if (test_pic) ===================================== modules/hw/vdpau/avcodec.c ===================================== @@ -108,7 +108,8 @@ static int Lock(vlc_va_t *va, picture_t *pic, uint8_t **data) return VLC_SUCCESS; } -static int Open(vlc_va_t *va, AVCodecContext *avctx, enum PixelFormat pix_fmt, +static int Open(vlc_va_t *va, AVCodecContext *avctx, const AVPixFmtDescriptor *desc, + enum PixelFormat pix_fmt, const es_format_t *fmt, picture_sys_t *p_sys) { if (pix_fmt != AV_PIX_FMT_VDPAU) @@ -116,6 +117,7 @@ static int Open(vlc_va_t *va, AVCodecContext *avctx, enum PixelFormat pix_fmt, (void) fmt; (void) p_sys; + (void) desc; void *func; VdpStatus err; VdpChromaType type; View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/fb75641be04c01856e5d190e741e515909f1e49b...e8b689c0c1288a4921834029292333169d9ceff5 -- View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/fb75641be04c01856e5d190e741e515909f1e49b...e8b689c0c1288a4921834029292333169d9ceff5 You're receiving this email because of your account on code.videolan.org. VideoLAN code repository instance From gitlab at videolan.org Fri Apr 7 09:04:48 2023 From: gitlab at videolan.org (Steve Lhomme (@robUx4)) Date: Fri, 07 Apr 2023 11:04:48 +0200 Subject: [vlc-commits] [Git][videolan/vlc][3.0.x] 14 commits: d3d9: move the pool creation in libd3d9_common Message-ID: <642fdcb08caae_1708884eca66844221e@gitlab.mail> Steve Lhomme pushed to branch 3.0.x at VideoLAN / VLC Commits: 26652727 by Steve Lhomme at 2023-04-07T08:10:54+00:00 d3d9: move the pool creation in libd3d9_common - - - - - 3341404c by Steve Lhomme at 2023-04-07T08:10:54+00:00 d3d9_fmt: keep the adapter info while it's loaded No need to reload the same thing many times. (cherry picked from commit 60c0cb10694c9fc4314dbed080fe802fbb5a4fef) (edited) edited: * 3.0 doesn't use a decoder device/video context * 3.0 didn't show the driver version in dxva2 Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz> - - - - - 02f5fac7 by Steve Lhomme at 2023-04-07T08:10:54+00:00 direct3d9: move the DXVA2 OpenGL Interop module in its own file It shares nothing with the D3D9 module and will never be loaded at the same time. No functional changes. (cherry picked from commit 886587dc8591ee3bada2bdef660cd0461d7249e7) (edited) edited: * 3.0 had a different name for the DXVA2 interop module * the OpenGL interop name in 3.0 is "glconv", not "glinterop" * 3.0 has the interop declarations in opengl/converter.h * 3.0 uses opengl_tex_converter_t instead of vlc_gl_interop Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz> - - - - - 16769e26 by Steve Lhomme at 2023-04-07T08:10:54+00:00 opengl: dxva2: make sure we can handle the conversion in StretchRect (cherry picked from commit b7a56bc889e4cc02f3bc626c20abb01ee5b394d8) (edited) edited: * 3.0 doesn't use a decoder device/video context * 3.0 doesn't know the exact D3DFORMAT on open but we deduce it from the chroma Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz> - - - - - 3e33bcd4 by Steve Lhomme at 2023-04-07T08:10:54+00:00 opengl: dxva2: always use the IDIRECT3DDEVICE9EX with DXVA interop (cherry picked from commit 15132bbffb0f89bfa9ef7dd79221235e501ee8e6) (edited) edited: * adapted patch as we don't use a decoder device/video context Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz> - - - - - cf08970c by Steve Lhomme at 2023-04-07T08:10:54+00:00 opengl: dxva2: use DXVA-HD instead of StretchRect for NVIDIA GPUs The StretchRect we're using has the same issue as with the D3D9 vout. (cherry picked from commit e595beb4e97391fd0b86caa1cc02955238908cb3) (edited) edited: * 3.0 uses opengl_tex_converter_t and not vlc_gl_interop * 3.0 uses b_color_range_full and not color_range Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz> - - - - - a2c6fd94 by Steve Lhomme at 2023-04-07T08:10:54+00:00 opengl: dxva2: fix indentation after previous commits No functional changes (cherry picked from commit f707c6f002defa3f093b028014a4b3af90e65d14) Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz> - - - - - f007cf9a by Steve Lhomme at 2023-04-07T08:10:54+00:00 contrib: mingw64: patch dxvahd.h before mingw-w64 11 The releases before 11 had bogus dxvahd DXVAHD_STREAM_STATE_xxx_COLOR_SPACE_DATA structures. This was confusing the initialization with LLVM. (cherry picked from commit 96a19e9410ea372d735a352b33fb6ad5a3ce5760) (edited) edited: * in 3.0 the mingw-w64 files are still in the pthreads directory Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz> - - - - - c41bbfd5 by Steve Lhomme at 2023-04-07T08:10:54+00:00 d3d9: fully initialize DXVAHD_BLT_STATE_OUTPUT_COLOR_SPACE_DATA Although we set all known usable bits, it seems that leaving reserved bits "uninitialized" doesn't work in some case. In particular with LLVM builds, which results in bogus output. Co-authored-by: Pierre Lamot <pierre at videolabs.io> (cherry picked from commit a7de762a710debc733f2b2ce5720f92ccab7f566) (edited) edited: * 3.0 doesn't have the GPU callbacks to tweak the output format colorimetry Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz> - - - - - de34414d by Steve Lhomme at 2023-04-07T08:10:54+00:00 d3d9: fully initialize DXVAHD_BLT_STATE_INPUT_COLOR_SPACE_DATA Although we set all known usable bits, it seems that leaving reserved bits "uninitialized" doesn't work in some case. In particular with LLVM builds, which results in bogus output. (cherry picked from commit 367b7e8eeafcd36e876be2d4e0ec2dfd978cc2cb) (edited) edited: * 3.0 uses b_color_range_full instead of color_range Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz> - - - - - 55bfc1ad by Steve Lhomme at 2023-04-07T08:10:54+00:00 d3d9: explicitly set the processing input type We do the processing on video files, not "graphics" generated sources. (cherry picked from commit b86fbe2e7a40caab99aab8a41dce657ed11a91db) (rebased) rebased: * 3.0 uses b_color_range_full instead of color_range Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz> - - - - - 111f34d3 by Steve Lhomme at 2023-04-07T08:10:54+00:00 d3d9: use the official typedef for DXVAHD_CreateDevice() It doesn't exist in mingw so we define it in that case. (cherry picked from commit dd8297d27a67d9bfa0a9a217c8ad37db45620e24) Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz> - - - - - d803f6aa by Steve Lhomme at 2023-04-07T08:10:54+00:00 interop_dxva2: add comments about the processor output values The same code in direct3d9 uses an output format that can vary. (cherry picked from commit 2e335eba28ebe1bcf0028385f70838dcf310e847) Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz> - - - - - f9e125db by Steve Lhomme at 2023-04-07T08:10:54+00:00 interop_dxva2: force win7 API compatibility Otherwise in 3.0 builds we target WinXP and the API is not available. Similar to 8241910b7bac3781ea0c4eb1503a23560a7a9412 - - - - - 10 changed files: - + contrib/src/pthreads/0001-headers-Update-to-Wine-master-and-regenerate-H-from-.patch - + contrib/src/pthreads/0002-headers-dxvahd-Regenerate-H-from-IDL.patch - contrib/src/pthreads/rules.mak - modules/codec/Makefile.am - modules/codec/avcodec/dxva2.c - modules/video_chroma/d3d9_fmt.c - modules/video_chroma/d3d9_fmt.h - modules/video_output/Makefile.am - + modules/video_output/opengl/interop_dxva2.c - modules/video_output/win32/direct3d9.c Changes: ===================================== contrib/src/pthreads/0001-headers-Update-to-Wine-master-and-regenerate-H-from-.patch ===================================== @@ -0,0 +1,62 @@ +From d4249c712991ab191f05968470b34587cc716a53 Mon Sep 17 00:00:00 2001 +From: LIU Hao +Date: Sat, 18 Mar 2023 14:59:38 +0800 +Subject: [PATCH 1/2] headers: Update to Wine master and regenerate H from IDL + (edited) + +Signed-off-by: LIU Hao + +edited: +* only kept the dxvahd.h changes +--- + mingw-w64-headers/include/dxvahd.h | 27 +++++++++++++++++++-------- + 1 file changed, 19 insertions(+), 8 deletions(-) + +diff --git a/mingw-w64-headers/include/dxvahd.h b/mingw-w64-headers/include/dxvahd.h +index 71b027863..aaff9400c 100644 +--- a/mingw-w64-headers/include/dxvahd.h ++++ b/mingw-w64-headers/include/dxvahd.h +@@ -251,10 +251,16 @@ typedef struct _DXVAHD_BLT_STATE_CONSTRICTION_DATA { + SIZE Size; + } DXVAHD_BLT_STATE_CONSTRICTION_DATA; + typedef struct _DXVAHD_BLT_STATE_OUTPUT_COLOR_SPACE_DATA { +- UINT Usage : 1; +- UINT RGB_Range : 1; +- UINT YCbCr_Matrix : 1; +- UINT YCbCr_xvYCC : 1; ++ __C89_NAMELESS union { ++ __C89_NAMELESS struct { ++ UINT Usage : 1; ++ UINT RGB_Range : 1; ++ UINT YCbCr_Matrix : 1; ++ UINT YCbCr_xvYCC : 1; ++ UINT Reserved : 28; ++ } __C89_NAMELESSSTRUCTNAME; ++ UINT Value; ++ } __C89_NAMELESSUNIONNAME; + } DXVAHD_BLT_STATE_OUTPUT_COLOR_SPACE_DATA; + typedef struct _DXVAHD_BLT_STATE_PRIVATE_DATA { + GUID Guid; +@@ -332,10 +338,15 @@ typedef struct _DXVAHD_STREAM_STATE_FRAME_FORMAT_DATA { + DXVAHD_FRAME_FORMAT FrameFormat; + } DXVAHD_STREAM_STATE_FRAME_FORMAT_DATA; + typedef struct _DXVAHD_STREAM_STATE_INPUT_COLOR_SPACE_DATA { +- UINT Type : 1; +- UINT RGB_Range : 1; +- UINT YCbCr_Matrix : 1; +- UINT YCbCr_xvYCC : 1; ++ __C89_NAMELESS union { ++ __C89_NAMELESS struct { ++ UINT Type : 1; ++ UINT RGB_Range : 1; ++ UINT YCbCr_Matrix : 1; ++ UINT YCbCr_xvYCC : 1; ++ } __C89_NAMELESSSTRUCTNAME; ++ UINT Value; ++ } __C89_NAMELESSUNIONNAME; + } DXVAHD_STREAM_STATE_INPUT_COLOR_SPACE_DATA; + typedef struct _DXVAHD_STREAM_STATE_LUMA_KEY_DATA { + WINBOOL Enable; +-- +2.37.3.windows.1 + ===================================== contrib/src/pthreads/0002-headers-dxvahd-Regenerate-H-from-IDL.patch ===================================== @@ -0,0 +1,25 @@ +From d12847294d570acc97790c7a02fb44a73850f347 Mon Sep 17 00:00:00 2001 +From: LIU Hao +Date: Sat, 18 Mar 2023 17:19:02 +0800 +Subject: [PATCH 2/2] headers/dxvahd: Regenerate H from IDL + +Signed-off-by: LIU Hao +--- + mingw-w64-headers/include/dxvahd.h | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/mingw-w64-headers/include/dxvahd.h b/mingw-w64-headers/include/dxvahd.h +index aaff9400c..6bcd753dd 100644 +--- a/mingw-w64-headers/include/dxvahd.h ++++ b/mingw-w64-headers/include/dxvahd.h +@@ -344,6 +344,7 @@ typedef struct _DXVAHD_STREAM_STATE_INPUT_COLOR_SPACE_DATA { + UINT RGB_Range : 1; + UINT YCbCr_Matrix : 1; + UINT YCbCr_xvYCC : 1; ++ UINT Reserved : 28; + } __C89_NAMELESSSTRUCTNAME; + UINT Value; + } __C89_NAMELESSUNIONNAME; +-- +2.37.3.windows.1 + ===================================== contrib/src/pthreads/rules.mak ===================================== @@ -11,12 +11,12 @@ PKGS += pthreads ifndef HAVE_VISUALSTUDIO PKGS += dxva dxvahd PKGS_ALL += dxva dxvahd -ifeq ($(call mingw_at_least, 8), true) -PKGS_FOUND += dxvahd -endif # MINGW 8 ifeq ($(call mingw_at_least, 10), true) PKGS_FOUND += dxva endif # MINGW 10 +ifeq ($(call mingw_at_least, 11), true) +PKGS_FOUND += dxvahd +endif # MINGW 11 ifeq ($(HAVE_WINPTHREAD),) PKGS_FOUND += pthreads endif @@ -35,6 +35,8 @@ $(TARBALLS)/mingw-w64-v$(MINGW64_VERSION).tar.bz2: # pthreads: mingw-w64-v$(MINGW64_VERSION).tar.bz2 .sum-pthreads pthreads: mingw-w64-$(MINGW64_HASH).tar.xz .sum-pthreads $(UNPACK) + $(APPLY) $(SRC)/pthreads/0001-headers-Update-to-Wine-master-and-regenerate-H-from-.patch + $(APPLY) $(SRC)/pthreads/0002-headers-dxvahd-Regenerate-H-from-IDL.patch $(MOVE) .pthreads: pthreads ===================================== modules/codec/Makefile.am ===================================== @@ -431,7 +431,7 @@ libdxva2_plugin_la_SOURCES = \ packetizer/h264_nal.c packetizer/h264_nal.h \ packetizer/hevc_nal.c packetizer/hevc_nal.h \ codec/avcodec/dxva_blacklist.c -libdxva2_plugin_la_LIBADD = libd3d9_common.la $(LIBCOM) -lshlwapi -luuid +libdxva2_plugin_la_LIBADD = libd3d9_common.la libchroma_copy.la $(LIBCOM) -lshlwapi -luuid if HAVE_AVCODEC_DXVA2 codec_LTLIBRARIES += libdxva2_plugin.la endif @@ -503,7 +503,7 @@ libmediacodec_plugin_la_SOURCES = codec/omxil/mediacodec.c codec/omxil/mediacode packetizer/hxxx_nal.h packetizer/hxxx_nal.c \ packetizer/h264_nal.c packetizer/h264_nal.h \ packetizer/hevc_nal.c packetizer/hevc_nal.h -libmediacodec_plugin_la_LIBADD = libchroma_copy.la +libmediacodec_plugin_la_LIBADD = libchroma_copy.la codec_LTLIBRARIES += $(LTLIBomxil) $(LTLIBomxil_vout) EXTRA_LTLIBRARIES += libomxil_plugin.la libomxil_vout_plugin.la if HAVE_ANDROID ===================================== modules/codec/avcodec/dxva2.c ===================================== @@ -3,7 +3,7 @@ ***************************************************************************** * Copyright (C) 2009 Geoffroy Couprie * Copyright (C) 2009 Laurent Aimar - * $Id$ + * $Id: 26cb48dc887acd90eba53d9a30d60a3cbed212d9 $ * * Authors: Geoffroy Couprie * Laurent Aimar @@ -82,12 +82,6 @@ DEFINE_GUID(DXVA2_NoEncrypt, 0x1b81bed0, 0xa0c7, 0x11d3, DEFINE_GUID(DXVA_Intel_H264_NoFGT_ClearVideo, 0x604F8E68, 0x4951, 0x4c54, 0x88, 0xFE, 0xAB, 0xD2, 0x5C, 0x15, 0xB3, 0xD6); -/* */ -typedef struct { - const char *name; - D3DFORMAT format; - vlc_fourcc_t codec; -} d3d9_format_t; /* XXX Preferred format must come first */ static const d3d9_format_t d3d_formats[] = { { "YV12", MAKEFOURCC('Y','V','1','2'), VLC_CODEC_YV12 }, @@ -501,18 +495,14 @@ static int DxSetupOutput(vlc_va_t *va, const GUID *input, const video_format_t * VLC_UNUSED(fmt); vlc_va_sys_t *sys = va->sys; - D3DADAPTER_IDENTIFIER9 identifier; - HRESULT hr = IDirect3D9_GetAdapterIdentifier(sys->hd3d.obj, sys->d3d_dev.adapterId, 0, &identifier); - if (FAILED(hr)) - return VLC_EGENERIC; - - UINT driverBuild = identifier.DriverVersion.LowPart & 0xFFFF; - if (identifier.VendorId == GPU_MANUFACTURER_INTEL && (identifier.DriverVersion.LowPart >> 16) >= 100) + const D3DADAPTER_IDENTIFIER9 *identifier = &sys->d3d_dev.identifier; + UINT driverBuild = identifier->DriverVersion.LowPart & 0xFFFF; + if (identifier->VendorId == GPU_MANUFACTURER_INTEL && (identifier->DriverVersion.LowPart >> 16) >= 100) { /* new Intel driver format */ - driverBuild += ((identifier.DriverVersion.LowPart >> 16) - 100) * 1000; + driverBuild += ((identifier->DriverVersion.LowPart >> 16) - 100) * 1000; } - if (!directx_va_canUseDecoder(va, identifier.VendorId, identifier.DeviceId, + if (!directx_va_canUseDecoder(va, identifier->VendorId, identifier->DeviceId, input, driverBuild)) { char* psz_decoder_name = directx_va_GetDecoderName(input); ===================================== modules/video_chroma/d3d9_fmt.c ===================================== @@ -28,6 +28,9 @@ #include "d3d9_fmt.h" #include "../codec/avcodec/va_surface.h" +#include "copy.h" + +#include picture_sys_t *ActivePictureSys(picture_t *p_pic) { @@ -94,12 +97,11 @@ HRESULT D3D9_CreateDevice(vlc_object_t *o, d3d9_handle_t *hd3d, HWND hwnd, } /* */ - D3DADAPTER_IDENTIFIER9 d3dai; - if (FAILED(IDirect3D9_GetAdapterIdentifier(hd3d->obj, AdapterToUse,0, &d3dai))) { + if (FAILED(IDirect3D9_GetAdapterIdentifier(hd3d->obj, AdapterToUse,0, &out->identifier))) { msg_Warn(o, "IDirect3D9_GetAdapterIdentifier failed"); } else { - msg_Dbg(o, "Direct3d9 Device: %s %lx %lx %lx", d3dai.Description, - d3dai.VendorId, d3dai.DeviceId, d3dai.Revision ); + msg_Dbg(o, "Direct3d9 Device: %s %lx %lx %lx", out->identifier.Description, + out->identifier.VendorId, out->identifier.DeviceId, out->identifier.Revision ); } DWORD thread_modes[] = { D3DCREATE_MULTITHREADED, 0 }; @@ -255,3 +257,116 @@ error: D3D9_Destroy( hd3d ); return VLC_EGENERIC; } + + +static void DestroyPicture(picture_t *picture) +{ + ReleasePictureSys(picture->p_sys); + + free(picture->p_sys); + free(picture); +} + +int Direct3D9LockSurface(picture_t *picture) +{ + /* Lock the surface to get a valid pointer to the picture buffer */ + D3DLOCKED_RECT d3drect; + HRESULT hr = IDirect3DSurface9_LockRect(picture->p_sys->surface, &d3drect, NULL, 0); + if (FAILED(hr)) { + return VLC_EGENERIC; + } + + return picture_UpdatePlanes(picture, d3drect.pBits, d3drect.Pitch); +} + +void Direct3D9UnlockSurface(picture_t *picture) +{ + /* Unlock the Surface */ + HRESULT hr = IDirect3DSurface9_UnlockRect(picture->p_sys->surface); + if (FAILED(hr)) { + //msg_Dbg(vd, "Failed IDirect3DSurface9_UnlockRect: 0x%0lx", hr); + } +} + +/* */ +picture_pool_t *Direct3D9CreatePicturePool(vlc_object_t *o, + d3d9_device_t *p_d3d9_dev, const d3d9_format_t *default_d3dfmt, const video_format_t *fmt, unsigned count) +{ + picture_pool_t* pool = NULL; + picture_t** pictures = NULL; + unsigned picture_count = 0; + + pictures = calloc(count, sizeof(*pictures)); + if (!pictures) + goto error; + + D3DFORMAT format; + switch (fmt->i_chroma) + { + case VLC_CODEC_D3D9_OPAQUE_10B: + format = MAKEFOURCC('P','0','1','0'); + break; + case VLC_CODEC_D3D9_OPAQUE: + format = MAKEFOURCC('N','V','1','2'); + break; + default: + if (!default_d3dfmt) + goto error; + format = default_d3dfmt->format; + break; + } + + for (picture_count = 0; picture_count < count; ++picture_count) + { + picture_sys_t *picsys = malloc(sizeof(*picsys)); + if (unlikely(picsys == NULL)) + goto error; + memset(picsys, 0, sizeof(*picsys)); + + HRESULT hr = IDirect3DDevice9_CreateOffscreenPlainSurface(p_d3d9_dev->dev, + fmt->i_width, + fmt->i_height, + format, + D3DPOOL_DEFAULT, + &picsys->surface, + NULL); + if (FAILED(hr)) { + msg_Err(o, "Failed to allocate surface %d (hr=0x%0lx)", picture_count, hr); + free(picsys); + goto error; + } + + picture_resource_t resource = { + .p_sys = picsys, + .pf_destroy = DestroyPicture, + }; + + picture_t *picture = picture_NewFromResource(fmt, &resource); + if (unlikely(picture == NULL)) { + free(picsys); + goto error; + } + + pictures[picture_count] = picture; + } + + picture_pool_configuration_t pool_cfg; + memset(&pool_cfg, 0, sizeof(pool_cfg)); + pool_cfg.picture_count = count; + pool_cfg.picture = pictures; + if( !is_d3d9_opaque( fmt->i_chroma ) ) + { + pool_cfg.lock = Direct3D9LockSurface; + pool_cfg.unlock = Direct3D9UnlockSurface; + } + + pool = picture_pool_NewExtended( &pool_cfg ); + +error: + if (pool == NULL && pictures) { + for (unsigned i=0;idxva2_dll); } +static inline bool is_d3d9_opaque(vlc_fourcc_t chroma) +{ + switch (chroma) + { + case VLC_CODEC_D3D9_OPAQUE: + case VLC_CODEC_D3D9_OPAQUE_10B: + return true; + default: + return false; + } +} + HRESULT D3D9_CreateDevice(vlc_object_t *, d3d9_handle_t *, HWND, const video_format_t *, d3d9_device_t *out); #define D3D9_CreateDevice(a,b,c,d,e) D3D9_CreateDevice( VLC_OBJECT(a), b, c, d, e ) @@ -99,4 +122,21 @@ void D3D9_Destroy(d3d9_handle_t *); int D3D9_FillPresentationParameters(d3d9_handle_t *, const video_format_t *, d3d9_device_t *); +/** + * It locks the surface associated to the picture and get the surface + * descriptor which amongst other things has the pointer to the picture + * data and its pitch. + */ +int Direct3D9LockSurface(picture_t *picture); + +/** + * It unlocks the surface associated to the picture. + */ +void Direct3D9UnlockSurface(picture_t *picture); + +struct picture_pool_t *Direct3D9CreatePicturePool(vlc_object_t *, d3d9_device_t *, + const d3d9_format_t *, const video_format_t *, unsigned); + + + #endif /* VLC_VIDEOCHROMA_D3D9_FMT_H_ */ ===================================== modules/video_output/Makefile.am ===================================== @@ -261,9 +261,18 @@ libdirect3d9_plugin_la_CPPFLAGS = $(AM_CPPFLAGS) \ -DMODULE_NAME_IS_direct3d9 libdirect3d9_plugin_la_LIBADD = libchroma_copy.la libd3d9_common.la -lgdi32 $(LIBCOM) -luuid libdirect3d9_plugin_la_LDFLAGS = $(AM_LDFLAGS) -rpath '$(voutdir)' + +libglinterop_dxva2_plugin_la_SOURCES = video_output/opengl/interop_dxva2.c \ + video_output/opengl/converter.h +libglinterop_dxva2_plugin_la_CFLAGS = $(AM_CFLAGS) $(GL_CFLAGS) +libglinterop_dxva2_plugin_la_LIBADD = libchroma_copy.la libd3d9_common.la + if HAVE_WIN32_DESKTOP vout_LTLIBRARIES += $(LTLIBdirect3d9) EXTRA_LTLIBRARIES += libdirect3d9_plugin.la +if HAVE_GL +vout_LTLIBRARIES += libglinterop_dxva2_plugin.la +endif endif libdirect3d11_plugin_la_SOURCES = video_output/win32/direct3d11.c \ ===================================== modules/video_output/opengl/interop_dxva2.c ===================================== @@ -0,0 +1,543 @@ +/***************************************************************************** + * direct3d9.c: Windows Direct3D9 video output module + ***************************************************************************** + * Copyright (C) 2006-2014 VLC authors and VideoLAN + * + * Authors: Martell Malone , + * Damien Fouilleul , + * Sasha Koruga , + * Felix Abecassis + * + * 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. + *****************************************************************************/ + +/***************************************************************************** + * Preamble: + * + * This plugin will use YUV surface if supported, using YUV will result in + * the best video quality (hardware filtering when rescaling the picture) + * and the fastest display as it requires less processing. + * + * If YUV overlay is not supported this plugin will use RGB offscreen video + * surfaces that will be blitted onto the primary surface (display) to + * effectively display the pictures. + * + *****************************************************************************/ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +// For dynamic use of DXVA-HD +#if _WIN32_WINNT < 0x0601 // _WIN32_WINNT_WIN7 +# undef _WIN32_WINNT +# define _WIN32_WINNT _WIN32_WINNT_WIN7 +#endif + +#include +#include +#include + +#include +#include +#include "../../video_chroma/d3d9_fmt.h" +#include + +#include "../opengl/converter.h" +#include + +/***************************************************************************** + * Module descriptor + *****************************************************************************/ +static int GLConvOpen(vlc_object_t *); +static void GLConvClose(vlc_object_t *); + +vlc_module_begin () + set_shortname("dxva2") + set_category(CAT_VIDEO) + set_subcategory(SUBCAT_VIDEO_VOUT) + set_description("DX OpenGL surface converter for D3D9") + set_capability("glconv", 1) + set_callbacks(GLConvOpen, GLConvClose) +vlc_module_end () + +struct wgl_vt { + PFNWGLDXSETRESOURCESHAREHANDLENVPROC DXSetResourceShareHandleNV; + PFNWGLDXOPENDEVICENVPROC DXOpenDeviceNV; + PFNWGLDXCLOSEDEVICENVPROC DXCloseDeviceNV; + PFNWGLDXREGISTEROBJECTNVPROC DXRegisterObjectNV; + PFNWGLDXUNREGISTEROBJECTNVPROC DXUnregisterObjectNV; + PFNWGLDXLOCKOBJECTSNVPROC DXLockObjectsNV; + PFNWGLDXUNLOCKOBJECTSNVPROC DXUnlockObjectsNV; +}; +struct glpriv +{ + struct wgl_vt vt; + d3d9_handle_t hd3d; + d3d9_device_t d3d_dev; + HANDLE gl_handle_d3d; + HANDLE gl_render; + IDirect3DSurface9 *dx_render; + + D3DFORMAT OutputFormat; + + /* range converter */ + struct { + HMODULE dll; + IDXVAHD_VideoProcessor *proc; + } processor; +}; + +static int +GLConvUpdate(const opengl_tex_converter_t *tc, GLuint *textures, + const GLsizei *tex_width, const GLsizei *tex_height, + picture_t *pic, const size_t *plane_offset) +{ + VLC_UNUSED(textures); VLC_UNUSED(tex_width); VLC_UNUSED(tex_height); VLC_UNUSED(plane_offset); + struct glpriv *priv = tc->priv; + HRESULT hr; + + picture_sys_t *picsys = ActivePictureSys(pic); + if (unlikely(!picsys || !priv->gl_render)) + return VLC_EGENERIC; + + if (!priv->vt.DXUnlockObjectsNV(priv->gl_handle_d3d, 1, &priv->gl_render)) + { + msg_Warn(tc->gl, "DXUnlockObjectsNV failed"); + return VLC_EGENERIC; + } + + if (priv->processor.proc) + { + DXVAHD_STREAM_DATA inputStream = { 0 }; + inputStream.Enable = TRUE; + inputStream.pInputSurface = picsys->surface; + hr = IDXVAHD_VideoProcessor_VideoProcessBltHD( priv->processor.proc, priv->dx_render, 0, 1, &inputStream ); + if (FAILED(hr)) { + D3DSURFACE_DESC srcDesc, dstDesc; + IDirect3DSurface9_GetDesc(picsys->surface, &srcDesc); + IDirect3DSurface9_GetDesc(priv->dx_render, &dstDesc); + + msg_Dbg(tc->gl, "Failed VideoProcessBltHD src:%4.4s (%d) dst:%4.4s (%d) (hr=0x%lX)", + (const char*)&srcDesc.Format, srcDesc.Format, + (const char*)&dstDesc.Format, dstDesc.Format, hr); + return VLC_EGENERIC; + } + } + else + { + const RECT rect = { + .left = 0, + .top = 0, + .right = pic->format.i_visible_width, + .bottom = pic->format.i_visible_height + }; + hr = IDirect3DDevice9Ex_StretchRect(priv->d3d_dev.devex, picsys->surface, + &rect, priv->dx_render, NULL, D3DTEXF_NONE); + if (FAILED(hr)) + { + msg_Warn(tc->gl, "IDirect3DDevice9Ex_StretchRect failed"); + return VLC_EGENERIC; + } + } + + if (!priv->vt.DXLockObjectsNV(priv->gl_handle_d3d, 1, &priv->gl_render)) + { + msg_Warn(tc->gl, "DXLockObjectsNV failed"); + priv->vt.DXUnregisterObjectNV(priv->gl_handle_d3d, priv->gl_render); + priv->gl_render = NULL; + return VLC_EGENERIC; + } + + return VLC_SUCCESS; +} + +static picture_pool_t * +GLConvGetPool(const opengl_tex_converter_t *tc, unsigned requested_count) +{ + struct glpriv *priv = tc->priv; + return Direct3D9CreatePicturePool(VLC_OBJECT(tc->gl), &priv->d3d_dev, NULL, + &tc->fmt, requested_count); +} + +static int +GLConvAllocateTextures(const opengl_tex_converter_t *tc, GLuint *textures, + const GLsizei *tex_width, const GLsizei *tex_height) +{ + VLC_UNUSED(tex_width); VLC_UNUSED(tex_height); + struct glpriv *priv = tc->priv; + + priv->gl_render = + priv->vt.DXRegisterObjectNV(priv->gl_handle_d3d, priv->dx_render, + textures[0], GL_TEXTURE_2D, WGL_ACCESS_WRITE_DISCARD_NV); + if (!priv->gl_render) + { + msg_Warn(tc->gl, "DXRegisterObjectNV failed: %lu", GetLastError()); + return VLC_EGENERIC; + } + + if (!priv->vt.DXLockObjectsNV(priv->gl_handle_d3d, 1, &priv->gl_render)) + { + msg_Warn(tc->gl, "DXLockObjectsNV failed"); + priv->vt.DXUnregisterObjectNV(priv->gl_handle_d3d, priv->gl_render); + priv->gl_render = NULL; + return VLC_EGENERIC; + } + + return VLC_SUCCESS; +} + +static void +GLConvClose(vlc_object_t *obj) +{ + opengl_tex_converter_t *tc = (void *)obj; + struct glpriv *priv = tc->priv; + + if (priv->gl_handle_d3d) + { + if (priv->gl_render) + { + priv->vt.DXUnlockObjectsNV(priv->gl_handle_d3d, 1, &priv->gl_render); + priv->vt.DXUnregisterObjectNV(priv->gl_handle_d3d, priv->gl_render); + } + + priv->vt.DXCloseDeviceNV(priv->gl_handle_d3d); + } + if (priv->processor.proc) + { + IDXVAHD_VideoProcessor_Release(priv->processor.proc); + FreeLibrary(priv->processor.dll); + } + + if (priv->dx_render) + IDirect3DSurface9_Release(priv->dx_render); + + D3D9_ReleaseDevice(&priv->d3d_dev); + D3D9_Destroy(&priv->hd3d); + free(tc->priv); +} + +static void SetupProcessorInput(opengl_tex_converter_t *interop, const video_format_t *fmt, D3DFORMAT src_format) +{ + struct glpriv *sys = interop->priv; + HRESULT hr; + DXVAHD_STREAM_STATE_D3DFORMAT_DATA d3dformat = { src_format }; + hr = IDXVAHD_VideoProcessor_SetVideoProcessStreamState( sys->processor.proc, 0, DXVAHD_STREAM_STATE_D3DFORMAT, sizeof(d3dformat), &d3dformat ); + + DXVAHD_STREAM_STATE_FRAME_FORMAT_DATA frame_format = { DXVAHD_FRAME_FORMAT_PROGRESSIVE }; + hr = IDXVAHD_VideoProcessor_SetVideoProcessStreamState( sys->processor.proc, 0, DXVAHD_STREAM_STATE_FRAME_FORMAT, sizeof(frame_format), &frame_format ); + + DXVAHD_STREAM_STATE_INPUT_COLOR_SPACE_DATA colorspace = { + .Type = 0, // video, not graphics + .RGB_Range = fmt->b_color_range_full ? 0 : 1, + .YCbCr_xvYCC = fmt->b_color_range_full ? 1 : 0, + .YCbCr_Matrix = fmt->space == COLOR_SPACE_BT601 ? 0 : 1, + }; + hr = IDXVAHD_VideoProcessor_SetVideoProcessStreamState( sys->processor.proc, 0, DXVAHD_STREAM_STATE_INPUT_COLOR_SPACE, sizeof(colorspace), &colorspace ); + + DXVAHD_STREAM_STATE_SOURCE_RECT_DATA srcRect; + srcRect.Enable = TRUE; + srcRect.SourceRect = (RECT) { + .left = interop->fmt.i_x_offset, + .right = interop->fmt.i_x_offset + interop->fmt.i_visible_width, + .top = interop->fmt.i_y_offset, + .bottom = interop->fmt.i_y_offset + interop->fmt.i_visible_height, + };; + hr = IDXVAHD_VideoProcessor_SetVideoProcessStreamState( sys->processor.proc, 0, DXVAHD_STREAM_STATE_SOURCE_RECT, sizeof(srcRect), &srcRect ); + + DXVAHD_BLT_STATE_TARGET_RECT_DATA dstRect; + dstRect.Enable = TRUE; + dstRect.TargetRect = (RECT) { + .left = 0, + .right = interop->fmt.i_visible_width, + .top = 0, + .bottom = interop->fmt.i_visible_height, + }; + hr = IDXVAHD_VideoProcessor_SetVideoProcessBltState( sys->processor.proc, DXVAHD_BLT_STATE_TARGET_RECT, sizeof(dstRect), &dstRect); +} + +static void GetFrameRate(DXVAHD_RATIONAL *r, const video_format_t *fmt) +{ + if (fmt->i_frame_rate && fmt->i_frame_rate_base) + { + r->Numerator = fmt->i_frame_rate; + r->Denominator = fmt->i_frame_rate_base; + } + else + { + r->Numerator = 0; + r->Denominator = 0; + } +} + +static int InitRangeProcessor(opengl_tex_converter_t *interop, IDirect3DDevice9Ex *devex, D3DFORMAT src_format) +{ + struct glpriv *sys = interop->priv; + + HRESULT hr; + + sys->processor.dll = LoadLibrary(TEXT("DXVA2.DLL")); + if (unlikely(!sys->processor.dll)) + { + msg_Err(interop, "Failed to load DXVA2.DLL"); + return VLC_EGENERIC; + } + + D3DFORMAT *formatsList = NULL; + DXVAHD_VPCAPS *capsList = NULL; + IDXVAHD_Device *hd_device = NULL; + +#ifdef __MINGW64_VERSION_MAJOR + typedef HRESULT (WINAPI* PDXVAHD_CreateDevice)(IDirect3DDevice9Ex *,const DXVAHD_CONTENT_DESC *,DXVAHD_DEVICE_USAGE,PDXVAHDSW_Plugin,IDXVAHD_Device **); +#endif + PDXVAHD_CreateDevice CreateDevice; + CreateDevice = (PDXVAHD_CreateDevice)GetProcAddress(sys->processor.dll, "DXVAHD_CreateDevice"); + if (CreateDevice == NULL) + { + msg_Err(interop, "Can't create HD device (not Windows 7+)"); + goto error; + } + + DXVAHD_CONTENT_DESC desc; + desc.InputFrameFormat = DXVAHD_FRAME_FORMAT_PROGRESSIVE; + GetFrameRate( &desc.InputFrameRate, &interop->fmt ); + desc.InputWidth = interop->fmt.i_visible_width; + desc.InputHeight = interop->fmt.i_visible_height; + desc.OutputFrameRate = desc.InputFrameRate; + desc.OutputWidth = interop->fmt.i_visible_width; + desc.OutputHeight = interop->fmt.i_visible_height; + + hr = CreateDevice(devex, &desc, DXVAHD_DEVICE_USAGE_PLAYBACK_NORMAL, NULL, &hd_device); + if (FAILED(hr)) + { + msg_Dbg(interop, "Failed to create the device (error 0x%lX)", hr); + goto error; + } + + DXVAHD_VPDEVCAPS devcaps = { 0 }; + hr = IDXVAHD_Device_GetVideoProcessorDeviceCaps( hd_device, &devcaps ); + if (unlikely(FAILED(hr))) + { + msg_Err(interop, "Failed to get the device capabilities (error 0x%lX)", hr); + goto error; + } + if (devcaps.VideoProcessorCount == 0) + { + msg_Warn(interop, "No good video processor found for range conversion"); + goto error; + } + + formatsList = malloc(devcaps.InputFormatCount * sizeof(*formatsList)); + if (unlikely(formatsList == NULL)) + { + msg_Dbg(interop, "Failed to allocate %u input formats", devcaps.InputFormatCount); + goto error; + } + + hr = IDXVAHD_Device_GetVideoProcessorInputFormats( hd_device, devcaps.InputFormatCount, formatsList); + UINT i; + for (i=0; iOutputFormat) + break; + } + if (i == devcaps.OutputFormatCount) + { + msg_Warn(interop, "Output format %d not supported for range conversion", sys->OutputFormat); + goto error; + } + + capsList = malloc(devcaps.VideoProcessorCount * sizeof(*capsList)); + if (unlikely(capsList == NULL)) + { + msg_Dbg(interop, "Failed to allocate %u video processors", devcaps.VideoProcessorCount); + goto error; + } + hr = IDXVAHD_Device_GetVideoProcessorCaps( hd_device, devcaps.VideoProcessorCount, capsList); + if (FAILED(hr)) + { + msg_Dbg(interop, "Failed to get the processor caps (error 0x%lX)", hr); + goto error; + } + + hr = IDXVAHD_Device_CreateVideoProcessor( hd_device, &capsList->VPGuid, &sys->processor.proc ); + if (FAILED(hr)) + { + msg_Dbg(interop, "Failed to create the processor (error 0x%lX)", hr); + goto error; + } + IDXVAHD_Device_Release( hd_device ); + + SetupProcessorInput(interop, &interop->fmt, src_format); + + DXVAHD_BLT_STATE_OUTPUT_COLOR_SPACE_DATA colorspace = { + .Usage = 0, // playback + .RGB_Range = /* full range */true ? 0 : 1, + .YCbCr_xvYCC = /* full range */true ? 1 : 0, + .YCbCr_Matrix = /* BT601 colorspace */ false ? 0 : 1, + }; + hr = IDXVAHD_VideoProcessor_SetVideoProcessBltState( sys->processor.proc, DXVAHD_BLT_STATE_OUTPUT_COLOR_SPACE, sizeof(colorspace), &colorspace); + + return VLC_SUCCESS; + +error: + free(capsList); + free(formatsList); + if (hd_device) + IDXVAHD_Device_Release(hd_device); + FreeLibrary(sys->processor.dll); + return VLC_EGENERIC; +} + +static int +GLConvOpen(vlc_object_t *obj) +{ + opengl_tex_converter_t *tc = (void *) obj; + + if (tc->fmt.i_chroma != VLC_CODEC_D3D9_OPAQUE + && tc->fmt.i_chroma != VLC_CODEC_D3D9_OPAQUE_10B) + return VLC_EGENERIC; + + if (tc->gl->ext != VLC_GL_EXT_WGL || !tc->gl->wgl.getExtensionsString) + return VLC_EGENERIC; + + const char *wglExt = tc->gl->wgl.getExtensionsString(tc->gl); + + if (wglExt == NULL || !HasExtension(wglExt, "WGL_NV_DX_interop")) + return VLC_EGENERIC; + + struct wgl_vt vt; +#define LOAD_EXT(name, type) do { \ + vt.name = (type) vlc_gl_GetProcAddress(tc->gl, "wgl" #name); \ + if (!vt.name) { \ + msg_Warn(obj, "'wgl " #name "' could not be loaded"); \ + return VLC_EGENERIC; \ + } \ +} while(0) + + LOAD_EXT(DXSetResourceShareHandleNV, PFNWGLDXSETRESOURCESHAREHANDLENVPROC); + LOAD_EXT(DXOpenDeviceNV, PFNWGLDXOPENDEVICENVPROC); + LOAD_EXT(DXCloseDeviceNV, PFNWGLDXCLOSEDEVICENVPROC); + LOAD_EXT(DXRegisterObjectNV, PFNWGLDXREGISTEROBJECTNVPROC); + LOAD_EXT(DXUnregisterObjectNV, PFNWGLDXUNREGISTEROBJECTNVPROC); + LOAD_EXT(DXLockObjectsNV, PFNWGLDXLOCKOBJECTSNVPROC); + LOAD_EXT(DXUnlockObjectsNV, PFNWGLDXUNLOCKOBJECTSNVPROC); + + struct glpriv *priv = calloc(1, sizeof(struct glpriv)); + if (!priv) + return VLC_ENOMEM; + tc->priv = priv; + priv->OutputFormat = D3DFMT_X8R8G8B8; + priv->vt = vt; + + if (D3D9_Create(obj, &priv->hd3d) != VLC_SUCCESS) + goto error; + + if (!priv->hd3d.use_ex) + { + msg_Warn(obj, "DX/GL interrop only working on d3d9x"); + goto error; + } + + if (FAILED(D3D9_CreateDevice(obj, &priv->hd3d, tc->gl->surface->handle.hwnd, + &tc->fmt, &priv->d3d_dev))) + goto error; + + D3DFORMAT format = tc->fmt.i_chroma == VLC_CODEC_D3D9_OPAQUE_10B ? + MAKEFOURCC('P','0','1','0') : MAKEFOURCC('N','V','1','2'); + + HRESULT hr; + bool force_dxva_hd = false; + if ( !tc->fmt.b_color_range_full && + priv->d3d_dev.identifier.VendorId == GPU_MANUFACTURER_NVIDIA ) + { + // NVIDIA bug, YUV to RGB internal conversion in StretchRect always converts from limited to limited range + msg_Dbg(tc->gl, "init DXVA-HD processor from %4.4s to RGB", (const char*)&format); + int err = InitRangeProcessor(tc, priv->d3d_dev.devex, format); + if (err == VLC_SUCCESS) + force_dxva_hd = true; + } + if (!force_dxva_hd) + { + // test whether device can perform color-conversion from that format to target format + hr = IDirect3D9_CheckDeviceFormatConversion(priv->hd3d.obj, + priv->d3d_dev.adapterId, + D3DDEVTYPE_HAL, + format, priv->OutputFormat); + if (FAILED(hr)) + { + msg_Dbg(tc->gl, "Unsupported conversion from %4.4s to RGB", (const char*)&format ); + goto error; + } + msg_Dbg(tc->gl, "using StrecthRect from %4.4s to RGB", (const char*)&format ); + } + + HANDLE shared_handle = NULL; + hr = IDirect3DDevice9Ex_CreateRenderTarget(priv->d3d_dev.devex, + tc->fmt.i_visible_width, + tc->fmt.i_visible_height, + priv->OutputFormat, + D3DMULTISAMPLE_NONE, 0, FALSE, + &priv->dx_render, &shared_handle); + if (FAILED(hr)) + { + msg_Warn(obj, "IDirect3DDevice9_CreateOffscreenPlainSurface failed"); + goto error; + } + + if (shared_handle) + priv->vt.DXSetResourceShareHandleNV(priv->dx_render, shared_handle); + + priv->gl_handle_d3d = priv->vt.DXOpenDeviceNV(priv->d3d_dev.devex); + if (!priv->gl_handle_d3d) + { + msg_Warn(obj, "DXOpenDeviceNV failed: %lu", GetLastError()); + goto error; + } + + tc->pf_update = GLConvUpdate; + tc->pf_get_pool = GLConvGetPool; + tc->pf_allocate_textures = GLConvAllocateTextures; + + tc->fshader = opengl_fragment_shader_init(tc, GL_TEXTURE_2D, VLC_CODEC_RGB32, + COLOR_SPACE_UNDEF); + if (tc->fshader == 0) + goto error; + + return VLC_SUCCESS; + +error: + GLConvClose(obj); + return VLC_EGENERIC; +} ===================================== modules/video_output/win32/direct3d9.c ===================================== @@ -70,9 +70,6 @@ static int Open(vlc_object_t *); static void Close(vlc_object_t *); -static int GLConvOpen(vlc_object_t *); -static void GLConvClose(vlc_object_t *); - #define DESKTOP_LONGTEXT N_(\ "The desktop mode allows you to display the video on the desktop.") @@ -109,13 +106,6 @@ vlc_module_begin () set_capability("vout display", 280) add_shortcut("direct3d9", "direct3d") set_callbacks(Open, Close) - -#ifdef HAVE_GL - add_submodule() - set_description("DX OpenGL surface converter for D3D9") - set_capability("glconv", 1) - set_callbacks(GLConvOpen, GLConvClose) -#endif vlc_module_end () /***************************************************************************** @@ -126,16 +116,6 @@ static const vlc_fourcc_t d3d_subpicture_chromas[] = { 0 }; -typedef struct -{ - const char *name; - D3DFORMAT format; /* D3D format */ - vlc_fourcc_t fourcc; /* VLC fourcc */ - uint32_t rmask; - uint32_t gmask; - uint32_t bmask; -} d3d9_format_t; - struct vout_display_sys_t { vout_display_sys_win32_t sys; @@ -188,9 +168,6 @@ static const d3d9_format_t *FindBufferFormat(vout_display_t *, D3DFORMAT); static int Open(vlc_object_t *); -static picture_pool_t *Direct3D9CreatePicturePool (vlc_object_t *, d3d9_device_t *, - const d3d9_format_t *, const video_format_t *, unsigned); - static void Prepare(vout_display_t *, picture_t *, subpicture_t *subpicture); static void Display(vout_display_t *, picture_t *, subpicture_t *subpicture); static picture_pool_t*DisplayPool(vout_display_t *, unsigned); @@ -231,18 +208,6 @@ static void Direct3D9RenderScene(vout_display_t *vd, d3d_region_t *, int, d3d_re /* */ static int DesktopCallback(vlc_object_t *, char const *, vlc_value_t, vlc_value_t, void *); -static bool is_d3d9_opaque(vlc_fourcc_t chroma) -{ - switch (chroma) - { - case VLC_CODEC_D3D9_OPAQUE: - case VLC_CODEC_D3D9_OPAQUE_10B: - return true; - default: - return false; - } -} - static HINSTANCE Direct3D9LoadShaderLibrary(void) { HINSTANCE instance = NULL; @@ -404,126 +369,6 @@ static void Close(vlc_object_t *object) free(vd->sys); } -static void DestroyPicture(picture_t *picture) -{ - ReleasePictureSys(picture->p_sys); - - free(picture->p_sys); - free(picture); -} - -/** - * It locks the surface associated to the picture and get the surface - * descriptor which amongst other things has the pointer to the picture - * data and its pitch. - */ -static int Direct3D9LockSurface(picture_t *picture) -{ - /* Lock the surface to get a valid pointer to the picture buffer */ - D3DLOCKED_RECT d3drect; - HRESULT hr = IDirect3DSurface9_LockRect(picture->p_sys->surface, &d3drect, NULL, 0); - if (FAILED(hr)) { - return VLC_EGENERIC; - } - - CommonUpdatePicture(picture, NULL, d3drect.pBits, d3drect.Pitch); - return VLC_SUCCESS; -} -/** - * It unlocks the surface associated to the picture. - */ -static void Direct3D9UnlockSurface(picture_t *picture) -{ - /* Unlock the Surface */ - HRESULT hr = IDirect3DSurface9_UnlockRect(picture->p_sys->surface); - if (FAILED(hr)) { - //msg_Dbg(vd, "Failed IDirect3DSurface9_UnlockRect: 0x%0lx", hr); - } -} - -/* */ -static picture_pool_t *Direct3D9CreatePicturePool(vlc_object_t *o, - d3d9_device_t *p_d3d9_dev, const d3d9_format_t *default_d3dfmt, const video_format_t *fmt, unsigned count) -{ - picture_pool_t* pool = NULL; - picture_t** pictures = NULL; - unsigned picture_count = 0; - - pictures = calloc(count, sizeof(*pictures)); - if (!pictures) - goto error; - - D3DFORMAT format; - switch (fmt->i_chroma) - { - case VLC_CODEC_D3D9_OPAQUE_10B: - format = MAKEFOURCC('P','0','1','0'); - break; - case VLC_CODEC_D3D9_OPAQUE: - format = MAKEFOURCC('N','V','1','2'); - break; - default: - if (!default_d3dfmt) - goto error; - format = default_d3dfmt->format; - break; - } - - for (picture_count = 0; picture_count < count; ++picture_count) - { - picture_sys_t *picsys = malloc(sizeof(*picsys)); - if (unlikely(picsys == NULL)) - goto error; - memset(picsys, 0, sizeof(*picsys)); - - HRESULT hr = IDirect3DDevice9_CreateOffscreenPlainSurface(p_d3d9_dev->dev, - fmt->i_width, - fmt->i_height, - format, - D3DPOOL_DEFAULT, - &picsys->surface, - NULL); - if (FAILED(hr)) { - msg_Err(o, "Failed to allocate surface %d (hr=0x%0lx)", picture_count, hr); - free(picsys); - goto error; - } - - picture_resource_t resource = { - .p_sys = picsys, - .pf_destroy = DestroyPicture, - }; - - picture_t *picture = picture_NewFromResource(fmt, &resource); - if (unlikely(picture == NULL)) { - free(picsys); - goto error; - } - - pictures[picture_count] = picture; - } - - picture_pool_configuration_t pool_cfg; - memset(&pool_cfg, 0, sizeof(pool_cfg)); - pool_cfg.picture_count = count; - pool_cfg.picture = pictures; - if( !is_d3d9_opaque( fmt->i_chroma ) ) - { - pool_cfg.lock = Direct3D9LockSurface; - pool_cfg.unlock = Direct3D9UnlockSurface; - } - - pool = picture_pool_NewExtended( &pool_cfg ); - -error: - if (pool == NULL && pictures) { - for (unsigned i=0;isys->sys.pool != NULL ) @@ -815,10 +660,12 @@ static void SetupProcessorInput(vout_display_t *vd, const video_format_t *fmt, c DXVAHD_STREAM_STATE_FRAME_FORMAT_DATA frame_format = { DXVAHD_FRAME_FORMAT_PROGRESSIVE }; hr = IDXVAHD_VideoProcessor_SetVideoProcessStreamState( sys->processor.proc, 0, DXVAHD_STREAM_STATE_FRAME_FORMAT, sizeof(frame_format), &frame_format ); - DXVAHD_STREAM_STATE_INPUT_COLOR_SPACE_DATA colorspace = { 0 }; - colorspace.RGB_Range = fmt->b_color_range_full ? 0 : 1; - colorspace.YCbCr_xvYCC = fmt->b_color_range_full ? 1 : 0; - colorspace.YCbCr_Matrix = fmt->space == COLOR_SPACE_BT601 ? 0 : 1; + DXVAHD_STREAM_STATE_INPUT_COLOR_SPACE_DATA colorspace = { + .Type = 0, // video, not graphics + .RGB_Range = fmt->b_color_range_full ? 0 : 1, + .YCbCr_xvYCC = fmt->b_color_range_full ? 1 : 0, + .YCbCr_Matrix = fmt->space == COLOR_SPACE_BT601 ? 0 : 1, + }; hr = IDXVAHD_VideoProcessor_SetVideoProcessStreamState( sys->processor.proc, 0, DXVAHD_STREAM_STATE_INPUT_COLOR_SPACE, sizeof(colorspace), &colorspace ); DXVAHD_STREAM_STATE_SOURCE_RECT_DATA srcRect; @@ -870,8 +717,11 @@ static int InitRangeProcessor(vout_display_t *vd, const d3d9_format_t *d3dfmt) DXVAHD_VPCAPS *capsList = NULL; IDXVAHD_Device *hd_device = NULL; - HRESULT (WINAPI *CreateDevice)(IDirect3DDevice9Ex *,const DXVAHD_CONTENT_DESC *,DXVAHD_DEVICE_USAGE,PDXVAHDSW_Plugin,IDXVAHD_Device **); - CreateDevice = (void *)GetProcAddress(sys->processor.dll, "DXVAHD_CreateDevice"); +#ifdef __MINGW64_VERSION_MAJOR + typedef HRESULT (WINAPI* PDXVAHD_CreateDevice)(IDirect3DDevice9Ex *,const DXVAHD_CONTENT_DESC *,DXVAHD_DEVICE_USAGE,PDXVAHDSW_Plugin,IDXVAHD_Device **); +#endif + PDXVAHD_CreateDevice CreateDevice; + CreateDevice = (PDXVAHD_CreateDevice)GetProcAddress(sys->processor.dll, "DXVAHD_CreateDevice"); if (CreateDevice == NULL) { msg_Err(vd, "Can't create HD device (not Windows 7+)"); @@ -961,11 +811,12 @@ static int InitRangeProcessor(vout_display_t *vd, const d3d9_format_t *d3dfmt) SetupProcessorInput(vd, &vd->source, d3dfmt); - DXVAHD_BLT_STATE_OUTPUT_COLOR_SPACE_DATA colorspace; - colorspace.Usage = 0; // playback - colorspace.RGB_Range = 0; // full range display - colorspace.YCbCr_xvYCC = 1; - colorspace.YCbCr_Matrix = 1; // BT.709 + DXVAHD_BLT_STATE_OUTPUT_COLOR_SPACE_DATA colorspace = { + .Usage = 0, // playback + .RGB_Range = 0, // full range display + .YCbCr_xvYCC = 1, + .YCbCr_Matrix = 1, // BT.709 + }; hr = IDXVAHD_VideoProcessor_SetVideoProcessBltState( sys->processor.proc, DXVAHD_BLT_STATE_OUTPUT_COLOR_SPACE, sizeof(colorspace), &colorspace); return VLC_SUCCESS; @@ -2057,224 +1908,3 @@ static int FindShadersCallback(vlc_object_t *object, const char *name, return ctx.count; } - -#ifdef HAVE_GL -#include "../opengl/converter.h" -#include - -struct wgl_vt { - PFNWGLDXSETRESOURCESHAREHANDLENVPROC DXSetResourceShareHandleNV; - PFNWGLDXOPENDEVICENVPROC DXOpenDeviceNV; - PFNWGLDXCLOSEDEVICENVPROC DXCloseDeviceNV; - PFNWGLDXREGISTEROBJECTNVPROC DXRegisterObjectNV; - PFNWGLDXUNREGISTEROBJECTNVPROC DXUnregisterObjectNV; - PFNWGLDXLOCKOBJECTSNVPROC DXLockObjectsNV; - PFNWGLDXUNLOCKOBJECTSNVPROC DXUnlockObjectsNV; -}; -struct glpriv -{ - struct wgl_vt vt; - d3d9_handle_t hd3d; - d3d9_device_t d3d_dev; - HANDLE gl_handle_d3d; - HANDLE gl_render; - IDirect3DSurface9 *dx_render; -}; - -static int -GLConvUpdate(const opengl_tex_converter_t *tc, GLuint *textures, - const GLsizei *tex_width, const GLsizei *tex_height, - picture_t *pic, const size_t *plane_offset) -{ - VLC_UNUSED(textures); VLC_UNUSED(tex_width); VLC_UNUSED(tex_height); VLC_UNUSED(plane_offset); - struct glpriv *priv = tc->priv; - HRESULT hr; - - picture_sys_t *picsys = ActivePictureSys(pic); - if (unlikely(!picsys || !priv->gl_render)) - return VLC_EGENERIC; - - if (!priv->vt.DXUnlockObjectsNV(priv->gl_handle_d3d, 1, &priv->gl_render)) - { - msg_Warn(tc->gl, "DXUnlockObjectsNV failed"); - return VLC_EGENERIC; - } - - const RECT rect = { - .left = 0, - .top = 0, - .right = pic->format.i_visible_width, - .bottom = pic->format.i_visible_height - }; - hr = IDirect3DDevice9Ex_StretchRect(priv->d3d_dev.devex, picsys->surface, - &rect, priv->dx_render, NULL, D3DTEXF_NONE); - if (FAILED(hr)) - { - msg_Warn(tc->gl, "IDirect3DDevice9Ex_StretchRect failed"); - return VLC_EGENERIC; - } - - if (!priv->vt.DXLockObjectsNV(priv->gl_handle_d3d, 1, &priv->gl_render)) - { - msg_Warn(tc->gl, "DXLockObjectsNV failed"); - priv->vt.DXUnregisterObjectNV(priv->gl_handle_d3d, priv->gl_render); - priv->gl_render = NULL; - return VLC_EGENERIC; - } - - return VLC_SUCCESS; -} - -static picture_pool_t * -GLConvGetPool(const opengl_tex_converter_t *tc, unsigned requested_count) -{ - struct glpriv *priv = tc->priv; - return Direct3D9CreatePicturePool(VLC_OBJECT(tc->gl), &priv->d3d_dev, NULL, - &tc->fmt, requested_count); -} - -static int -GLConvAllocateTextures(const opengl_tex_converter_t *tc, GLuint *textures, - const GLsizei *tex_width, const GLsizei *tex_height) -{ - VLC_UNUSED(tex_width); VLC_UNUSED(tex_height); - struct glpriv *priv = tc->priv; - - priv->gl_render = - priv->vt.DXRegisterObjectNV(priv->gl_handle_d3d, priv->dx_render, - textures[0], GL_TEXTURE_2D, WGL_ACCESS_WRITE_DISCARD_NV); - if (!priv->gl_render) - { - msg_Warn(tc->gl, "DXRegisterObjectNV failed: %lu", GetLastError()); - return VLC_EGENERIC; - } - - if (!priv->vt.DXLockObjectsNV(priv->gl_handle_d3d, 1, &priv->gl_render)) - { - msg_Warn(tc->gl, "DXLockObjectsNV failed"); - priv->vt.DXUnregisterObjectNV(priv->gl_handle_d3d, priv->gl_render); - priv->gl_render = NULL; - return VLC_EGENERIC; - } - - return VLC_SUCCESS; -} - -static void -GLConvClose(vlc_object_t *obj) -{ - opengl_tex_converter_t *tc = (void *)obj; - struct glpriv *priv = tc->priv; - - if (priv->gl_handle_d3d) - { - if (priv->gl_render) - { - priv->vt.DXUnlockObjectsNV(priv->gl_handle_d3d, 1, &priv->gl_render); - priv->vt.DXUnregisterObjectNV(priv->gl_handle_d3d, priv->gl_render); - } - - priv->vt.DXCloseDeviceNV(priv->gl_handle_d3d); - } - - if (priv->dx_render) - IDirect3DSurface9_Release(priv->dx_render); - - D3D9_ReleaseDevice(&priv->d3d_dev); - D3D9_Destroy(&priv->hd3d); - free(tc->priv); -} - -static int -GLConvOpen(vlc_object_t *obj) -{ - opengl_tex_converter_t *tc = (void *) obj; - - if (tc->fmt.i_chroma != VLC_CODEC_D3D9_OPAQUE - && tc->fmt.i_chroma != VLC_CODEC_D3D9_OPAQUE_10B) - return VLC_EGENERIC; - - if (tc->gl->ext != VLC_GL_EXT_WGL || !tc->gl->wgl.getExtensionsString) - return VLC_EGENERIC; - - const char *wglExt = tc->gl->wgl.getExtensionsString(tc->gl); - - if (wglExt == NULL || !HasExtension(wglExt, "WGL_NV_DX_interop")) - return VLC_EGENERIC; - - struct wgl_vt vt; -#define LOAD_EXT(name, type) do { \ - vt.name = (type) vlc_gl_GetProcAddress(tc->gl, "wgl" #name); \ - if (!vt.name) { \ - msg_Warn(obj, "'wgl " #name "' could not be loaded"); \ - return VLC_EGENERIC; \ - } \ -} while(0) - - LOAD_EXT(DXSetResourceShareHandleNV, PFNWGLDXSETRESOURCESHAREHANDLENVPROC); - LOAD_EXT(DXOpenDeviceNV, PFNWGLDXOPENDEVICENVPROC); - LOAD_EXT(DXCloseDeviceNV, PFNWGLDXCLOSEDEVICENVPROC); - LOAD_EXT(DXRegisterObjectNV, PFNWGLDXREGISTEROBJECTNVPROC); - LOAD_EXT(DXUnregisterObjectNV, PFNWGLDXUNREGISTEROBJECTNVPROC); - LOAD_EXT(DXLockObjectsNV, PFNWGLDXLOCKOBJECTSNVPROC); - LOAD_EXT(DXUnlockObjectsNV, PFNWGLDXUNLOCKOBJECTSNVPROC); - - struct glpriv *priv = calloc(1, sizeof(struct glpriv)); - if (!priv) - return VLC_ENOMEM; - tc->priv = priv; - priv->vt = vt; - - if (D3D9_Create(obj, &priv->hd3d) != VLC_SUCCESS) - goto error; - - if (!priv->hd3d.use_ex) - { - msg_Warn(obj, "DX/GL interrop only working on d3d9x"); - goto error; - } - - if (FAILED(D3D9_CreateDevice(obj, &priv->hd3d, tc->gl->surface->handle.hwnd, - &tc->fmt, &priv->d3d_dev))) - goto error; - - HRESULT hr; - HANDLE shared_handle = NULL; - hr = IDirect3DDevice9Ex_CreateRenderTarget(priv->d3d_dev.devex, - tc->fmt.i_visible_width, - tc->fmt.i_visible_height, - D3DFMT_X8R8G8B8, - D3DMULTISAMPLE_NONE, 0, FALSE, - &priv->dx_render, &shared_handle); - if (FAILED(hr)) - { - msg_Warn(obj, "IDirect3DDevice9_CreateOffscreenPlainSurface failed"); - goto error; - } - - if (shared_handle) - priv->vt.DXSetResourceShareHandleNV(priv->dx_render, shared_handle); - - priv->gl_handle_d3d = priv->vt.DXOpenDeviceNV(priv->d3d_dev.dev); - if (!priv->gl_handle_d3d) - { - msg_Warn(obj, "DXOpenDeviceNV failed: %lu", GetLastError()); - goto error; - } - - tc->pf_update = GLConvUpdate; - tc->pf_get_pool = GLConvGetPool; - tc->pf_allocate_textures = GLConvAllocateTextures; - - tc->fshader = opengl_fragment_shader_init(tc, GL_TEXTURE_2D, VLC_CODEC_RGB32, - COLOR_SPACE_UNDEF); - if (tc->fshader == 0) - goto error; - - return VLC_SUCCESS; - -error: - GLConvClose(obj); - return VLC_EGENERIC; -} -#endif View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/e8b689c0c1288a4921834029292333169d9ceff5...f9e125db29f9f0d57e6ed3398a80f825e6710dab -- View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/e8b689c0c1288a4921834029292333169d9ceff5...f9e125db29f9f0d57e6ed3398a80f825e6710dab You're receiving this email because of your account on code.videolan.org. VideoLAN code repository instance From gitlab at videolan.org Fri Apr 7 12:26:03 2023 From: gitlab at videolan.org (Steve Lhomme (@robUx4)) Date: Fri, 07 Apr 2023 14:26:03 +0200 Subject: [vlc-commits] [Git][videolan/vlc][master] 8 commits: qml/ControlLayout: Add the 'contentWidth' property Message-ID: <64300bdbd7ef5_17088811c6c6c4719d1@gitlab.mail> Steve Lhomme pushed to branch master at VideoLAN / VLC Commits: 9bea3945 by Benjamin Arnaud at 2023-04-07T12:11:27+00:00 qml/ControlLayout: Add the 'contentWidth' property - - - - - a421045f by Benjamin Arnaud at 2023-04-07T12:11:27+00:00 qml/ControlLayout: Add the 'alignment' property - - - - - 96e3f573 by Benjamin Arnaud at 2023-04-07T12:11:27+00:00 qml/ControlLayout: Add the 'count' alias - - - - - 44bc4d84 by Benjamin Arnaud at 2023-04-07T12:11:27+00:00 qml/ControlLayout: Update the 'implicitWidth' property - - - - - 3efc5ce6 by Benjamin Arnaud at 2023-04-07T12:11:27+00:00 qml/ControlLayout: Add the 'preferredWidth' support - - - - - aec938f0 by Benjamin Arnaud at 2023-04-07T12:11:27+00:00 qml/ArtworkInfoWidget: Add the 'preferredWidth' property Co-authored-by: Fatih Uzunoglu <fuzun54 at outlook.com> - - - - - a1f2bda7 by Benjamin Arnaud at 2023-04-07T12:11:27+00:00 qml/PlayerControlLayout: Update resize and collpasing behavior This patch adds dynamic scaling for the loaders based on their internal content. It's notably useful to gain space when one of them is empty. We have that scenario for the classic controls layout. - - - - - 72c34ac1 by Benjamin Arnaud at 2023-04-07T12:11:27+00:00 qml/PlayerControlLayout: Update the 'layoutSpacing' property The spacing between controls feels more optimal with the 'margin_xlarge' value. - - - - - 3 changed files: - modules/gui/qt/player/qml/ControlLayout.qml - modules/gui/qt/player/qml/PlayerControlLayout.qml - modules/gui/qt/player/qml/controlbarcontrols/ArtworkInfoWidget.qml Changes: ===================================== modules/gui/qt/player/qml/ControlLayout.qml ===================================== @@ -32,27 +32,9 @@ FocusScope { // Properties - readonly property real minimumWidth: { - var count = repeater.count + property int contentWidth: 0 - if (count === 0) - return 0 - - var size = 0 - - for (var i = 0; i < count; ++i) { - var item = repeater.itemAt(i) - - if (item.minimumWidth === undefined) - size += item.implicitWidth - else - size += item.minimumWidth - } - - return size + ((count - 1) * playerControlLayout.spacing) - } - - property bool rightAligned: false + property int alignment: 0 property var altFocusAction: Navigation.defaultNavigationUp @@ -63,6 +45,8 @@ FocusScope { // Aliases + property alias count: repeater.count + property alias model: repeater.model // Signals @@ -71,7 +55,23 @@ FocusScope { // Settings - implicitWidth: minimumWidth + implicitWidth: { + if (count === 0) + return 0 + + var size = 0 + + for (var i = 0; i < count; ++i) { + size += repeater.itemAt(i).preferredWidth + } + + if (alignment) + // NOTE: We provision the spacing induced by the alignment item. + return size + count * rowLayout.spacing + else + return size + (count - 1) * rowLayout.spacing + } + implicitHeight: rowLayout.implicitHeight Navigation.navigable: { @@ -102,6 +102,28 @@ FocusScope { altFocusAction() } + function _updateContentWidth() { + var size = 0 + + for (var i = 0; i < count; i++) { + + var item = repeater.itemAt(i) + + if (item === null || item.isActive === false) + continue + + var width = item.width + + if (width) + size += width + spacing + } + + if (size) + contentWidth = size - spacing + else + contentWidth = size + } + // Children RowLayout { @@ -112,20 +134,26 @@ FocusScope { spacing: playerControlLayout.spacing Item { - Layout.fillWidth: rightAligned + Layout.fillWidth: (controlLayout.alignment === Qt.AlignRight) } Repeater { id: repeater // NOTE: We apply the 'navigation chain' after adding the item. - onItemAdded: item.applyNavigation() + onItemAdded: { + item.applyNavigation() + + controlLayout._updateContentWidth() + } onItemRemoved: { // NOTE: We update the 'navigation chain' after removing the item. item.removeNavigation() item.recoverFocus(index) + + controlLayout._updateContentWidth() } delegate: Loader { @@ -133,6 +161,9 @@ FocusScope { // Properties + // NOTE: This is required for contentWidth because the visible property is delayed. + property bool isActive: (x + minimumWidth <= rowLayout.width) + property int minimumWidth: { if (expandable) return item.minimumWidth @@ -142,6 +173,9 @@ FocusScope { return 0 } + property int preferredWidth: (item && item.preferredWidth) ? item.preferredWidth + : minimumWidth + readonly property bool expandable: (item && item.minimumWidth !== undefined) // Settings @@ -154,22 +188,27 @@ FocusScope { Layout.minimumWidth: minimumWidth - // NOTE: -1 resets to the implicit maximum width. - Layout.maximumWidth: (item) ? item.implicitWidth : -1 + Layout.preferredWidth: preferredWidth + + Layout.maximumWidth: preferredWidth - Layout.alignment: Qt.AlignVCenter | (rightAligned ? Qt.AlignRight : Qt.AlignLeft) + Layout.alignment: (Qt.AlignVCenter | controlLayout.alignment) BindingCompat { delayed: true // this is important target: loader property: "visible" - value: (loader.x + minimumWidth <= rowLayout.width) + value: isActive } // Events Component.onCompleted: repeater.countChanged.connect(controlLayout._handleFocus) + onIsActiveChanged: controlLayout._updateContentWidth() + + onWidthChanged: controlLayout._updateContentWidth() + onActiveFocusChanged: { if (activeFocus && (!!item && !item.focus)) { recoverFocus() @@ -328,7 +367,7 @@ FocusScope { } Item { - Layout.fillWidth: !rightAligned + Layout.fillWidth: (controlLayout.alignment === Qt.AlignLeft) } } } ===================================== modules/gui/qt/player/qml/PlayerControlLayout.qml ===================================== @@ -32,7 +32,7 @@ FocusScope { property real spacing: VLCStyle.margin_normal // spacing between controls - property real layoutSpacing: VLCStyle.margin_xxlarge // spacing between layouts (left, center, and right) + property real layoutSpacing: VLCStyle.margin_xlarge // spacing between layouts (left, center, and right) property int identifier: -1 @@ -48,35 +48,96 @@ FocusScope { colorSet: ColorContext.Window } + // Private + + property int _minimumSpacing: layoutSpacing - spacing + // Signals signal requestLockUnlockAutoHide(bool lock) // Settings - implicitWidth: loaderLeft.implicitWidth + loaderCenter.implicitWidth - + loaderRight.implicitWidth + 2 * layoutSpacing - implicitHeight: VLCStyle.maxControlbarControlHeight // Events - Component.onCompleted: console.assert(identifier >= 0) + Component.onCompleted: { + console.assert(identifier >= 0) + + _updateLayout() + } + + onWidthChanged: _updateLayout() + + // Functions + + function _updateLayout() { + var item = loaderCenter.item + + // NOTE: Sometimes this gets called before the item is loaded. + if (item === null) + return + + if (item.count) { + + loaderCenter.width = Math.min(loaderCenter.implicitWidth, width) + + loaderLeft.width = loaderCenter.x - _minimumSpacing + + loaderRight.width = width - loaderCenter.x - loaderCenter.width - _minimumSpacing + + } else if (loaderRight.item.count) { + + var implicitLeft = loaderLeft.implicitWidth + var implicitRight = loaderRight.implicitWidth + + var total = implicitLeft + implicitRight + + var size = total + _minimumSpacing + + if (size > width) { + size = width - _minimumSpacing + + // NOTE: When both sizes are equals we expand on the left. + if (implicitLeft >= implicitRight) { + + loaderRight.width = Math.round(size * (implicitRight / total)) + + var contentWidth = loaderRight.item.contentWidth + + // NOTE: We assign the remaining width based on the contentWidth. + if (contentWidth) + loaderLeft.width = width - contentWidth - _minimumSpacing + else + loaderLeft.width = width + } else { + loaderLeft.width = Math.round(size * (implicitLeft / total)) + + var contentWidth = loaderLeft.item.contentWidth + + // NOTE: We assign the remaining width based on the contentWidth. + if (contentWidth) + loaderRight.width = width - contentWidth - _minimumSpacing + else + loaderRight.width = width + } + } else { + loaderLeft.width = implicitLeft + loaderRight.width = implicitRight + } + } else + loaderLeft.width = width + } // Children Loader { id: loaderLeft - anchors { - right: loaderCenter.left - left: parent.left - top: parent.top - bottom: parent.bottom - - // Spacing for the filler item acts as padding - rightMargin: layoutSpacing - spacing - } + anchors.left: parent.left + anchors.top: parent.top + anchors.bottom: parent.bottom active: !!playerControlLayout.model && !!playerControlLayout.model.left @@ -90,6 +151,8 @@ FocusScope { ctx: MainCtx } + alignment: Qt.AlignLeft + focus: true altFocusAction: Navigation.defaultNavigationRight @@ -97,6 +160,10 @@ FocusScope { Navigation.parentItem: playerControlLayout Navigation.rightItem: loaderCenter.item + onImplicitWidthChanged: playerControlLayout._updateLayout() + + onCountChanged: playerControlLayout._updateLayout() + onRequestLockUnlockAutoHide: playerControlLayout.requestLockUnlockAutoHide(lock) } } @@ -104,16 +171,12 @@ FocusScope { Loader { id: loaderCenter - anchors { - horizontalCenter: parent.horizontalCenter - top: parent.top - bottom: parent.bottom - } + anchors.top: parent.top + anchors.bottom: parent.bottom - active: !!playerControlLayout.model && !!playerControlLayout.model.center + anchors.horizontalCenter: parent.horizontalCenter - width: (parent.width < implicitWidth) ? parent.width - : implicitWidth + active: !!playerControlLayout.model && !!playerControlLayout.model.center sourceComponent: ControlLayout { model: ControlListFilter { @@ -131,6 +194,10 @@ FocusScope { Navigation.leftItem: loaderLeft.item Navigation.rightItem: loaderRight.item + onImplicitWidthChanged: playerControlLayout._updateLayout() + + onCountChanged: playerControlLayout._updateLayout() + onRequestLockUnlockAutoHide: playerControlLayout.requestLockUnlockAutoHide(lock) } } @@ -138,15 +205,9 @@ FocusScope { Loader { id: loaderRight - anchors { - left: loaderCenter.right - right: parent.right - top: parent.top - bottom: parent.bottom - - // Spacing for the filler item acts as padding - leftMargin: layoutSpacing - spacing - } + anchors.right: parent.right + anchors.top: parent.top + anchors.bottom: parent.bottom active: !!playerControlLayout.model && !!playerControlLayout.model.right @@ -158,7 +219,7 @@ FocusScope { ctx: MainCtx } - rightAligned: true + alignment: Qt.AlignRight focus: true @@ -167,6 +228,10 @@ FocusScope { Navigation.parentItem: playerControlLayout Navigation.leftItem: loaderCenter.item + onImplicitWidthChanged: playerControlLayout._updateLayout() + + onCountChanged: playerControlLayout._updateLayout() + onRequestLockUnlockAutoHide: playerControlLayout.requestLockUnlockAutoHide(lock) } } ===================================== modules/gui/qt/player/qml/controlbarcontrols/ArtworkInfoWidget.qml ===================================== @@ -33,6 +33,12 @@ AbstractButton { readonly property real minimumWidth: coverRect.implicitWidth + + (leftPadding + rightPadding) + readonly property int preferredWidth: minimumWidth + contentItem.spacing * 2 + + + Math.max(titleLabel.implicitWidth, + artistLabel.implicitWidth, + progressIndicator.implicitWidth) + property bool _keyPressed: false text: I18n.qtr("Open player") View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/34e98057dd9dc50b5e33209072441cdc44d20e81...72c34ac178d835a549920ece08a0e4edefe12351 -- View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/34e98057dd9dc50b5e33209072441cdc44d20e81...72c34ac178d835a549920ece08a0e4edefe12351 You're receiving this email because of your account on code.videolan.org. VideoLAN code repository instance From gitlab at videolan.org Sat Apr 8 06:49:11 2023 From: gitlab at videolan.org (Steve Lhomme (@robUx4)) Date: Sat, 08 Apr 2023 08:49:11 +0200 Subject: [vlc-commits] [Git][videolan/vlc][master] 4 commits: d3d11_filters: only define D3D1_VIDEO_PROCESSOR enums for old mingw-w64 Message-ID: <64310e6757906_17088811c6c6c49601@gitlab.mail> Steve Lhomme pushed to branch master at VideoLAN / VLC Commits: 4620e69c by Steve Lhomme at 2023-04-08T06:30:16+00:00 d3d11_filters: only define D3D1_VIDEO_PROCESSOR enums for old mingw-w64 - - - - - d8bd8e1f by Steve Lhomme at 2023-04-08T06:30:16+00:00 win32: remove unneeded w32api.h include - - - - - ea197ba0 by Steve Lhomme at 2023-04-08T06:30:16+00:00 vlc_fixups: don't force __STDC_*_MACROS on mingw-w64 __STDC_FORMAT_MACROS has no effect __STDC_CONSTANT_MACROS and __STDC_LIMIT_MACROS are already set when compiling for C++11 since mingw-w64 4.0.1 - - - - - c1bac1a8 by Steve Lhomme at 2023-04-08T06:30:16+00:00 dshow: remove unneded QACONTAINERFLAGS hack QACONTAINERFLAGS is defined properly in minwg-w64 - - - - - 4 changed files: - include/vlc_fixups.h - modules/access/dshow/filter.cpp - modules/hw/d3d11/d3d11_filters.c - src/win32/dirs.c Changes: ===================================== include/vlc_fixups.h ===================================== @@ -108,7 +108,7 @@ typedef unsigned short mode_t; /* C++11 says there's no need to define __STDC_*_MACROS when including * inttypes.h and stdint.h. */ -#if defined (__cplusplus) && (defined(__MINGW32__) || defined(__UCLIBC__)) +#if defined (__cplusplus) && defined(__UCLIBC__) # ifndef __STDC_FORMAT_MACROS # define __STDC_FORMAT_MACROS 1 # endif ===================================== modules/access/dshow/filter.cpp ===================================== @@ -31,11 +31,6 @@ #include #include -#ifndef _MSC_VER - /* Work-around a bug in w32api-2.5 */ -# define QACONTAINERFLAGS QACONTAINERFLAGS_SOMETHINGELSE -#endif - #include "access.h" #include "filter.h" ===================================== modules/hw/d3d11/d3d11_filters.c ===================================== @@ -42,12 +42,12 @@ #include "d3d11_processor.h" #include "../../video_chroma/d3d11_fmt.h" -#ifdef __MINGW32__ +#if defined(__MINGW64_VERSION_MAJOR) && __MINGW64_VERSION_MAJOR < 8 #define D3D11_VIDEO_PROCESSOR_FILTER_CAPS_BRIGHTNESS 0x1 #define D3D11_VIDEO_PROCESSOR_FILTER_CAPS_CONTRAST 0x2 #define D3D11_VIDEO_PROCESSOR_FILTER_CAPS_HUE 0x4 #define D3D11_VIDEO_PROCESSOR_FILTER_CAPS_SATURATION 0x8 -#endif +#endif // __MINGW64_VERSION_MAJOR<8 #define PROCESSOR_SLICES 2 ===================================== src/win32/dirs.c ===================================== @@ -30,9 +30,6 @@ #endif #include -#ifdef __MINGW32__ -# include -#endif #include #include View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/72c34ac178d835a549920ece08a0e4edefe12351...c1bac1a85d504b2d25185eabfa2823fe8a2508f7 -- View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/72c34ac178d835a549920ece08a0e4edefe12351...c1bac1a85d504b2d25185eabfa2823fe8a2508f7 You're receiving this email because of your account on code.videolan.org. VideoLAN code repository instance From gitlab at videolan.org Sat Apr 8 11:15:46 2023 From: gitlab at videolan.org (Jean-Baptiste Kempf (@jbk)) Date: Sat, 08 Apr 2023 13:15:46 +0200 Subject: [vlc-commits] [Git][videolan/vlc][master] tools: bootstrap: raise meson's requirement to 1.0.0 Message-ID: <64314ce2bf98b_170888360d684506233@gitlab.mail> Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC Commits: 28851ad2 by Khalid Masum at 2023-04-08T10:29:36+00:00 tools: bootstrap: raise meson's requirement to 1.0.0 bootstrap warns "meson too old" and proceeds to download and install meson 1.0.0 when meson version is found to be 1.0.0 anyway. Raise meson's requirement to 1.0.0 to work-around this problem. - - - - - 1 changed file: - extras/tools/bootstrap Changes: ===================================== extras/tools/bootstrap ===================================== @@ -150,7 +150,7 @@ check flex check_nasm 2.14 check gettext check help2man -check meson 0.60.0 +check meson 1.0.0 check_ninja DEPS_ONLY="help2man" View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/28851ad2ad422bb621d36b27161f300ccb7b7cce -- View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/28851ad2ad422bb621d36b27161f300ccb7b7cce You're receiving this email because of your account on code.videolan.org. VideoLAN code repository instance From gitlab at videolan.org Sat Apr 8 17:57:38 2023 From: gitlab at videolan.org (Jean-Baptiste Kempf (@jbk)) Date: Sat, 08 Apr 2023 19:57:38 +0200 Subject: [vlc-commits] [Git][videolan/vlc][master] 3 commits: qml: reuse items in VideoQualityLabels Message-ID: <6431ab12825fb_1708886582e645211a6@gitlab.mail> Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC Commits: 21f05ba7 by Prince Gupta at 2023-04-08T17:09:44+00:00 qml: reuse items in VideoQualityLabels improves performance when scrolling in ExpandGridView - - - - - 5bc28f4d by Prince Gupta at 2023-04-08T17:09:44+00:00 qml: use direct function assignment for grid cover labels - - - - - 5a52d25e by Prince Gupta at 2023-04-08T17:09:44+00:00 qml: use direct function assignment for getting title cover labels - - - - - 5 changed files: - modules/gui/qt/medialibrary/qml/VideoAll.qml - modules/gui/qt/medialibrary/qml/VideoAllSubDisplay.qml - modules/gui/qt/medialibrary/qml/VideoListDisplay.qml - modules/gui/qt/widgets/qml/TableColumns.qml - modules/gui/qt/widgets/qml/VideoQualityLabels.qml Changes: ===================================== modules/gui/qt/medialibrary/qml/VideoAll.qml ===================================== @@ -54,6 +54,11 @@ MainInterface.MainViewLoader { property alias dragItem: dragItem + // function(model) -> [strings....] + // used to get grid labels per model item + property var gridLabels: getLabel + property var listLabels: getLabel + list: list grid: grid emptyLabel: emptylabel @@ -179,7 +184,7 @@ MainInterface.MainViewLoader { && gridView.expandIndex !== gridItem.index) ? 0.7 : 1 - labels: root.onLabelGrid(model) + labels: root.gridLabels(model) // FIXME: Sometimes MLBaseModel::getDataAt returns {} so we use 'isNew === true'. showNewIndicator: (model.isNew === true) @@ -267,6 +272,8 @@ MainInterface.MainViewLoader { onRightClick: root.contextMenu.popup(selectionModel.selectedIndexes, globalMousePos) + coverLabels: root.listLabels + // Functions function onLabels(model) { return root.onLabelList(model); } ===================================== modules/gui/qt/medialibrary/qml/VideoAllSubDisplay.qml ===================================== @@ -55,6 +55,10 @@ VideoAll { contextMenu: Util.MLContextMenu { model: _meta ? _meta.model : null; showPlayAsAudioAction: true } + gridLabels: !!_meta ? _meta.gridLabels : root.getLabel + + listLabels: !!_meta ? _meta.listLabels : root.getLabel + // Functions function _updateMetaModel(groupping) { @@ -102,9 +106,6 @@ VideoAll { function onDoubleClick(object) { _meta.onDoubleClick(object) } - function onLabelGrid(object) { return _meta.onLabelGrid(object) } - function onLabelList(object) { return _meta.onLabelList(object) } - function isInfoExpandPanelAvailable(modelIndexData) { return _meta.isInfoExpandPanelAvailable(modelIndexData) } @@ -126,6 +127,10 @@ VideoAll { property var model: MLVideoModel { ml: MediaLib } + property var gridLabels: root.getLabel + + property var listLabels: root.getLabel + function onAction(indexes) { MediaLib.addAndPlay(model.getIdsForIndexes(indexes)) g_mainDisplay.showPlayer() @@ -133,9 +138,6 @@ VideoAll { function onDoubleClick(object) { g_mainDisplay.play(MediaLib, object.id) } - function onLabelGrid(object) { return root.getLabel(object) } - function onLabelList(object) { return root.getLabel(object) } - function isInfoExpandPanelAvailable(modelIndexData) { return true } } } @@ -148,6 +150,14 @@ VideoAll { property var model: MLVideoGroupsModel { ml: MediaLib } + property var gridLabels: function (model) { + return root.getLabelGroup(model, I18n.qtr("%1 Videos")) + } + + property var listLabels: function (model) { + return root.getLabelGroup(model, I18n.qtr("%1")) + } + function onAction(indexes) { var index = indexes[0] @@ -173,14 +183,6 @@ VideoAll { root.showList(object, Qt.MouseFocusReason) } - function onLabelGrid(object) { - return root.getLabelGroup(object, I18n.qtr("%1 Videos")) - } - - function onLabelList(object) { - return root.getLabelGroup(object, I18n.qtr("%1")) - } - function isInfoExpandPanelAvailable(modelIndexData) { return modelIndexData.isVideo } @@ -195,6 +197,14 @@ VideoAll { property var model: MLVideoFoldersModel { ml: MediaLib } + property var gridLabels: function (model) { + return root.getLabelGroup(model, I18n.qtr("%1 Videos")) + } + + property var listLabels: function (model) { + return root.getLabelGroup(model, I18n.qtr("%1")) + } + function onAction(indexes) { var index = indexes[0] @@ -205,14 +215,6 @@ VideoAll { root.showList(object, Qt.MouseFocusReason) } - function onLabelGrid(object) { - return root.getLabelGroup(object, I18n.qtr("%1 Videos")) - } - - function onLabelList(object) { - return root.getLabelGroup(object, I18n.qtr("%1")) - } - function isInfoExpandPanelAvailable(modelIndexData) { return false } ===================================== modules/gui/qt/medialibrary/qml/VideoListDisplay.qml ===================================== @@ -37,6 +37,8 @@ MainInterface.MainTableView { // NOTE: This is useful for groups because our main criteria is 'name' instead of 'title'. property string mainCriteria: "title" + property alias coverLabels: tableColumns.titlecoverLabels + //--------------------------------------------------------------------------------------------- // Private @@ -162,8 +164,6 @@ MainInterface.MainTableView { titleCover_width: VLCStyle.listAlbumCover_width titleCover_radius: VLCStyle.listAlbumCover_radius - function titlecoverLabels(model) { - return listView_id.onLabels(model); - } + titlecoverLabels: listView_id.onLabels } } ===================================== modules/gui/qt/widgets/qml/TableColumns.qml ===================================== @@ -41,10 +41,9 @@ Item { property int titleCover_height: VLCStyle.trackListAlbumCover_heigth property int titleCover_radius: VLCStyle.trackListAlbumCover_radius - // Functions - - function titlecoverLabels(model) { - // implement this function to show labels in title Cover + // function (model) -> [string...] + // implement this function to show labels in title Cover + property var titlecoverLabels: function(model) { return [] } ===================================== modules/gui/qt/widgets/qml/VideoQualityLabels.qml ===================================== @@ -22,7 +22,16 @@ import org.videolan.vlc 0.1 import "qrc:///style/" Row { - property alias labels: repeater.model + id: root + + property var labels + + onLabelsChanged: { + // try to reuse items, texts are assigned with Binding + // extra items are hidden, Row should take care of them + if (repeater.count < labels.length) + repeater.model = labels.length + } spacing: VLCStyle.margin_xxsmall @@ -42,7 +51,9 @@ Row { leftPadding: VLCStyle.margin_xxxsmall rightPadding: VLCStyle.margin_xxxsmall - text: modelData + visible: index < root.labels.length + text: index >= root.labels.length ? "" : root.labels[index] + font.pixelSize: VLCStyle.fontSize_normal color: theme.fg.primary View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/28851ad2ad422bb621d36b27161f300ccb7b7cce...5a52d25eec9dd3213bbb76349d624147ecfacbcc -- View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/28851ad2ad422bb621d36b27161f300ccb7b7cce...5a52d25eec9dd3213bbb76349d624147ecfacbcc You're receiving this email because of your account on code.videolan.org. VideoLAN code repository instance From gitlab at videolan.org Sun Apr 9 09:45:54 2023 From: gitlab at videolan.org (Jean-Baptiste Kempf (@jbk)) Date: Sun, 09 Apr 2023 11:45:54 +0200 Subject: [vlc-commits] [Git][videolan/vlc][master] qt: don't scale radius for drop shadow effect Message-ID: <64328952b2925_1708884eca668533157@gitlab.mail> Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC Commits: 5db6d3c8 by Prince Gupta at 2023-04-09T07:59:11+00:00 qt: don't scale radius for drop shadow effect improves batching and reduces size of generated effect - - - - - 1 changed file: - modules/gui/qt/util/effects_image_provider.cpp Changes: ===================================== modules/gui/qt/util/effects_image_provider.cpp ===================================== @@ -77,12 +77,12 @@ public: // Copy the mask QPainter painter(&ret); painter.setCompositionMode(QPainter::CompositionMode_Source); - const auto radius = effectiveBlurRadius(); + const auto radius = m_blurRadius; painter.drawImage(radius + m_xOffset, radius + m_yOffset, mask); } // Blur the mask - qt_blurImage(ret, effectiveBlurRadius(), false); + qt_blurImage(ret, m_blurRadius, false); return ret; } @@ -90,8 +90,8 @@ public: constexpr QSize boundingSize(const QSize& size) const { // Size of bounding rectangle of the effect - const qreal radius = 2 * effectiveBlurRadius(); - return size + QSize(qAbs(m_xOffset) + radius, qAbs(m_yOffset) + radius); + const qreal diameter = m_blurRadius * 2; + return size + QSize(qAbs(m_xOffset) + diameter, qAbs(m_yOffset) + diameter); } protected: @@ -99,13 +99,6 @@ protected: QColor m_color {63, 63, 63, 180}; qreal m_xOffset = 0.0; qreal m_yOffset = 0.0; - -private: - constexpr qreal effectiveBlurRadius() const - { - // Translated blur radius for the Qt blur algorithm - return 2.5 * (m_blurRadius + 1); - } }; class RoundedRectDropShadowEffect : public RectDropShadowEffect View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/5db6d3c820ec004f54fec9474d950746eaf3a3d0 -- View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/5db6d3c820ec004f54fec9474d950746eaf3a3d0 You're receiving this email because of your account on code.videolan.org. VideoLAN code repository instance From gitlab at videolan.org Sun Apr 9 11:04:03 2023 From: gitlab at videolan.org (Jean-Baptiste Kempf (@jbk)) Date: Sun, 09 Apr 2023 13:04:03 +0200 Subject: [vlc-commits] [Git][videolan/vlc][master] 6 commits: qml: update playlist delegate spacing Message-ID: <64329ba366deb_1708887ae5ab853656f@gitlab.mail> Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC Commits: 21b64442 by Prince Gupta at 2023-04-09T10:10:57+00:00 qml: update playlist delegate spacing - - - - - d515c92c by Prince Gupta at 2023-04-09T10:10:57+00:00 qml: don't set font weight on subtitle of playlist delegate - - - - - 2702b4d0 by Prince Gupta at 2023-04-09T10:10:57+00:00 qml: increase playlist art size - - - - - 190e9f9e by Prince Gupta at 2023-04-09T10:10:57+00:00 qt: add separator colors on Item component - - - - - 0bc8e1b1 by Prince Gupta at 2023-04-09T10:10:57+00:00 qml: improve CurrentIndicator widget * allow to disable positioning (set source = null) * simplify implementation - - - - - 664ff645 by Prince Gupta at 2023-04-09T10:10:57+00:00 qml: add current indicator to playlistdelegate - - - - - 13 changed files: - modules/gui/qt/medialibrary/qml/MusicArtistDelegate.qml - modules/gui/qt/playlist/qml/PlaylistDelegate.qml - modules/gui/qt/playlist/qml/PlaylistListView.qml - modules/gui/qt/style/VLCStyle.qml - modules/gui/qt/style/colorcontext.cpp - modules/gui/qt/style/colorcontext.hpp - modules/gui/qt/style/gtkthemeprovider/gtkthemeprovider.cpp - modules/gui/qt/style/qtthemeprovider.hpp - modules/gui/qt/style/systempalette.cpp - modules/gui/qt/style/systempalettethemeprovider.cpp - modules/gui/qt/style/windowsthemeprovider.cpp - modules/gui/qt/widgets/qml/BannerTabButton.qml - modules/gui/qt/widgets/qml/CurrentIndicator.qml Changes: ===================================== modules/gui/qt/medialibrary/qml/MusicArtistDelegate.qml ===================================== @@ -116,7 +116,7 @@ T.ItemDelegate { onDoubleClicked: itemDoubleClicked(mouse) Widgets.CurrentIndicator { - height: parent.height - (margin * 2) + length: parent.height - (margin * 2) margin: VLCStyle.dp(4, VLCStyle.scale) ===================================== modules/gui/qt/playlist/qml/PlaylistDelegate.qml ===================================== @@ -44,11 +44,11 @@ T.ItemDelegate { // Settings - topPadding: VLCStyle.margin_xxsmall + topPadding: VLCStyle.playlistDelegate_verticalPadding - bottomPadding: VLCStyle.margin_xxsmall + bottomPadding: VLCStyle.playlistDelegate_verticalPadding - leftPadding: VLCStyle.margin_normal + leftPadding: VLCStyle.margin_xxsmall rightPadding: Math.max(listView.scrollBarWidth, VLCStyle.margin_normal) @@ -112,12 +112,34 @@ T.ItemDelegate { contentItem: RowLayout { spacing: 0 + Widgets.CurrentIndicator { + id: currentIndicator + + // disable positioning via CurrentIndicator, manually position according to RowLayout + source: null + + implicitWidth: VLCStyle.heightBar_xxxsmall + Layout.fillHeight: true + + color: { + if (model.isCurrent) + return theme.accent + + // based on design, ColorContext can't handle this case + if (!delegate.hovered) + return VLCStyle.setColorAlpha(theme.indicator, 0) + + return theme.indicator + } + } + Item { id: artworkItem - Layout.preferredHeight: VLCStyle.icon_normal - Layout.preferredWidth: VLCStyle.icon_normal + Layout.preferredHeight: VLCStyle.icon_playlistArt + Layout.preferredWidth: VLCStyle.icon_playlistArt Layout.alignment: Qt.AlignVCenter + Layout.leftMargin: VLCStyle.margin_xsmall Accessible.role: Accessible.Graphic Accessible.name: I18n.qtr("Cover") @@ -178,7 +200,7 @@ T.ItemDelegate { Layout.fillWidth: true Layout.fillHeight: true Layout.leftMargin: VLCStyle.margin_large - spacing: 0 + spacing: VLCStyle.margin_xsmall Widgets.ListLabel { id: textInfo @@ -198,7 +220,6 @@ T.ItemDelegate { Layout.fillHeight: true Layout.fillWidth: true - font.weight: model.isCurrent ? Font.DemiBold : Font.Normal text: (model.artist ? model.artist : I18n.qtr("Unknown Artist")) color: theme.fg.primary verticalAlignment: Text.AlignBottom ===================================== modules/gui/qt/playlist/qml/PlaylistListView.qml ===================================== @@ -238,7 +238,8 @@ Control { spacing: VLCStyle.margin_large Widgets.IconLabel { - Layout.preferredWidth: VLCStyle.icon_playlistHeader + // playlist cover column + Layout.preferredWidth: VLCStyle.icon_playlistArt horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter ===================================== modules/gui/qt/style/VLCStyle.qml ===================================== @@ -114,6 +114,7 @@ QtObject { readonly property int icon_actionButton: icon_normal readonly property int icon_PIP: icon_normal readonly property int icon_CSD: icon_small + readonly property int icon_playlistArt: dp(32, scale) readonly property int play_cover_small: dp(24, scale) readonly property int play_cover_normal: dp(48, scale) @@ -222,6 +223,8 @@ QtObject { readonly property int artistBanner_height: dp(200, scale) + readonly property int playlistDelegate_verticalPadding: dp(6, scale) + //global application size, updated by the root widget property int appWidth: 0 property int appHeight: 0 ===================================== modules/gui/qt/style/colorcontext.cpp ===================================== @@ -402,6 +402,11 @@ QColor ColorContext::separator() const return getColor(Decoration, Separator); } +QColor ColorContext::indicator() const +{ + return getColor(Decoration, Indicator); +} + QColor ColorContext::shadow() const { return getColor(Decoration, Shadow); ===================================== modules/gui/qt/style/colorcontext.hpp ===================================== @@ -117,6 +117,7 @@ public: Accent = VQTC_NAME_ACCENT, Shadow = VQTC_NAME_SHADOW, Separator = VQTC_NAME_SEPARATOR, + Indicator = VQTC_NAME_INDICATOR }; Q_PROPERTY(SystemPalette* palette READ palette WRITE setPalette NOTIFY paletteChanged FINAL) @@ -139,6 +140,7 @@ public: Q_PROPERTY(QColor visualFocus READ visualFocus NOTIFY colorsChanged FINAL) Q_PROPERTY(QColor border READ border NOTIFY colorsChanged FINAL) Q_PROPERTY(QColor separator READ separator NOTIFY colorsChanged FINAL) + Q_PROPERTY(QColor indicator READ indicator NOTIFY colorsChanged FINAL) Q_PROPERTY(QColor shadow READ shadow NOTIFY colorsChanged FINAL) Q_PROPERTY(QColor accent READ accent NOTIFY colorsChanged FINAL) @@ -160,6 +162,7 @@ public: QColor visualFocus() const; QColor border() const; QColor separator() const; + QColor indicator() const; QColor shadow() const; QColor accent() const; ===================================== modules/gui/qt/style/gtkthemeprovider/gtkthemeprovider.cpp ===================================== @@ -359,6 +359,9 @@ static int updatePalette(vlc_qt_theme_provider_t* obj) setGtkColorSetFg(obj, CS, VQTC_NAME_PRIMARY, ITEM_SELECTOR); setGtkColorSetBorder(obj, CS, ITEM_SELECTOR); setGtkColorSetHighlight(obj, CS, ITEM_SELECTOR); + + const auto separator = GetSeparatorColor(" GtkListBoxRow#separator.horizontal"); + setGtkColor(obj, CS, VQTC_SECTION_DECORATION, VQTC_NAME_INDICATOR, VQTC_STATE_NORMAL, separator); } #define COMBOBOX_SELECTOR VIEW_SELECTOR " GtkComboBoxText#combobox #box.linked #entry.combo" ===================================== modules/gui/qt/style/qtthemeprovider.hpp ===================================== @@ -74,6 +74,7 @@ enum vlc_qt_theme_color_name { VQTC_NAME_ACCENT, VQTC_NAME_SHADOW, VQTC_NAME_SEPARATOR, + VQTC_NAME_INDICATOR, VQTC_NAME_COUNT }; ===================================== modules/gui/qt/style/systempalette.cpp ===================================== @@ -561,6 +561,9 @@ void SystemPalette::makeLightPalette() setColor(CS, C::Fg, C::Primary, C::Normal, Qt::black); setColor(CS, C::Fg, C::Secondary, C::Normal, setColorAlpha(Qt::black, 0.6)); + + setColor(CS, C::Decoration, C::Indicator, C::Normal, QColor("#9e9e9e")); //FIXME not a predef + } //Accent Buttons @@ -755,6 +758,8 @@ void SystemPalette::makeDarkPalette() setColor(CS, C::Fg, C::Primary, C::Normal, Qt::white); setColor(CS, C::Fg, C::Secondary, C::Normal, setColorAlpha(Qt::white, 0.6)); + + setColor(CS, C::Decoration, C::Indicator, C::Normal, QColor("#666666")); //FIXME not a predef } //Accent Buttons ===================================== modules/gui/qt/style/systempalettethemeprovider.cpp ===================================== @@ -327,6 +327,13 @@ static int updatePalette(vlc_qt_theme_provider_t* obj) setQtColor(obj, CS, VQTC_SECTION_BG, VQTC_NAME_HIGHLIGHT, VQTC_STATE_FOCUSED, hightlightHover); setQtColor(obj, CS, VQTC_SECTION_BG, VQTC_NAME_HIGHLIGHT, VQTC_STATE_HOVERED, hightlightHover); setQtColor(obj, CS, VQTC_SECTION_FG, VQTC_NAME_HIGHLIGHT, VQTC_STATE_NORMAL, textOnHightlight); + + + const auto bg = palette.color(QPalette::AlternateBase); + const auto indicator = sys->m_isDark ? bg.lighter() : bg.darker(); + setQtColor(obj, CS, VQTC_SECTION_DECORATION, VQTC_NAME_INDICATOR + , VQTC_STATE_NORMAL, indicator); + } //Badge ===================================== modules/gui/qt/style/windowsthemeprovider.cpp ===================================== @@ -171,6 +171,8 @@ static int updatePalette(vlc_qt_theme_provider_t* obj) setQtColor(obj, CS, VQTC_SECTION_DECORATION, VQTC_NAME_BORDER, VQTC_STATE_NORMAL, COLOR_BTNTEXT); setQtColor(obj, CS, VQTC_SECTION_DECORATION, VQTC_NAME_BORDER, VQTC_STATE_FOCUSED, COLOR_HIGHLIGHT); setQtColor(obj, CS, VQTC_SECTION_DECORATION, VQTC_NAME_BORDER, VQTC_STATE_HOVERED, COLOR_HIGHLIGHT); + + setQtColor(obj, CS, VQTC_SECTION_DECORATION, VQTC_NAME_INDICATOR, VQTC_STATE_NORMAL, COLOR_HIGHLIGHT); } //set colors on all buttons ===================================== modules/gui/qt/widgets/qml/BannerTabButton.qml ===================================== @@ -130,7 +130,7 @@ T.TabButton { } Widgets.CurrentIndicator { - width: tabRow.width + length: tabRow.width orientation: Qt.Horizontal ===================================== modules/gui/qt/widgets/qml/CurrentIndicator.qml ===================================== @@ -23,6 +23,7 @@ import org.videolan.vlc 0.1 import "qrc:///style/" Rectangle { + id: root property int orientation: Qt.Vertical property int margin: VLCStyle.margin_xxxsmall @@ -31,37 +32,33 @@ Rectangle { id: theme } - color: theme.accent - width: orientation === Qt.Vertical ? VLCStyle.heightBar_xxxsmall : parent.width - height: orientation === Qt.Horizontal ? VLCStyle.heightBar_xxxsmall : parent.height + property Item source: parent + + property int length: 0 - onOrientationChanged: { - if (orientation == Qt.Vertical) { - anchors.horizontalCenter = undefined - anchors.verticalCenter = Qt.binding(function () { - return parent.verticalCenter - }) - anchors.left = Qt.binding(function () { - return parent.left - }) - anchors.right = undefined - anchors.leftMargin = Qt.binding(function () { - return margin - }) - anchors.bottomMargin = 0 - } else { - anchors.top = undefined - anchors.bottom = Qt.binding(function () { - return parent.bottom - }) - anchors.horizontalCenter = Qt.binding(function () { - return parent.horizontalCenter - }) - anchors.verticalCenter = undefined - anchors.leftMargin = 0 - anchors.bottomMargin = Qt.binding(function () { - return margin - }) + property var _position: [ + { + // for orientation == Qt.Vertical + "width" : VLCStyle.heightBar_xxxsmall, + "height": root.length, + "x": margin, + "y": !!source ? (source.height - root.length) / 2 : 0 + }, + { + // for orientation == Qt.Horizontal + "width": root.length, + "height": VLCStyle.heightBar_xxxsmall, + "x": !!source ? (source.width - root.length) / 2 : 0, + "y": !!source ? source.height - margin : 0, } - } + ] + + property var _currentPosition: (orientation === Qt.Vertical) ? _position[0] : _position[1] + + color: theme.accent + + x: _currentPosition.x + y: _currentPosition.y + width: _currentPosition.width + height: _currentPosition.height } View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/5db6d3c820ec004f54fec9474d950746eaf3a3d0...664ff6454d6fc95eb95c49f49a60421e43c0884b -- View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/5db6d3c820ec004f54fec9474d950746eaf3a3d0...664ff6454d6fc95eb95c49f49a60421e43c0884b You're receiving this email because of your account on code.videolan.org. VideoLAN code repository instance From gitlab at videolan.org Sun Apr 9 14:19:18 2023 From: gitlab at videolan.org (Jean-Baptiste Kempf (@jbk)) Date: Sun, 09 Apr 2023 16:19:18 +0200 Subject: [vlc-commits] [Git][videolan/vlc][master] Fix alignment issues with qt-safe-area option Message-ID: <6432c966db10b_17088865832c4541052@gitlab.mail> Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC Commits: 653fd6de by Mohit Marathe at 2023-04-09T11:15:39+00:00 Fix alignment issues with qt-safe-area option Signed-off-by: Mohit Marathe <mohitmarathe23 at gmail.com> - - - - - 1 changed file: - modules/gui/qt/medialibrary/qml/MusicArtistsAlbums.qml Changes: ===================================== modules/gui/qt/medialibrary/qml/MusicArtistsAlbums.qml ===================================== @@ -135,8 +135,6 @@ FocusScope { Row { anchors.fill: parent - anchors.leftMargin: root.leftPadding - visible: artistModel.count > 0 Widgets.KeyNavigableListView { @@ -179,7 +177,7 @@ FocusScope { text: I18n.qtr("Artists") font.pixelSize: VLCStyle.fontSize_large color: artistList.colorContext.fg.primary - leftPadding: VLCStyle.margin_normal + leftPadding: root.leftPadding + VLCStyle.margin_normal bottomPadding: VLCStyle.margin_small topPadding: VLCStyle.margin_xlarge } @@ -187,6 +185,8 @@ FocusScope { delegate: MusicArtistDelegate { width: artistList.width + leftPadding: root.leftPadding + isCurrent: ListView.isCurrentItem mlModel: artistModel View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/653fd6de8b6a73975b3480af681980c19ce3f2fa -- View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/653fd6de8b6a73975b3480af681980c19ce3f2fa You're receiving this email because of your account on code.videolan.org. VideoLAN code repository instance From gitlab at videolan.org Sun Apr 9 16:16:57 2023 From: gitlab at videolan.org (Jean-Baptiste Kempf (@jbk)) Date: Sun, 09 Apr 2023 18:16:57 +0200 Subject: [vlc-commits] [Git][videolan/vlc][master] qt: fix scaling of sort icon in contextual menu Message-ID: <6432e4f92a91c_1708887b04a6c5509ed@gitlab.mail> Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC Commits: 120ce6a3 by Pierre Lamot at 2023-04-09T14:47:04+00:00 qt: fix scaling of sort icon in contextual menu fix: #27985 - - - - - 1 changed file: - modules/gui/qt/menus/qml_menu_wrapper.cpp Changes: ===================================== modules/gui/qt/menus/qml_menu_wrapper.cpp ===================================== @@ -49,8 +49,11 @@ namespace if (arrowsize <= 0) arrowsize = 32; + qreal dpr = widget ? widget->devicePixelRatioF() : 1.0; headerOption.rect = QRect(0, 0, arrowsize, arrowsize); - QPixmap arrow(arrowsize, arrowsize); + + QPixmap arrow(arrowsize * dpr, arrowsize * dpr); + arrow.setDevicePixelRatio(dpr); arrow.fill(Qt::transparent); { View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/120ce6a393099f95e414785bf45b12cd84d67742 -- View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/120ce6a393099f95e414785bf45b12cd84d67742 You're receiving this email because of your account on code.videolan.org. VideoLAN code repository instance From gitlab at videolan.org Mon Apr 10 01:48:56 2023 From: gitlab at videolan.org (Jean-Baptiste Kempf (@jbk)) Date: Mon, 10 Apr 2023 03:48:56 +0200 Subject: [vlc-commits] [Git][videolan/vlc][master] 6 commits: packetizer: h264: refactor sps/pps duplication Message-ID: <64336b08b8535_1708884eca65455788e@gitlab.mail> Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC Commits: 3ea4bcad by Francois Cartegnie at 2023-04-09T16:17:08+00:00 packetizer: h264: refactor sps/pps duplication - - - - - 86393842 by Francois Cartegnie at 2023-04-09T16:17:08+00:00 packetizer: h264: compare sps/pps before replacement - - - - - c85581f4 by Francois Cartegnie at 2023-04-09T16:17:08+00:00 packetizer: h264: add h264_get_xps_id shortcut - - - - - 21a329cc by Francois Cartegnie at 2023-04-09T16:17:08+00:00 packetizer: h264: refactor sps/pps handling - - - - - d8898afb by Francois Cartegnie at 2023-04-09T16:17:08+00:00 packetizer: h264: refactor gathering sps/pps - - - - - ed97dd9f by Francois Cartegnie at 2023-04-09T16:17:08+00:00 packetizer: h264: add all sps/pps sets to extradata - - - - - 3 changed files: - modules/packetizer/h264.c - modules/packetizer/h264_nal.c - modules/packetizer/h264_nal.h Changes: ===================================== modules/packetizer/h264.c ===================================== @@ -152,9 +152,8 @@ static block_t * PacketizeDrain( void *p_private ); static block_t *ParseNALBlock( decoder_t *, bool *pb_ts_used, block_t * ); static block_t *OutputPicture( decoder_t *p_dec ); -static void PutSPS( decoder_t *p_dec, block_t *p_frag ); -static void PutPPS( decoder_t *p_dec, block_t *p_frag ); -static void PutSPSEXT( decoder_t *p_dec, block_t *p_frag ); +static void ReleaseXPS( decoder_sys_t *p_sys ); +static bool PutXPS( decoder_t *p_dec, uint8_t i_nal_type, block_t *p_frag ); static bool ParseSliceHeader( decoder_t *p_dec, const block_t *p_frag, h264_slice_t *p_slice ); static bool ParseSeiCallback( const hxxx_sei_data_t *, void * ); @@ -164,38 +163,33 @@ static const uint8_t p_h264_startcode[3] = { 0x00, 0x00, 0x01 }; /***************************************************************************** * Helpers *****************************************************************************/ - -static void StoreSPS( decoder_sys_t *p_sys, uint8_t i_id, - block_t *p_block, h264_sequence_parameter_set_t *p_sps ) -{ - if( p_sys->sps[i_id].p_block ) - block_Release( p_sys->sps[i_id].p_block ); - if( p_sys->sps[i_id].p_sps ) - h264_release_sps( p_sys->sps[i_id].p_sps ); - if( p_sys->sps[i_id].p_sps == p_sys->p_active_sps ) - p_sys->p_active_sps = NULL; - p_sys->sps[i_id].p_block = p_block; - p_sys->sps[i_id].p_sps = p_sps; -} - -static void StorePPS( decoder_sys_t *p_sys, uint8_t i_id, - block_t *p_block, h264_picture_parameter_set_t *p_pps ) +static void LastAppendXPSCopy( const block_t *p_block, block_t ***ppp_last ) { - if( p_sys->pps[i_id].p_block ) - block_Release( p_sys->pps[i_id].p_block ); - if( p_sys->pps[i_id].p_pps ) - h264_release_pps( p_sys->pps[i_id].p_pps ); - if( p_sys->pps[i_id].p_pps == p_sys->p_active_pps ) - p_sys->p_active_pps = NULL; - p_sys->pps[i_id].p_block = p_block; - p_sys->pps[i_id].p_pps = p_pps; + if( !p_block ) + return; + block_t *p_dup = block_Alloc( 4 + p_block->i_buffer ); + if( p_dup ) + { + memcpy( &p_dup->p_buffer[0], annexb_startcode4, 4 ); + memcpy( &p_dup->p_buffer[4], p_block->p_buffer, p_block->i_buffer ); + block_ChainLastAppend( ppp_last, p_dup ); + } } -static void StoreSPSEXT( decoder_sys_t *p_sys, uint8_t i_id, block_t *p_block ) +static block_t * GatherSets( decoder_sys_t *p_sys, bool b_need_sps, bool b_need_pps ) { - if( p_sys->spsext[i_id].p_block ) - block_Release( p_sys->spsext[i_id].p_block ); - p_sys->spsext[i_id].p_block = p_block; + block_t *p_xpsnal = NULL; + block_t **pp_xpsnal_tail = &p_xpsnal; + for( int i = 0; i <= H264_SPS_ID_MAX && b_need_sps; i++ ) + { + LastAppendXPSCopy( p_sys->sps[i].p_block, &pp_xpsnal_tail ); + /* 7.4.1.2.3, shall be the next NAL unit after a sequence parameter set NAL unit + * having the same value of seq_parameter_set_id */ + LastAppendXPSCopy( p_sys->spsext[i].p_block, &pp_xpsnal_tail ); + } + for( int i = 0; i < H264_PPS_ID_MAX && b_need_pps; i++ ) + LastAppendXPSCopy( p_sys->pps[i].p_block, &pp_xpsnal_tail ); + return p_xpsnal; } static void ActivateSets( decoder_t *p_dec, const h264_sequence_parameter_set_t *p_sps, @@ -250,29 +244,18 @@ static void ActivateSets( decoder_t *p_dec, const h264_sequence_parameter_set_t if( p_dec->fmt_out.i_extra == 0 && p_pps ) { - const block_t *p_spsblock = p_sys->sps[p_sps->i_id].p_block; - const block_t *p_ppsblock = p_sys->pps[p_pps->i_id].p_block; - const block_t *p_spsextblock = p_sys->spsext[p_sps->i_id].p_block; - - if( p_spsblock && p_ppsblock ) + block_t *p_xpsblocks = GatherSets( p_sys, true, true ); + if( p_xpsblocks ) { - size_t i_alloc = p_ppsblock->i_buffer + p_spsblock->i_buffer; - if( p_spsextblock ) - i_alloc += p_spsextblock->i_buffer; - p_dec->fmt_out.p_extra = malloc( i_alloc ); + size_t i_total; + block_ChainProperties( p_xpsblocks, NULL, &i_total, NULL ); + p_dec->fmt_out.p_extra = malloc( i_total ); if( p_dec->fmt_out.p_extra ) { - uint8_t*p_buf = p_dec->fmt_out.p_extra; - p_dec->fmt_out.i_extra = i_alloc; - memcpy( p_buf, p_spsblock->p_buffer, p_spsblock->i_buffer ); - p_buf += p_spsblock->i_buffer; - if( p_spsextblock ) - { - memcpy( p_buf, p_spsextblock->p_buffer, p_spsextblock->i_buffer ); - p_buf += p_spsextblock->i_buffer; - } - memcpy( p_buf, p_ppsblock->p_buffer, p_ppsblock->i_buffer ); + p_dec->fmt_out.i_extra = i_total; + block_ChainExtract( p_xpsblocks, p_dec->fmt_out.p_extra, i_total ); } + block_ChainRelease( p_xpsblocks ); } } } @@ -485,15 +468,9 @@ static void Close( vlc_object_t *p_this ) { decoder_t *p_dec = (decoder_t*)p_this; decoder_sys_t *p_sys = p_dec->p_sys; - int i; DropStoredNAL( p_sys ); - for( i = 0; i <= H264_SPS_ID_MAX; i++ ) - StoreSPS( p_sys, i, NULL, NULL ); - for( i = 0; i <= H264_PPS_ID_MAX; i++ ) - StorePPS( p_sys, i, NULL, NULL ); - for( i = 0; i <= H264_SPSEXT_ID_MAX; i++ ) - StoreSPSEXT( p_sys, i, NULL ); + ReleaseXPS( p_sys ); packetizer_Clean( &p_sys->packetizer ); @@ -714,15 +691,9 @@ static block_t *ParseNALBlock( decoder_t *p_dec, bool *pb_ts_used, block_t *p_fr /* Stored for insert on keyframes */ if( i_nal_type == H264_NAL_SPS ) - { - PutSPS( p_dec, p_frag ); - p_sys->b_new_sps = true; - } + p_sys->b_new_sps |= PutXPS( p_dec, i_nal_type, p_frag ); else - { - PutPPS( p_dec, p_frag ); - p_sys->b_new_pps = true; - } + p_sys->b_new_pps |= PutXPS( p_dec, i_nal_type, p_frag ); break; case H264_NAL_SEI: @@ -734,7 +705,7 @@ static block_t *ParseNALBlock( decoder_t *p_dec, bool *pb_ts_used, block_t *p_fr break; case H264_NAL_SPS_EXT: - PutSPSEXT( p_dec, p_frag ); + PutXPS( p_dec, i_nal_type, p_frag ); if( p_sys->b_slice ) p_pic = OutputPicture( p_dec ); break; @@ -875,25 +846,8 @@ static block_t *OutputPicture( decoder_t *p_dec ) } /* Gather PPS/SPS if required */ - block_t *p_xpsnal = NULL; - block_t **pp_xpsnal_tail = &p_xpsnal; - if( b_need_sps_pps || p_sys->b_new_sps || p_sys->b_new_pps ) - { - for( int i = 0; i <= H264_SPS_ID_MAX && (b_need_sps_pps || p_sys->b_new_sps); i++ ) - { - if( p_sys->sps[i].p_block ) - block_ChainLastAppend( &pp_xpsnal_tail, block_Duplicate( p_sys->sps[i].p_block ) ); - /* 7.4.1.2.3, shall be the next NAL unit after a sequence parameter set NAL unit - * having the same value of seq_parameter_set_id */ - if( p_sys->spsext[i].p_block ) - block_ChainLastAppend( &pp_xpsnal_tail, block_Duplicate( p_sys->spsext[i].p_block ) ); - } - for( int i = 0; i < H264_PPS_ID_MAX && (b_need_sps_pps || p_sys->b_new_pps); i++ ) - { - if( p_sys->pps[i].p_block ) - block_ChainLastAppend( &pp_xpsnal_tail, block_Duplicate( p_sys->pps[i].p_block ) ); - } - } + block_t *p_xpsnal = GatherSets( p_sys, b_need_sps_pps|p_sys->b_new_sps, + b_need_sps_pps|p_sys->b_new_pps ); /* Now rebuild NAL Sequence, inserting PPS/SPS if any */ if( p_sys->leading.p_head && @@ -1089,90 +1043,130 @@ static block_t *OutputPicture( decoder_t *p_dec ) return p_pic; } -static void PutSPS( decoder_t *p_dec, block_t *p_frag ) +static int CmpXPS( const block_t *p_ref, const block_t *p_nal ) { - decoder_sys_t *p_sys = p_dec->p_sys; + return p_ref == NULL || + p_ref->i_buffer != p_nal->i_buffer || + memcmp( p_ref->p_buffer, p_nal->p_buffer, p_nal->i_buffer ); +} + +#define wrap_h264_xps_decode(funcname ) \ + static void *funcname ## _wrapper ( const uint8_t *a, size_t b, bool c ) \ + { return funcname(a,b,c); } - const uint8_t *p_buffer = p_frag->p_buffer; - size_t i_buffer = p_frag->i_buffer; +wrap_h264_xps_decode(h264_decode_sps) +wrap_h264_xps_decode(h264_decode_pps) - if( !hxxx_strip_AnnexB_startcode( &p_buffer, &i_buffer ) ) +#define wrap_h264_xps_release(funcname, typecast) \ + static void funcname ## _wrapper ( void *a ) { funcname((typecast *)a); } + +wrap_h264_xps_release(h264_release_sps, h264_sequence_parameter_set_t) +wrap_h264_xps_release(h264_release_pps, h264_picture_parameter_set_t) + +static void ReleaseXPS( decoder_sys_t *p_sys ) +{ + for( int i = 0; i <= H264_SPS_ID_MAX; i++ ) { - block_Release( p_frag ); - return; + if( !p_sys->sps[i].p_block ) + continue; + block_Release( p_sys->sps[i].p_block ); + h264_release_sps( p_sys->sps[i].p_sps ); } - - h264_sequence_parameter_set_t *p_sps = h264_decode_sps( p_buffer, i_buffer, true ); - if( !p_sps ) + for( int i = 0; i <= H264_PPS_ID_MAX; i++ ) { - msg_Warn( p_dec, "invalid SPS" ); - block_Release( p_frag ); - return; + if( !p_sys->pps[i].p_block ) + continue; + block_Release( p_sys->pps[i].p_block ); + h264_release_pps( p_sys->pps[i].p_pps ); } - - /* We have a new SPS */ - if( !p_sys->sps[p_sps->i_id].p_sps ) - msg_Dbg( p_dec, "found NAL_SPS (sps_id=%d)", p_sps->i_id ); - - StoreSPS( p_sys, p_sps->i_id, p_frag, p_sps ); + for( int i = 0; i <= H264_SPSEXT_ID_MAX; i++ ) + { + if( p_sys->spsext[i].p_block ) + block_Release( p_sys->spsext[i].p_block ); + } + p_sys->p_active_sps = NULL; + p_sys->p_active_pps = NULL; } -static void PutPPS( decoder_t *p_dec, block_t *p_frag ) +static bool PutXPS( decoder_t *p_dec, uint8_t i_nal_type, block_t *p_frag ) { decoder_sys_t *p_sys = p_dec->p_sys; - const uint8_t *p_buffer = p_frag->p_buffer; - size_t i_buffer = p_frag->i_buffer; - if( !hxxx_strip_AnnexB_startcode( &p_buffer, &i_buffer ) ) + uint8_t i_id; + if( !hxxx_strip_AnnexB_startcode( (const uint8_t **)&p_frag->p_buffer, + &p_frag->i_buffer ) || + !h264_get_xps_id( p_frag->p_buffer, p_frag->i_buffer, &i_id ) ) { block_Release( p_frag ); - return; + return false; } - h264_picture_parameter_set_t *p_pps = h264_decode_pps( p_buffer, i_buffer, true ); - if( !p_pps ) + const char * rgsz_types[3] = {"SPS", "PPS", "SPSEXT"}; + const char *psz_type; + block_t **pp_block_dst; + /* all depend on pp_xps_dst */ + void **pp_xps_dst = NULL; + const void **pp_active; /* optional */ + void * (* pf_decode_xps)(const uint8_t *, size_t, bool); + void (* pf_release_xps)(void *); + + switch( i_nal_type ) { - msg_Warn( p_dec, "invalid PPS" ); - block_Release( p_frag ); - return; + case H264_NAL_SPS: + psz_type = rgsz_types[0]; + pp_active = (const void **) &p_sys->p_active_sps; + pp_block_dst = &p_sys->sps[i_id].p_block; + pp_xps_dst = (void **) &p_sys->sps[i_id].p_sps; + pf_decode_xps = h264_decode_sps_wrapper; + pf_release_xps = h264_release_sps_wrapper; + break; + case H264_NAL_PPS: + psz_type = rgsz_types[1]; + pp_active = (const void **) &p_sys->p_active_pps; + pp_block_dst = &p_sys->pps[i_id].p_block; + pp_xps_dst = (void **) &p_sys->pps[i_id].p_pps; + pf_decode_xps = h264_decode_pps_wrapper; + pf_release_xps = h264_release_pps_wrapper; + break; + case H264_NAL_SPS_EXT: + psz_type = rgsz_types[2]; + pp_block_dst = &p_sys->spsext[i_id].p_block; + break; + default: + block_Release( p_frag ); + return false; } - /* We have a new PPS */ - if( !p_sys->pps[p_pps->i_id].p_pps ) - msg_Dbg( p_dec, "found NAL_PPS (pps_id=%d sps_id=%d)", p_pps->i_id, p_pps->i_sps_id ); - - StorePPS( p_sys, p_pps->i_id, p_frag, p_pps ); -} - -static void PutSPSEXT( decoder_t *p_dec, block_t *p_frag ) -{ - decoder_sys_t *p_sys = p_dec->p_sys; - const uint8_t *p_buffer = p_frag->p_buffer; - size_t i_buffer = p_frag->i_buffer; - - if( !hxxx_strip_AnnexB_startcode( &p_buffer, &i_buffer ) ) + if( !CmpXPS( *pp_block_dst, p_frag ) ) { block_Release( p_frag ); - return; + return false; } - h264_sequence_parameter_set_extension_t *p_spsext = - h264_decode_sps_extension( p_buffer, i_buffer, true ); - if( !p_spsext ) + msg_Dbg( p_dec, "found NAL_%s (id=%" PRIu8 ")", psz_type, i_id ); + + if( pp_xps_dst != NULL ) { - msg_Warn( p_dec, "invalid SPSEXT" ); - block_Release( p_frag ); - return; + void *p_xps = pf_decode_xps( p_frag->p_buffer, p_frag->i_buffer, true ); + if( !p_xps ) + { + block_Release( p_frag ); + return false; + } + if( *pp_xps_dst ) + { + if( pp_active && *pp_active == *pp_xps_dst ) + *pp_active = NULL; + pf_release_xps( *pp_xps_dst ); + } + *pp_xps_dst = p_xps; } - /* We have a new SPSEXT */ - if( !p_sys->spsext[p_spsext->i_sps_id].p_block ) - msg_Dbg( p_dec, "found NAL_SPSEXT (sps_id=%d)", p_spsext->i_sps_id ); + if( *pp_block_dst ) + block_Release( *pp_block_dst ); + *pp_block_dst = p_frag; - StoreSPSEXT( p_sys, p_spsext->i_sps_id, p_frag ); - - /* we don't need a decoded one */ - h264_release_sps_extension( p_spsext ); + return true; } static void GetSPSPPS( uint8_t i_pps_id, void *priv, ===================================== modules/packetizer/h264_nal.c ===================================== @@ -740,6 +740,41 @@ block_t *h264_NAL_to_avcC( uint8_t i_nal_length_size, return bo.b; } +bool h264_get_xps_id( const uint8_t *p_buf, size_t i_buf, uint8_t *pi_id ) +{ + if( i_buf < 2 ) + return false; + + /* No need to lookup convert from emulation for that data */ + uint8_t i_max, i_offset; + switch( h264_getNALType(p_buf) ) + { + case H264_NAL_SPS: + i_offset = 1 + 3 /* profile constraint level */; + i_max = H264_SPS_ID_MAX; + break; + case H264_NAL_PPS: + i_offset = 1; + i_max = H264_PPS_ID_MAX; + break; + case H264_NAL_SPS_EXT: + i_offset = 1; + i_max = H264_SPSEXT_ID_MAX; + break; + default: + return false; + } + + if( i_buf <= i_offset ) + return false; + + bs_t bs; + bs_init( &bs, &p_buf[i_offset], i_buf - i_offset ); + *pi_id = bs_read_ue( &bs ); + + return !bs_error( &bs ) && *pi_id <= i_max; +} + static const h264_level_limits_t * h264_get_level_limits( const h264_sequence_parameter_set_t *p_sps ) { uint16_t i_level_number = p_sps->i_level; ===================================== modules/packetizer/h264_nal.h ===================================== @@ -89,6 +89,8 @@ typedef struct h264_sequence_parameter_set_t h264_sequence_parameter_set_t; typedef struct h264_picture_parameter_set_t h264_picture_parameter_set_t; typedef struct h264_sequence_parameter_set_extension_t h264_sequence_parameter_set_extension_t; +bool h264_get_xps_id(const uint8_t *p_nalbuf, size_t i_nalbuf, uint8_t *pi_id); + h264_sequence_parameter_set_t * h264_decode_sps( const uint8_t *, size_t, bool ); h264_picture_parameter_set_t * h264_decode_pps( const uint8_t *, size_t, bool ); h264_sequence_parameter_set_extension_t * h264_decode_sps_extension( const uint8_t *, size_t, bool ); View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/120ce6a393099f95e414785bf45b12cd84d67742...ed97dd9fb80a2d02de8c3b756aaeb263f8b807bb -- View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/120ce6a393099f95e414785bf45b12cd84d67742...ed97dd9fb80a2d02de8c3b756aaeb263f8b807bb You're receiving this email because of your account on code.videolan.org. VideoLAN code repository instance From gitlab at videolan.org Tue Apr 11 05:52:07 2023 From: gitlab at videolan.org (Jean-Baptiste Kempf (@jbk)) Date: Tue, 11 Apr 2023 07:52:07 +0200 Subject: [vlc-commits] [Git][videolan/vlc][master] 12 commits: macosx: Ensure fullscreen button is hidden and not just resized when native... Message-ID: <6434f587b81f3_17088880df43c580378@gitlab.mail> Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC Commits: 68455f95 by Claudio Cambra at 2023-04-10T17:07:23+00:00 macosx: Ensure fullscreen button is hidden and not just resized when native fullscreen enabled, fixing visual bug in control bar Signed-off-by: Claudio Cambra <developer at claudiocambra.com> - - - - - 5b9b1e3c by Claudio Cambra at 2023-04-10T17:07:23+00:00 macosx: Add button cluster next to volume slider in VLCMainVideoView UI Signed-off-by: Claudio Cambra <developer at claudiocambra.com> - - - - - 781b30cc by Claudio Cambra at 2023-04-10T17:07:23+00:00 macosx: Add a VLCMainVideoViewControlsBar Signed-off-by: Claudio Cambra <developer at claudiocambra.com> - - - - - 1e6256b4 by Claudio Cambra at 2023-04-10T17:07:23+00:00 macosx: Enable bookmarks button in main video view to toggle bookmarks window Signed-off-by: Claudio Cambra <developer at claudiocambra.com> - - - - - 3d8f20a0 by Claudio Cambra at 2023-04-10T17:07:23+00:00 macosx: Hide subtitle button when there are no subtitle tracks available Signed-off-by: Claudio Cambra <developer at claudiocambra.com> - - - - - 21c17407 by Claudio Cambra at 2023-04-10T17:07:23+00:00 macosx: Hide audio tracks button when there are no subtitle tracks available Signed-off-by: Claudio Cambra <developer at claudiocambra.com> - - - - - e6cdd3e3 by Claudio Cambra at 2023-04-10T17:07:23+00:00 macosx: Update visibility of tracks buttons when current media item changes or tracks are changed Signed-off-by: Claudio Cambra <developer at claudiocambra.com> - - - - - 30f09909 by Claudio Cambra at 2023-04-10T17:07:23+00:00 macosx: Open subtitles menu when hitting subtitles button Signed-off-by: Claudio Cambra <developer at claudiocambra.com> - - - - - 729f31d3 by Claudio Cambra at 2023-04-10T17:07:23+00:00 macosx: Open audio menu when clicking audio menu button in main video view Signed-off-by: Claudio Cambra <developer at claudiocambra.com> - - - - - 27290173 by Claudio Cambra at 2023-04-10T17:07:23+00:00 macosx: Simplify audio and subtitle button handling as we are showing the full menu Signed-off-by: Claudio Cambra <developer at claudiocambra.com> - - - - - cf45b7a7 by Claudio Cambra at 2023-04-10T17:07:23+00:00 macosx: Add tooltips to subtitle and audio settings buttons Signed-off-by: Claudio Cambra <developer at claudiocambra.com> - - - - - 921a6a50 by Claudio Cambra at 2023-04-10T17:07:23+00:00 macosx: Constify pointers in VLCMainVideoViewControlsBar Signed-off-by: Claudio Cambra <developer at claudiocambra.com> - - - - - 6 changed files: - extras/package/macosx/VLC.xcodeproj/project.pbxproj - modules/gui/macosx/Makefile.am - modules/gui/macosx/UI/VLCMainVideoView.xib - modules/gui/macosx/windows/mainwindow/VLCControlsBarCommon.m - + modules/gui/macosx/windows/mainwindow/VLCMainVideoViewControlsBar.h - + modules/gui/macosx/windows/mainwindow/VLCMainVideoViewControlsBar.m Changes: ===================================== extras/package/macosx/VLC.xcodeproj/project.pbxproj ===================================== @@ -79,6 +79,7 @@ 5317FE04294E3DD3001702F0 /* VLCLibraryCollectionViewDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 5317FE03294E3DD3001702F0 /* VLCLibraryCollectionViewDelegate.m */; }; 5325C57D29302E6800B2B63A /* VLCLibraryAudioViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 5325C57B29302E6800B2B63A /* VLCLibraryAudioViewController.m */; }; 534E8E3A29A06325009503F8 /* VLCMainVideoViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 534E8E3929A06325009503F8 /* VLCMainVideoViewController.m */; }; + 5352B37329DF29BF0011CE03 /* VLCMainVideoViewControlsBar.m in Sources */ = {isa = PBXBuildFile; fileRef = 5352B37229DF29BF0011CE03 /* VLCMainVideoViewControlsBar.m */; }; 5362550D293FD639005D64FA /* VLCLibraryWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 5362550C293FD639005D64FA /* VLCLibraryWindowController.m */; }; 536283F0291146BC00640C15 /* VLCLibraryTableView.m in Sources */ = {isa = PBXBuildFile; fileRef = 536283DE291146BC00640C15 /* VLCLibraryTableView.m */; }; 536283F1291146BC00640C15 /* VLCLibraryAlbumTracksDataSource.m in Sources */ = {isa = PBXBuildFile; fileRef = 536283DF291146BC00640C15 /* VLCLibraryAlbumTracksDataSource.m */; }; @@ -258,6 +259,8 @@ 534E8E3729A04F95009503F8 /* VLCMainVideoView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = VLCMainVideoView.xib; sourceTree = ""; }; 534E8E3829A06325009503F8 /* VLCMainVideoViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VLCMainVideoViewController.h; sourceTree = ""; }; 534E8E3929A06325009503F8 /* VLCMainVideoViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VLCMainVideoViewController.m; sourceTree = ""; }; + 5352B37129DF29BF0011CE03 /* VLCMainVideoViewControlsBar.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VLCMainVideoViewControlsBar.h; sourceTree = ""; }; + 5352B37229DF29BF0011CE03 /* VLCMainVideoViewControlsBar.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VLCMainVideoViewControlsBar.m; sourceTree = ""; }; 5362550B293FD639005D64FA /* VLCLibraryWindowController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VLCLibraryWindowController.h; sourceTree = ""; }; 5362550C293FD639005D64FA /* VLCLibraryWindowController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VLCLibraryWindowController.m; sourceTree = ""; }; 536283DC291146BC00640C15 /* VLCLibraryAlbumTracksDataSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VLCLibraryAlbumTracksDataSource.h; sourceTree = ""; }; @@ -321,9 +324,9 @@ 53ED472A29C8FF9D00795DB1 /* VLCLibraryAlbumTracksTableViewDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VLCLibraryAlbumTracksTableViewDelegate.m; sourceTree = ""; }; 53ED472C29C907C200795DB1 /* VLCLibraryVideoTableViewDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VLCLibraryVideoTableViewDelegate.h; sourceTree = ""; }; 53ED472D29C907C200795DB1 /* VLCLibraryVideoTableViewDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VLCLibraryVideoTableViewDelegate.m; sourceTree = ""; }; - 53ED473729CAF67F00795DB1 /* VLCLibraryTableCellViewProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VLCLibraryTableCellViewProtocol.h; sourceTree = ""; }; 53ED473429CA4F3400795DB1 /* VLCLibraryTableViewDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VLCLibraryTableViewDelegate.h; sourceTree = ""; }; 53ED473529CA4F3400795DB1 /* VLCLibraryTableViewDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VLCLibraryTableViewDelegate.m; sourceTree = ""; }; + 53ED473729CAF67F00795DB1 /* VLCLibraryTableCellViewProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VLCLibraryTableCellViewProtocol.h; sourceTree = ""; }; 53ED473A29CBC64200795DB1 /* NSPasteboardItem+VLCAdditions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSPasteboardItem+VLCAdditions.h"; sourceTree = ""; }; 53ED473B29CBC64200795DB1 /* NSPasteboardItem+VLCAdditions.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NSPasteboardItem+VLCAdditions.m"; sourceTree = ""; }; 53F0E92B299B002300491D49 /* VLCInputNodePathControlItem.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VLCInputNodePathControlItem.h; sourceTree = ""; }; @@ -1034,6 +1037,8 @@ children = ( 1C1ED51D2205AC6B00811EC0 /* VLCControlsBarCommon.h */, E0382C01160BA09E0031D7FF /* VLCControlsBarCommon.m */, + 5352B37129DF29BF0011CE03 /* VLCMainVideoViewControlsBar.h */, + 5352B37229DF29BF0011CE03 /* VLCMainVideoViewControlsBar.m */, 7D5678EE1D5BA397002698F3 /* VLCMainWindowControlsBar.h */, 7D5678EF1D5BA397002698F3 /* VLCMainWindowControlsBar.m */, ); @@ -1897,6 +1902,7 @@ 7D61DCE4236C1937008133CF /* VLCCustomWindowButton.m in Sources */, 7DFFF90123682D4800C8B0C9 /* VLCDetachedAudioWindow.m in Sources */, 7D66D4392200C5B80040D04A /* VLCVideoFilterHelper.m in Sources */, + 5352B37329DF29BF0011CE03 /* VLCMainVideoViewControlsBar.m in Sources */, 7D445D812202524000263D34 /* VLCPlaylistController.m in Sources */, 7DFBDCBE226CED7200B700A5 /* VLCMediaSource.m in Sources */, 536283F2291146BC00640C15 /* VLCLibraryCollectionViewAlbumSupplementaryDetailView.m in Sources */, ===================================== modules/gui/macosx/Makefile.am ===================================== @@ -348,6 +348,8 @@ libmacosx_plugin_la_SOURCES = \ gui/macosx/windows/logging/VLCLogWindowController.m \ gui/macosx/windows/mainwindow/VLCControlsBarCommon.h \ gui/macosx/windows/mainwindow/VLCControlsBarCommon.m \ + gui/macosx/windows/mainwindow/VLCMainVideoViewControlsBar.h \ + gui/macosx/windows/mainwindow/VLCMainVideoViewControlsBar.m \ gui/macosx/windows/mainwindow/VLCMainWindowControlsBar.h \ gui/macosx/windows/mainwindow/VLCMainWindowControlsBar.m \ gui/macosx/windows/video/VLCAspectRatioRetainingVideoWindow.h \ ===================================== modules/gui/macosx/UI/VLCMainVideoView.xib ===================================== @@ -1,8 +1,8 @@ - + - + @@ -28,19 +28,20 @@ - + + + - + - @@ -80,7 +81,7 @@ - + @@ -97,34 +98,111 @@ - - + + - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + @@ -137,20 +215,6 @@ - @@ -197,7 +261,7 @@