Changeset 1b26ff77b0fd9ea5d713c7acd52259e6c68efbf5

Show
Ignore:
Timestamp:
30/12/07 02:50:14 (9 months ago)
Author:
Pierre d'Herbemont <pdherbemont@videolan.org>
git-committer:
Pierre d'Herbemont <pdherbemont@videolan.org> 1198979414 +0000
git-parent:

[0d4609bfb9bdb1900613263ac66b354dd3bf754a]

git-author:
Pierre d'Herbemont <pdherbemont@videolan.org> 1198979414 +0000
Message:

MacOSX/Framework/VLCMedia.m: Update the subitems on sub item additions.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • extras/MacOSX/Framework/Sources/VLCMedia.m

    r35f97be r1b26ff7  
    7171/* Callback Methods */ 
    7272- (void)metaChanged:(NSString *)metaType; 
     73- (void)subItemAdded; 
    7374@end 
    7475 
     
    123124} 
    124125 
     126static void HandleMediaSubItemAdded(const libvlc_event_t *event, void *self) 
     127{ 
     128    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 
     129    [[VLCEventManager sharedManager] callOnMainThreadObject:self 
     130                                                 withMethod:@selector(subItemAdded) 
     131                                       withArgumentAsObject:nil]; 
     132    [pool release]; 
     133} 
     134 
    125135/****************************************************************************** 
    126136 * Implementation 
     
    207217            libvlc_event_detach(p_em, libvlc_MediaDescriptorDurationChanged, HandleMediaDurationChanged, self, NULL); 
    208218            libvlc_event_detach(p_em, libvlc_MediaDescriptorStateChanged,    HandleMediaStateChanged,    self, NULL); 
     219            libvlc_event_detach(p_em, libvlc_MediaDescriptorSubItemAdded,    HandleMediaSubItemAdded,    self, NULL); 
    209220        } 
    210221        [super release]; 
     
    428439    libvlc_event_attach(p_em, libvlc_MediaDescriptorDurationChanged, HandleMediaDurationChanged, self, &ex); 
    429440    libvlc_event_attach(p_em, libvlc_MediaDescriptorStateChanged,    HandleMediaStateChanged,    self, &ex); 
     441    libvlc_event_attach(p_em, libvlc_MediaDescriptorSubItemAdded,    HandleMediaSubItemAdded,    self, &ex); 
    430442    quit_on_exception( &ex ); 
    431443     
     
    439451        libvlc_media_list_release( p_mlist ); 
    440452    } 
     453 
    441454    state = LibVLCStateToMediaState(libvlc_media_descriptor_get_state( p_md, NULL )); 
    442455    /* Force VLCMetaInformationTitle, that will trigger preparsing 
     
    490503    [self fetchMetaInformationFromLibVLCWithType:metaType]; 
    491504} 
     505 
     506- (void)subItemAdded 
     507{ 
     508    if( subitems ) 
     509        return; /* Nothing to do */ 
     510 
     511    libvlc_media_list_t *p_mlist = libvlc_media_descriptor_subitems( p_md, NULL ); 
     512 
     513    NSAssert( p_mlist, @"The mlist shouldn't be nil, we are receiving a subItemAdded"); 
     514 
     515    [self willChangeValueForKey:@"subitems"]; 
     516    subitems = [[VLCMediaList mediaListWithLibVLCMediaList:p_mlist] retain]; 
     517    [self didChangeValueForKey:@"subitems"]; 
     518    libvlc_media_list_release( p_mlist ); 
     519} 
    492520@end 
    493521