Bladeren bron

VLCMediaPlayer: expand the API by adding setter/getter for the video scale factor

Needs additional testing
Felix Paul Kühne 12 jaren geleden
bovenliggende
commit
fa7f356adb
2 gewijzigde bestanden met toevoegingen van 21 en 0 verwijderingen
  1. 11 0
      Headers/Public/VLCMediaPlayer.h
  2. 10 0
      Sources/VLCMediaPlayer.m

+ 11 - 0
Headers/Public/VLCMediaPlayer.h

@@ -124,6 +124,17 @@ extern NSString * VLCMediaPlayerStateToString(VLCMediaPlayerState state);
 - (char *)videoCropGeometry;
 
 /**
+ * Set/Get the current video scaling factor.
+ * That is the ratio of the number of pixels on
+ * screen to the number of pixels in the original decoded video in each
+ * dimension. Zero is a special value; it will adjust the video to the output
+ * window/drawable (in windowed mode) or the entire screen.
+ *
+ * \param relative scale factor as float 
+ */
+@property (readwrite) float scaleFactor;
+
+/**
  * Take a snapshot of the current video.
  *
  * If width AND height is 0, original size is used.

+ 10 - 0
Sources/VLCMediaPlayer.m

@@ -378,6 +378,16 @@ static void HandleMediaPlayerMediaChanged(const libvlc_event_t * event, void * s
     return result;
 }
 
+- (void)setScaleFactor:(float)value
+{
+    libvlc_video_set_scale(instance, value);
+}
+
+- (float)scaleFactor
+{
+    return libvlc_video_get_scale(instance);
+}
+
 - (void)saveVideoSnapshotAt:(NSString *)path withWidth:(NSUInteger)width andHeight:(NSUInteger)height
 {
     int failure = libvlc_video_take_snapshot(instance, 0, [path UTF8String], width, height);