Browse Source

osx/framework: added wrapper methods for snapshots and deinterlacing

Felix Paul Kühne 15 years ago
parent
commit
947b1cdaf7
2 changed files with 36 additions and 0 deletions
  1. 20 0
      Headers/Public/VLCMediaPlayer.h
  2. 16 0
      Sources/VLCMediaPlayer.m

+ 20 - 0
Headers/Public/VLCMediaPlayer.h

@@ -112,6 +112,26 @@ extern NSString * VLCMediaPlayerStateToString(VLCMediaPlayerState state);
 - (void)setVideoTeleText:(int)value;
 - (int)videoTeleText;
 
+/**
+ * Take a snapshot of the current video.
+ *
+ * If width AND height is 0, original size is used.
+ * If width OR height is 0, original aspect-ratio is preserved.
+ *
+ * \param path the path where to save the screenshot to
+ * \param width the snapshot's width
+ * \param height the snapshot's height
+ */
+- (void)saveVideoSnapshotAt: (NSString *)path withWidth:(NSUInteger)width andHeight:(NSUInteger)height;
+
+/**
+ * Enable or disable deinterlace filter
+ *
+ * \param name of deinterlace filter to use (availability depends on underlying VLC version)
+ * \param enable boolean to enable or disable deinterlace filter
+ */
+- (void)setDeinterlaceFilter: (NSString *)name enabled: (BOOL)enabled;
+
 @property float rate;
 
 @property (readonly) VLCAudio * audio;

+ 16 - 0
Sources/VLCMediaPlayer.m

@@ -304,6 +304,22 @@ static void HandleMediaInstanceStateChanged(const libvlc_event_t * event, void *
     return result;
 }
 
+- (void)saveVideoSnapshotAt: (NSString *)path withWidth:(NSUInteger)width andHeight:(NSUInteger)height
+{
+    libvlc_exception_t ex;
+    libvlc_exception_init( &ex );
+    libvlc_video_take_snapshot( instance, [path UTF8String], width, height, &ex );
+    catch_exception( &ex );
+}
+
+- (void)setDeinterlaceFilter: (NSString *)name enabled: (BOOL)enabled
+{
+    libvlc_exception_t ex;
+    libvlc_exception_init( &ex );
+    libvlc_video_set_deinterlace( instance, (int)enabled , [name UTF8String], &ex );
+    catch_exception( &ex );
+}
+
 - (void)setRate:(float)value
 {
     libvlc_media_player_set_rate( instance, value, NULL );