Skip to content

VLCMediaPlayer: Improved videoAspectRatio property

VLCMediaPlayer: Improved videoAspectRatio property

Improvements

  • Eliminates the need to free() the return value, making it easier to use
  • Supports ObjC NSString* Swift String for easier use

// ObjC example

// set Before
mediaPlayer.videoAspectRatio = (char *)@"4:3".UTF8String;

// set After
mediaPlayer.videoAspectRatio = @"4:3";

// get Before
char * aspectRatio = mediaPlayer.videoAspectRatio;
free(aspectRatio); // after use

// get After
NSString *aspectRatio = mediaPlayer.videoAspectRatio;

// Swift example

// set Before
let aspectRatio: UnsafeMutablePointer<CChar>? = strdup("4:3")
mediaPlayer.videoAspectRatio = aspectRatio
aspectRatio?.deallocate()

// set After
mediaPlayer.videoAspectRatio = "4:3"

// get Before
let aspectRatio: UnsafeMutablePointer<CChar>? = mediaPlayer.videoAspectRatio
aspectRatio?.deallocate() // after use

// get After
let aspectRatio: String? = mediaPlayer.videoAspectRatio

best regards.

Merge request reports

Loading