]> git.sesse.net Git - vlc/commitdiff
ALL: backport of 13058,13059,13070,13088,13090,13091,13099 from trunk.
authorGildas Bazin <gbazin@videolan.org>
Wed, 2 Nov 2005 18:16:58 +0000 (18:16 +0000)
committerGildas Bazin <gbazin@videolan.org>
Wed, 2 Nov 2005 18:16:58 +0000 (18:16 +0000)
modules/codec/ffmpeg/demux.c
modules/codec/x264.c
modules/gui/wxwidgets/playlist.cpp
modules/gui/wxwidgets/wxwidgets.h
modules/stream_out/transcode.c

index 86e4aaec3ab3c8a3aa1d1127ada54d255caad9c3..6ab01e01329e2547187d7646b7a00ad124192e16 100644 (file)
@@ -191,8 +191,17 @@ int E_(OpenDemux)( vlc_object_t *p_this )
         vlc_fourcc_t fcc;
 
         if( !E_(GetVlcFourcc)( cc->codec_id, NULL, &fcc, NULL ) )
+        {
             fcc = VLC_FOURCC( 'u', 'n', 'd', 'f' );
 
+            /* Special case for raw video data */
+            if( cc->codec_id == CODEC_ID_RAWVIDEO )
+            {
+                msg_Dbg( p_demux, "raw video, pixel format: %i", cc->pix_fmt );
+                fcc = E_(GetVlcChroma)( cc->pix_fmt );
+            }
+        }
+
         switch( cc->codec_type )
         {
         case CODEC_TYPE_AUDIO:
index 8a42f29f3da1534521f3144daa391c20b1a6f1a3..1a82a6eacb2da5f490d3889488c3048495fd0a43 100644 (file)
@@ -236,6 +236,7 @@ static int  Open ( vlc_object_t *p_this )
         return VLC_EGENERIC;
     }
 
+#if X264_BUILD < 37
     if( p_enc->fmt_in.video.i_width % 16 != 0 ||
         p_enc->fmt_in.video.i_height % 16!= 0 )
     {
@@ -253,6 +254,7 @@ static int  Open ( vlc_object_t *p_this )
                   p_enc->fmt_in.video.i_width >> 4 << 4,
                   p_enc->fmt_in.video.i_height >> 4 << 4 );
     }
+#endif
 
     sout_CfgParse( p_enc, SOUT_CFG_PREFIX, ppsz_sout_options, p_enc->p_cfg );
 
@@ -265,8 +267,12 @@ static int  Open ( vlc_object_t *p_this )
     p_sys->i_last_ref_pts = 0;
 
     x264_param_default( &p_sys->param );
-    p_sys->param.i_width  = p_enc->fmt_in.video.i_width >> 4 << 4;
-    p_sys->param.i_height = p_enc->fmt_in.video.i_height >> 4 << 4;
+    p_sys->param.i_width  = p_enc->fmt_in.video.i_width;
+    p_sys->param.i_height = p_enc->fmt_in.video.i_height;
+#if X264_BUILD < 37
+    p_sys->param.i_width  = p_sys->param.i_width >> 4 << 4;
+    p_sys->param.i_height = p_sys->param.i_height >> 4 << 4;
+#endif
 
     var_Get( p_enc, SOUT_CFG_PREFIX "qp-min", &val );
     if( val.i_int >= 1 && val.i_int <= 51 ) i_qmin = val.i_int;
index b17ea0a75144e21b41be54965903e4d30b3a8803..e6256c0bcfe6826f46fa822f8a6630b725c18ffc 100644 (file)
@@ -204,6 +204,7 @@ Playlist::Playlist( intf_thread_t *_p_intf, wxWindow *p_parent ):
     i_update_counter = 0;
     i_sort_mode = MODE_NONE;
     b_need_update = VLC_FALSE;
+    i_items_to_append = 0;
     p_playlist = (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
                                                 FIND_ANYWHERE );
     if( p_playlist == NULL ) return;
@@ -483,15 +484,23 @@ void Playlist::UpdateTreeItem( wxTreeItemId item )
     LockPlaylist( p_intf->p_sys, p_playlist );
     playlist_item_t *p_item = playlist_ItemGetById( p_playlist,
                                           ((PlaylistItem *)p_data)->i_id );
-    if( !p_item ) return;
+    if( !p_item )
+    {
+        UnlockPlaylist( p_intf->p_sys, p_playlist );
+        return;
+    }
 
     wxString msg;
     wxString duration = wxU( "" );
     char *psz_author = vlc_input_item_GetInfo( &p_item->input,
                                                      _("Meta-information"),
                                                      _("Artist"));
-    if( psz_author == NULL )
+    if( !psz_author )
+    {
+        UnlockPlaylist( p_intf->p_sys, p_playlist );
         return;
+    }
+
     char psz_duration[MSTRTIME_MAX_SIZE];
     mtime_t dur = p_item->input.i_duration;
 
