[vlc-devel] [PATCH 10/11] picture_chain: pass a vlc_picture_chain_t to vlc_picture_chain_Pop/PeekFront

Steve Lhomme robux4 at ycbcr.xyz
Fri Sep 25 07:05:44 CEST 2020


On 2020-09-24 17:32, Steve Lhomme wrote:
> On 2020-09-24 17:28, Thomas Guillem wrote:
>> Is it possible to put 10 and 11/ before all other commits?
> 
> Now that I cleaned mosaic, it should be possible after #3

Scratch that. Patches between 4 to 9 replace the double pointer with the 
new type. Then 10 and 11 leverage the use of this type to make the API 
tighter and cleaner.

You can't do 10 and 11 until the code is actually using vlc_picture_chain_t.

>>
>> On Thu, Sep 24, 2020, at 16:49, Steve Lhomme wrote:
>>> ---
>>>   include/vlc_picture.h              | 10 +++++-----
>>>   modules/hw/mmal/converter.c        |  2 +-
>>>   modules/spu/mosaic.c               |  6 +++---
>>>   modules/stream_out/mosaic_bridge.c |  2 +-
>>>   src/misc/filter_chain.c            |  2 +-
>>>   src/misc/picture_fifo.c            |  4 ++--
>>>   src/video_output/snapshot.c        |  4 ++--
>>>   7 files changed, 15 insertions(+), 15 deletions(-)
>>>
>>> diff --git a/include/vlc_picture.h b/include/vlc_picture.h
>>> index c19a8c91c9c..7ea85456a08 100644
>>> --- a/include/vlc_picture.h
>>> +++ b/include/vlc_picture.h
>>> @@ -194,12 +194,12 @@ static inline bool
>>> vlc_picture_chain_IsEmpty(const vlc_picture_chain_t *chain)
>>>    *
>>>    * \return the front of the picture chain (the picture itself)
>>>    */
>>> -static inline picture_t * vlc_picture_chain_PopFront(picture_t **chain)
>>> +static inline picture_t *
>>> vlc_picture_chain_PopFront(vlc_picture_chain_t *chain)
>>>   {
>>> -    picture_t *front = *chain;
>>> +    picture_t *front = chain->front;
>>>       if (front)
>>>       {
>>> -        *chain = front->p_next;
>>> +        chain->front = front->p_next;
>>>           // unlink the front picture from the rest of the chain
>>>           front->p_next = NULL;
>>>       }
>>> @@ -213,9 +213,9 @@ static inline picture_t *
>>> vlc_picture_chain_PopFront(picture_t **chain)
>>>    *
>>>    * \return the front of the picture chain (the picture itself)
>>>    */
>>> -static inline picture_t * vlc_picture_chain_PeekFront(picture_t
>>> **chain)
>>> +static inline picture_t *
>>> vlc_picture_chain_PeekFront(vlc_picture_chain_t *chain)
>>>   {
>>> -    return *chain;
>>> +    return chain->front;
>>>   }
>>>   /**
>>> diff --git a/modules/hw/mmal/converter.c b/modules/hw/mmal/converter.c
>>> index c8af63a0782..bc1150b2da3 100644
>>> --- a/modules/hw/mmal/converter.c
>>> +++ b/modules/hw/mmal/converter.c
>>> @@ -118,7 +118,7 @@ static MMAL_FOURCC_T
>>> pic_to_slice_mmal_fourcc(MMAL_FOURCC_T fcc)
>>>   static picture_t * pic_fifo_get(vlc_picture_chain_t * const pf)
>>>   {
>>> -    return vlc_picture_chain_PopFront( &pf->front );
>>> +    return vlc_picture_chain_PopFront( &pf );
>>>   }
>>>   static void pic_fifo_release_all(vlc_picture_chain_t * const pf)
>>> diff --git a/modules/spu/mosaic.c b/modules/spu/mosaic.c
>>> index c1c19653052..557f619992f 100644
>>> --- a/modules/spu/mosaic.c
>>> +++ b/modules/spu/mosaic.c
>>> @@ -531,14 +531,14 @@ static subpicture_t *Filter( filter_t *p_filter,
>>> vlc_tick_t date )
>>>           while ( !vlc_picture_chain_IsEmpty( &p_es->pictures ) )
>>>           {
>>> -            picture_t *front = vlc_picture_chain_PeekFront(
>>> &p_es->pictures.front );
>>> +            picture_t *front = vlc_picture_chain_PeekFront(
>>> &p_es->pictures );
>>>               if ( front->date + p_sys->i_delay >= date )
>>>                   break; // front picture not late
>>>               if ( picture_HasChainedPics( front ) )
>>>               {
>>>                   // front picture is late and has more pictures
>>> chained, skip it
>>> -                front = vlc_picture_chain_PopFront(
>>> &p_es->pictures.front );
>>> +                front = vlc_picture_chain_PopFront( &p_es->pictures );
>>>                   picture_Release( front );
>>>                   continue;
>>>               }
>>> @@ -589,7 +589,7 @@ static subpicture_t *Filter( filter_t *p_filter,
>>> vlc_tick_t date )
>>>           video_format_Init( &fmt_in, 0 );
>>>           video_format_Init( &fmt_out, 0 );
>>> -        p_converted = vlc_picture_chain_PeekFront(
>>> &p_es->pictures.front );
>>> +        p_converted = vlc_picture_chain_PeekFront( &p_es->pictures );
>>>           if ( !p_sys->b_keep )
>>>           {
>>>               /* Convert the images */
>>> diff --git a/modules/stream_out/mosaic_bridge.c
>>> b/modules/stream_out/mosaic_bridge.c
>>> index 38d32a311be..964c28e52d4 100644
>>> --- a/modules/stream_out/mosaic_bridge.c
>>> +++ b/modules/stream_out/mosaic_bridge.c
>>> @@ -461,7 +461,7 @@ static void Del( sout_stream_t *p_stream, void *id )
>>>       p_es->b_empty = true;
>>>       while ( !vlc_picture_chain_IsEmpty( &p_es->pictures ) )
>>>       {
>>> -        picture_t *es_picture = vlc_picture_chain_PopFront(
>>> &p_es->pictures.front );
>>> +        picture_t *es_picture = vlc_picture_chain_PopFront(
>>> &p_es->pictures );
>>>           picture_Release( es_picture );
>>>       }
>>> diff --git a/src/misc/filter_chain.c b/src/misc/filter_chain.c
>>> index f32fd1b6798..dcc27dd8f94 100644
>>> --- a/src/misc/filter_chain.c
>>> +++ b/src/misc/filter_chain.c
>>> @@ -532,7 +532,7 @@ static void FilterDeletePictures(
>>> vlc_picture_chain_t *pictures )
>>>   {
>>>       while( !vlc_picture_chain_IsEmpty( pictures ) )
>>>       {
>>> -        picture_t *next = vlc_picture_chain_PopFront( &pictures->front
>>> );
>>> +        picture_t *next = vlc_picture_chain_PopFront( pictures );
>>>           picture_Release( next );
>>>       }
>>>   }
>>> diff --git a/src/misc/picture_fifo.c b/src/misc/picture_fifo.c
>>> index ae1c66c2ada..9178166765f 100644
>>> --- a/src/misc/picture_fifo.c
>>> +++ b/src/misc/picture_fifo.c
>>> @@ -52,7 +52,7 @@ static void PictureFifoPush(picture_fifo_t *fifo,
>>> picture_t *picture)
>>>   }
>>>   static picture_t *PictureFifoPop(picture_fifo_t *fifo)
>>>   {
>>> -    return vlc_picture_chain_PopFront( &fifo->pics.front );
>>> +    return vlc_picture_chain_PopFront( &fifo->pics );
>>>   }
>>>   picture_fifo_t *picture_fifo_New(void)
>>> @@ -101,7 +101,7 @@ void picture_fifo_Flush(picture_fifo_t *fifo,
>>> vlc_tick_t date, bool flush_before
>>>       PictureFifoReset(&tmp);
>>>       while ( !vlc_picture_chain_IsEmpty( &old_chain ) ) {
>>> -        picture_t *picture = vlc_picture_chain_PopFront( 
>>> &old_chain.front );
>>> +        picture_t *picture = vlc_picture_chain_PopFront( &old_chain );
>>>           if ((date == VLC_TICK_INVALID) ||
>>>               ( flush_before && picture->date <= date) ||
>>> diff --git a/src/video_output/snapshot.c b/src/video_output/snapshot.c
>>> index 485e37eb717..5213428bcc8 100644
>>> --- a/src/video_output/snapshot.c
>>> +++ b/src/video_output/snapshot.c
>>> @@ -70,7 +70,7 @@ void vout_snapshot_Destroy(vout_snapshot_t *snap)
>>>           return;
>>>       while ( !vlc_picture_chain_IsEmpty( &snap->pics ) ) {
>>> -        picture_t *picture = vlc_picture_chain_PopFront( 
>>> &snap->pics.front );
>>> +        picture_t *picture = vlc_picture_chain_PopFront( &snap->pics );
>>>           picture_Release(picture);
>>>       }
>>> @@ -108,7 +108,7 @@ picture_t *vout_snapshot_Get(vout_snapshot_t *snap,
>>> vlc_tick_t timeout)
>>>           vlc_cond_timedwait(&snap->wait, &snap->lock, deadline) == 0);
>>>       /* */
>>> -    picture_t *picture = vlc_picture_chain_PopFront( 
>>> &snap->pics.front );
>>> +    picture_t *picture = vlc_picture_chain_PopFront( &snap->pics );
>>>       if (!picture && snap->request_count > 0)
>>>           snap->request_count--;
>>> -- 
>>> 2.26.2
>>>
>>> _______________________________________________
>>> vlc-devel mailing list
>>> To unsubscribe or modify your subscription options:
>>> https://mailman.videolan.org/listinfo/vlc-devel
>> _______________________________________________
>> vlc-devel mailing list
>> To unsubscribe or modify your subscription options:
>> https://mailman.videolan.org/listinfo/vlc-devel
>>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel


More information about the vlc-devel mailing list