[mythtv] Looking to commit code...

David Blain mythtv at theblains.net
Tue Mar 6 22:00:33 UTC 2012


> Kind of in the same vein are bitmask properties like recording video and 
> audio properties. Right now a raw integer is written which is a pain to
interpret. 
> You'd expect the json to look like this:
>
> VideoProps:
>   {
>     VID_DAMAGED : false,
>     VID_1080 : true,
>     ...
>   }
> 
> Same deal for enums: a recording's status is written as an integer where 
> you'd expect to see "rsRecorded" etc.
> 
> Is the bitmask thing intentional? Slip through the cracks?
> 
> If you give a hint for how to implement it I could whip up a patch
assuming 
> that such changes are welcome at this late stage.
> 
> - George

The serialization library is written to be generic with no knowledge of the
data being serialized other than that provided by Qt's metadata.

Although Qt does have a way to identify enums (using the Q_ENUM macro), I
hit a snag using it.  It requires that the enums be part of the class using
the macro and this class needs to be derived from QObject.  

Since we're using enums that are defined in the global namespace located in
other libraries, the Q_ENUM macro doesn't work.  I looked into two options:

1) Make duplicate enums in the Service/Data Contract classes (too likely to
get out of sync).
2) Move enums to Service/Data Contract classes.  (This would need a large
refactoring of the current code base... not something I was willing to take
on at this point)

If you can find a solution to this, I'd be more than happy to review/commit
the patch.

David.



More information about the mythtv-dev mailing list