This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Apr 13th, 2010  |  syntax: None  |  size: 3.15 KB  |  views: 201  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Index: apps/gui/skin_engine/skin_display.c
  2. ===================================================================
  3. --- apps/gui/skin_engine/skin_display.c (revision 25615)
  4. +++ apps/gui/skin_engine/skin_display.c (working copy)
  5. @@ -178,7 +178,7 @@
  6.      }
  7.  }
  8.  
  9. -bool audio_peek_track(struct mp3entry* id3, int offset);
  10. +bool audio_peek_track_noblock(struct mp3entry* id3, int offset);
  11.  static void draw_playlist_viewer_list(struct gui_wps *gwps,
  12.                                        struct playlistviewer *viewer)
  13.  {
  14. @@ -210,7 +210,8 @@
  15.              pid3 = state->nid3;
  16.          }
  17.  #if CONFIG_CODEC == SWCODEC
  18. -        else if ((i>cur_playlist_pos) && audio_peek_track(&id3, i-cur_playlist_pos))
  19. +        else if ((i>cur_playlist_pos) &&
  20. +                audio_peek_track_noblock(&id3, i-cur_playlist_pos))
  21.          {
  22.              pid3 = &id3;
  23.          }
  24. Index: apps/playback.c
  25. ===================================================================
  26. --- apps/playback.c     (revision 25615)
  27. +++ apps/playback.c     (working copy)
  28. @@ -646,6 +646,24 @@
  29.      return false;
  30.  }
  31.  
  32. +bool audio_peek_track_noblock(struct mp3entry* id3, int offset)
  33. +{
  34. +    int next_idx;
  35. +    int new_offset = ci.new_track + wps_offset + offset;
  36. +
  37. +    if (!audio_have_tracks())
  38. +        return false;
  39. +    next_idx = (track_ridx + new_offset) & MAX_TRACK_MASK;
  40. +
  41. +    if (tracks[next_idx].id3_hid >= 0 &&
  42. +        (bufavailable(tracks[next_idx].id3_hid) == sizeof(struct mp3entry)))
  43. +    {
  44. +        return bufread(tracks[next_idx].id3_hid, sizeof(struct mp3entry), id3)
  45. +                    == sizeof(struct mp3entry);
  46. +    }
  47. +    return false;
  48. +}
  49. +
  50.  #ifdef HAVE_ALBUMART
  51.  int playback_current_aa_hid(int slot)
  52.  {
  53. Index: apps/buffering.c
  54. ===================================================================
  55. --- apps/buffering.c    (revision 25615)
  56. +++ apps/buffering.c    (working copy)
  57. @@ -1307,6 +1307,19 @@
  58.      return adjusted_size;
  59.  }
  60.  
  61. +ssize_t bufavailable(int handle_id)
  62. +{
  63. +    const struct memory_handle *h;
  64. +
  65. +    h = find_handle(handle_id);
  66. +
  67. +    if (!h)
  68. +        return ERR_HANDLE_NOT_FOUND;
  69. +        
  70. +    return h->available;
  71. +}
  72. +    
  73. +
  74.  ssize_t bufgettail(int handle_id, size_t size, void **data)
  75.  {
  76.      size_t tidx;
  77. Index: apps/buffering.h
  78. ===================================================================
  79. --- apps/buffering.h    (revision 25615)
  80. +++ apps/buffering.h    (working copy)
  81. @@ -64,6 +64,7 @@
  82.   * bufadvance: Move handle reading index, relatively to current position
  83.   * bufread   : Copy data from a handle to a buffer
  84.   * bufgetdata: Obtain a pointer for linear access to a "size" amount of data
  85. + * bufavailable: Get the number of bytes currently available for the handle
  86.   * bufgettail: Out-of-band get the last size bytes of a handle.
  87.   * bufcuttail: Out-of-band remove the trailing 'size' bytes of a handle.
  88.   *
  89. @@ -82,6 +83,7 @@
  90.  int bufadvance(int handle_id, off_t offset);
  91.  ssize_t bufread(int handle_id, size_t size, void *dest);
  92.  ssize_t bufgetdata(int handle_id, size_t size, void **data);
  93. +ssize_t bufavailable(int handle_id);
  94.  ssize_t bufgettail(int handle_id, size_t size, void **data);
  95.  ssize_t bufcuttail(int handle_id, size_t size);
clone this paste RAW Paste Data