]> git.sesse.net Git - vlc/blobdiff - lib/media_player.c
demux: playlist: asx: handle common mime type for asx playlist and asf
[vlc] / lib / media_player.c
index c48daa49e4e96de5ea3eb8ec906d7e32544ee4ab..c23dd42aa33b0de665fb546fb31ab3a534ff3a07 100644 (file)
@@ -33,6 +33,7 @@
 #include <vlc_demux.h>
 #include <vlc_input.h>
 #include <vlc_vout.h>
+#include <vlc_aout.h>
 #include <vlc_keys.h>
 
 #include "libvlc_internal.h"
@@ -457,6 +458,15 @@ libvlc_media_player_new( libvlc_instance_t *instance )
     var_Create (mp, "amem-rate", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT);
     var_Create (mp, "amem-channels", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT);
 
+    /* Video Title */
+    var_Create (mp, "video-title-show", VLC_VAR_BOOL);
+    var_Create (mp, "video-title-position", VLC_VAR_INTEGER);
+    var_Create (mp, "video-title-timeout", VLC_VAR_INTEGER);
+
+    /* Equalizer */
+    var_Create (mp, "equalizer-preamp", VLC_VAR_FLOAT);
+    var_Create (mp, "equalizer-bands", VLC_VAR_STRING);
+
     mp->p_md = NULL;
     mp->state = libvlc_NothingSpecial;
     mp->p_libvlc_instance = instance;
@@ -1222,12 +1232,6 @@ int libvlc_media_player_will_play( libvlc_media_player_t *p_mi )
 
 int libvlc_media_player_set_rate( libvlc_media_player_t *p_mi, float rate )
 {
-    if (rate < 0.)
-    {
-        libvlc_printerr ("Playing backward not supported");
-        return -1;
-    }
-
     var_SetFloat (p_mi, "rate", rate);
 
     input_thread_t *p_input_thread = libvlc_get_input_thread ( p_mi );
@@ -1385,3 +1389,77 @@ void libvlc_media_player_next_frame( libvlc_media_player_t *p_mi )
         vlc_object_release( p_input_thread );
     }
 }
+
+void libvlc_media_player_set_video_title_display( libvlc_media_player_t *p_mi, libvlc_position_t position, unsigned timeout )
+{
+    if ( position != libvlc_position_disable )
+    {
+        var_SetBool( p_mi, "video-title-show", true );
+        var_SetInteger( p_mi, "video-title-position", position );
+        var_SetInteger( p_mi, "video-title-timeout", timeout );
+    }
+    else
+    {
+        var_SetBool( p_mi, "video-title-show", false );
+    }
+}
+
+/**
+ * Maximum size of a formatted equalizer amplification band frequency value.
+ *
+ * The allowed value range is supposed to be constrained from -20.0 to 20.0.
+ *
+ * The format string " %.07f" with a minimum value of "-20" gives a maximum
+ * string length of e.g. " -19.1234567", i.e. 12 bytes (not including the null
+ * terminator).
+ */
+#define EQZ_BAND_VALUE_SIZE 12
+
+int libvlc_media_player_set_equalizer( libvlc_media_player_t *p_mi, libvlc_equalizer_t *p_equalizer )
+{
+    float f_preamp;
+    char *psz_bands;
+
+    if ( p_equalizer )
+    {
+        f_preamp = p_equalizer->f_preamp;
+
+        psz_bands = malloc( EQZ_BANDS_MAX * EQZ_BAND_VALUE_SIZE + 1 );
+        if ( unlikely( psz_bands == NULL ) )
+            return -1;
+
+        char *p = psz_bands;
+        int c;
+        for ( int i = 0; i < EQZ_BANDS_MAX; i++ )
+        {
+            c = snprintf( p, EQZ_BAND_VALUE_SIZE + 1, " %.07f", p_equalizer->f_amp[i] );
+            if ( unlikely( c >= EQZ_BAND_VALUE_SIZE + 1 ) )
+            {
+                free( psz_bands );
+                return -1;
+            }
+
+            p += c;
+        }
+    }
+    else
+    {
+        f_preamp = 0.f;
+        psz_bands = NULL;
+    }
+
+    var_SetFloat( p_mi, "equalizer-preamp", f_preamp );
+    var_SetString( p_mi, "equalizer-bands", psz_bands );
+
+    audio_output_t *p_aout = input_resource_HoldAout( p_mi->input.p_resource );
+    if ( p_aout )
+    {
+        var_SetFloat( p_aout, "equalizer-preamp", f_preamp );
+        var_SetString( p_aout, "equalizer-bands", psz_bands );
+
+        vlc_object_release( p_aout );
+    }
+
+    free( psz_bands );
+    return 0;
+}