Changeset dc723a84d4d51c3db68193966c46be82dd0f7e15
- Timestamp:
- 07/04/06 20:38:30
(3 years ago)
- Author:
- Felix Paul Kühne <fkuehne@videolan.org>
- git-committer:
- Felix Paul Kühne <fkuehne@videolan.org> 1144435110 +0000
- git-parent:
[1f8e57e56a742e99d643e9e75c2298972a7d2bf3]
- git-author:
- Felix Paul Kühne <fkuehne@videolan.org> 1144435110 +0000
- Message:
* don't free a vlc-object. Thanks to Meuuh for pointing this out.
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| rb8f24b4 |
rdc723a8 |
|
| 2 | 2 | * bookmarks.m: MacOS X Bookmarks window |
|---|
| 3 | 3 | ***************************************************************************** |
|---|
| 4 | | * Copyright (C) 2005 the VideoLAN team |
|---|
| | 4 | * Copyright (C) 2005, 2006 the VideoLAN team |
|---|
| 5 | 5 | * $Id$ |
|---|
| 6 | 6 | * |
|---|
| … | … | |
| 78 | 78 | - (void)dealloc |
|---|
| 79 | 79 | { |
|---|
| 80 | | if(p_old_input) |
|---|
| 81 | | { |
|---|
| 82 | | free(p_old_input); |
|---|
| | 80 | if( p_old_input ) |
|---|
| | 81 | { |
|---|
| | 82 | vlc_object_release( p_old_input ); |
|---|
| 83 | 83 | } |
|---|
| 84 | 84 | [super dealloc]; |
|---|
| … | … | |
| 96 | 96 | [o_btn_extract setTitle: _NS("Extract")]; |
|---|
| 97 | 97 | [o_btn_rm setTitle: _NS("Remove")]; |
|---|
| 98 | | [[[o_tbl_dataTable tableColumnWithIdentifier:@"description"] headerCell] \ |
|---|
| | 98 | [[[o_tbl_dataTable tableColumnWithIdentifier:@"description"] headerCell] |
|---|
| 99 | 99 | setStringValue: _NS("Description")]; |
|---|
| 100 | | [[[o_tbl_dataTable tableColumnWithIdentifier:@"size_offset"] headerCell] \ |
|---|
| | 100 | [[[o_tbl_dataTable tableColumnWithIdentifier:@"size_offset"] headerCell] |
|---|
| 101 | 101 | setStringValue: _NS("Position")]; |
|---|
| 102 | | [[[o_tbl_dataTable tableColumnWithIdentifier:@"time_offset"] headerCell] \ |
|---|
| | 102 | [[[o_tbl_dataTable tableColumnWithIdentifier:@"time_offset"] headerCell] |
|---|
| 103 | 103 | setStringValue: _NS("Time")]; |
|---|
| 104 | 104 | |
|---|
| … | … | |
| 122 | 122 | /* add item to list */ |
|---|
| 123 | 123 | intf_thread_t * p_intf = VLCIntf; |
|---|
| 124 | | input_thread_t * p_input = (input_thread_t *)vlc_object_find( p_intf, \ |
|---|
| | 124 | input_thread_t * p_input = (input_thread_t *)vlc_object_find( p_intf, |
|---|
| 125 | 125 | VLC_OBJECT_INPUT, FIND_ANYWHERE ); |
|---|
| 126 | 126 | if( !p_input ) |
|---|
| … | … | |
| 149 | 149 | /* clear table */ |
|---|
| 150 | 150 | intf_thread_t * p_intf = VLCIntf; |
|---|
| 151 | | input_thread_t *p_input = (input_thread_t *)vlc_object_find( p_intf, \ |
|---|
| | 151 | input_thread_t *p_input = (input_thread_t *)vlc_object_find( p_intf, |
|---|
| 152 | 152 | VLC_OBJECT_INPUT, FIND_ANYWHERE ); |
|---|
| 153 | 153 | |
|---|
| … | … | |
| 168 | 168 | * really trust it */ |
|---|
| 169 | 169 | intf_thread_t * p_intf = VLCIntf; |
|---|
| 170 | | input_thread_t * p_input = (input_thread_t *)vlc_object_find( p_intf, \ |
|---|
| | 170 | input_thread_t * p_input = (input_thread_t *)vlc_object_find( p_intf, |
|---|
| 171 | 171 | VLC_OBJECT_INPUT, FIND_ANYWHERE ); |
|---|
| 172 | 172 | seekpoint_t **pp_bookmarks; |
|---|
| … | … | |
| 183 | 183 | return; |
|---|
| 184 | 184 | } |
|---|
| 185 | | else if( input_Control( p_input, INPUT_GET_BOOKMARKS, &pp_bookmarks, \ |
|---|
| | 185 | else if( input_Control( p_input, INPUT_GET_BOOKMARKS, &pp_bookmarks, |
|---|
| 186 | 186 | &i_bookmarks ) != VLC_SUCCESS ) |
|---|
| 187 | 187 | { |
|---|
| … | … | |
| 194 | 194 | return; |
|---|
| 195 | 195 | } else { |
|---|
| 196 | | [o_edit_fld_name setStringValue: [NSString stringWithUTF8String: \ |
|---|
| | 196 | [o_edit_fld_name setStringValue: [NSString stringWithUTF8String: |
|---|
| 197 | 197 | pp_bookmarks[row]->psz_name]]; |
|---|
| 198 | | [o_edit_fld_time setStringValue: [[NSNumber numberWithInt: \ |
|---|
| | 198 | [o_edit_fld_time setStringValue: [[NSNumber numberWithInt: |
|---|
| 199 | 199 | (pp_bookmarks[row]->i_time_offset / 1000000)] stringValue]]; |
|---|
| 200 | | [o_edit_fld_bytes setStringValue: [[NSNumber numberWithInt: \ |
|---|
| | 200 | [o_edit_fld_bytes setStringValue: [[NSNumber numberWithInt: |
|---|
| 201 | 201 | pp_bookmarks[row]->i_byte_offset] stringValue]]; |
|---|
| 202 | 202 | } |
|---|
| … | … | |
| 226 | 226 | seekpoint_t **pp_bookmarks; |
|---|
| 227 | 227 | int i_bookmarks, i; |
|---|
| 228 | | input_thread_t *p_input = (input_thread_t *)vlc_object_find( p_intf, \ |
|---|
| | 228 | input_thread_t *p_input = (input_thread_t *)vlc_object_find( p_intf, |
|---|
| 229 | 229 | VLC_OBJECT_INPUT, FIND_ANYWHERE ); |
|---|
| 230 | 230 | |
|---|
| 231 | 231 | if( !p_input ) |
|---|
| 232 | 232 | { |
|---|
| 233 | | NSBeginCriticalAlertSheet(_NS("No input"), _NS("OK"), \ |
|---|
| 234 | | @"", @"", o_bookmarks_window, nil, nil, nil, nil, _NS("No " \ |
|---|
| 235 | | "input found. A stream must be playing or paused for " \ |
|---|
| | 233 | NSBeginCriticalAlertSheet(_NS("No input"), _NS("OK"), |
|---|
| | 234 | @"", @"", o_bookmarks_window, nil, nil, nil, nil, _NS("No " |
|---|
| | 235 | "input found. A stream must be playing or paused for " |
|---|
| 236 | 236 | "bookmarks to work.")); |
|---|
| 237 | 237 | return; |
|---|
| … | … | |
| 239 | 239 | if( p_old_input != p_input ) |
|---|
| 240 | 240 | { |
|---|
| 241 | | NSBeginCriticalAlertSheet(_NS("Input has changed"), _NS("OK"), \ |
|---|
| 242 | | @"", @"", o_bookmarks_window, nil, nil, nil, nil, _NS("Input " \ |
|---|
| 243 | | "has changed, unable to save bookmark. Suspending playback with " \ |
|---|
| 244 | | "\"Pause\" while editing bookmarks to ensure to keep the same " \ |
|---|
| | 241 | NSBeginCriticalAlertSheet(_NS("Input has changed"), _NS("OK"), |
|---|
| | 242 | @"", @"", o_bookmarks_window, nil, nil, nil, nil, _NS("Input " |
|---|
| | 243 | "has changed, unable to save bookmark. Suspending playback with " |
|---|
| | 244 | "\"Pause\" while editing bookmarks to ensure to keep the same " |
|---|
| 245 | 245 | "input.")); |
|---|
| 246 | 246 | vlc_object_release( p_input ); |
|---|
| … | … | |
| 248 | 248 | } |
|---|
| 249 | 249 | |
|---|
| 250 | | if( input_Control( p_input, INPUT_GET_BOOKMARKS, &pp_bookmarks, \ |
|---|
| | 250 | if( input_Control( p_input, INPUT_GET_BOOKMARKS, &pp_bookmarks, |
|---|
| 251 | 251 | &i_bookmarks ) != VLC_SUCCESS ) |
|---|
| 252 | 252 | { |
|---|
| … | … | |
| 266 | 266 | pp_bookmarks[i]->i_time_offset = ([[o_edit_fld_time stringValue] intValue] * 1000000); |
|---|
| 267 | 267 | |
|---|
| 268 | | if( input_Control( p_input, INPUT_CHANGE_BOOKMARK, pp_bookmarks[i], i ) \ |
|---|
| | 268 | if( input_Control( p_input, INPUT_CHANGE_BOOKMARK, pp_bookmarks[i], i ) |
|---|
| 269 | 269 | != VLC_SUCCESS ) |
|---|
| 270 | 270 | { |
|---|
| … | … | |
| 290 | 290 | if( [o_tbl_dataTable numberOfSelectedRows] < 2 ) |
|---|
| 291 | 291 | { |
|---|
| 292 | | NSBeginAlertSheet(_NS("Invalid selection"), _NS("OK"), \ |
|---|
| 293 | | @"", @"", o_bookmarks_window, nil, nil, nil, nil, _NS("" \ |
|---|
| 294 | | "Two bookmarks have to be selected.")); |
|---|
| | 292 | NSBeginAlertSheet(_NS("Invalid selection"), _NS("OK"), |
|---|
| | 293 | @"", @"", o_bookmarks_window, nil, nil, nil, nil, |
|---|
| | 294 | _NS("Two bookmarks have to be selected.")); |
|---|
| 295 | 295 | return; |
|---|
| 296 | 296 | } |
|---|
| … | … | |
| 300 | 300 | if( !p_input ) |
|---|
| 301 | 301 | { |
|---|
| 302 | | NSBeginCriticalAlertSheet(_NS("No input found"), _NS("OK"), \ |
|---|
| 303 | | @"", @"", o_bookmarks_window, nil, nil, nil, nil, _NS("" \ |
|---|
| 304 | | "The stream must be playing or paused for bookmarks to work.")); |
|---|
| | 302 | NSBeginCriticalAlertSheet(_NS("No input found"), _NS("OK"), |
|---|
| | 303 | @"", @"", o_bookmarks_window, nil, nil, nil, nil, |
|---|
| | 304 | _NS("The stream must be playing or paused for bookmarks to work.")); |
|---|
| 305 | 305 | return; |
|---|
| 306 | 306 | } |
|---|
| … | … | |
| 332 | 332 | msg_Dbg(p_intf, "got the bookmark-indexes"); |
|---|
| 333 | 333 | |
|---|
| 334 | | if( input_Control( p_input, INPUT_GET_BOOKMARKS, &pp_bookmarks, \ |
|---|
| | 334 | if( input_Control( p_input, INPUT_GET_BOOKMARKS, &pp_bookmarks, |
|---|
| 335 | 335 | &i_bookmarks ) != VLC_SUCCESS ) |
|---|
| 336 | 336 | { |
|---|
| … | … | |
| 341 | 341 | msg_Dbg(p_intf, "calling wizard"); |
|---|
| 342 | 342 | |
|---|
| 343 | | [[[VLCMain sharedInstance] getWizard] initWithExtractValuesFrom: \ |
|---|
| 344 | | [[NSNumber numberWithInt: \ |
|---|
| 345 | | (pp_bookmarks[i_first]->i_time_offset/1000000)] stringValue] \ |
|---|
| 346 | | to: [[NSNumber numberWithInt: \ |
|---|
| 347 | | (pp_bookmarks[i_second]->i_time_offset/1000000)] stringValue] \ |
|---|
| 348 | | ofItem: [NSString stringWithUTF8String: \ |
|---|
| | 343 | [[[VLCMain sharedInstance] getWizard] initWithExtractValuesFrom: |
|---|
| | 344 | [[NSNumber numberWithInt: |
|---|
| | 345 | (pp_bookmarks[i_first]->i_time_offset/1000000)] stringValue] |
|---|
| | 346 | to: [[NSNumber numberWithInt: |
|---|
| | 347 | (pp_bookmarks[i_second]->i_time_offset/1000000)] stringValue] |
|---|
| | 348 | ofItem: [NSString stringWithUTF8String: |
|---|
| 349 | 349 | p_input->input.p_item->psz_uri]]; |
|---|
| 350 | 350 | vlc_object_release( p_input ); |
|---|
| … | … | |
| 356 | 356 | intf_thread_t * p_intf = VLCIntf; |
|---|
| 357 | 357 | input_thread_t *p_input = |
|---|
| 358 | | (input_thread_t *)vlc_object_find( p_intf, VLC_OBJECT_INPUT, FIND_ANYWHERE ); |
|---|
| | 358 | (input_thread_t *)vlc_object_find( p_intf, VLC_OBJECT_INPUT, |
|---|
| | 359 | FIND_ANYWHERE ); |
|---|
| 359 | 360 | |
|---|
| 360 | 361 | if( !p_input ) |
|---|
| … | … | |
| 373 | 374 | intf_thread_t * p_intf = VLCIntf; |
|---|
| 374 | 375 | input_thread_t *p_input = |
|---|
| 375 | | (input_thread_t *)vlc_object_find( p_intf, VLC_OBJECT_INPUT, FIND_ANYWHERE ); |
|---|
| | 376 | (input_thread_t *)vlc_object_find( p_intf, VLC_OBJECT_INPUT, |
|---|
| | 377 | FIND_ANYWHERE ); |
|---|
| 376 | 378 | |
|---|
| 377 | 379 | if( !p_input ) return; |
|---|
| … | … | |
| 405 | 407 | /* return the number of bookmarks */ |
|---|
| 406 | 408 | intf_thread_t * p_intf = VLCIntf; |
|---|
| 407 | | input_thread_t * p_input = (input_thread_t *)vlc_object_find( p_intf, \ |
|---|
| | 409 | input_thread_t * p_input = (input_thread_t *)vlc_object_find( p_intf, |
|---|
| 408 | 410 | VLC_OBJECT_INPUT, FIND_ANYWHERE ); |
|---|
| 409 | 411 | seekpoint_t **pp_bookmarks; |
|---|
| … | … | |
| 414 | 416 | return 0; |
|---|
| 415 | 417 | } |
|---|
| 416 | | else if( input_Control( p_input, INPUT_GET_BOOKMARKS, &pp_bookmarks, \ |
|---|
| | 418 | else if( input_Control( p_input, INPUT_GET_BOOKMARKS, &pp_bookmarks, |
|---|
| 417 | 419 | &i_bookmarks ) != VLC_SUCCESS ) |
|---|
| 418 | 420 | { |
|---|
| … | … | |
| 426 | 428 | } |
|---|
| 427 | 429 | |
|---|
| 428 | | - (id)tableView:(NSTableView *)theDataTable objectValueForTableColumn: \ |
|---|
| | 430 | - (id)tableView:(NSTableView *)theDataTable objectValueForTableColumn: |
|---|
| 429 | 431 | (NSTableColumn *)theTableColumn row: (int)row |
|---|
| 430 | 432 | { |
|---|
| 431 | 433 | /* return the corresponding data as NSString */ |
|---|
| 432 | 434 | intf_thread_t * p_intf = VLCIntf; |
|---|
| 433 | | input_thread_t * p_input = (input_thread_t *)vlc_object_find( p_intf, \ |
|---|
| | 435 | input_thread_t * p_input = (input_thread_t *)vlc_object_find( p_intf, |
|---|
| 434 | 436 | VLC_OBJECT_INPUT, FIND_ANYWHERE ); |
|---|
| 435 | 437 | seekpoint_t **pp_bookmarks; |
|---|
| … | … | |
| 444 | 446 | return @""; |
|---|
| 445 | 447 | } |
|---|
| 446 | | else if( input_Control( p_input, INPUT_GET_BOOKMARKS, &pp_bookmarks, \ |
|---|
| | 448 | else if( input_Control( p_input, INPUT_GET_BOOKMARKS, &pp_bookmarks, |
|---|
| 447 | 449 | &i_bookmarks ) != VLC_SUCCESS ) |
|---|
| 448 | 450 | { |
|---|
| … | … | |
| 468 | 470 | i_toBeReturned = pp_bookmarks[row]->i_time_offset; |
|---|
| 469 | 471 | vlc_object_release( p_input ); |
|---|
| 470 | | return [[NSNumber numberWithInt: (i_toBeReturned / 1000000)] \ |
|---|
| | 472 | return [[NSNumber numberWithInt: (i_toBeReturned / 1000000)] |
|---|
| 471 | 473 | stringValue]; |
|---|
| 472 | 474 | } |
|---|
| … | … | |
| 475 | 477 | /* may not happen, but just in case */ |
|---|
| 476 | 478 | vlc_object_release( p_input ); |
|---|
| 477 | | msg_Err(p_intf, "unknown table column identifier (%s) while" \ |
|---|
| 478 | | "updating the bookmark table", [[theTableColumn identifier] \ |
|---|
| | 479 | msg_Err(p_intf, "unknown table column identifier (%s) while " |
|---|
| | 480 | "updating the bookmark table", [[theTableColumn identifier] |
|---|
| 479 | 481 | |
|---|
| 480 | 482 | UTF8String] ); |
|---|