[vlc-devel] [PATCH] OS X AppleScript: added new features
Jan Winter
jwinter at gmx.net
Tue Sep 13 23:51:34 CEST 2011
Hi Felix,
thanks for your comments.
> - for - (NSString*) nameOfCurrentItem, lastComponent isn't the way to go. instead, you should do something like this:
Did you mean this:
that function in VLCCoreInteraction can stay as it is
- (NSString*)pathOfCurrentPlaylistItem
{
input_thread_t *p_input = pl_CurrentInput( VLCIntf );
if (!p_input) return nil;
input_item_t *p_item = input_GetItem( p_input );
if (!p_item) return nil;
char *psz_uri = input_item_GetURI( p_item );
if (!psz_uri) return nil;
NSString *o_name;
o_name = [[NSURL URLWithString:[NSString stringWithUTF8String:psz_uri]] path];
return o_name;
}
that function should be added to VLCCoreInteraction ???
- (NSString*)nameOfCurrentPlaylistItem
{
input_thread_t *p_input = pl_CurrentInput( VLCIntf );
if (!p_input) return nil;
input_item_t *p_item = input_GetItem( p_input );
if (!p_item) return nil;
char *psz_uri = input_item_GetURI( p_item );
if (!psz_uri) return nil;
NSString *o_name;
char *format = var_InheritString( VLCIntf, "input-title-format" );
char *formated = str_format_meta( p_input, format );
free( format );
o_name = [NSString stringWithUTF8String:formated];
free( formated );
NSURL * o_url = [NSURL URLWithString: [NSString stringWithUTF8String: psz_uri]];
free( psz_uri );
if ([aString isEqualToString:@""])
{
if ([o_url isFileURL])
o_name = [[NSFileManager defaultManager] displayNameAtPath: [o_url path]];
else
o_name = [o_url absoluteString];
}
return o_name;
}
> Additionally, setAudioVolume will need to be re-written, since the core's volume scale was changed to be cubic with a maximum of 200 % as far as I remember. However, this change wasn't reflected in the OS X UI so far.
Does that mean that [[VLCCoreInteraction sharedInstance] setVolume:i_parameter] stays the same, I have to adjust the function in applescript.m? Is it enough to limit the scale to 200% or do you mean with cubic a non-linear scale?
- (void) setAudioVolume: (double) d_audioVolume {
//1 = 100%, 4 = 400%; 0 <= d_audioVolume <= 4
//0-1024 (but AOUT_VOLUME_MAX == 512)???
//AOUT_VOLUME_DEFAULT = 256 = 100%
//somehow [[VLCCoreInteraction sharedInstance] setVolume:i_parameter] has 0-32 steps with 32 as stepWidth (0 - 1024)
if (d_audioVolume < 0)
d_audioVolume = 0;
if (d_audioVolume > 4)
d_audioVolume = 4;
intf_thread_t * p_intf = VLCIntf;
playlist_t * p_playlist = pl_Get( VLCIntf );
int i_volume_step = config_GetInt( VLCIntf->p_libvlc, "volume-step" );
int i_parameter = (int) ( d_audioVolume * i_volume_step / 4 );
[[VLCCoreInteraction sharedInstance] setVolume:i_parameter];
}
Do you've got a hint for me how to use one of the functions like libvlc_audio_get_track_count in libvlc_media_player.h ?
I tried s.th. like:
libvlc_media_player_t *p_media_player = mediacontrol_get_media_player( ??? );
int i = libvlc_audio_get_track_count( p_media_player );
but I don't know how to get a mediacontrol_instance and I also get compile errors, because libvlc_media_player.h can't be found…
Any hints would be really appreciated, cause I spent some hours without effort finding my way :(
Thanks
Jan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20110913/8ecab7b3/attachment.html>
More information about the vlc-devel
mailing list