]> git.sesse.net Git - vlc/commitdiff
* Show meta-information separately
authorClément Stenac <zorglub@videolan.org>
Sun, 19 Feb 2006 16:16:56 +0000 (16:16 +0000)
committerClément Stenac <zorglub@videolan.org>
Sun, 19 Feb 2006 16:16:56 +0000 (16:16 +0000)
* Collect more meta-information in id3

include/vlc_meta.h
modules/demux/util/id3tag.c
modules/gui/wxwidgets/dialogs/fileinfo.cpp
modules/gui/wxwidgets/dialogs/fileinfo.hpp
modules/gui/wxwidgets/dialogs/infopanels.cpp
modules/gui/wxwidgets/dialogs/infopanels.hpp
modules/gui/wxwidgets/dialogs/iteminfo.cpp
modules/gui/wxwidgets/dialogs/iteminfo.hpp

index fc6933aa0c6c03925b6cbff46aa1f53210094f81..5041fbfb92458eddc317f780b139afef71d6f938 100644 (file)
@@ -40,6 +40,7 @@
 #define VLC_META_URL                N_("URL")
 #define VLC_META_LANGUAGE           N_("Language")
 #define VLC_META_NOW_PLAYING        N_("Now Playing")
+#define VLC_META_PUBLISHER          N_("Publisher")
 
 #define VLC_META_CDDB_ARTIST        N_("CDDB Artist")
 #define VLC_META_CDDB_CATEGORY      N_("CDDB Category")
index a3b41dd2247fef92cf52183940d9f5e6486fba13..15ad5f3d41cd414a4eba2b7c46a19ba010a90626 100644 (file)
@@ -107,6 +107,26 @@ static void ParseID3Tag( demux_t *p_demux, uint8_t *p_data, int i_size )
                 vlc_meta_Add( (vlc_meta_t *)p_demux->p_private,
                               VLC_META_ARTIST, psz_temp );
             }
