Changeset 211b483e7eb44ad8c4fe56ca298515d210d9ef71
- Timestamp:
- 30/05/07 01:25:47 (2 years ago)
- git-parent:
- Files:
-
- modules/control/dbus.c (modified) (15 diffs)
- modules/control/dbus.h (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
modules/control/dbus.c
r9025fab r211b483 67 67 static int Open ( vlc_object_t * ); 68 68 static void Close ( vlc_object_t * ); 69 static void Run ( intf_thread_t * );69 static void Run ( intf_thread_t * ); 70 70 71 71 … … 179 179 i_pos = position.f_float * 1000 ; 180 180 } 181 pl_Release( ((vlc_object_t*) p_this) ); 181 182 ADD_INT32( &i_pos ); 182 pl_Release( ((vlc_object_t*) p_this) );183 183 REPLY_SEND; 184 184 } … … 189 189 REPLY_INIT; 190 190 vlc_value_t position; 191 playlist_t* p_playlist = NULL; 191 192 dbus_int32_t i_pos; 192 193 … … 205 206 return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; 206 207 } 207 p laylist_t *p_playlist = pl_Yield( ((vlc_object_t*) p_this) );208 p_playlist = pl_Yield( ((vlc_object_t*) p_this) ); 208 209 input_thread_t *p_input = p_playlist->p_input; 209 210 … … 330 331 } 331 332 333 DBUS_METHOD( GetCurrentMetadata ) 334 { 335 REPLY_INIT; 336 OUT_ARGUMENTS; 337 playlist_t* p_playlist = pl_Yield( (vlc_object_t*) p_this ); 338 339 GetInputMeta( p_playlist->status.p_item->p_input, &args ); 340 341 pl_Release( p_playlist ); 342 REPLY_SEND; 343 } 344 332 345 /* Media Player information */ 333 346 … … 351 364 DBusError error; 352 365 dbus_error_init( &error ); 366 playlist_t* p_playlist = NULL; 353 367 354 368 char *psz_mrl; … … 368 382 } 369 383 370 p laylist_t *p_playlist = pl_Yield( (vlc_object_t*) p_this );384 p_playlist = pl_Yield( (vlc_object_t*) p_this ); 371 385 playlist_Add( p_playlist, psz_mrl, NULL, PLAYLIST_APPEND | 372 ( ( b_play == TRUE ) ? PLAYLIST_GO : 0 ) , 373 PLAYLIST_END, VLC_TRUE, VLC_FALSE );386 ( ( b_play == TRUE ) ? PLAYLIST_GO : 0 ) , 387 PLAYLIST_END, VLC_TRUE, VLC_FALSE ); 374 388 pl_Release( p_playlist ); 375 389 … … 384 398 playlist_t *p_playlist = pl_Yield( (vlc_object_t*) p_this ); 385 399 playlist_item_t* p_tested_item = p_playlist->p_root_onelevel; 386 387 while ( p_tested_item->p_input->i_id != 400 401 while ( p_tested_item->p_input->i_id != 388 402 p_playlist->status.p_item->p_input->i_id ) 389 403 { … … 399 413 400 414 DBUS_METHOD( GetMetadata ) 401 { 415 { 402 416 REPLY_INIT; 403 417 OUT_ARGUMENTS; … … 406 420 407 421 dbus_int32_t i_position, i_count = 0; 408 422 409 423 playlist_t *p_playlist = pl_Yield( (vlc_object_t*) p_this ); 410 424 playlist_item_t* p_tested_item = p_playlist->p_root_onelevel; … … 494 508 pl_Release( p_playlist ); 495 509 510 REPLY_SEND; 511 } 512 513 DBUS_METHOD( Loop ) 514 { 515 REPLY_INIT; 516 OUT_ARGUMENTS; 517 518 DBusError error; 519 dbus_bool_t b_loop; 520 vlc_value_t val; 521 playlist_t* p_playlist = NULL; 522 523 dbus_error_init( &error ); 524 dbus_message_get_args( p_from, &error, 525 DBUS_TYPE_BOOLEAN, &b_loop, 526 DBUS_TYPE_INVALID ); 527 528 if( dbus_error_is_set( &error ) ) 529 { 530 msg_Err( (vlc_object_t*) p_this, "D-Bus message reading : %s\n", 531 error.message ); 532 dbus_error_free( &error ); 533 return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; 534 } 535 536 val.b_bool = ( b_loop == TRUE ) ? VLC_TRUE : VLC_FALSE ; 537 p_playlist = pl_Yield( (vlc_object_t*) p_this ); 538 var_Set ( p_playlist, "loop", val ); 539 pl_Release( ((vlc_object_t*) p_this) ); 540 541 REPLY_SEND; 542 } 543 544 DBUS_METHOD( Repeat ) 545 { 546 REPLY_INIT; 547 OUT_ARGUMENTS; 548 549 DBusError error; 550 dbus_bool_t b_repeat; 551 vlc_value_t val; 552 playlist_t* p_playlist = NULL; 553 554 dbus_error_init( &error ); 555 dbus_message_get_args( p_from, &error, 556 DBUS_TYPE_BOOLEAN, &b_repeat, 557 DBUS_TYPE_INVALID ); 558 559 if( dbus_error_is_set( &error ) ) 560 { 561 msg_Err( (vlc_object_t*) p_this, "D-Bus message reading : %s\n", 562 error.message ); 563 dbus_error_free( &error ); 564 return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; 565 } 566 567 val.b_bool = ( b_repeat == TRUE ) ? VLC_TRUE : VLC_FALSE ; 568 569 p_playlist = pl_Yield( (vlc_object_t*) p_this ); 570 var_Set ( p_playlist, "repeat", val ); 571 pl_Release( ((vlc_object_t*) p_this) ); 572 496 573 REPLY_SEND; 497 574 } … … 567 644 METHOD_FUNC( "PositionGet", PositionGet ); 568 645 METHOD_FUNC( "GetStatus", GetStatus ); 646 METHOD_FUNC( "GetMetadata", GetCurrentMetadata ); 569 647 570 648 return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; … … 584 662 METHOD_FUNC( "AddTrack", AddTrack ); 585 663 METHOD_FUNC( "DelTrack", DelTrack ); 664 METHOD_FUNC( "Loop", Loop ); 665 METHOD_FUNC( "Repeat", Repeat ); 586 666 587 667 return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; … … 753 833 DBusMessageIter *args ) 754 834 { /*FIXME: Works only for already read metadata. */ 755 /*FIXME: Should return the length in seconds rather than milliseconds */756 835 757 836 DBusMessageIter dict, dict_entry, variant; 837 /* We need the track length to be expressed in seconds 838 * instead of milliseconds */ 839 dbus_int64_t i_length = (p_input->i_duration / 1000); 840 758 841 759 842 const char* ppsz_meta_items[] = … … 788 871 ADD_META( 17, DBUS_TYPE_INT32, p_input->p_meta->i_status ); 789 872 ADD_META( 18, DBUS_TYPE_STRING, p_input->psz_uri ); 790 ADD_META( 19, DBUS_TYPE_INT64, p_input->i_duration);873 ADD_META( 19, DBUS_TYPE_INT64, i_length ); 791 874 792 875 dbus_message_iter_close_container( args, &dict ); modules/control/dbus.h
ra33fbe9 r211b483 5 5 * $Id$ 6 6 * 7 * Author: Rafaël Carré <funman at videolanorg> 7 * Authors: Rafaël Carré <funman at videolanorg> 8 * Mirsal ENNAIME <mirsal dot ennaime at gmail dot com> 8 9 * 9 10 * This program is free software; you can redistribute it and/or modify … … 139 140 " <arg type=\"i\" direction=\"out\" />\n" 140 141 " </method>\n" 142 " <method name=\"GetMetadata\">\n" 143 " <arg type=\"a{sv}\" direction=\"out\" />\n" 144 " </method>\n" 141 145 " </interface>\n" 142 146 "</node>\n" … … 170 174 " <arg type=\"i\" direction=\"out\" />\n" 171 175 " </method>\n" 176 " <method name=\"Loop\">\n" 177 " <arg type=\"b\" direction=\"in\" />\n" 178 " </method>\n" 179 " <method name=\"Repeat\">\n" 180 " <arg type=\"b\" direction=\"in\" />\n" 181 " </method>\n" 172 182 " </interface>\n" 173 183 "</node>\n"
