Commit a8498fbd authored by Felix Paul Kühne's avatar Felix Paul Kühne

macosx/playlistinfo: remove object instance from xib file and set it up the proper way

parent 5fb6cff9
......@@ -29,73 +29,72 @@
@class VLCInfoTreeItem;
@interface VLCInfo : NSObject
{
IBOutlet id o_info_window;
IBOutlet id o_uri_lbl;
IBOutlet id o_title_lbl;
IBOutlet id o_author_lbl;
IBOutlet id o_uri_txt;
IBOutlet id o_title_txt;
IBOutlet id o_author_txt;
IBOutlet id o_outline_view;
IBOutlet id o_tab_view;
@property (readonly) input_item_t *item;
IBOutlet id o_collection_lbl;
IBOutlet id o_collection_txt;
IBOutlet id o_copyright_lbl;
IBOutlet id o_copyright_txt;
IBOutlet id o_date_lbl;
IBOutlet id o_date_txt;
IBOutlet id o_description_lbl;
IBOutlet id o_description_txt;
IBOutlet id o_encodedby_lbl;
IBOutlet id o_encodedby_txt;
IBOutlet id o_genre_lbl;
IBOutlet id o_genre_txt;
IBOutlet id o_language_lbl;
IBOutlet id o_language_txt;
IBOutlet id o_nowPlaying_lbl;
IBOutlet id o_nowPlaying_txt;
IBOutlet id o_publisher_lbl;
IBOutlet id o_publisher_txt;
IBOutlet id o_seqNum_lbl;
IBOutlet id o_seqNum_txt;
IBOutlet id o_image_well;
IBOutlet id o_saveMetaData_btn;
@property (readwrite, weak) IBOutlet NSPanel *infoPanel;
@property (readwrite, weak) IBOutlet NSOutlineView *outlineView;
@property (readwrite, weak) IBOutlet NSTabView *tabView;
IBOutlet id o_audio_lbl;
IBOutlet id o_audio_decoded_lbl;
IBOutlet id o_audio_decoded_txt;
IBOutlet id o_demux_bitrate_lbl;
IBOutlet id o_demux_bitrate_txt;
IBOutlet id o_demux_bytes_lbl;
IBOutlet id o_demux_bytes_txt;
IBOutlet id o_displayed_lbl;
IBOutlet id o_displayed_txt;
IBOutlet id o_input_bitrate_lbl;
IBOutlet id o_input_bitrate_txt;
IBOutlet id o_input_lbl;
IBOutlet id o_lost_abuffers_lbl;
IBOutlet id o_lost_abuffers_txt;
IBOutlet id o_lost_frames_lbl;
IBOutlet id o_lost_frames_txt;
IBOutlet id o_played_abuffers_lbl;
IBOutlet id o_played_abuffers_txt;
IBOutlet id o_read_bytes_lbl;
IBOutlet id o_read_bytes_txt;
IBOutlet id o_sent_bitrate_lbl;
IBOutlet id o_sent_bitrate_txt;
IBOutlet id o_sent_bytes_lbl;
IBOutlet id o_sent_bytes_txt;
IBOutlet id o_sent_packets_lbl;
IBOutlet id o_sent_packets_txt;
IBOutlet id o_sout_lbl;
IBOutlet id o_video_lbl;
IBOutlet id o_video_decoded_lbl;
IBOutlet id o_video_decoded_txt;
}
@property (readonly) input_item_t *item;
@property (readwrite, weak) IBOutlet NSTextField *uriLabel;
@property (readwrite, weak) IBOutlet NSTextField *titleLabel;
@property (readwrite, weak) IBOutlet NSTextField *authorLabel;
@property (readwrite, weak) IBOutlet NSTextField *uriTextField;
@property (readwrite, weak) IBOutlet NSTextField *titleTextField;
@property (readwrite, weak) IBOutlet NSTextField *authorTextField;
@property (readwrite, weak) IBOutlet NSTextField *collectionLabel;
@property (readwrite, weak) IBOutlet NSTextField *collectionTextField;
@property (readwrite, weak) IBOutlet NSTextField *copyrightLabel;
@property (readwrite, weak) IBOutlet NSTextField *copyrightTextField;
@property (readwrite, weak) IBOutlet NSTextField *dateLabel;
@property (readwrite, weak) IBOutlet NSTextField *dateTextField;
@property (readwrite, weak) IBOutlet NSTextField *descriptionLabel;
@property (readwrite, weak) IBOutlet NSTextField *descriptionTextField;
@property (readwrite, weak) IBOutlet NSTextField *encodedbyLabel;
@property (readwrite, weak) IBOutlet NSTextField *encodedbyTextField;
@property (readwrite, weak) IBOutlet NSTextField *genreLabel;
@property (readwrite, weak) IBOutlet NSTextField *genreTextField;
@property (readwrite, weak) IBOutlet NSTextField *languageLabel;
@property (readwrite, weak) IBOutlet NSTextField *languageTextField;
@property (readwrite, weak) IBOutlet NSTextField *nowPlayingLabel;
@property (readwrite, weak) IBOutlet NSTextField *nowPlayingTextField;
@property (readwrite, weak) IBOutlet NSTextField *publisherLabel;
@property (readwrite, weak) IBOutlet NSTextField *publisherTextField;
@property (readwrite, weak) IBOutlet NSTextField *seqNumLabel;
@property (readwrite, weak) IBOutlet NSTextField *seqNumTextField;
@property (readwrite, weak) IBOutlet NSImageView *imageWell;
@property (readwrite, weak) IBOutlet NSButton *saveMetaDataButton;
@property (readwrite, weak) IBOutlet NSTextField *audioLabel;
@property (readwrite, weak) IBOutlet NSTextField *audioDecodedLabel;
@property (readwrite, weak) IBOutlet NSTextField *audioDecodedTextField;
@property (readwrite, weak) IBOutlet NSTextField *demuxBitrateLabel;
@property (readwrite, weak) IBOutlet NSTextField *demuxBitrateTextField;
@property (readwrite, weak) IBOutlet NSTextField *demuxBytesLabel;
@property (readwrite, weak) IBOutlet NSTextField *demuxBytesTextField;
@property (readwrite, weak) IBOutlet NSTextField *displayedLabel;
@property (readwrite, weak) IBOutlet NSTextField *displayedTextField;
@property (readwrite, weak) IBOutlet NSTextField *inputBitrateLabel;
@property (readwrite, weak) IBOutlet NSTextField *inputBitrateTextField;
@property (readwrite, weak) IBOutlet NSTextField *inputLabel;
@property (readwrite, weak) IBOutlet NSTextField *lostAudioBuffersLabel;
@property (readwrite, weak) IBOutlet NSTextField *lostAudioBuffersTextField;
@property (readwrite, weak) IBOutlet NSTextField *lostFramesLabel;
@property (readwrite, weak) IBOutlet NSTextField *lostFramesTextField;
@property (readwrite, weak) IBOutlet NSTextField *playedAudioBuffersLabel;
@property (readwrite, weak) IBOutlet NSTextField *playedAudioBuffersTextField;
@property (readwrite, weak) IBOutlet NSTextField *readBytesLabel;
@property (readwrite, weak) IBOutlet NSTextField *readBytesTextField;
@property (readwrite, weak) IBOutlet NSTextField *sentBitrateLabel;
@property (readwrite, weak) IBOutlet NSTextField *sentBitrateTextField;
@property (readwrite, weak) IBOutlet NSTextField *sentBytesLabel;
@property (readwrite, weak) IBOutlet NSTextField *sentBytesTextField;
@property (readwrite, weak) IBOutlet NSTextField *sentPacketsLabel;
@property (readwrite, weak) IBOutlet NSTextField *sentPacketsTextField;
@property (readwrite, weak) IBOutlet NSTextField *soutLabel;
@property (readwrite, weak) IBOutlet NSTextField *videoLabel;
@property (readwrite, weak) IBOutlet NSTextField *videoDecodedLabel;
@property (readwrite, weak) IBOutlet NSTextField *videoDecodedTextField;
- (void)updateCocoaWindowLevel:(NSInteger)i_level;
- (void)initPanel;
......
/*****************************************************************************
r playlistinfo.m: MacOS X interface module
* playlistinfo.m: MacOS X interface module
*****************************************************************************
* Copyright (C) 2002-2015 VLC authors and VideoLAN
* $Id$
......@@ -20,11 +20,7 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
/*****************************************************************************
* Preamble
*****************************************************************************/
******************************************************************************/
#import "CompatibilityFixes.h"
#import "intf.h"
......@@ -32,16 +28,13 @@
#import "playlist.h"
#import <vlc_url.h>
/*****************************************************************************
* VLCPlaylistInfo Implementation
*****************************************************************************/
@interface VLCInfo ()
@interface VLCInfo () <NSOutlineViewDataSource, NSOutlineViewDelegate>
{
VLCInfoTreeItem *rootItem;
input_item_t *p_item;
BOOL b_nibLoaded;
BOOL b_awakeFromNib;
BOOL b_stats;
}
......@@ -49,85 +42,79 @@
@implementation VLCInfo
static VLCInfo *_o_sharedInstance = nil;
+ (VLCInfo *)sharedInstance
{
return _o_sharedInstance ? _o_sharedInstance : [[self alloc] init];
}
- (id)init
{
if (!_o_sharedInstance) {
_o_sharedInstance = [super init];
static VLCInfo *sharedInstance = nil;
static dispatch_once_t pred;
if (_o_sharedInstance != nil) {
p_item = NULL;
[self updatePanelWithItem: NULL];
rootItem = [[VLCInfoTreeItem alloc] init];
}
}
dispatch_once(&pred, ^{
sharedInstance = [VLCInfo new];
});
return _o_sharedInstance;
return sharedInstance;
}
- (void)awakeFromNib
{
[o_info_window setExcludedFromWindowsMenu: YES];
[_infoPanel setExcludedFromWindowsMenu: YES];
if (!OSX_SNOW_LEOPARD)
[o_info_window setCollectionBehavior: NSWindowCollectionBehaviorFullScreenAuxiliary];
[_infoPanel setCollectionBehavior: NSWindowCollectionBehaviorFullScreenAuxiliary];
[_infoPanel setTitle: _NS("Media Information")];
[o_info_window setTitle: _NS("Media Information")];
[o_uri_lbl setStringValue: _NS("Location")];
[o_title_lbl setStringValue: _NS("Title")];
[o_author_lbl setStringValue: _NS("Artist")];
[o_saveMetaData_btn setStringValue: _NS("Save Metadata")];
_outlineView.dataSource = self;
_outlineView.delegate = self;
[[o_tab_view tabViewItemAtIndex: 0] setLabel: _NS("General")];
[[o_tab_view tabViewItemAtIndex: 1] setLabel: _NS("Codec Details")];
[[o_tab_view tabViewItemAtIndex: 2] setLabel: _NS("Statistics")];
[o_tab_view selectTabViewItemAtIndex: 0];
[_uriLabel setStringValue: _NS("Location")];
[_titleLabel setStringValue: _NS("Title")];
[_authorLabel setStringValue: _NS("Artist")];
[_saveMetaDataButton setStringValue: _NS("Save Metadata")];
[[_tabView tabViewItemAtIndex: 0] setLabel: _NS("General")];
[[_tabView tabViewItemAtIndex: 1] setLabel: _NS("Codec Details")];
[[_tabView tabViewItemAtIndex: 2] setLabel: _NS("Statistics")];
[_tabView selectTabViewItemAtIndex: 0];
/* constants defined in vlc_meta.h */
[o_genre_lbl setStringValue: _NS(VLC_META_GENRE)];
[o_copyright_lbl setStringValue: _NS(VLC_META_COPYRIGHT)];
[o_collection_lbl setStringValue: _NS(VLC_META_ALBUM)];
[o_seqNum_lbl setStringValue: _NS(VLC_META_TRACK_NUMBER)];
[o_description_lbl setStringValue: _NS(VLC_META_DESCRIPTION)];
[o_date_lbl setStringValue: _NS(VLC_META_DATE)];
[o_language_lbl setStringValue: _NS(VLC_META_LANGUAGE)];
[o_nowPlaying_lbl setStringValue: _NS(VLC_META_NOW_PLAYING)];
[o_publisher_lbl setStringValue: _NS(VLC_META_PUBLISHER)];
[o_encodedby_lbl setStringValue: _NS(VLC_META_ENCODED_BY)];
[_genreLabel setStringValue: _NS(VLC_META_GENRE)];
[_copyrightLabel setStringValue: _NS(VLC_META_COPYRIGHT)];
[_collectionLabel setStringValue: _NS(VLC_META_ALBUM)];
[_seqNumLabel setStringValue: _NS(VLC_META_TRACK_NUMBER)];
[_descriptionLabel setStringValue: _NS(VLC_META_DESCRIPTION)];
[_dateLabel setStringValue: _NS(VLC_META_DATE)];
[_languageLabel setStringValue: _NS(VLC_META_LANGUAGE)];
[_nowPlayingLabel setStringValue: _NS(VLC_META_NOW_PLAYING)];
[_publisherLabel setStringValue: _NS(VLC_META_PUBLISHER)];
[_encodedbyLabel setStringValue: _NS(VLC_META_ENCODED_BY)];
/* statistics */
[o_input_lbl setStringValue: _NS("Input")];
[o_read_bytes_lbl setStringValue: _NS("Read at media")];
[o_input_bitrate_lbl setStringValue: _NS("Input bitrate")];
[o_demux_bytes_lbl setStringValue: _NS("Demuxed")];
[o_demux_bitrate_lbl setStringValue: _NS("Stream bitrate")];
[_inputLabel setStringValue: _NS("Input")];
[_readBytesLabel setStringValue: _NS("Read at media")];
[_inputBitrateLabel setStringValue: _NS("Input bitrate")];
[_demuxBytesLabel setStringValue: _NS("Demuxed")];
[_demuxBitrateLabel setStringValue: _NS("Stream bitrate")];
[o_video_lbl setStringValue: _NS("Video")];
[o_video_decoded_lbl setStringValue: _NS("Decoded blocks")];
[o_displayed_lbl setStringValue: _NS("Displayed frames")];
[o_lost_frames_lbl setStringValue: _NS("Lost frames")];
[_videoLabel setStringValue: _NS("Video")];
[_videoDecodedLabel setStringValue: _NS("Decoded blocks")];
[_displayedLabel setStringValue: _NS("Displayed frames")];
[_lostFramesLabel setStringValue: _NS("Lost frames")];
[o_sout_lbl setStringValue: _NS("Streaming")];
[o_sent_packets_lbl setStringValue: _NS("Sent packets")];
[o_sent_bytes_lbl setStringValue: _NS("Sent bytes")];
[o_sent_bitrate_lbl setStringValue: _NS("Send rate")];
[_soutLabel setStringValue: _NS("Streaming")];
[_sentPacketsLabel setStringValue: _NS("Sent packets")];
[_sentBytesLabel setStringValue: _NS("Sent bytes")];
[_sentBitrateLabel setStringValue: _NS("Send rate")];
[o_audio_lbl setStringValue: _NS("Audio")];
[o_audio_decoded_lbl setStringValue: _NS("Decoded blocks")];
[o_played_abuffers_lbl setStringValue: _NS("Played buffers")];
[o_lost_abuffers_lbl setStringValue: _NS("Lost buffers")];
[_audioLabel setStringValue: _NS("Audio")];
[_audioDecodedLabel setStringValue: _NS("Decoded blocks")];
[_playedAudioBuffersLabel setStringValue: _NS("Played buffers")];
[_lostAudioBuffersLabel setStringValue: _NS("Lost buffers")];
[o_info_window setInitialFirstResponder: o_uri_txt];
[_infoPanel setInitialFirstResponder: _uriLabel];
b_awakeFromNib = YES;
/* We may be awoken from nib way after initialisation
* Update ourselves */
*Update ourselves */
[self updatePanelWithItem:p_item];
}
......@@ -140,48 +127,50 @@ static VLCInfo *_o_sharedInstance = nil;
- (void)updateCocoaWindowLevel:(NSInteger)i_level
{
if (o_info_window && [o_info_window isVisible] && [o_info_window level] != i_level)
[o_info_window setLevel: i_level];
if (_infoPanel && [_infoPanel isVisible] && [_infoPanel level] != i_level)
[_infoPanel setLevel: i_level];
}
- (void)initPanel
{
if (!b_nibLoaded)
b_nibLoaded = [NSBundle loadNibNamed:@"MediaInfo" owner: self];
b_stats = var_InheritBool(VLCIntf, "stats");
if (!b_stats) {
if ([o_tab_view numberOfTabViewItems] > 2)
[o_tab_view removeTabViewItem: [o_tab_view tabViewItemAtIndex: 2]];
if ([_tabView numberOfTabViewItems] > 2)
[_tabView removeTabViewItem: [_tabView tabViewItemAtIndex: 2]];
}
else
[self initMediaPanelStats];
NSInteger i_level = [[[VLCMain sharedInstance] voutController] currentStatusWindowLevel];
[o_info_window setLevel: i_level];
[o_info_window makeKeyAndOrderFront:nil];
[_infoPanel setLevel: i_level];
[_infoPanel makeKeyAndOrderFront:nil];
}
- (void)initMediaPanelStats
{
//Initializing Input Variables
[o_read_bytes_txt setStringValue: [NSString stringWithFormat:_NS("%.1f KiB"), (float)0]];
[o_input_bitrate_txt setStringValue: [NSString stringWithFormat:@"%6.0f kb/s", (float)0]];
[o_demux_bytes_txt setStringValue: [NSString stringWithFormat:_NS("%.1f KiB"), (float)0]];
[o_demux_bitrate_txt setStringValue: [NSString stringWithFormat:@"%6.0f kb/s", (float)0]];
[_readBytesTextField setStringValue: [NSString stringWithFormat:_NS("%.1f KiB"), (float)0]];
[_inputBitrateTextField setStringValue: [NSString stringWithFormat:@"%6.0f kb/s", (float)0]];
[_demuxBytesTextField setStringValue: [NSString stringWithFormat:_NS("%.1f KiB"), (float)0]];
[_demuxBitrateTextField setStringValue: [NSString stringWithFormat:@"%6.0f kb/s", (float)0]];
//Initializing Video Variables
[o_video_decoded_txt setIntValue:0];
[o_displayed_txt setIntValue:0];
[o_lost_frames_txt setIntValue:0];
[_videoDecodedTextField setIntValue:0];
[_displayedTextField setIntValue:0];
[_lostFramesTextField setIntValue:0];
//Initializing Output Variables
[o_sent_packets_txt setIntValue: 0];
[o_sent_bytes_txt setStringValue: [NSString stringWithFormat:_NS("%.1f KiB"), (float)0]];
[o_sent_bitrate_txt setStringValue: [NSString stringWithFormat:@"%6.0f kb/s", (float)0]];
[_sentPacketsTextField setIntValue: 0];
[_sentBytesTextField setStringValue: [NSString stringWithFormat:_NS("%.1f KiB"), (float)0]];
[_sentBitrateTextField setStringValue: [NSString stringWithFormat:@"%6.0f kb/s", (float)0]];
//Initializing Audio Variables
[o_audio_decoded_txt setIntValue:0];
[o_played_abuffers_txt setIntValue: 0];
[o_lost_abuffers_txt setIntValue: 0];
[_audioDecodedTextField setIntValue:0];
[_playedAudioBuffersTextField setIntValue: 0];
[_lostAudioBuffersTextField setIntValue: 0];
}
- (void)updateMetadata
......@@ -195,17 +184,21 @@ static VLCInfo *_o_sharedInstance = nil;
- (void)updatePanelWithItem:(input_item_t *)_p_item;
{
@autoreleasepool {
rootItem = [[VLCInfoTreeItem alloc] init];
if (_p_item != p_item) {
if (p_item) vlc_gc_decref(p_item);
[o_saveMetaData_btn setEnabled: NO];
if (_p_item) vlc_gc_incref(_p_item);
if (p_item)
vlc_gc_decref(p_item);
[_saveMetaDataButton setEnabled: NO];
if (_p_item)
vlc_gc_incref(_p_item);
p_item = _p_item;
}
if (!p_item) {
/* Erase */
#define SET( foo ) \
[self setMeta: "" forLabel: o_##foo##_txt];
[self setMeta: "" forLabel: _##foo##TextField];
SET( uri );
SET( title );
SET( author );
......@@ -220,26 +213,26 @@ static VLCInfo *_o_sharedInstance = nil;
SET( description );
SET( encodedby );
#undef SET
[o_image_well setImage: [NSImage imageNamed: @"noart.png"]];
[_imageWell setImage: [NSImage imageNamed: @"noart.png"]];
} else {
if (!input_item_IsPreparsed(p_item))
libvlc_MetaRequest(VLCIntf->p_libvlc, p_item, META_REQUEST_OPTION_NONE);
/* fill uri info */
char * psz_url = decode_URI(input_item_GetURI(p_item));
[o_uri_txt setStringValue: [NSString stringWithUTF8String:psz_url ? psz_url : ""]];
char *psz_url = decode_URI(input_item_GetURI(p_item));
[_uriTextField setStringValue: [NSString stringWithUTF8String:psz_url ? psz_url : ""]];
free(psz_url);
/* fill title info */
char * psz_title = input_item_GetTitle(p_item);
char *psz_title = input_item_GetTitle(p_item);
if (!psz_title)
psz_title = input_item_GetName(p_item);
[o_title_txt setStringValue: [NSString stringWithUTF8String:psz_title ? : ""]];
[_titleTextField setStringValue: [NSString stringWithUTF8String:psz_title ? : ""]];
free(psz_title);
#define SET( foo, bar ) \
char *psz_##foo = input_item_Get##bar ( p_item ); \
[self setMeta: psz_##foo forLabel: o_##foo##_txt]; \
[self setMeta: psz_##foo forLabel: _##foo##TextField]; \
FREENULL( psz_##foo );
/* fill the other fields */
......@@ -258,22 +251,22 @@ static VLCInfo *_o_sharedInstance = nil;
#undef SET
char *psz_meta;
NSImage *o_image;
NSImage *image;
psz_meta = input_item_GetArtURL(p_item);
/* FIXME Can also be attachment:// */
if (psz_meta && strncmp(psz_meta, "attachment://", 13))
o_image = [[NSImage alloc] initWithContentsOfURL: [NSURL URLWithString:[NSString stringWithUTF8String:psz_meta]]];
image = [[NSImage alloc] initWithContentsOfURL: [NSURL URLWithString:[NSString stringWithUTF8String:psz_meta]]];
else
o_image = [NSImage imageNamed: @"noart.png"];
[o_image_well setImage: o_image];
image = [NSImage imageNamed: @"noart.png"];
[_imageWell setImage: image];
FREENULL(psz_meta);
}
/* reload the advanced table */
[rootItem refresh];
[o_outline_view reloadData];
[o_outline_view expandItem:nil expandChildren:YES];
[_outlineView reloadData];
[_outlineView expandItem:nil expandChildren:YES];
/* update the stats once to display p_item change faster */
[self updateStatistics];
......@@ -293,7 +286,7 @@ static VLCInfo *_o_sharedInstance = nil;
if (!b_awakeFromNib || !b_stats)
return;
if ([o_info_window isVisible]) {
if ([_infoPanel isVisible]) {
if (!p_item || !p_item->p_stats) {
[self initMediaPanelStats];
return;
......@@ -302,31 +295,31 @@ static VLCInfo *_o_sharedInstance = nil;
vlc_mutex_lock(&p_item->p_stats->lock);
/* input */
[o_read_bytes_txt setStringValue: [NSString stringWithFormat:
[_readBytesTextField setStringValue: [NSString stringWithFormat:
@"%8.0f KiB", (float)(p_item->p_stats->i_read_bytes)/1024]];
[o_input_bitrate_txt setStringValue: [NSString stringWithFormat:
[_inputBitrateTextField setStringValue: [NSString stringWithFormat:
@"%6.0f kb/s", (float)(p_item->p_stats->f_input_bitrate)*8000]];
[o_demux_bytes_txt setStringValue: [NSString stringWithFormat:
[_demuxBytesTextField setStringValue: [NSString stringWithFormat:
@"%8.0f KiB", (float)(p_item->p_stats->i_demux_read_bytes)/1024]];
[o_demux_bitrate_txt setStringValue: [NSString stringWithFormat:
[_demuxBitrateTextField setStringValue: [NSString stringWithFormat:
@"%6.0f kb/s", (float)(p_item->p_stats->f_demux_bitrate)*8000]];
/* Video */
[o_video_decoded_txt setIntValue: p_item->p_stats->i_decoded_video];
[o_displayed_txt setIntValue: p_item->p_stats->i_displayed_pictures];
[o_lost_frames_txt setIntValue: p_item->p_stats->i_lost_pictures];
[_videoDecodedTextField setIntValue: p_item->p_stats->i_decoded_video];
[_displayedTextField setIntValue: p_item->p_stats->i_displayed_pictures];
[_lostFramesTextField setIntValue: p_item->p_stats->i_lost_pictures];
/* Sout */
[o_sent_packets_txt setIntValue: p_item->p_stats->i_sent_packets];
[o_sent_bytes_txt setStringValue: [NSString stringWithFormat: @"%8.0f KiB",
[_sentPacketsTextField setIntValue: p_item->p_stats->i_sent_packets];
[_sentBytesTextField setStringValue: [NSString stringWithFormat: @"%8.0f KiB",
(float)(p_item->p_stats->i_sent_bytes)/1024]];
[o_sent_bitrate_txt setStringValue: [NSString stringWithFormat:
[_sentBitrateTextField setStringValue: [NSString stringWithFormat:
@"%6.0f kb/s", (float)(p_item->p_stats->f_send_bitrate*8)*1000]];
/* Audio */
[o_audio_decoded_txt setIntValue: p_item->p_stats->i_decoded_audio];
[o_played_abuffers_txt setIntValue: p_item->p_stats->i_played_abuffers];
[o_lost_abuffers_txt setIntValue: p_item->p_stats->i_lost_abuffers];
[_audioDecodedTextField setIntValue: p_item->p_stats->i_decoded_audio];
[_playedAudioBuffersTextField setIntValue: p_item->p_stats->i_played_abuffers];
[_lostAudioBuffersTextField setIntValue: p_item->p_stats->i_lost_abuffers];
vlc_mutex_unlock(&p_item->p_stats->lock);
}
......@@ -334,7 +327,7 @@ static VLCInfo *_o_sharedInstance = nil;
- (IBAction)metaFieldChanged:(id)sender
{
[o_saveMetaData_btn setEnabled: YES];
[_saveMetaDataButton setEnabled: YES];
}
- (IBAction)saveMetaData:(id)sender
......@@ -342,28 +335,28 @@ static VLCInfo *_o_sharedInstance = nil;
if (!p_item)
goto error;
#define utf8( o_blub ) \
[[o_blub stringValue] UTF8String]
input_item_SetName( p_item, utf8( o_title_txt ) );
input_item_SetTitle( p_item, utf8( o_title_txt ) );
input_item_SetArtist( p_item, utf8( o_author_txt ) );
input_item_SetAlbum( p_item, utf8( o_collection_txt ) );
input_item_SetGenre( p_item, utf8( o_genre_txt ) );
input_item_SetTrackNum( p_item, utf8( o_seqNum_txt ) );
input_item_SetDate( p_item, utf8( o_date_txt ) );
input_item_SetCopyright( p_item, utf8( o_copyright_txt ) );
input_item_SetPublisher( p_item, utf8( o_publisher_txt ) );
input_item_SetDescription( p_item, utf8( o_description_txt ) );
input_item_SetLanguage( p_item, utf8( o_language_txt ) );
playlist_t * p_playlist = pl_Get(VLCIntf);
#define utf8( _blub ) \
[[_blub stringValue] UTF8String]
input_item_SetName( p_item, utf8( _titleTextField ) );
input_item_SetTitle( p_item, utf8( _titleTextField ) );
input_item_SetArtist( p_item, utf8( _authorTextField ) );
input_item_SetAlbum( p_item, utf8( _collectionTextField ) );
input_item_SetGenre( p_item, utf8( _genreTextField ) );
input_item_SetTrackNum( p_item, utf8( _seqNumTextField ) );
input_item_SetDate( p_item, utf8( _dateTextField ) );
input_item_SetCopyright( p_item, utf8( _copyrightTextField ) );
input_item_SetPublisher( p_item, utf8( _publisherTextField ) );
input_item_SetDescription( p_item, utf8( _descriptionTextField ) );
input_item_SetLanguage( p_item, utf8( _languageTextField ) );
playlist_t *p_playlist = pl_Get(VLCIntf);
input_item_WriteMeta(VLC_OBJECT(p_playlist), p_item);
var_SetBool(p_playlist, "intf-change", true);
[self updatePanelWithItem: p_item];
[o_saveMetaData_btn setEnabled: NO];
[_saveMetaDataButton setEnabled: NO];
return;
error:
......@@ -374,7 +367,7 @@ error:
- (IBAction)downloadCoverArt:(id)sender
{
playlist_t * p_playlist = pl_Get(VLCIntf);
playlist_t *p_playlist = pl_Get(VLCIntf);
if (p_item) libvlc_ArtRequest(VLCIntf->p_libvlc, p_item, META_REQUEST_OPTION_NONE);
}
......@@ -388,11 +381,9 @@ error:
@implementation VLCInfo (NSMenuValidation)
- (BOOL)validateMenuItem:(NSMenuItem *)o_mi
- (BOOL)validateMenuItem:(NSMenuItem *)mi
{
BOOL bEnabled = TRUE;
if ([[o_mi title] isEqualToString: _NS("Information")]) {
if ([[mi title] isEqualToString: _NS("Information")]) {
return ![[[VLCMain sharedInstance] playlist] isSelectionEmpty];
}
......@@ -430,7 +421,7 @@ error:
@interface VLCInfoTreeItem ()
{
int i_object_id;
input_item_t * p_item;
input_item_t *p_item;
VLCInfoTreeItem *_parent;
NSMutableArray *_children;
BOOL _isALeafNode;
......@@ -452,7 +443,7 @@ error:
_value = [item_value copy];
i_object_id = i_id;
_parent = parent_item;
p_item = [(VLCInfo *)[[VLCMain sharedInstance] info] item];
p_item = [[VLCInfo sharedInstance] item];
}
return self;
}
......@@ -469,7 +460,7 @@ error:
}
/* Creates and returns the array of children
* Loads children incrementally */
*Loads children incrementally */
- (void)_updateChildren
{
if (!p_item)
......@@ -499,7 +490,7 @@ error:
}
else if (_parent->i_object_id == -1) {
vlc_mutex_lock(&p_item->lock);
info_category_t * cat = p_item->pp_categories[i_object_id];
info_category_t *cat = p_item->pp_categories[i_object_id];
for (int i = 0 ; i < cat->i_infos ; i++) {
NSString *name;
NSString *value;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment