[vlc-devel] [vlc-commits] xa: remove struct member

Rémi Denis-Courmont remi at remlab.net
Sun Jul 9 16:07:43 CEST 2017


Le 9 juillet 2017 16:34:36 GMT+03:00, "Rémi Denis-Courmont" <git at videolan.org> a écrit :
>vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Jul 
>9 16:22:04 2017 +0300| [da721e6fca98c487d5933c1d5164ee58203138e0] |
>committer: Rémi Denis-Courmont
>
>xa: remove struct member
>
>>
>http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=da721e6fca98c487d5933c1d5164ee58203138e0
>---
>
> modules/demux/xa.c | 22 ++++++++++------------
> 1 file changed, 10 insertions(+), 12 deletions(-)
>
>diff --git a/modules/demux/xa.c b/modules/demux/xa.c
>index cc525cfdfc..92e06bf7b7 100644
>--- a/modules/demux/xa.c
>+++ b/modules/demux/xa.c
>@@ -58,7 +58,6 @@ struct demux_sys_t
> {
>     es_out_id_t     *p_es;
> 
>-    int64_t         i_data_offset;
>     unsigned int    i_data_size;
>     unsigned int    i_block_frames;
>     unsigned int    i_frame_size;
>@@ -80,6 +79,8 @@ typedef struct xa_header_t
>     uint16_t wBitsPerSample;
> } xa_header_t;
> 
>+#define HEADER_LENGTH 24
>+
>static_assert(offsetof(xa_header_t, wBitsPerSample) == 22, "Bad
>padding");
> 
> #define FRAME_LENGTH 28 /* samples per frame */
>@@ -107,7 +108,7 @@ static int Open( vlc_object_t * p_this )
>     /* read XA header*/
>     xa_header_t xa;
> 
>-    if( vlc_stream_Read( p_demux->s, &xa, 24 ) < 24 )
>+    if( vlc_stream_Read( p_demux->s, &xa, HEADER_LENGTH ) <
>HEADER_LENGTH )
>     {
>         free( p_sys );
>         return VLC_EGENERIC;
>@@ -127,7 +128,6 @@ static int Open( vlc_object_t * p_this )
>   fmt.i_bitrate = (fmt.audio.i_rate * fmt.audio.i_bytes_per_frame * 8)
>                     / fmt.audio.i_frame_length;
> 
>-    p_sys->i_data_offset = vlc_stream_Tell( p_demux->s );
>     /* FIXME: better computation */
>     p_sys->i_data_size = xa.iSize * 15 / 56;
>     /* How many frames per block (1:1 is too CPU intensive) */
>@@ -167,13 +167,11 @@ static int Demux( demux_t *p_demux )
> {
>     demux_sys_t *p_sys = p_demux->p_sys;
>     block_t     *p_block;
>-    int64_t     i_offset;
>+    int64_t     i_offset = vlc_stream_Tell( p_demux->s );
>     unsigned    i_frames = p_sys->i_block_frames;
> 
>-    i_offset = vlc_stream_Tell( p_demux->s );
>-
>     if( p_sys->i_data_size > 0 &&
>-        i_offset >= p_sys->i_data_offset + p_sys->i_data_size )
>+        (i_offset - HEADER_LENGTH) >= p_sys->i_data_size )
>     {
>         /* EOF */
>         return 0;
>@@ -213,9 +211,9 @@ static int Control( demux_t *p_demux, int i_query,
>va_list args )
> {
>     demux_sys_t *p_sys  = p_demux->p_sys;
> 
>-    return demux_vaControlHelper( p_demux->s, p_sys->i_data_offset,
>-                                   p_sys->i_data_size ?
>p_sys->i_data_offset
>-                                   + p_sys->i_data_size : -1,
>-                                   p_sys->i_bitrate,
>p_sys->i_frame_size,
>-                                   i_query, args );
>+    return demux_vaControlHelper( p_demux->s, HEADER_LENGTH,
>+                                  p_sys->i_data_size
>+                                  ? HEADER_LENGTH + p_sys->i_data_size
>: -1,
>+                                  p_sys->i_bitrate,
>p_sys->i_frame_size,
>+                                  i_query, args );
> }
>
>_______________________________________________
>vlc-commits mailing list
>vlc-commits at videolan.org
>https://mailman.videolan.org/listinfo/vlc-commits

+ constant
-- 
Rémi Denis-Courmont
Typed on an inconvenient virtual keyboard
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20170709/d81bbb8f/attachment.html>


More information about the vlc-devel mailing list