jpeg: remove all the dlna stuff
authorLeandro Dorileo <leandro.maciel.dorileo@intel.com>
Fri, 17 Jan 2014 12:40:06 +0000 (10:40 -0200)
committerLeandro Dorileo <leandro.maciel.dorileo@intel.com>
Wed, 29 Jan 2014 12:15:44 +0000 (10:15 -0200)
Remove all the dlna stuff and make use of the container field so
we can know the rules to apply.

src/plugins/jpeg/jpeg.c

index 70b7e2f..70c1750 100644 (file)
 #include <string.h>
 #include <strings.h>
 
-static const struct lms_string_size dlna_mime =
-    LMS_STATIC_STRING_SIZE("image/jpeg");
-static const struct lms_string_size dlna_sm_ico =
-    LMS_STATIC_STRING_SIZE("JPEG_SM_ICO");
-static const struct lms_string_size dlna_lrg_ico =
-    LMS_STATIC_STRING_SIZE("JPEG_LRG_ICO");
-static const struct lms_string_size dlna_tn =
-    LMS_STATIC_STRING_SIZE("JPEG_TN");
-static const struct lms_string_size dlna_sm =
-    LMS_STATIC_STRING_SIZE("JPEG_SM");
-static const struct lms_string_size dlna_med =
-    LMS_STATIC_STRING_SIZE("JPEG_MED");
-static const struct lms_string_size dlna_lrg =
-    LMS_STATIC_STRING_SIZE("JPEG_LRG");
-
-static void
-_fill_dlna_profile(struct lms_image_info *info)
-{
-    const unsigned short w = info->width;
-    const unsigned short h = info->height;
-
-    info->dlna_mime = dlna_mime;
-
-    if (w == 0 || h == 0)
-        return;
-
-    if (w == 48 && h == 48)
-        info->dlna_profile = dlna_sm_ico;
-    else if (w == 120 && h == 120)
-        info->dlna_profile = dlna_lrg_ico;
-    else if (w <= 160 && h <= 160)
-        info->dlna_profile = dlna_tn;
-    else if (w <= 640 && h <= 480)
-        info->dlna_profile = dlna_sm;
-    else if (w <= 1024 && h <= 768)
-        info->dlna_profile = dlna_med;
-    else if (w <= 4096 && h <= 4096)
-        info->dlna_profile = dlna_lrg;
-}
+#define DECL_STR(cname, str)                                            \
+    static const struct lms_string_size cname = LMS_STATIC_STRING_SIZE(str)
+
+DECL_STR(_container_jpeg, "jpeg");
 
 enum {
     JPEG_MARKER_SOI = 0xd8,
@@ -687,8 +652,7 @@ _parse(struct plugin *plugin, struct lms_context *ctxt, const struct lms_file_in
     if (info.artist.str)
       lms_charset_conv(ctxt->cs_conv, &info.artist.str, &info.artist.len);
 
-    _fill_dlna_profile(&info);
-
+    info.container = _container_jpeg;
     info.id = finfo->id;
     r = lms_db_image_add(plugin->img_db, &info);