+            else if( !strcmp(p_frame->id, ID3_FRAME_YEAR ) )
+            {
+                vlc_meta_Add( (vlc_meta_t *)p_demux->p_private,
+                              VLC_META_DATE, psz_temp );
+            }
+            else if( !strcmp(p_frame->id, ID3_FRAME_COMMENT ) )
+            {
+                vlc_meta_Add( (vlc_meta_t *)p_demux->p_private,
+                              VLC_META_DESCRIPTION, psz_temp );
+            }
+            else if( strstr( (char*)p_frame->description, "Copyright" ) )
+            {
+                vlc_meta_Add( (vlc_meta_t *)p_demux->p_private,
+                              VLC_META_COPYRIGHT, psz_temp );
+            }
+            else if( strstr( (char*)p_frame->description, "Publisher" ) )
+            {
+                vlc_meta_Add( (vlc_meta_t *)p_demux->p_private,
+                              VLC_META_PUBLISHER, psz_temp );
+            }
             else
             {
                 /* Unknown meta info */
index 7109f30046745f19d5fd6dba237453a5b1d668b6..a591801ef0c78e99ea52bb6d70c2cb84a8b9209f 100644 (file)
@@ -69,10 +69,12 @@ FileInfo::FileInfo( intf_thread_t *_p_intf, wxWindow *p_parent ):
 #if (!wxCHECK_VERSION(2,5,2))
         wxNotebookSizer *notebook_sizer = new wxNotebookSizer( notebook );
 #endif
-    item_info = new ItemInfoPanel( p_intf, notebook, false );
+    item_info = new MetaDataPanel( p_intf, notebook, false );
+    advanced_info = new AdvancedInfoPanel( p_intf, notebook );
     stats_info = new InputStatsInfoPanel( p_intf, notebook );
 
     notebook->AddPage( item_info, wxU(_("General") ), true );
+    notebook->AddPage( advanced_info, wxU(_("Advanced information") ), false );
     notebook->AddPage( stats_info, wxU(_("Statistics") ), false );
 
 #if (!wxCHECK_VERSION(2,5,2))
@@ -84,7 +86,6 @@ FileInfo::FileInfo( intf_thread_t *_p_intf, wxWindow *p_parent ):
     panel_sizer->Layout();
     SetSizerAndFit( panel_sizer );
 
-
     if( p_playlist )
     {
         var_AddCallback( p_playlist, "item-change", ItemChanged, this );
@@ -112,6 +113,7 @@ void FileInfo::Update()
     if( !p_input || p_input->b_dead || !p_input->input.p_item->psz_name )
     {
         item_info->Clear();
+        advanced_info->Clear();
         stats_info->Clear();
         vlc_object_release( p_playlist );
         return;
@@ -121,7 +123,10 @@ void FileInfo::Update()
     vlc_mutex_lock( &p_input->input.p_item->lock );
     if( b_need_update == VLC_TRUE )
     {
+        vlc_mutex_unlock( &p_input->input.p_item->lock  );
         item_info->Update( p_input->input.p_item );
+        vlc_mutex_lock( &p_input->input.p_item->lock  );
+        advanced_info->Update( p_input->input.p_item );
     }
     stats_info->Update( p_input->input.p_item );
     vlc_mutex_unlock( &p_input->input.p_item->lock );
index 04268a78989c34faab4cfc61e89f2f77dd95bcb0..3884343cc9d6403f2f4bc7e3603846453b3a5c88 100644 (file)
@@ -30,7 +30,8 @@
 
 namespace wxvlc
 {
-    class ItemInfoPanel;
+    class MetaDataPanel;
+    class AdvancedInfoPanel;
     class InputStatsInfoPanel;
     class FileInfo: public wxFrame
     {
@@ -52,7 +53,8 @@ namespace wxvlc
 
         mtime_t last_update;
 
-        ItemInfoPanel *item_info;
+        MetaDataPanel *item_info;
+        AdvancedInfoPanel *advanced_info;
         InputStatsInfoPanel *stats_info;
 
         wxBoxSizer *panel_sizer;
index d1169bd27cd28ac7174d917264210e7266cfa574..a5217de177ee22029e04f003ae1081af7dcc1bc7 100644 (file)
 #include <wx/combobox.h>
 #include <wx/statline.h>
 
+#include <vlc_meta.h>
+
 #ifndef wxRB_SINGLE
 #   define wxRB_SINGLE 0
 #endif
 
 /*****************************************************************************
- * General info panel
+ * General info (URI, name, metadata)
  *****************************************************************************/
-BEGIN_EVENT_TABLE( ItemInfoPanel, wxPanel )
+BEGIN_EVENT_TABLE( MetaDataPanel, wxPanel )
 END_EVENT_TABLE()
 
-ItemInfoPanel::ItemInfoPanel( intf_thread_t *_p_intf,
+MetaDataPanel::MetaDataPanel( intf_thread_t *_p_intf,
                               wxWindow* _p_parent,
                               bool _b_modifiable ):
     wxPanel( _p_parent, -1 )
@@ -73,6 +75,118 @@ ItemInfoPanel::ItemInfoPanel( intf_thread_t *_p_intf,
     name_text = new wxTextCtrl( this, -1,
             wxU(""), wxDefaultPosition, wxSize( 300, -1 ), flags );
     sizer->Add( name_text, 1 , wxALL|wxEXPAND , 0 );
+    sizer->Layout();
+
+    /* Metadata */
+    wxFlexGridSizer *meta_sizer = new wxFlexGridSizer(2,11,20);
+    meta_sizer->AddGrowableCol(1);
+
+#define ADD_META( string, widget ) {                                        \
+        meta_sizer->Add( new wxStaticText( this, -1, wxU(_(string) ) ),1,   \
+                         wxTOP|wxRIGHT|wxLEFT|wxEXPAND, 0 );                \
+        widget = new wxStaticText( this, -1, wxU( "" ) );                   \
+        meta_sizer->Add( widget, 1, wxTOP|wxRIGHT|wxLEFT|wxEXPAND, 0 ); }
+
+    ADD_META( VLC_META_ARTIST, artist_text );
+    ADD_META( VLC_META_GENRE, genre_text );
+    ADD_META( VLC_META_COPYRIGHT, copyright_text );
+    ADD_META( VLC_META_COLLECTION, collection_text );
+    ADD_META( VLC_META_SEQ_NUM, seqnum_text );
+    ADD_META( VLC_META_DESCRIPTION, description_text );
+    ADD_META( VLC_META_RATING, rating_text );
+    ADD_META( VLC_META_DATE, date_text );
+    ADD_META( VLC_META_LANGUAGE, language_text );
+    ADD_META( VLC_META_NOW_PLAYING, nowplaying_text );
+    ADD_META( VLC_META_PUBLISHER, publisher_text );
+
+    meta_sizer->Layout();
+
+    panel_sizer->Add( sizer, 0, wxEXPAND | wxALL, 5 );
+    panel_sizer->Add( meta_sizer, 0, wxEXPAND | wxALL, 5 );
+    panel_sizer->Layout();
+    SetSizerAndFit( panel_sizer );
+}
+
+MetaDataPanel::~MetaDataPanel()
+{
+}
+
+void MetaDataPanel::Update( input_item_t *p_item )
+{
+    /* Rebuild the tree */
+    Clear();
+
+    uri_text->SetValue( wxU( p_item->psz_uri ) );
+    name_text->SetValue( wxU( p_item->psz_name ) );
+
+#define UPDATE_META( meta, widget ) {                                       \
+    char *psz_meta = vlc_input_item_GetInfo( p_item, _(VLC_META_INFO_CAT),  \
+                                            _(meta) );                      \
+    if( psz_meta != NULL )                                                  \
+    {                                                                       \
+        widget->SetLabel( wxU( psz_meta ) );                                \
+    }                                                                       \
+    }
+
+    UPDATE_META( VLC_META_ARTIST, artist_text );
+    UPDATE_META( VLC_META_GENRE, genre_text );
+    UPDATE_META( VLC_META_COPYRIGHT, copyright_text );
+    UPDATE_META( VLC_META_COLLECTION, collection_text );
+    UPDATE_META( VLC_META_SEQ_NUM, seqnum_text );
+    UPDATE_META( VLC_META_DESCRIPTION, description_text );
+    UPDATE_META( VLC_META_RATING, rating_text );
+    UPDATE_META( VLC_META_DATE, date_text );
+    UPDATE_META( VLC_META_LANGUAGE, language_text );
+    UPDATE_META( VLC_META_NOW_PLAYING, nowplaying_text );
+    UPDATE_META( VLC_META_PUBLISHER, publisher_text );
+
+#undef UPDATE_META
+}
+
+char* MetaDataPanel::GetURI( )
+{
+    return  strdup( uri_text->GetLineText(0).mb_str() );
+}
+
+char* MetaDataPanel::GetName( )
+{
+    return  strdup( name_text->GetLineText(0).mb_str() );
+}
+
+void MetaDataPanel::Clear()
+{
+}
+
+void MetaDataPanel::OnOk( )
+{
+}
+
+void MetaDataPanel::OnCancel( )
+{
+}
+
+
+/*****************************************************************************
+ * General info panel
+ *****************************************************************************/
+BEGIN_EVENT_TABLE( AdvancedInfoPanel, wxPanel )
+END_EVENT_TABLE()
+
+AdvancedInfoPanel::AdvancedInfoPanel( intf_thread_t *_p_intf,
+                                      wxWindow* _p_parent ):
+    wxPanel( _p_parent, -1 )
+{
+    int flags= wxTE_PROCESS_ENTER;
+    /* Initializations */
+    p_intf = _p_intf;
+    p_parent = _p_parent;
+
+    SetAutoLayout( TRUE );
+
+    wxBoxSizer *panel_sizer = new wxBoxSizer( wxVERTICAL );
+
+    wxFlexGridSizer *sizer = new wxFlexGridSizer(2,8,20);
+    sizer->AddGrowableCol(1);
 
     /* Treeview */
     info_tree = new wxTreeCtrl( this, -1, wxDefaultPosition,
@@ -81,25 +195,20 @@ ItemInfoPanel::ItemInfoPanel( intf_thread_t *_p_intf,
                                 wxTR_HIDE_ROOT );
     info_root = info_tree->AddRoot( wxU( "" ) );
 
-    sizer->Layout();
-    panel_sizer->Add( sizer, 0, wxEXPAND | wxALL, 15 );
     panel_sizer->Add( info_tree, 1, wxEXPAND | wxALL, 5 );
     panel_sizer->Layout();
     SetSizerAndFit( panel_sizer );
 }
 
-ItemInfoPanel::~ItemInfoPanel()
+AdvancedInfoPanel::~AdvancedInfoPanel()
 {
 }
 
-void ItemInfoPanel::Update( input_item_t *p_item )
+void AdvancedInfoPanel::Update( input_item_t *p_item )
 {
     /* Rebuild the tree */
     Clear();
 
-    uri_text->SetValue( wxU( p_item->psz_uri ) );
-    name_text->SetValue( wxU( p_item->psz_name ) );
-
     for( int i = 0; i< p_item->i_categories ; i++)
     {
         wxTreeItemId cat = info_tree->AppendItem( info_root,
@@ -117,26 +226,16 @@ void ItemInfoPanel::Update( input_item_t *p_item )
     }
 }
 
-char* ItemInfoPanel::GetURI( )
-{
-    return  strdup( uri_text->GetLineText(0).mb_str() );
-}
-
-char* ItemInfoPanel::GetName( )
-{
-    return  strdup( name_text->GetLineText(0).mb_str() );
-}
-
-void ItemInfoPanel::Clear()
+void AdvancedInfoPanel::Clear()
 {
     info_tree->DeleteChildren( info_root );
 }
 
-void ItemInfoPanel::OnOk( )
+void AdvancedInfoPanel::OnOk( )
 {
 }
 
-void ItemInfoPanel::OnCancel( )
+void AdvancedInfoPanel::OnCancel( )
 {
 }
 
index e7888fa9e18bbd1984ea6b67d1e63018b01cf2af..a355b9a1bdcadd0b309f71e313ed8952a3246b67 100644 (file)
 
 namespace wxvlc
 {
-class ItemInfoPanel: public wxPanel
+class MetaDataPanel: public wxPanel
 {
 public:
     /* Constructor */
-    ItemInfoPanel( intf_thread_t *p_intf, wxWindow *p_parent, bool );
-    virtual ~ItemInfoPanel();
+    MetaDataPanel( intf_thread_t *p_intf, wxWindow *p_parent, bool );
+    virtual ~MetaDataPanel();
+
+    void Update( input_item_t *);
+    void Clear();
+
+    char* GetURI();
+    char* GetName();
+
+    void OnOk();
+    void OnCancel();
+
+private:
+    DECLARE_EVENT_TABLE();
+
+    intf_thread_t *p_intf;
+    input_item_t *p_item;
+    wxWindow *p_parent;
+
+    wxTextCtrl *uri_text;
+    wxTextCtrl *name_text;
+    wxStaticText *uri_label;
+    wxStaticText *name_label;
+
+    wxStaticText *artist_text;
+    wxStaticText *genre_text;
+    wxStaticText *copyright_text;
+    wxStaticText *collection_text;
+    wxStaticText *seqnum_text;
+    wxStaticText *description_text;
+    wxStaticText *rating_text;
+    wxStaticText *date_text;
+    wxStaticText *setting_text;
+    wxStaticText *language_text;
+    wxStaticText *nowplaying_text;
+    wxStaticText *publisher_text;
+
+    bool b_modifiable;
+};
+
+
+class AdvancedInfoPanel: public wxPanel
+{
+public:
+    /* Constructor */
+    AdvancedInfoPanel( intf_thread_t *p_intf, wxWindow *p_parent );
+    virtual ~AdvancedInfoPanel();
 
     void Update( input_item_t *);
     void Clear();
index f767f903ce8eb671432566fd34d2a6155906791e..116c0faec79e2c6735f574378d4023aeff62a031 100644 (file)
@@ -69,7 +69,7 @@ ItemInfoDialog::ItemInfoDialog( intf_thread_t *_p_intf,
     panel->SetAutoLayout( TRUE );
 
     /* Create the standard info panel */
-    info_panel = new ItemInfoPanel(p_intf, panel, true );
+    info_panel = new MetaDataPanel(p_intf, panel, true );
     info_panel->Update( &(p_item->input) );
     /* Separation */
     wxStaticLine *static_line = new wxStaticLine( panel, wxID_OK );
index 5a096330eeeeea48513c7635e79a9533e0f944bb..5a1549f8b42c05219f5e1ca402812b50414671dd 100644 (file)
@@ -57,7 +57,7 @@ private:
 
     /* Controls for the iteminfo dialog box */
     wxPanel *info_subpanel;
-    ItemInfoPanel *info_panel;
+    MetaDataPanel *info_panel;
 
     wxPanel *group_subpanel;
     wxPanel *group_panel;