vlc/vlc-2.2 | branch: master | Timothy B. Terriberry <[email protected]> | Sat Sep 20 10:16:33 2014 -0700| [46613a9d6b7f725038764b7615c2122e472aa481] | committer: Jean-Baptiste Kempf
input: Tag attachments with the demuxer that produced them This way, when metadata is updated, we only replace the attachments produced by the demuxer whose metadata changed. Fixes #11976 Tested by reverting the patch in #11966 (with some fix-ups to pass the right arguments where the code had changed). Signed-off-by: Rémi Denis-Courmont <[email protected]> (cherry picked from commit 223a42c1ec748dd5a0b338c90c571a37483f3297) Signed-off-by: Jean-Baptiste Kempf <[email protected]> > http://git.videolan.org/gitweb.cgi/vlc/vlc-2.2.git/?a=commit;h=46613a9d6b7f725038764b7615c2122e472aa481 --- src/input/input.c | 46 +++++++++++++++++++++++++++++++------------- src/input/input_internal.h | 1 + 2 files changed, 34 insertions(+), 13 deletions(-) diff --git a/src/input/input.c b/src/input/input.c index 8affd94..41c1a99 100644 --- a/src/input/input.c +++ b/src/input/input.c @@ -98,8 +98,8 @@ static void InputGetExtraFiles( input_thread_t *p_input, int *pi_list, char ***pppsz_list, const char *psz_access, const char *psz_path ); -static void AppendAttachment( int *pi_attachment, input_attachment_t ***ppp_attachment, - int i_new, input_attachment_t **pp_new ); +static void AppendAttachment( int *pi_attachment, input_attachment_t ***ppp_attachment, demux_t ***ppp_attachment_demux, + int i_new, input_attachment_t **pp_new, demux_t *p_demux ); enum { SUB_NOFLAG = 0x00, @@ -342,6 +342,7 @@ static input_thread_t *Create( vlc_object_t *p_parent, input_item_t *p_item, memset( &p_input->p->bookmark, 0, sizeof(p_input->p->bookmark) ); TAB_INIT( p_input->p->i_bookmark, p_input->p->pp_bookmark ); TAB_INIT( p_input->p->i_attachment, p_input->p->attachment ); + p_input->p->attachment_demux = NULL; p_input->p->p_sout = NULL; p_input->p->b_out_pace_control = false; @@ -1406,6 +1407,8 @@ static void End( input_thread_t * p_input ) for( i = 0; i < p_input->p->i_attachment; i++ ) vlc_input_attachment_Delete( p_input->p->attachment[i] ); TAB_CLEAN( p_input->p->i_attachment, p_input->p->attachment ); + free( p_input->p->attachment_demux); + p_input->p->attachment_demux = NULL; } vlc_mutex_unlock( &p_input->p->p_item->lock ); @@ -2458,8 +2461,8 @@ static int InputSourceInit( input_thread_t *p_input, &attachment, &i_attachment ) ) { vlc_mutex_lock( &p_input->p->p_item->lock ); - AppendAttachment( &p_input->p->i_attachment, &p_input->p->attachment, - i_attachment, attachment ); + AppendAttachment( &p_input->p->i_attachment, &p_input->p->attachment, &p_input->p->attachment_demux, + i_attachment, attachment, in->p_demux ); vlc_mutex_unlock( &p_input->p->p_item->lock ); } @@ -2560,8 +2563,8 @@ static void InputSourceMeta( input_thread_t *p_input, if( p_demux_meta->i_attachments > 0 ) { vlc_mutex_lock( &p_input->p->p_item->lock ); - AppendAttachment( &p_input->p->i_attachment, &p_input->p->attachment, - p_demux_meta->i_attachments, p_demux_meta->attachments ); + AppendAttachment( &p_input->p->i_attachment, &p_input->p->attachment, &p_input->p->attachment_demux, + p_demux_meta->i_attachments, p_demux_meta->attachments, p_demux); vlc_mutex_unlock( &p_input->p->p_item->lock ); } module_unneed( p_demux, p_id3 ); @@ -2690,22 +2693,29 @@ static void InputMetaUser( input_thread_t *p_input, vlc_meta_t *p_meta ) } } -static void AppendAttachment( int *pi_attachment, input_attachment_t ***ppp_attachment, - int i_new, input_attachment_t **pp_new ) +static void AppendAttachment( int *pi_attachment, input_attachment_t ***ppp_attachment, demux_t ***ppp_attachment_demux, + int i_new, input_attachment_t **pp_new, demux_t *p_demux ) { int i_attachment = *pi_attachment; input_attachment_t **attachment = *ppp_attachment; + demux_t **attachment_demux = *ppp_attachment_demux; int i; attachment = xrealloc( attachment, sizeof(*attachment) * ( i_attachment + i_new ) ); + attachment_demux = xrealloc( attachment_demux, + sizeof(*attachment_demux) * ( i_attachment + i_new ) ); for( i = 0; i < i_new; i++ ) - attachment[i_attachment++] = pp_new[i]; + { + attachment[i_attachment] = pp_new[i]; + attachment_demux[i_attachment++] = p_demux; + } free( pp_new ); /* */ *pi_attachment = i_attachment; *ppp_attachment = attachment; + *ppp_attachment_demux = attachment_demux; } /***************************************************************************** @@ -2731,12 +2741,22 @@ static void InputUpdateMeta( input_thread_t *p_input, demux_t *p_demux ) vlc_mutex_lock( &p_input->p->p_item->lock ); if( p_input->p->i_attachment > 0 ) { + int j = 0; for( int i = 0; i < p_input->p->i_attachment; i++ ) - vlc_input_attachment_Delete( p_input->p->attachment[i] ); - TAB_CLEAN( p_input->p->i_attachment, p_input->p->attachment ); + { + if( p_input->p->attachment_demux[i] == p_demux ) + vlc_input_attachment_Delete( p_input->p->attachment[i] ); + else + { + p_input->p->attachment[j] = p_input->p->attachment[i]; + p_input->p->attachment_demux[j] = p_input->p->attachment_demux[i]; + j++; + } + } + p_input->p->i_attachment = j; } - AppendAttachment( &p_input->p->i_attachment, &p_input->p->attachment, - i_attachment, attachment ); + AppendAttachment( &p_input->p->i_attachment, &p_input->p->attachment, &p_input->p->attachment_demux, + i_attachment, attachment, p_demux ); vlc_mutex_unlock( &p_input->p->p_item->lock ); } diff --git a/src/input/input_internal.h b/src/input/input_internal.h index 9f71294..2236313 100644 --- a/src/input/input_internal.h +++ b/src/input/input_internal.h @@ -116,6 +116,7 @@ struct input_thread_private_t /* Input attachment */ int i_attachment; input_attachment_t **attachment; + demux_t **attachment_demux; /* Main input properties */ _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
