[vlc-commits] [Git][videolan/vlc][master] 2 commits: meta: return a failure if no meta writer module is found in input_item_WriteMeta

Steve Lhomme (@robUx4) gitlab at videolan.org
Sun Nov 23 07:55:33 UTC 2025



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
019f945e by Pierre Lamot at 2025-11-23T07:31:58+00:00
meta: return a failure if no meta writer module is found in input_item_WriteMeta

- - - - -
de6a6b6e by Pierre Lamot at 2025-11-23T07:31:58+00:00
qt: open an error dialog when saving metadata fails

- - - - -


4 changed files:

- modules/gui/qt/dialogs/mediainfo/info_panels.cpp
- modules/gui/qt/dialogs/mediainfo/info_panels.hpp
- modules/gui/qt/dialogs/mediainfo/mediainfo.cpp
- src/input/meta.c


Changes:

=====================================
modules/gui/qt/dialogs/mediainfo/info_panels.cpp
=====================================
@@ -50,6 +50,7 @@
 #include <QApplication>
 #include <QPushButton>
 #include <QRegularExpression>
+#include <QMessageBox>
 
 /************************************************************************
  * Single panels
@@ -255,12 +256,14 @@ void MetaPanel::update( const SharedInputItem& p_item )
 /**
  * Save the MetaData, triggered by parent->save Button
  **/
-void MetaPanel::saveMeta()
+bool MetaPanel::saveMeta()
 {
     const auto input = p_input.get();
 
-    if( input == NULL )
-        return;
+    if( input == NULL ) {
+        QMessageBox::warning( this, qtr("Metadata"), qtr("Not editing a file") );
+        return false;
+    }
 
     /* now we read the modified meta data */
     input_item_SetTitle(  input, qtu( title_text->text() ) );
@@ -276,11 +279,15 @@ void MetaPanel::saveMeta()
     input_item_SetPublisher( input, qtu( publisher_text->text() ) );
     input_item_SetDescription( input, qtu( description_text->toPlainText() ) );
 
-    input_item_WriteMeta( VLC_OBJECT(p_intf), input );
-
     /* Reset the status of the mode. No need to emit any signal because parent
        is the only caller */
     b_inEditMode = false;
+    int vlcret = input_item_WriteMeta( VLC_OBJECT(p_intf), input );
+    if (vlcret != VLC_SUCCESS) {
+        QMessageBox::warning( this, qtr("Metadata"), qtr("Failed to save metadata") );
+        return false;
+    }
+    return true;
 }
 
 


=====================================
modules/gui/qt/dialogs/mediainfo/info_panels.hpp
=====================================
@@ -50,7 +50,7 @@ class MetaPanel: public QWidget
     Q_OBJECT
 public:
     MetaPanel( QWidget *, qt_intf_t * );
-    void saveMeta();
+    bool saveMeta();
 
     bool isInEditMode();
     void setEditMode( bool );


=====================================
modules/gui/qt/dialogs/mediainfo/mediainfo.cpp
=====================================
@@ -152,8 +152,9 @@ int MediaInfoDialog::currentTab()
 
 void MediaInfoDialog::saveMeta()
 {
-    MP->saveMeta();
-    saveMetaButton->hide();
+    bool success = MP->saveMeta();
+    if (success)
+        saveMetaButton->hide();
 }
 
 void MediaInfoDialog::updateAllTabs( const SharedInputItem& p_item )


=====================================
src/input/meta.c
=====================================
@@ -311,8 +311,10 @@ int input_item_WriteMeta( vlc_object_t *obj, input_item_t *p_item )
         goto error;
 
     module_t *p_mod = module_need( p_export, "meta writer", NULL, false );
-    if( p_mod )
-        module_unneed( p_export, p_mod );
+    if( !p_mod )
+      goto error;
+
+    module_unneed( p_export, p_mod );
     vlc_object_delete(p_export);
     return VLC_SUCCESS;
 



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/0b2f6feffc77f202389bd50654df65fb7bca45e6...de6a6b6e29afe5b3cf79f02483c24aa12baa9b24

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


VideoLAN code repository instance


More information about the vlc-commits mailing list