commit c391da13606202618ed9024566260d6689a9aae5
Author: Christophe Fergeau <cferg...@mandriva.com>
Date:   Sun Feb 28 21:55:40 2010 +0100

    attempt at handling new smart playlist action
    
    Newer iTunes add some smart playlists to a mhsd type 5, but these smart
    playlists use an unknown action type (0x800). While it's not known yet how 
it
    behaves, attempt to partially handle it to avoid libgpod warnings.

 docs/reference/tmpl/smart-playlists.sgml |    2 ++
 src/itdb.h                               |   18 ++++++++++++++++++
 src/itdb_playlist.c                      |   13 +++++++++++++
 3 files changed, 33 insertions(+), 0 deletions(-)
---
diff --git a/docs/reference/tmpl/smart-playlists.sgml 
b/docs/reference/tmpl/smart-playlists.sgml
index 613d5df..8a54c5c 100644
--- a/docs/reference/tmpl/smart-playlists.sgml
+++ b/docs/reference/tmpl/smart-playlists.sgml
@@ -112,6 +112,7 @@ These functions and structures are for dealing with smart 
playlists.
 @ITDB_SPLACTION_IS_IN_THE_RANGE: 
 @ITDB_SPLACTION_IS_IN_THE_LAST: 
 @ITDB_SPLACTION_BINARY_AND: 
+...@itdb_splaction_binary_unknown1: 
 @ITDB_SPLACTION_IS_STRING: 
 @ITDB_SPLACTION_CONTAINS: 
 @ITDB_SPLACTION_STARTS_WITH: 
@@ -121,6 +122,7 @@ These functions and structures are for dealing with smart 
playlists.
 @ITDB_SPLACTION_IS_NOT_LESS_THAN: 
 @ITDB_SPLACTION_IS_NOT_IN_THE_RANGE: 
 @ITDB_SPLACTION_IS_NOT_IN_THE_LAST: 
+...@itdb_splaction_binary_unknown2: 
 @ITDB_SPLACTION_IS_NOT: 
 @ITDB_SPLACTION_DOES_NOT_CONTAIN: 
 @ITDB_SPLACTION_DOES_NOT_START_WITH: 
