Changeset 1886ae1a376ebd893ed2941197e8872d27f8d6c0

Show
Ignore:
Timestamp:
27/03/08 15:08:14 (7 months ago)
Author:
Felix Paul Kühne <fkuehne@videolan.org>
git-committer:
Felix Paul Kühne <fkuehne@videolan.org> 1206626894 +0100
git-parent:

[db088db0439ce5b537234f7c868162a4be106fbe]

git-author:
Felix Paul Kühne <fkuehne@videolan.org> 1206626894 +0100
Message:

Implementing meta tag writing and cleaned a bit up

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • extras/package/macosx/Resources/English.lproj/MediaInfo.nib/classes.nib

    raa9bce0 r1886ae1  
    1515        <dict> 
    1616            <key>CLASS</key> 
     17            <string>NSTextField</string> 
     18            <key>LANGUAGE</key> 
     19            <string>ObjC</string> 
     20            <key>SUPERCLASS</key> 
     21            <string>NSControl</string> 
     22        </dict> 
     23        <dict> 
     24            <key>CLASS</key> 
    1725            <string>NSObject</string> 
    1826            <key>LANGUAGE</key> 
     
    2634                <key>deleteOutlineGroup</key> 
    2735                <string>id</string> 
     36                <key>metaFieldChanged</key> 
     37                <string>id</string> 
    2838                <key>saveMetaData</key> 
    29                 <string>id</string> 
    30                 <key>toggleInfoPanel</key> 
    31                 <string>id</string> 
    32                 <key>togglePlaylistInfoPanel</key> 
    3339                <string>id</string> 
    3440            </dict> 
  • extras/package/macosx/Resources/English.lproj/MediaInfo.nib/info.nib

    raa9bce0 r1886ae1  
    1111    <key>IBOpenObjects</key> 
    1212    <array> 
    13         <integer>8</integer> 
     13        <integer>3</integer> 
    1414    </array> 
    1515    <key>IBSystem Version</key> 
  • modules/gui/macosx/playlistinfo.h

    raa9bce0 r1886ae1  
    100100 
    101101- (void)initPanel; 
     102- (IBAction)metaFieldChanged:(id)sender; 
    102103- (IBAction)saveMetaData:(id)sender; 
    103104- (void)updatePanel; 
  • modules/gui/macosx/playlistinfo.m

    raa9bce0 r1886ae1  
    8686    [o_nowPlaying_lbl setStringValue: _NS(VLC_META_NOW_PLAYING)]; 
    8787    [o_publisher_lbl setStringValue: _NS(VLC_META_PUBLISHER)]; 
    88   
     88 
    8989    /* statistics */ 
    9090    [o_input_box setTitle: _NS("Input")]; 
     
    9393    [o_demux_bytes_lbl setStringValue: _NS("Demuxed")]; 
    9494    [o_demux_bitrate_lbl setStringValue: _NS("Stream bitrate")]; 
    95   
     95 
    9696    [o_video_box setTitle: _NS("Video")]; 
    9797    [o_video_decoded_lbl setStringValue: _NS("Decoded blocks")]; 
     
    9999    [o_lost_frames_lbl setStringValue: _NS("Lost frames")]; 
    100100    [o_fps_lbl setStringValue: _NS("Frames per Second")]; 
    101   
     101 
    102102    [o_sout_box setTitle: _NS("Streaming")]; 
    103103    [o_sent_packets_lbl setStringValue: _NS("Sent packets")]; 
    104104    [o_sent_bytes_lbl setStringValue: _NS("Sent bytes")]; 
    105105    [o_sent_bitrate_lbl setStringValue: _NS("Send rate")]; 
    106   
     106 
    107107    [o_audio_box setTitle: _NS("Audio")]; 
    108108    [o_audio_decoded_lbl setStringValue: _NS("Decoded blocks")]; 
    109109    [o_played_abuffers_lbl setStringValue: _NS("Played buffers")]; 
    110110    [o_lost_abuffers_lbl setStringValue: _NS("Lost buffers")]; 
     111 
     112    [o_info_window setInitialFirstResponder: o_uri_txt]; 
    111113} 
    112114 
     
    157159 
    158160    /* fill uri info */ 
    159     char *psz_uri = input_item_GetURI( p_item->p_input ); 
    160     if( psz_uri ) 
    161     { 
    162         [o_uri_txt setStringValue: [NSString stringWithUTF8String:psz_uri]]; 
    163     } 
    164     free( psz_uri ); 
     161    if( input_item_GetURI( p_item->p_input ) != NULL ) 
     162    { 
     163        [o_uri_txt setStringValue: [NSString stringWithUTF8String: input_item_GetURI( p_item->p_input ) ]]; 
     164    } 
    165165 
    166166#define SET( foo, bar ) \ 
     
    180180    SET( language, Language ); 
    181181    SET( date, Date ); 
     182    SET( description, Description ); 
    182183 
    183184#undef SET 
    184      
     185 
    185186    char *psz_meta; 
    186187    NSImage *o_image; 
    187     /* FIXME!!  
    188     psz_meta = input_item_GetArtURL( p_item ); 
     188    psz_meta = input_item_GetArtURL( p_item->p_input ); 
    189189    if( psz_meta && !strncmp( psz_meta, "file://", 7 ) ) 
    190190        o_image = [[NSImage alloc] initWithContentsOfURL: [NSURL URLWithString: [NSString stringWithUTF8String: psz_meta]]]; 
    191     else */ 
     191    else 
    192192        o_image = [[NSImage imageNamed: @"noart.png"] retain]; 
    193193    [o_image_well setImage: o_image]; 
    194194    [o_image release]; 
    195     //free( psz_meta ); 
     195    FREENULL( psz_meta ); 
    196196 
    197197    /* reload the advanced table */ 
     
    207207    if( psz_meta != NULL && *psz_meta) 
    208208        [theItem setStringValue: [NSString stringWithUTF8String:psz_meta]]; 
     209    else 
     210        [theItem setStringValue: @""]; 
    209211} 
    210212 
     
    230232        [o_lost_frames_txt setIntValue: p_item->p_input->p_stats->i_lost_pictures]; 
    231233        float f_fps = 0; 
    232         /* FIXME! input_Control( p_item->p_input, INPUT_GET_VIDEO_FPS, &f_fps ); */ 
     234        /* FIXME: input_Control( p_item->p_input, INPUT_GET_VIDEO_FPS, &f_fps ); */ 
    233235        [o_fps_txt setFloatValue: f_fps]; 
    234236 
     
    249251} 
    250252 
     253- (IBAction)metaFieldChanged:(id)sender 
     254{ 
     255    [o_saveMetaData_btn setEnabled: YES]; 
     256} 
     257 
    251258- (IBAction)saveMetaData:(id)sender 
    252259{ 
    253     /* TODO: implement this feature 
    254260    intf_thread_t * p_intf = VLCIntf; 
    255261    playlist_t * p_playlist = pl_Yield( p_intf ); 
     
    258264    if( [self isItemInPlaylist: p_item] ) 
    259265    { 
    260         input_item_SetName( p_item->p_input, (char*) 
    261                 [[o_title_txt stringValue] UTF8String] ); 
    262         input_item_SetURI( p_item->p_input, (char*) 
    263                 [[o_uri_txt stringValue] UTF8String] ); 
    264         input_item_SetArtist( p_item->p_input, (char*) 
    265                 [[o_author_txt stringValue] UTF8String] ); 
     266        meta_export_t p_export; 
     267        p_export.p_item = p_item->p_input; 
     268 
     269        if( p_item->p_input == NULL ) 
     270            goto end; 
     271 
     272        /* we can write meta data only in a file */ 
     273        vlc_mutex_lock( &p_item->p_input->lock ); 
     274        int i_type = p_item->p_input->i_type; 
     275        vlc_mutex_unlock( &p_item->p_input->lock ); 
     276        if( i_type == ITEM_TYPE_FILE ) 
     277        { 
     278            char *psz_uri_orig = input_item_GetURI( p_item->p_input ); 
     279            char *psz_uri = psz_uri_orig; 
     280            if( !strncmp( psz_uri, "file://", 7 ) ) 
     281                psz_uri += 7; /* strlen("file://") = 7 */ 
     282             
     283            p_export.psz_file = strndup( psz_uri, PATH_MAX ); 
     284            free( psz_uri_orig ); 
     285        } 
     286        else 
     287            goto end; 
     288 
     289        #define utf8( o_blub ) \ 
     290            [[o_blub stringValue] UTF8String] 
     291 
     292        input_item_SetName( p_item->p_input, utf8( o_title_txt ) ); 
     293        input_item_SetTitle( p_item->p_input, utf8( o_title_txt ) ); 
     294        input_item_SetArtist( p_item->p_input, utf8( o_author_txt ) ); 
     295        input_item_SetAlbum( p_item->p_input, utf8( o_collection_txt ) ); 
     296        input_item_SetGenre( p_item->p_input, utf8( o_genre_txt ) ); 
     297        input_item_SetTrackNum( p_item->p_input, utf8( o_seqNum_txt ) ); 
     298        input_item_SetDate( p_item->p_input, utf8( o_date_txt ) ); 
     299        input_item_SetCopyright( p_item->p_input, utf8( o_copyright_txt ) ); 
     300        input_item_SetPublisher( p_item->p_input, utf8( o_publisher_txt ) ); 
     301        input_item_SetDescription( p_item->p_input, utf8( o_description_txt ) ); 
     302        input_item_SetLanguage( p_item->p_input, utf8( o_language_txt ) ); 
     303 
     304        PL_LOCK; 
     305        p_playlist->p_private = &p_export; 
     306 
     307        module_t *p_mod = module_Need( p_playlist, "meta writer", NULL, 0 ); 
     308        if( p_mod ) 
     309            module_Unneed( p_playlist, p_mod ); 
     310        PL_UNLOCK; 
    266311 
    267312        val.b_bool = VLC_TRUE; 
    268313        var_Set( p_playlist, "intf-change", val ); 
    269     } 
    270     vlc_object_release( p_playlist );*/ 
     314        [self updatePanel]; 
     315    } 
     316 
     317    end: 
     318    vlc_object_release( p_playlist ); 
     319    [o_saveMetaData_btn setEnabled: NO]; 
    271320} 
    272321