1
0

toc.c 753 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #include "acd.h"
  2. Toc thetoc;
  3. void
  4. tocthread(void *v)
  5. {
  6. Drive *d;
  7. threadsetname("tocthread");
  8. d = v;
  9. DPRINT(2, "recv ctocdisp?...");
  10. while(recv(d->ctocdisp, &thetoc) == 1) {
  11. DPRINT(2, "recv ctocdisp!...");
  12. drawtoc(d->w, &thetoc);
  13. DPRINT(2, "send dbreq...\n");
  14. send(d->ctocdbreq, &thetoc);
  15. }
  16. }
  17. void
  18. freetoc(Toc *t)
  19. {
  20. int i;
  21. free(t->title);
  22. for(i=0; i<t->ntrack; i++)
  23. free(t->track[i].title);
  24. }
  25. void
  26. cddbthread(void *v)
  27. {
  28. Drive *d;
  29. Toc t;
  30. threadsetname("cddbthread");
  31. d = v;
  32. while(recv(d->ctocdbreply, &t) == 1) {
  33. if(thetoc.nchange == t.nchange) {
  34. freetoc(&thetoc);
  35. thetoc = t;
  36. redrawtoc(d->w, &thetoc);
  37. }
  38. }
  39. }
  40. void
  41. cdstatusthread(void *v)
  42. {
  43. Drive *d;
  44. Cdstatus s;
  45. d = v;
  46. for(;;)
  47. recv(d->cstat, &s);
  48. }