<br><br><div class="gmail_quote">On Thu, Feb 25, 2010 at 10:03 PM, Laurent Aimar <span dir="ltr"><<a href="mailto:fenrir@via.ecp.fr">fenrir@via.ecp.fr</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">Hi,<br>
<br>
On Thu, Feb 25, 2010, Pierre d'Herbemont wrote:<br>
</div>> Updated patch attached.<br>
> Pierre.<br>
<div class="im"><br>
> struct input_item_t<br>
> {<br>
> VLC_GC_MEMBERS<br>
> @@ -73,6 +102,9 @@ struct input_item_t<br>
> int i_es; /**< Number of es format descriptions */<br>
> es_format_t **es; /**< Es formats */<br>
><br>
</div>> + int i_tracks; /**< Number of track info descriptions */<br>
> + input_item_track_t **tracks;/**< Tracks Info */<br>
Vertical align would look nicer.<br></blockquote><div><br></div><div>*sigh*</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
> input_item_t *p_input_item = p_md->p_input_item;<br>
> vlc_mutex_lock( &p_input_item->lock );<br>
><br>
> - const int i_es = p_input_item->i_es;<br>
> - *pp_es = (i_es > 0) ? malloc( i_es * sizeof(libvlc_media_track_info_t) ) : NULL;<br>
> + const int i_tracks = p_input_item->i_tracks;<br>
> + *pp_tracks = (i_tracks > 0) ? malloc( i_tracks * sizeof(libvlc_media_track_info_t) ) : NULL;<br>
Any reason why you don't want to use sizeof(*variable) ? But as I<br>
don't maintain libvlc, I don't really care.</blockquote><div><br></div><div>Simply didn't see it.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">
> diff --git a/src/input/es_out.c b/src/input/es_out.c<br>
</div>> index 3062d8e..aa0ffbb 100644<br>
<div class="im">> --- a/src/input/es_out.c<br>
> +++ b/src/input/es_out.c<br>
</div>> @@ -45,6 +45,7 @@<br>
> #include "es_out.h"<br>
> #include "event.h"<br>
> #include "info.h"<br>
> +#include "item.h"<br>
><br>
> #include "../stream_output/stream_output.h"<br>
><br>
> @@ -2041,6 +2042,8 @@ static void EsOutDel( es_out_t *out, es_out_id_t *es )<br>
> if( es->p_pgrm == p_sys->p_pgrm )<br>
> EsOutESVarUpdate( out, es, true );<br>
><br>
> + input_item_DeleteTrack( input_GetItem(p_sys->p_input), &es->fmt );<br>
I don't think you want it here otherwise you will end up with an empty<br>
track list once the item is played.<br></blockquote><div><br></div><div>That's what I was asking on IRC.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
> @@ -2223,7 +2226,7 @@ static int EsOutControlLocked( es_out_t *out, int i_query, va_list args )<br>
> }<br>
> return VLC_SUCCESS;<br>
> }<br>
> -<br>
> +<br>
Cosmetic.<br></blockquote><div><br></div><div>Well, trailing spaces, it's ok to have it in the patch I guess. </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
> @@ -99,6 +100,10 @@ static inline void input_item_Clean( input_item_t *p_i )<br>
> }<br>
> TAB_CLEAN( p_i->i_es, p_i->es );<br>
><br>
> + for( i = 0; i < p_i->i_tracks; i++ )<br>
> + free( p_i->tracks[i] );<br>
I would really like an input_item_track_Delete instead of a direct free.<br></blockquote><div><br></div><div>okay. So that's what you meant the first time.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
> +static input_item_track_t *input_item_track_NewFromESFormat(const es_format_t *fmt)<br>
> +{<br>
> + input_item_track_t *ret = malloc(sizeof(*ret));<br>
<div class="im">> + ret->i_codec = fmt->i_codec;<br>
> + ret->i_id = fmt->i_id;<br>
> + ret->i_cat = fmt->i_cat;<br>
> +<br>
> + ret->i_profile = fmt->i_profile;<br>
> + ret->i_level = fmt->i_level;<br>
> +<br>
</div>> + switch(fmt->i_cat)<br>
> + {<br>
> + case VIDEO_ES:<br>
<div class="im">> + ret->u.video.i_height = fmt->video.i_height;<br>
> + ret->u.video.i_width = fmt->video.i_width;<br>
</div>> + break;<br>
> + case AUDIO_ES:<br>
<div class="im">> + ret->u.audio.i_channels = fmt->audio.i_channels;<br>
> + ret->u.audio.i_rate = fmt->audio.i_rate;<br>
</div>> + break;<br>
> + default:<br>
> + break;<br>
Bad indentation level. Vertical align would also help.</blockquote><div><br></div><div>What level do you want? There are plenty of coding style... And we have none.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
</blockquote><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="im">
> +/* Called by es_out when a new Elementary Stream is added or updated. */<br>
</div>> +void input_item_UpdateTrack(input_item_t *item, const es_format_t *fmt)<br>
> +{<br>
> + input_item_track_t *track = input_item_track_NewFromESFormat(fmt);<br>
Missing:<br>
if( !track)<br>
return;<br>
<div class="im"><br>
> +<br>
> + vlc_mutex_lock( &item->lock );<br>
> +<br>
</div>> + for( int i = 0; i < item->i_tracks; i++ )<br>
> + {<br>
> + if( item->tracks[i]->i_id == track->i_id )<br>
<div class="im">> + {<br>
> + /* We've found the right ES, replace it */<br>
</div>> + free(item->tracks[i]);<br>
input_item_track_Delete.<br>
<br>
> + item->tracks[i] = track;<br>
<div class="im">> + vlc_mutex_unlock( &item->lock );<br>
</div>> + return;<br>
> + }<br>
<div class="im">> + }<br>
> +<br>
> + /* ES not found, create a new one. */<br>
</div>> + TAB_APPEND(item->i_tracks, item->tracks, track);<br>
> +<br>
<div class="im">> + vlc_mutex_unlock( &item->lock );<br>
> +}<br>
</div>> +<br>
> +void input_item_DeleteTrack(input_item_t *item, const es_format_t *fmt)<br>
<div class="im">> +{<br>
> + vlc_mutex_lock( &item->lock );<br>
> +<br>
</div>> + for( int i = 0; i < item->i_tracks; i++ )<br>
> + {<br>
> + if( item->tracks[i]->i_id == fmt->i_id )<br>
> + {<br>
> + /* We've found the right track, remove it */<br>
> + free(item->tracks[i]);<br>
> + TAB_REMOVE(item->i_tracks, item->tracks, item->tracks[i]);<br>
<div class="im">> + vlc_mutex_unlock( &item->lock );<br>
</div>> + return;<br>
> + }<br>
> + }<br>
> +<br>
> +#ifndef NDEBUG<br>
> + // This should not happen, it means that someone removed a non existent track.<br>
> + abort();<br>
> +#endif<br>
> +<br>
<div class="im">> + vlc_mutex_unlock( &item->lock );<br>
> +}<br>
</div> I don't think this function is used once removed from EsOutDel.<br></blockquote><div><br></div><div>It's not. </div></div><br>