diff --git a/src/itdb.h b/src/itdb.h
index 840a637..c5329b4 100644
--- a/src/itdb.h
+++ b/src/itdb.h
@@ -447,6 +447,8 @@ typedef enum {
  *  bit 7 = unknown, but probably less than or equal to
  *  bit 8 = a range selection
  *  bit 9 = "in the last"
+ *  bit 10 = binary AND
+ *  bit 11 = unknown
  *  </programlisting>
  * </informalexample>
  *
@@ -459,6 +461,20 @@ typedef enum {
     ITDB_SPLACTION_IS_IN_THE_RANGE = 0x00000100,
     ITDB_SPLACTION_IS_IN_THE_LAST = 0x00000200,
     ITDB_SPLACTION_BINARY_AND = 0x00000400,
+    /* This action has been seen in the smart playlists stored in mhsd5
+     * on recent ipods. It operates on the "video kind" field. 
+     * It uses integer values, and the from/to values are different.
+     * The "from" value might be the list of bits that are allowed to be set
+     * in the value we are matching, and the "to" value might be a value
+     * that must be set in the value we are matching. For example, there's 
+     * a TVShow playlist using that action, from is 0x208044, to is 0x40. 
+     * "video kind" is a bitfield so the 1st value let us filter out
+     * entries with unwanted bits, and the second one ensures we have a
+     * TVShow. A match could be tested with:
+     * is_match = (((val & from) == val) && (val & to))
+     * I'm not sure what this becomes when this action is negated...
+     */
+    ITDB_SPLACTION_BINARY_UNKNOWN1 = 0x00000800,
 
     ITDB_SPLACTION_IS_STRING = 0x01000001,
     ITDB_SPLACTION_CONTAINS = 0x01000002,
@@ -470,6 +486,8 @@ typedef enum {
     ITDB_SPLACTION_IS_NOT_LESS_THAN = 0x02000040,
     ITDB_SPLACTION_IS_NOT_IN_THE_RANGE = 0x02000100,
     ITDB_SPLACTION_IS_NOT_IN_THE_LAST = 0x02000200,
+    ITDB_SPLACTION_BINARY_UNKNOWN2 = 0x02000800,
+
 
     ITDB_SPLACTION_IS_NOT = 0x03000001,
     ITDB_SPLACTION_DOES_NOT_CONTAIN = 0x03000002,
diff --git a/src/itdb_playlist.c b/src/itdb_playlist.c
index ab0488f..97134fa 100644
--- a/src/itdb_playlist.c
+++ b/src/itdb_playlist.c
@@ -71,6 +71,8 @@ gboolean itdb_spl_action_known (ItdbSPLAction action)
     case ITDB_SPLACTION_IS_NOT:
     case ITDB_SPLACTION_DOES_NOT_CONTAIN:
     case ITDB_SPLACTION_BINARY_AND:
+    case ITDB_SPLACTION_BINARY_UNKNOWN1:
+    case ITDB_SPLACTION_BINARY_UNKNOWN2:
        result = TRUE;
     }
     if (result == FALSE)
@@ -187,6 +189,8 @@ ItdbSPLActionType itdb_splr_get_action_type (const 
Itdb_SPLRule *splr)
        case ITDB_SPLACTION_IS_IN_THE_LAST:
        case ITDB_SPLACTION_IS_NOT_IN_THE_LAST:
        case ITDB_SPLACTION_BINARY_AND:
+       case ITDB_SPLACTION_BINARY_UNKNOWN1:
+       case ITDB_SPLACTION_BINARY_UNKNOWN2:
            return ITDB_SPLAT_INVALID;
        }
        /* Unknown action type */
@@ -207,6 +211,8 @@ ItdbSPLActionType itdb_splr_get_action_type (const 
Itdb_SPLRule *splr)
        case ITDB_SPLACTION_IS_IN_THE_RANGE:
            return ITDB_SPLAT_RANGE_INT;
        case ITDB_SPLACTION_BINARY_AND:
+       case ITDB_SPLACTION_BINARY_UNKNOWN1:
+       case ITDB_SPLACTION_BINARY_UNKNOWN2:
        case ITDB_SPLACTION_IS_STRING:
        case ITDB_SPLACTION_CONTAINS:
        case ITDB_SPLACTION_STARTS_WITH:
@@ -251,11 +257,16 @@ ItdbSPLActionType itdb_splr_get_action_type (const 
Itdb_SPLRule *splr)
        case ITDB_SPLACTION_IS_NOT:
        case ITDB_SPLACTION_DOES_NOT_CONTAIN:
        case ITDB_SPLACTION_BINARY_AND:
+       case ITDB_SPLACTION_BINARY_UNKNOWN1:
+       case ITDB_SPLACTION_BINARY_UNKNOWN2:
            return ITDB_SPLAT_INVALID;
        }
     case ITDB_SPLFT_BINARY_AND:
        switch ((ItdbSPLAction)splr->action)
        {
+       case ITDB_SPLACTION_BINARY_UNKNOWN1:
+       case ITDB_SPLACTION_BINARY_UNKNOWN2:
+            return ITDB_SPLAT_UNKNOWN;
        case ITDB_SPLACTION_BINARY_AND:
            return ITDB_SPLAT_BINARY_AND;
        case ITDB_SPLACTION_IS_INT:
@@ -306,6 +317,8 @@ ItdbSPLActionType itdb_splr_get_action_type (const 
Itdb_SPLRule *splr)
        case ITDB_SPLACTION_IS_NOT:
        case ITDB_SPLACTION_DOES_NOT_CONTAIN:
        case ITDB_SPLACTION_BINARY_AND:
+       case ITDB_SPLACTION_BINARY_UNKNOWN1:
+       case ITDB_SPLACTION_BINARY_UNKNOWN2:
            return ITDB_SPLAT_INVALID;
        }
        /* Unknown action type */

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
gtkpod-cvs2 mailing list
gtkpod-cvs2@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gtkpod-cvs2

Reply via email to