@@ -18,8 +18,8 @@ use crate::gpu::video_convert_mode;
1818use gstreamer as gst;
1919use std:: collections:: HashMap ;
2020use strom_types:: {
21- block:: * , common_video_pixel_format_enum_values , common_video_resolution_enum_values ,
22- element:: ElementPadRef , PropertyValue , * ,
21+ block:: * , common_video_framerate_enum_values , common_video_pixel_format_enum_values ,
22+ common_video_resolution_enum_values , element:: ElementPadRef , PropertyValue , * ,
2323} ;
2424use tracing:: info;
2525
@@ -73,14 +73,19 @@ impl BlockBuilder for VideoFormatBuilder {
7373 }
7474 }
7575
76- // Add framerate if specified
76+ // Add framerate if specified (supports both fraction "25/1" and legacy decimal "25" formats)
7777 if let Some ( fps) = framerate {
78- // Convert decimal framerates to proper fractions
79- let framerate_fraction = match fps {
80- "23.976" => "24000/1001" . to_string ( ) ,
81- "29.97" => "30000/1001" . to_string ( ) ,
82- "59.94" => "60000/1001" . to_string ( ) ,
83- _ => format ! ( "{}/1" , fps) ,
78+ let framerate_fraction = if fps. contains ( '/' ) {
79+ // Already in fraction format (e.g. "25/1", "30000/1001")
80+ fps. to_string ( )
81+ } else {
82+ // Legacy decimal format — convert to fraction
83+ match fps {
84+ "23.976" => "24000/1001" . to_string ( ) ,
85+ "29.97" => "30000/1001" . to_string ( ) ,
86+ "59.94" => "60000/1001" . to_string ( ) ,
87+ _ => format ! ( "{}/1" , fps) ,
88+ }
8489 } ;
8590 caps_fields. push ( format ! ( "framerate={}" , framerate_fraction) ) ;
8691 }
@@ -193,20 +198,7 @@ fn videoformat_definition() -> BlockDefinition {
193198 label: "Framerate" . to_string( ) ,
194199 description: "Framerate in fps - creates videorate element. Leave empty to pass through." . to_string( ) ,
195200 property_type: PropertyType :: Enum {
196- values: vec![
197- EnumValue { value: "" . to_string( ) , label: Some ( "-" . to_string( ) ) } ,
198- EnumValue { value: "10" . to_string( ) , label: Some ( "10 fps" . to_string( ) ) } ,
199- EnumValue { value: "15" . to_string( ) , label: Some ( "15 fps" . to_string( ) ) } ,
200- EnumValue { value: "23.976" . to_string( ) , label: Some ( "23.976 fps (24000/1001)" . to_string( ) ) } ,
201- EnumValue { value: "24" . to_string( ) , label: Some ( "24 fps" . to_string( ) ) } ,
202- EnumValue { value: "25" . to_string( ) , label: Some ( "25 fps" . to_string( ) ) } ,
203- EnumValue { value: "29.97" . to_string( ) , label: Some ( "29.97 fps (30000/1001)" . to_string( ) ) } ,
204- EnumValue { value: "30" . to_string( ) , label: Some ( "30 fps" . to_string( ) ) } ,
205- EnumValue { value: "50" . to_string( ) , label: Some ( "50 fps" . to_string( ) ) } ,
206- EnumValue { value: "59.94" . to_string( ) , label: Some ( "59.94 fps (60000/1001)" . to_string( ) ) } ,
207- EnumValue { value: "60" . to_string( ) , label: Some ( "60 fps" . to_string( ) ) } ,
208- EnumValue { value: "120" . to_string( ) , label: Some ( "120 fps" . to_string( ) ) } ,
209- ] ,
201+ values: common_video_framerate_enum_values( true ) ,
210202 } ,
211203 default_value: Some ( PropertyValue :: String ( "" . to_string( ) ) ) ,
212204 mapping: PropertyMapping {
0 commit comments