Opened 14 years ago

Closed 14 years ago

#655 closed patch (fixed)

Refactoring of addListener/dispatch code

Reported by: eskil <myth@…> Owned by: Isaac Richards
Priority: minor Milestone: unknown
Component: mythtv Version:
Severity: medium Keywords:
Cc: Ticket locked: no

Description

While working on shoutcast/musictree code, I had to add another class that implemented the addListener/removeListener/dispatch API. This API was implemented by

  • OutputListeners (inherited by AudioOutput)
  • MythContext
  • !Decoder (mythmusic)

instead to cut'n'pasting all that code again, I donned the refactoring hat and moved this into a MythObservable class, and changed the above classes to inherit from this. Submitting this as a separate patch to keep it reviewable.

The changes are

  • add MythObservable in mythobservable.h/.cpp, implements add/removeListener, dispatch and dispatchNow.
  • move MythEvent from mythcontext.h into mythevent.h
  • make OutputEvent and DecoderEvent inherit from MythEvent (so I'm ensured that the event passed to !MythObservable::dispatch implemnets a clone method).
  • make MythContext, OutputListeners and Decoder inherit MythObservable, remove their implementations of add/remove/dispatch.
  • doxygen comments for MythObservable...
  • Additionally, moved mythmusic/genres.c into a .h and .cpp file, since that makes the genre list accessible from other metadata editors.

Attachments (2)

observable.patch (26.8 KB) - added by eskil <myth@…> 14 years ago.
patch that introduces MythObservable? and moves genres.c to genres.h/genres.cpp
observable.2.patch (26.7 KB) - added by eskil <myth@…> 14 years ago.
obligatory remove-cruft and fit coding style patch update…

Download all attachments as: .zip

Change History (3)

Changed 14 years ago by eskil <myth@…>

Attachment: observable.patch added

patch that introduces MythObservable? and moves genres.c to genres.h/genres.cpp

Changed 14 years ago by eskil <myth@…>

Attachment: observable.2.patch added

obligatory remove-cruft and fit coding style patch update...

comment:1 Changed 14 years ago by Isaac Richards

Resolution: fixed
Status: newclosed

(In [8175]) Close #655 by applying patch (refactoring the listener code).

Note: See TracTickets for help on using tickets.