@@ -518,7 +527,11 @@ void Playlist::UpdateTreeItem( wxTreeItemId item )
     if( p_playlist->status.p_item == p_item )
     {
         treectrl->SetItemBold( item, true );
-        treectrl->EnsureVisible( item );
+        while( treectrl->GetItemParent( item ).IsOk() )
+        {
+            item = treectrl->GetItemParent( item );
+            treectrl->Expand( item );
+        }
     }
     else
     {
@@ -532,23 +545,23 @@ void Playlist::AppendItem( wxCommandEvent& event )
 {
     playlist_add_t *p_add = (playlist_add_t *)event.GetClientData();
     playlist_item_t *p_item = NULL;
+    wxTreeItemId item, node;
 
-    wxTreeItemId item,node;
+    i_items_to_append--;
 
-    if( p_add->i_view != i_current_view )
-    {
-        goto update;
-    }
+    /* No need to do anything if the playlist is going to be rebuilt */
+    if( b_need_update ) return;
+
+    if( p_add->i_view != i_current_view ) goto update;
 
     node = FindItem( treectrl->GetRootItem(), p_add->i_node );
-    if( !node.IsOk() )
-    {
-        goto update;
-    }
+    if( !node.IsOk() ) goto update;
 
     p_item = playlist_ItemGetById( p_playlist, p_add->i_item );
-    if( !p_item )
-        goto update;
+    if( !p_item ) goto update;
+
+    item = FindItem( treectrl->GetRootItem(), p_add->i_item );
+    if( item.IsOk() ) goto update;
 
     item = treectrl->AppendItem( node,
                                  wxL2U( p_item->input.psz_name ), -1,-1,
@@ -747,6 +760,8 @@ void Playlist::Rebuild( vlc_bool_t b_root )
 {
     playlist_view_t *p_view;
 
+    i_items_to_append = 0;
+
     /* We can remove the callbacks before locking, anyway, we won't
      * miss anything */
     if( b_root )
@@ -851,21 +866,13 @@ void Playlist::DeleteTreeItem( wxTreeItemId item )
        return;
    }
 
-   if( p_item->i_children == -1 )
-   {
-       UnlockPlaylist( p_intf->p_sys, p_playlist );
-       DeleteItem( p_item->input.i_id );
-   }
-   else
-   {
-       UnlockPlaylist( p_intf->p_sys, p_playlist );
-       DeleteNode( p_item );
-   }
+   if( p_item->i_children == -1 ) DeleteItem( p_item->input.i_id );
+   else DeleteNode( p_item );
+
    RemoveItem( item );
+   UnlockPlaylist( p_intf->p_sys, p_playlist );
 }
 
-
-
 void Playlist::DeleteItem( int item_id )
 {
     playlist_LockDelete( p_playlist, item_id );
@@ -1078,7 +1085,11 @@ void Playlist::OnActivateItem( wxTreeEvent& event )
 
     LockPlaylist( p_intf->p_sys, p_playlist );
 
-    if( !( p_wxitem && p_wxparent ) ) return;
+    if( !( p_wxitem && p_wxparent ) )
+    {
+        UnlockPlaylist( p_intf->p_sys, p_playlist );
+        return;
+    }
 
     p_item2 = playlist_ItemGetById(p_playlist, p_wxitem->i_id);
     p_node2 = playlist_ItemGetById(p_playlist, p_wxparent->i_id);
@@ -1505,9 +1516,16 @@ static int ItemAppended( vlc_object_t *p_this, const char *psz_variable,
     Playlist *p_playlist_dialog = (Playlist *)param;
 
     playlist_add_t *p_add = (playlist_add_t *)malloc(sizeof( playlist_add_t));
-
     memcpy( p_add, nval.p_address, sizeof( playlist_add_t ) );
 
+    if( p_playlist_dialog->i_items_to_append++ > 50 )
+    {
+        /* Too many items waiting to be added, it will be quicker to rebuild
+         * the whole playlist */
+        p_playlist_dialog->b_need_update = VLC_TRUE;
+        return VLC_SUCCESS;
+    }
+
     wxCommandEvent event( wxEVT_PLAYLIST, AppendItem_Event );
     event.SetClientData( (void *)p_add );
     p_playlist_dialog->AddPendingEvent( event );
index 5177d2576315778127affe79921f13ada6fd118e..e97463f85da3fcef4d111cd37356f031fd550094 100644 (file)
@@ -878,6 +878,7 @@ public:
     void AppendItem( wxCommandEvent& );
 
     bool b_need_update;
+    int  i_items_to_append;
 
 private:
     void RemoveItem( int );
index eeb8f18cb4b22622255c008a354a0b486a259765..e4fd880ae7c33e2d5d39f59724f7c40b4f2b4d68 100644 (file)
@@ -1500,6 +1500,8 @@ static int transcode_video_new( sout_stream_t *p_stream, sout_stream_id_t *id )
     /* Close the encoder.
      * We'll open it only when we have the first frame. */
     module_Unneed( id->p_encoder, id->p_encoder->p_module );
+    if( id->p_encoder->fmt_out.p_extra )
+        free( id->p_encoder->fmt_out.p_extra );
     id->p_encoder->p_module = NULL;
 
     if( p_sys->i_threads >= 1 )