[vlc-commits] transcode: store the picture chain using vlc_picture_chain_t
Steve Lhomme
git at videolan.org
Tue Oct 6 13:27:18 CEST 2020
vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Thu Sep 24 13:01:15 2020 +0200| [e5a4e71e49565c80c5286de98358888780d824bf] | committer: Steve Lhomme
transcode: store the picture chain using vlc_picture_chain_t
Move the while at the start of the loop so it's easier to read what we loop on.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e5a4e71e49565c80c5286de98358888780d824bf
---
modules/stream_out/transcode/transcode.h | 5 +----
modules/stream_out/transcode/video.c | 18 ++++++++----------
2 files changed, 9 insertions(+), 14 deletions(-)
diff --git a/modules/stream_out/transcode/transcode.h b/modules/stream_out/transcode/transcode.h
index bdde41e91d..1be5c8c127 100644
--- a/modules/stream_out/transcode/transcode.h
+++ b/modules/stream_out/transcode/transcode.h
@@ -87,10 +87,7 @@ struct sout_stream_id_sys_t
vlc_mutex_t lock;
union
{
- struct {
- picture_t *first;
- picture_t *tail;
- } pic;
+ vlc_picture_chain_t pic;
struct {
subpicture_t *first;
subpicture_t **last;
diff --git a/modules/stream_out/transcode/video.c b/modules/stream_out/transcode/video.c
index 0bb4f25f7b..5dc572b534 100644
--- a/modules/stream_out/transcode/video.c
+++ b/modules/stream_out/transcode/video.c
@@ -151,16 +151,15 @@ static void decoder_queue_video( decoder_t *p_dec, picture_t *p_pic )
assert(!picture_HasChainedPics(p_pic));
vlc_mutex_lock(&id->fifo.lock);
- id->fifo.pic.tail = vlc_picture_chain_Append( &id->fifo.pic.first, id->fifo.pic.tail, p_pic );
+ id->fifo.pic.tail = vlc_picture_chain_Append( &id->fifo.pic.front, id->fifo.pic.tail, p_pic );
vlc_mutex_unlock(&id->fifo.lock);
}
-static picture_t *transcode_dequeue_all_pics( sout_stream_id_sys_t *id )
+static vlc_picture_chain_t transcode_dequeue_all_pics( sout_stream_id_sys_t *id )
{
vlc_mutex_lock(&id->fifo.lock);
- picture_t *p_pics = id->fifo.pic.first;
- id->fifo.pic.first = NULL;
- id->fifo.pic.tail = NULL;
+ vlc_picture_chain_t p_pics = id->fifo.pic;
+ vlc_picture_chain_Init( &id->fifo.pic );
vlc_mutex_unlock(&id->fifo.lock);
return p_pics;
@@ -173,8 +172,7 @@ int transcode_video_init( sout_stream_t *p_stream, const es_format_t *p_fmt,
"creating video transcoding from fcc=`%4.4s' to fcc=`%4.4s'",
(char*)&p_fmt->i_codec, (char*)&id->p_enccfg->i_codec );
- id->fifo.pic.first = NULL;
- id->fifo.pic.tail = NULL;
+ vlc_picture_chain_Init( &id->fifo.pic );
id->b_transcode = true;
es_format_Init( &id->decoder_out, VIDEO_ES, 0 );
@@ -446,9 +444,9 @@ int transcode_video_process( sout_stream_t *p_stream, sout_stream_id_sys_t *id,
if( ret != VLCDEC_SUCCESS )
return VLC_EGENERIC;
- picture_t *p_pics = transcode_dequeue_all_pics( id );
+ vlc_picture_chain_t p_pics = transcode_dequeue_all_pics( id );
- do
+ while( !vlc_picture_chain_IsEmpty( &p_pics ) )
{
picture_t *p_pic = vlc_picture_chain_PopFront( &p_pics );
@@ -631,7 +629,7 @@ error:
if( p_pic )
picture_Release( p_pic );
id->b_error = true;
- } while( p_pics );
+ }
if( id->p_enccfg->video.threads.i_count >= 1 )
{
More information about the vlc-commits
mailing list