- }
- else
- {
- if ([[theTableColumn identifier] isEqualToString: @"description"])
- {
- toBeReturned = pp_bookmarks[row]->psz_name;
- vlc_object_release( p_input );
- return [NSString stringWithUTF8String: toBeReturned];
- }
- else if ([[theTableColumn identifier] isEqualToString: @"size_offset"])
- {
- i_toBeReturned = pp_bookmarks[row]->i_byte_offset;
- vlc_object_release( p_input );
- return [[NSNumber numberWithInt: i_toBeReturned] stringValue];
- }
- else if ([[theTableColumn identifier] isEqualToString: @"time_offset"])
- {
- i_toBeReturned = pp_bookmarks[row]->i_time_offset;
- vlc_object_release( p_input );
- return [[NSNumber numberWithInt: (i_toBeReturned / 1000000)] \
- stringValue];
- }
- else
- {
- /* may not happen, but just in case */
- vlc_object_release( p_input );
- msg_Err(p_intf, "VLCBookmarks: unknown table column identifier " \
- "(%s) while updating table", [[theTableColumn identifier] \
- UTF8String] );
- return @"unknown identifier";
+ else if (input_Control(p_input, INPUT_GET_BOOKMARKS, &pp_bookmarks, &i_bookmarks) != VLC_SUCCESS)
+ ret = @"";
+ else if (row >= i_bookmarks)
+ ret = @"";
+ else {
+ NSString * identifier = [theTableColumn identifier];
+ if ([identifier isEqualToString: @"description"])
+ ret = toNSStr(pp_bookmarks[row]->psz_name);
+ else if ([identifier isEqualToString: @"size_offset"])
+ ret = [NSString stringWithFormat:@"%lli", pp_bookmarks[row]->i_byte_offset];
+ else if ([identifier isEqualToString: @"time_offset"]) {
+ int total = pp_bookmarks[row]->i_time_offset/ 1000000;
+ int hour = total / (60*60);
+ int min = (total - hour*60*60) / 60;
+ int sec = total - hour*60*60 - min*60;
+ ret = [NSString stringWithFormat:@"%02d:%02d:%02d", hour, min, sec];