[vlc-devel] Patch for C64 SID suppport

Rémi Denis-Courmont remi at remlab.net
Wed Dec 8 01:12:04 CET 2010


   Hello,

Good, but I still have a few more comments:

+static int Demux (demux_t *demux)
+{
+    demux_sys_t *sys = demux->p_sys;
+    int i_bk = ( sys->fmt.audio.i_bitspersample / 8 ) * sys-
>fmt.audio.i_channels;
+
+    block_t *block = block_New( p_demux, sys->fmt.audio.i_rate / 10 * i_bk );
+    if (unlikely(block==NULL))
+        return 0;

Oh, that works. But you really do not need to keep the whole stream format 
description around. You might as well keep just the sample size and sample 
count. You might even hardcode the sample count to any reasonable - the point 
is just to not send small blocks as this would be CPU-heavy.

(...)
+        case DEMUX_GET_TITLE_INFO :
+            if ( sys->tuneInfo.songs > 1 )
+            {
+                input_title_t ***ppp_title = (input_title_t***) va_arg (args, 
input_title_t***);
+                int *pi_int    = (int*)va_arg( args, int* );
+
+                *pi_int = sys->tuneInfo.songs;
+                *ppp_title = (input_title_t**) xmalloc( sizeof 
(input_title_t**) * sys->tuneInfo.songs);
+
+                for( int i = 0; i < sys->tuneInfo.songs; i++ )
+                {
+                    char psz_temp[16];
+                    snprintf(psz_temp, 15, "Song %i", i);

asprintf() would be more straightforward. Most importantly, you need to either 
mark the string for translation, or alternatively not set any title name.

+                    (*ppp_title)[i] = vlc_input_title_New();
+                    (*ppp_title)[i]->psz_name = strdup (psz_temp);
+                }
+
+                return VLC_SUCCESS;
+            }
+            return VLC_EGENERIC;


-- 
Rémi Denis-Courmont
http://www.remlab.net/



More information about the vlc-devel mailing list