]> git.sesse.net Git - vlc/blobdiff - src/input/es_out.c
programs is a string, which is a string, which is not a list
[vlc] / src / input / es_out.c
index 67324f1864593e94fb0814d4d60881f74a2bd278..1468ba4a7cf6bbddbe88e2a888104cc626134788 100644 (file)
@@ -648,7 +648,7 @@ static void EsOutDecodersStopBuffering( es_out_t *out, bool b_forced )
 
     if( i_stream_duration <= i_buffering_duration && !b_forced )
     {
-        const double f_level = (double)i_stream_duration / i_buffering_duration;
+        const double f_level = __MAX( (double)i_stream_duration / i_buffering_duration, 0 );
         input_SendEventCache( p_sys->p_input, f_level );
 
         msg_Dbg( p_sys->p_input, "Buffering %d%%", (int)(100 * f_level) );
@@ -1234,7 +1234,7 @@ static void EsOutProgramMeta( es_out_t *out, int i_group, const vlc_meta_t *p_me
     char **ppsz_all_keys = vlc_meta_CopyExtraNames(p_meta );
 
     info_category_t *p_cat = NULL;
-    if( psz_provider || *ppsz_all_keys[0] )
+    if( psz_provider || ( ppsz_all_keys[0] && *ppsz_all_keys[0] ) )
     {
         char *psz_cat = EsOutProgramGetMetaName( p_pgrm );
         if( psz_cat )
@@ -1453,7 +1453,12 @@ static es_out_id_t *EsOutAdd( es_out_t *out, const es_format_t *fmt )
         es->fmt.i_id = out->p_sys->i_id;
     if( !es->fmt.i_original_fourcc )
         es->fmt.i_original_fourcc = es->fmt.i_codec;
-    es->fmt.i_codec = vlc_fourcc_GetCodec( es->fmt.i_cat, es->fmt.i_codec );
+    if( es->fmt.i_cat == AUDIO_ES )
+        es->fmt.i_codec = vlc_fourcc_GetCodecAudio( es->fmt.i_codec,
+                                                    es->fmt.audio.i_bitspersample );
+    else
+        es->fmt.i_codec = vlc_fourcc_GetCodec( es->fmt.i_cat,
+                                               es->fmt.i_codec );
 
     es->i_id = es->fmt.i_id;
     es->i_meta_id = out->p_sys->i_id;
@@ -1742,19 +1747,24 @@ static void EsOutSelect( es_out_t *out, es_out_id_t *es, bool b_force )
     }
     else if( p_sys->i_mode == ES_OUT_MODE_PARTIAL )
     {
-        vlc_value_t val;
-        int i;
-        var_Get( p_sys->p_input, "programs", &val );
-        for ( i = 0; i < val.p_list->i_count; i++ )
+        char *prgms = var_GetNonEmptyString( p_sys->p_input, "programs" );
+        if( prgms != NULL )
         {
-            if ( val.p_list->p_values[i].i_int == es->p_pgrm->i_id || b_force )
+            char *buf;
+
+            for ( const char *prgm = strtok_r( prgms, ",", &buf );
+                  prgm != NULL;
+                  prgm = strtok_r( NULL, ",", &buf ) )
             {
-                if( !EsIsSelected( es ) )
-                    EsSelect( out, es );
-                break;
+                if( atoi( prgm ) == es->p_pgrm->i_id || b_force )
+                {
+                    if( !EsIsSelected( es ) )
+                        EsSelect( out, es );
+                    break;
+                }
             }
+            free( prgms );
         }
-        var_FreeList( &val, NULL );
     }
     else if( p_sys->i_mode == ES_OUT_MODE_AUTO )
     {
@@ -2317,7 +2327,7 @@ static int EsOutControlLocked( es_out_t *out, int i_query, va_list args )
                     if( i_pts_delay > __MIN( i_pts_delay_base + i_jitter_max, INPUT_PTS_DELAY_MAX ) )
                     {
                         msg_Err( p_sys->p_input,
-                                 "ES_OUT_SET_(GROUP_)PCR  is called too late (jitter of %d ms ingnored)",
+                                 "ES_OUT_SET_(GROUP_)PCR  is called too late (jitter of %d ms ignored)",
                                  (int)(i_pts_delay - i_pts_delay_base) / 1000 );
                         i_pts_delay = p_sys->i_pts_delay;
                     }