]> git.sesse.net Git - vlc/commitdiff
Add the --custom-aspect-ratios and --custom-crop-ratios options which make it possibl...
authorAntoine Cellerier <dionoea@videolan.org>
Sat, 13 May 2006 20:56:03 +0000 (20:56 +0000)
committerAntoine Cellerier <dionoea@videolan.org>
Sat, 13 May 2006 20:56:03 +0000 (20:56 +0000)
src/libvlc.h
src/video_output/vout_intf.c

index d118bb9fef6d260e5ba7ddceee2b4b32c6c2293e..3c2975d3c4c583ea518d68963eed3da3c1fed18d 100644 (file)
@@ -322,6 +322,16 @@ static char *ppsz_align_descriptions[] =
     "aspect, or a float value (1.25, 1.3333, etc.) expressing pixel " \
     "squareness.")
 
+#define CUSTOM_CROP_RATIOS_TEXT N_("Custom crop ratios list")
+#define CUSTOM_CROP_RATIOS_LONGTEXT N_( \
+    "Comma seperated list of crop ratios which will be added in the " \
+    "interface's crop ratios list.")
+
+#define CUSTOM_ASPECT_RATIOS_TEXT N_("Custom aspect ratios list")
+#define CUSTOM_ASPECT_RATIOS_LONGTEXT N_( \
+    "Comma seperated list of aspect ratios which will be added in the " \
+    "interface's aspect ratio list.")
+
 #define HDTV_FIX_TEXT N_("Fix HDTV height")
 #define HDTV_FIX_LONGTEXT N_( \
     "This allows proper handling of HDTV-1080 video format " \
@@ -1205,10 +1215,12 @@ vlc_module_begin();
     add_integer( "video-x", -1, NULL, VIDEOX_TEXT, VIDEOX_LONGTEXT, VLC_TRUE );
     add_integer( "video-y", -1, NULL, VIDEOY_TEXT, VIDEOY_LONGTEXT, VLC_TRUE );
     add_string( "crop", NULL, NULL, CROP_TEXT, CROP_LONGTEXT, VLC_FALSE );
+    add_string( "custom-crop-ratios", NULL, NULL, CUSTOM_CROP_RATIOS_TEXT,
+                CUSTOM_CROP_RATIOS_LONGTEXT, VLC_FALSE );
     add_string( "aspect-ratio", NULL, NULL,
                 ASPECT_RATIO_TEXT, ASPECT_RATIO_LONGTEXT, VLC_FALSE );
-    add_string( "monitor-par", NULL, NULL,
-                MASPECT_RATIO_TEXT, MASPECT_RATIO_LONGTEXT, VLC_TRUE );
+    add_string( "custom-aspect-ratios", NULL, NULL, CUSTOM_ASPECT_RATIOS_TEXT,
+                CUSTOM_ASPECT_RATIOS_LONGTEXT, VLC_FALSE );
     add_bool( "hdtv-fix", 1, NULL, HDTV_FIX_TEXT, HDTV_FIX_LONGTEXT, VLC_TRUE );
     add_bool( "video-deco", 1, NULL, VIDEO_DECO_TEXT,
               VIDEO_DECO_LONGTEXT, VLC_TRUE );
index 731429ae4f95bd815d519a278a488ca94753a940..4ec1b10986a78e26b185bd600d84140b38eab809 100644 (file)
@@ -181,6 +181,7 @@ void vout_IntfInit( vout_thread_t *p_vout )
 {
     vlc_value_t val, text, old_val;
     vlc_bool_t b_force_par = VLC_FALSE;
+    char *psz_buf;
 
     /* Create a few object variables we'll need later on */
     var_Create( p_vout, "snapshot-path", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
@@ -248,6 +249,30 @@ void vout_IntfInit( vout_thread_t *p_vout )
     val.psz_string = "5:4"; text.psz_string = "5:4";
     var_Change( p_vout, "crop", VLC_VAR_ADDCHOICE, &val, &text );
 
+    /* Add custom crop ratios */
+    psz_buf = config_GetPsz( p_vout, "custom-crop-ratios" );
+    if( psz_buf && *psz_buf )
+    {
+        char *psz_cur = psz_buf;
+        char *psz_next;
+        while( psz_cur && *psz_cur )
+        {
+            psz_next = strchr( psz_cur, ',' );
+            if( psz_next )
+            {
+                *psz_next = '\0';
+                psz_next++;
+            }
+            val.psz_string = strdup( psz_cur );
+            text.psz_string = strdup( psz_cur );
+            var_Change( p_vout, "crop", VLC_VAR_ADDCHOICE, &val, &text);
+            free( val.psz_string );
+            free( text.psz_string );
+            psz_cur = psz_next;
+        }
+    }
+    if( psz_buf ) free( psz_buf );
+
     var_AddCallback( p_vout, "crop", CropCallback, NULL );
     var_Get( p_vout, "crop", &old_val );
     if( old_val.psz_string && *old_val.psz_string )
@@ -311,6 +336,30 @@ void vout_IntfInit( vout_thread_t *p_vout )
     val.psz_string = "5:4"; text.psz_string = "5:4";
     var_Change( p_vout, "aspect-ratio", VLC_VAR_ADDCHOICE, &val, &text );
 
+    /* Add custom aspect ratios */
+    psz_buf = config_GetPsz( p_vout, "custom-aspect-ratios" );
+    if( psz_buf && *psz_buf )
+    {
+        char *psz_cur = psz_buf;
+        char *psz_next;
+        while( psz_cur && *psz_cur )
+        {
+            psz_next = strchr( psz_cur, ',' );
+            if( psz_next )
+            {
+                *psz_next = '\0';
+                psz_next++;
+            }
+            val.psz_string = strdup( psz_cur );
+            text.psz_string = strdup( psz_cur );
+            var_Change( p_vout, "aspect-ratio", VLC_VAR_ADDCHOICE, &val, &text);
+            free( val.psz_string );
+            free( text.psz_string );
+            psz_cur = psz_next;
+        }
+    }
+    if( psz_buf ) free( psz_buf );
+
     var_AddCallback( p_vout, "aspect-ratio", AspectCallback, NULL );
     var_Get( p_vout, "aspect-ratio", &old_val );
     if( (old_val.psz_string && *old_val.psz_string) || b_force_par )