utils refactor.
authorGustavo Sverzut Barbieri <barbieri@profusion.mobi>
Tue, 10 Sep 2013 23:04:20 +0000 (20:04 -0300)
committerGustavo Sverzut Barbieri <barbieri@profusion.mobi>
Tue, 10 Sep 2013 23:04:20 +0000 (20:04 -0300)
move parser specific stuff from src/lib/shared/util.h to
src/plugin/shared/util.h, still not to be installed and without "lms_"
prefix.

the aspect_ratio calculation was moved into lightmediascanner_util.h
and lightmediascanner_db.h to be simpler to use.

extract name from path is also too common, now in
lightmediascanner_util.h as lms_name_from_path().

17 files changed:
src/lib/Makefile.am
src/lib/lightmediascanner_db.h
src/lib/lightmediascanner_db_video.c
src/lib/lightmediascanner_utils.c
src/lib/lightmediascanner_utils.h
src/lib/shared/util.c [deleted file]
src/plugins/Makefile.am
src/plugins/asf/asf.c
src/plugins/flac/flac.c
src/plugins/id3/id3.c
src/plugins/jpeg/jpeg.c
src/plugins/mp4/mp4.c
src/plugins/ogg/ogg.c
src/plugins/png/png.c
src/plugins/rm/rm.c
src/plugins/shared/util.h [moved from src/lib/shared/util.h with 88% similarity]
src/plugins/wave/wave.c

index a9d5b78..5368f40 100644 (file)
@@ -29,9 +29,3 @@ liblightmediascanner_la_SOURCES = \
 
 liblightmediascanner_la_LIBADD = -ldl @SQLITE3_LIBS@ @LTLIBICONV@
 liblightmediascanner_la_LDFLAGS = -version-info @version_info@
-
-# shared sources/headers
-noinst_LTLIBRARIES = shared/libshared.la
-shared_libshared_la_SOURCES = shared/util.c
-
-noinst_HEADERS += shared/util.h
index 93f54e7..0b87b01 100644 (file)
@@ -171,6 +171,8 @@ extern "C" {
     API int lms_db_video_free(lms_db_video_t *ldv) GNUC_NON_NULL(1);
     API int lms_db_video_add(lms_db_video_t *ldv, struct lms_video_info *info) GNUC_NON_NULL(1, 2);
 
+    API int lms_stream_video_info_aspect_ratio_guess(struct lms_stream_video_info *info) GNUC_NON_NULL(1);
+
     /* Playlist Records */
     struct lms_playlist_info {
         int64_t id;
index c985292..8a7f00c 100644 (file)
@@ -616,3 +616,25 @@ lms_db_video_add(lms_db_video_t *ldv, struct lms_video_info *info)
 
     return r;
 }
+
+/**
+ * If aspect ratio wasn't set yet, guess it from stream video info size.
+ *
+ * This function calls lms_aspect_ratio_guess() and thus the
+ * aspect_ratio string will be allocated with malloc(). Remember to
+ * free() it afterwards.
+ *
+ * @param info where to query width and height, then setting aspect_ratio string.
+ *
+ * @return 1 on success, 0 on failure.
+ */
+int
+lms_stream_video_info_aspect_ratio_guess(struct lms_stream_video_info *info)
+{
+    if (info->aspect_ratio.len > 0)
+        return 1;
+
+    return lms_aspect_ratio_guess(&info->aspect_ratio,
+                                  info->width,
+                                  info->height);
+}
index 12a8eef..b43393b 100644 (file)
 
 #include <lightmediascanner_utils.h>
 #include <ctype.h>
+#include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <alloca.h>
+#include <math.h>
 
 /**
  * Strips string, in place.
@@ -192,6 +194,78 @@ lms_string_size_strndup(struct lms_string_size *dst, const char *src, int size)
     return 1;
 }
 
+/* Euclidean algorithm
+ * http://en.wikipedia.org/wiki/Euclidean_algorithm */
+static unsigned int
+gcd(unsigned int a, unsigned int b)
+{
+    unsigned int t;
+
+    while (b) {
+        t = b;
+        b = a % t;
+        a = t;
+    }
+
+    return a;
+}
+
+/**
+ * Guess aspect ratio from known ratios or Greatest Common Divisor.
+ *
+ * @param ret where to store the newly allocated string with ratio.
+ * @param width frame width to guess aspect ratio.
+ * @param height frame height to guess aspect ratio.
+ * @return 1 on success and @c ret->str must be @c free()d, 0 on failure.
+ */
+int
+lms_aspect_ratio_guess(struct lms_string_size *ret, int width, int height)
+{
+    static struct {
+        double ratio;
+        struct lms_string_size str;
+    } *itr, known_ratios[] = {
+        {16.0 / 9.0, LMS_STATIC_STRING_SIZE("16:9")},
+        {4.0 / 3.0, LMS_STATIC_STRING_SIZE("4:3")},
+        {3.0 / 2.0, LMS_STATIC_STRING_SIZE("3:2")},
+        {5.0 / 3.0, LMS_STATIC_STRING_SIZE("5:3")},
+        {8.0 / 5.0, LMS_STATIC_STRING_SIZE("8:5")},
+        {1.85, LMS_STATIC_STRING_SIZE("1.85:1")},
+        {1.4142, LMS_STATIC_STRING_SIZE("1.41:1")},
+        {2.39, LMS_STATIC_STRING_SIZE("2.39:1")},
+        {16.18 / 10.0, LMS_STATIC_STRING_SIZE("16.18:10")},
+        {-1.0, {NULL, 0}}
+    };
+    double ratio;
+    unsigned num, den, f;
+
+    if (width <= 0 || height <= 0) {
+        ret->len = 0;
+        ret->str = NULL;
+        return 0;
+    }
+
+    ratio = (double)width / (double)height;
+    for (itr = known_ratios; itr->ratio > 0.0; itr++) {
+        if (fabs(ratio - itr->ratio) <= 0.01)
+            return lms_string_size_dup(ret, &itr->str);
+    }
+
+    f = gcd(width, height);
+
+    num = width / f;
+    den = height / f;
+    ret->len = asprintf(&ret->str, "%u:%u", num, den);
+    if (ret->len == (unsigned int)-1) {
+        ret->len = 0;
+        ret->str = NULL;
+        return 0;
+    }
+
+    return 1;
+}
+
+
 /**
  * Find out which of the given extensions matches the given name.
  *
@@ -243,3 +317,35 @@ lms_which_extension(const char *name, unsigned int name_len, const struct lms_st
 
     return -1;
 }
+
+/**
+ * Extract name from a path given its path string, length, base and extension.
+ *
+ * @param name where to store the result.
+ * @param path the input path to base the name on.
+ * @param pathlen the path size in bytes.
+ * @param baselen where (offset int bytes) in path starts the filename (base name).
+ * @param extlen the extension length in bytes.
+ * @param cs_conv charset conversion to use, if none use @c NULL.
+ * @return 1 on success, 0 on failure.
+ */
+int
+lms_name_from_path(struct lms_string_size *name, const char *path, unsigned int pathlen, unsigned int baselen, unsigned int extlen, struct lms_charset_conv *cs_conv)
+{
+    int size = pathlen - baselen - extlen;
+
+    name->str = malloc(size + 1);
+    if (!name->str) {
+        name->len = 0;
+        return 0;
+    }
+
+    name->len = size;
+    memcpy(name->str, path + baselen, size);
+    name->str[size] = '\0';
+
+    if (cs_conv)
+        lms_charset_conv(cs_conv, &name->str, &name->len);
+
+    return 1;
+}
index ef200bb..c5fd5f4 100644 (file)
@@ -45,6 +45,7 @@
 extern "C" {
 #endif
 
+#include <lightmediascanner_charset_conv.h>
 
     struct lms_string_size {
         char *str;
@@ -62,8 +63,11 @@ extern "C" {
     API int lms_string_size_dup(struct lms_string_size *dst, const struct lms_string_size *src) GNUC_NON_NULL(1, 2);
     API int lms_string_size_strndup(struct lms_string_size *dst, const char *src, int size) GNUC_NON_NULL(1);
 
+    API int lms_aspect_ratio_guess(struct lms_string_size *ret, int width, int height) GNUC_NON_NULL(1);
+
     API int lms_which_extension(const char *name, unsigned int name_len, const struct lms_string_size *exts, unsigned int exts_len) GNUC_NON_NULL(1, 3);
 
+    API int lms_name_from_path(struct lms_string_size *name, const char *path, unsigned int pathlen, unsigned int baselen, unsigned int extlen, struct lms_charset_conv *cs_conv) GNUC_NON_NULL(1, 2);
 
 
 #ifdef __cplusplus
diff --git a/src/lib/shared/util.c b/src/lib/shared/util.c
deleted file mode 100644 (file)
index 2e1555f..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-/**
- * Copyright (C) 2013  Intel Corporation. All rights reserved.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA
- *
- * @author Lucas De Marchi <lucas.demarchi@intel.com>
- */
-
-#include <stdlib.h>
-#include <string.h>
-
-#include "util.h"
-
-struct lms_string_size str_extract_name_from_path(
-    const char *path, unsigned int pathlen, unsigned int baselen,
-    const struct lms_string_size *ext, struct lms_charset_conv *cs_conv)
-{
-    struct lms_string_size str;
-
-    str.len = pathlen - baselen - ext->len;
-    str.str = malloc(str.len + 1);
-    if (!str.str)
-        return (struct lms_string_size) { };
-    memcpy(str.str, path + baselen, str.len);
-    str.str[str.len] = '\0';
-    if (cs_conv)
-        lms_charset_conv(cs_conv, &str.str, &str.len);
-
-    return str;
-}
-
-/* Euclidean algorithm
- * http://en.wikipedia.org/wiki/Euclidean_algorithm */
-static unsigned int gcd(unsigned int a, unsigned int b)
-{
-    unsigned int t;
-
-    while (b) {
-        t = b;
-        b = a % t;
-        a = t;
-    }
-
-    return a;
-}
-
-void reduce_gcd(unsigned int w, unsigned int h, unsigned int *dw,
-                unsigned int *dh)
-{
-    unsigned int f;
-
-    *dw = w;
-    *dh = h;
-
-    if (!w || !h)
-        return;
-
-    f = gcd(w, h);
-    *dw /= f;
-    *dh /= f;
-}
index 9ef8bc8..d7c94ab 100644 (file)
@@ -3,17 +3,16 @@ MAINTAINERCLEANFILES = Makefile.in
 AM_LDFLAGS = -module -avoid-version -shared $(GCLDFLAGS)
 AM_CFLAGS = -fvisibility=hidden $(WARNINGFLAGS)
 AM_CPPFLAGS = -include $(top_builddir)/config.h \
-               -I$(top_srcdir)/src/lib @SQLITE3_CFLAGS@
+               -I$(top_srcdir)/src/lib -I$(srcdir) @SQLITE3_CFLAGS@
 pkgdir = $(pluginsdir)
 
-PLUGINS_LIBADD = $(top_builddir)/src/lib/liblightmediascanner.la \
-                $(top_builddir)/src/lib/shared/libshared.la
+PLUGINS_LIBADD = $(top_builddir)/src/lib/liblightmediascanner.la
 
 pkg_LTLIBRARIES =
 BUILT_SOURCES =
 EXTRA_DIST =
 SUBDIRS =
-noinst_HEADERS =
+noinst_HEADERS = shared/util.h
 
 if USE_MODULE_DUMMY
 pkg_LTLIBRARIES += dummy/dummy.la
index 1cb6dea..0c2c793 100644 (file)
@@ -449,7 +449,6 @@ _parse_stream_properties(int fd, struct asf_info *info)
 
             /* other fields are ignored */
         } __attribute__((packed)) video;
-        unsigned int num, den;
 
         r = read(fd, &video, sizeof(video));
         if (r != sizeof(video))
@@ -462,11 +461,7 @@ _parse_stream_properties(int fd, struct asf_info *info)
         s->base.codec = *_video_codec_id_to_str(video.compression_id);
         s->base.video.width = get_le32(&video.width);
         s->base.video.height = get_le32(&video.height);
-
-        reduce_gcd(s->base.video.width, s->base.video.height, &num, &den);
-        asprintf(&s->base.video.aspect_ratio.str, "%u:%u", num, den);
-        s->base.video.aspect_ratio.len = s->base.video.aspect_ratio.str ?
-            strlen(s->base.video.aspect_ratio.str) : 0;
+        lms_stream_video_info_aspect_ratio_guess(&s->base.video);
     }
 
     _stream_copy_extension_properties(s);
@@ -796,10 +791,9 @@ _parse(struct plugin *plugin, struct lms_context *ctxt, const struct lms_file_in
     lms_string_size_strip_and_free(&info.genre);
 
     if (!info.title.str)
-        info.title = str_extract_name_from_path(finfo->path, finfo->path_len,
-                                                finfo->base,
-                                                &_exts[((long) match) - 1],
-                                                ctxt->cs_conv);
+        lms_name_from_path(&info.title, finfo->path, finfo->path_len,
+                           finfo->base, _exts[((long) match) - 1].len,
+                           ctxt->cs_conv);
 
     if (info.type == LMS_STREAM_TYPE_AUDIO) {
         struct lms_audio_info audio_info = { };
index 4857b21..4175b4a 100644 (file)
@@ -26,7 +26,6 @@
 
 #include <lightmediascanner_plugin.h>
 #include <lightmediascanner_db.h>
-#include <shared/util.h>
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -121,10 +120,9 @@ _parse(struct plugin *plugin, struct lms_context *ctxt, const struct lms_file_in
 
 title_fallback:
     if (!info.title.str)
-        info.title = str_extract_name_from_path(finfo->path, finfo->path_len,
-                                                finfo->base,
-                                                &_exts[((long) match) - 1],
-                                                NULL);
+        lms_name_from_path(&info.title, finfo->path, finfo->path_len,
+                           finfo->base, _exts[((long) match) - 1].len,
+                           NULL);
     if (info.title.str)
         lms_charset_conv(ctxt->cs_conv, &info.title.str, &info.title.len);
 
index b4ba169..de56dfc 100644 (file)
@@ -1269,10 +1269,9 @@ _parse(struct plugin *plugin, struct lms_context *ctxt, const struct lms_file_in
     }
 
     if (!info.title.str)
-        info.title = str_extract_name_from_path(finfo->path, finfo->path_len,
-                                                finfo->base,
-                                                &_exts[((long) match) - 1],
-                                                ctxt->cs_conv);
+        lms_name_from_path(&info.title, finfo->path, finfo->path_len,
+                           finfo->base, _exts[((long) match) - 1].len,
+                           ctxt->cs_conv);
 
     if (info.trackno == -1)
         info.trackno = 0;
index 0915409..23c7aaf 100644 (file)
@@ -681,10 +681,9 @@ _parse(struct plugin *plugin, struct lms_context *ctxt, const struct lms_file_in
         info.date = finfo->mtime;
 
     if (!info.title.str)
-        info.title = str_extract_name_from_path(finfo->path, finfo->path_len,
-                                                finfo->base,
-                                                &_exts[((long) match) - 1],
-                                                ctxt->cs_conv);
+        lms_name_from_path(&info.title, finfo->path, finfo->path_len,
+                           finfo->base, _exts[((long) match) - 1].len,
+                           ctxt->cs_conv);
     if (info.artist.str)
       lms_charset_conv(ctxt->cs_conv, &info.artist.str, &info.artist.len);
 
index b7c3322..d287fe5 100644 (file)
@@ -28,7 +28,6 @@ static const char PV[] = PACKAGE_VERSION; /* mp4.h screws PACKAGE_VERSION */
 
 #include <lightmediascanner_plugin.h>
 #include <lightmediascanner_db.h>
-#include <shared/util.h>
 
 #include <mp4v2/mp4v2.h>
 #include <string.h>
@@ -499,38 +498,6 @@ _get_lang(MP4FileHandle mp4_fh, MP4TrackId id)
     return ret;
 }
 
-static struct lms_string_size
-_guess_aspect_ratio(const struct lms_stream_video_info *info)
-{
-    static struct {
-        double ratio;
-        struct lms_string_size str;
-    } *itr, known_ratios[] = {
-        {16.0 / 9.0, LMS_STATIC_STRING_SIZE("16:9")},
-        {4.0 / 3.0, LMS_STATIC_STRING_SIZE("4:3")},
-        {3.0 / 2.0, LMS_STATIC_STRING_SIZE("3:2")},
-        {5.0 / 3.0, LMS_STATIC_STRING_SIZE("5:3")},
-        {8.0 / 5.0, LMS_STATIC_STRING_SIZE("8:5")},
-        {1.85, LMS_STATIC_STRING_SIZE("1.85:1")},
-        {1.4142, LMS_STATIC_STRING_SIZE("1.41:1")},
-        {2.39, LMS_STATIC_STRING_SIZE("2.39:1")},
-        {16.18 / 10.0, LMS_STATIC_STRING_SIZE("16.18:10")},
-        {-1.0, {NULL, 0}}
-    };
-    double ratio;
-
-    if (info->width == 0 || info->height == 0)
-        return nullstr;
-
-    ratio = (double)info->width / (double)info->height;
-    for (itr = known_ratios; itr->ratio > 0.0; itr++) {
-        if (fabs(ratio - itr->ratio) <= 0.01)
-            return itr->str;
-    }
-
-    return nullstr;
-}
-
 static int
 _parse(struct plugin *plugin, struct lms_context *ctxt, const struct lms_file_info *finfo, void *match)
 {
@@ -613,7 +580,7 @@ _parse(struct plugin *plugin, struct lms_context *ctxt, const struct lms_file_in
                 s->video.width = MP4GetTrackVideoWidth(mp4_fh, id);
                 s->video.height = MP4GetTrackVideoHeight(mp4_fh, id);
                 s->video.framerate = MP4GetTrackVideoFrameRate(mp4_fh, id);
-                s->video.aspect_ratio = _guess_aspect_ratio(&s->video);
+                lms_stream_video_info_aspect_ratio_guess(&s->video);
             }
 
             s->next = video_info.streams;
@@ -629,10 +596,9 @@ _parse(struct plugin *plugin, struct lms_context *ctxt, const struct lms_file_in
     lms_string_size_strip_and_free(&info.genre);
 
     if (!info.title.str)
-        info.title = str_extract_name_from_path(finfo->path, finfo->path_len,
-                                                finfo->base,
-                                                &_exts[((long) match) - 1],
-                                                NULL);
+        lms_name_from_path(&info.title, finfo->path, finfo->path_len,
+                           finfo->base, _exts[((long) match) - 1].len,
+                           NULL);
     if (info.title.str)
         lms_charset_conv(ctxt->cs_conv, &info.title.str, &info.title.len);
     if (info.artist.str)
@@ -670,8 +636,10 @@ fail:
     while (video_info.streams) {
         struct lms_stream *s = video_info.streams;
         video_info.streams = s->next;
-        if (s->type == LMS_STREAM_TYPE_VIDEO)
+        if (s->type == LMS_STREAM_TYPE_VIDEO) {
             free(s->codec.str); /* ugly, but h264 needs alloc */
+            free(s->video.aspect_ratio.str);
+        }
         free(s->lang.str);
         free(s);
     }
index bac1749..5eef05a 100644 (file)
@@ -33,7 +33,6 @@
 #include <lightmediascanner_plugin.h>
 #include <lightmediascanner_db.h>
 #include <lightmediascanner_utils.h>
-#include <shared/util.h>
 
 #include <assert.h>
 #include <errno.h>
@@ -334,13 +333,7 @@ static void _parse_theora_and_vorbis_streams(struct ogg_info *info,
 
             num = s->video.ti.aspect_numerator;
             den = s->video.ti.aspect_denominator;
-            if (num && den) {
-                reduce_gcd(num, den, &num, &den);
-                asprintf(&s->base.video.aspect_ratio.str, "%u:%u", num, den);
-                s->base.video.aspect_ratio.len =
-                    s->base.video.aspect_ratio.str ?
-                    strlen(s->base.video.aspect_ratio.str) : 0;
-            }
+            lms_aspect_ratio_guess(&s->base.video.aspect_ratio, num, den);
         }
     }
 
@@ -500,10 +493,9 @@ _parse(struct plugin *plugin, struct lms_context *ctxt,
       goto done;
 
     if (!info.title.str)
-        info.title = str_extract_name_from_path(finfo->path, finfo->path_len,
-                                                finfo->base,
-                                                &_exts[((long) match) - 1],
-                                                NULL);
+        lms_name_from_path(&info.title, finfo->path, finfo->path_len,
+                           finfo->base, _exts[((long) match) - 1].len,
+                           NULL);
     if (info.title.str)
         lms_charset_conv(ctxt->cs_conv, &info.title.str, &info.title.len);
     if (info.artist.str)
index b07dff9..fedd67f 100644 (file)
@@ -30,7 +30,6 @@
 #include <lightmediascanner_plugin.h>
 #include <lightmediascanner_utils.h>
 #include <lightmediascanner_db.h>
-#include <shared/util.h>
 
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -173,10 +172,9 @@ _parse(struct plugin *plugin, struct lms_context *ctxt, const struct lms_file_in
         info.date = finfo->mtime;
 
     if (!info.title.str)
-        info.title = str_extract_name_from_path(finfo->path, finfo->path_len,
-                                                finfo->base,
-                                                &_exts[((long) match) - 1],
-                                                NULL);
+        lms_name_from_path(&info.title, finfo->path, finfo->path_len,
+                           finfo->base, _exts[((long) match) - 1].len,
+                           NULL);
     if (info.title.str)
         lms_charset_conv(ctxt->cs_conv, &info.title.str, &info.title.len);
     if (info.artist.str)
index 7b8a85a..6277f93 100644 (file)
@@ -29,7 +29,6 @@
 
 #include <lightmediascanner_plugin.h>
 #include <lightmediascanner_db.h>
-#include <shared/util.h>
 
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -457,10 +456,9 @@ _parse(struct plugin *plugin, struct lms_context *ctxt, const struct lms_file_in
     lms_string_size_strip_and_free(&info.artist);
 
     if (!info.title.str)
-        info.title = str_extract_name_from_path(finfo->path, finfo->path_len,
-                                                finfo->base,
-                                                &_exts[((long) match) - 1],
-                                                NULL);
+        lms_name_from_path(&info.title, finfo->path, finfo->path_len,
+                           finfo->base, _exts[((long) match) - 1].len,
+                           NULL);
     if (info.title.str)
         lms_charset_conv(ctxt->cs_conv, &info.title.str, &info.title.len);
 
similarity index 88%
rename from src/lib/shared/util.h
rename to src/plugins/shared/util.h
index 23ba004..5eac471 100644 (file)
@@ -25,7 +25,6 @@
 #include <stddef.h>
 
 #include <lightmediascanner_utils.h>
-#include <lightmediascanner_charset_conv.h>
 
 #define NSEC100_PER_SEC  10000000ULL
 #define MSEC_PER_SEC  1000ULL
@@ -103,11 +102,3 @@ static inline uint16_t get_be16(const void *ptr)
 #else
 #error "Unknown byte order"
 #endif
-
-
-struct lms_string_size str_extract_name_from_path(
-    const char *path, unsigned int pathlen, unsigned int baselen,
-    const struct lms_string_size *ext, struct lms_charset_conv *cs_conv);
-
-void reduce_gcd(unsigned int w, unsigned int h, unsigned int *dw,
-                unsigned int *dh);
index 78ae7f9..71008bb 100644 (file)
@@ -254,10 +254,9 @@ _parse(struct plugin *plugin, struct lms_context *ctxt,
     _parse_info(fd, &info);
 
     if (!info.title.str)
-        info.title = str_extract_name_from_path(finfo->path, finfo->path_len,
-                                                finfo->base,
-                                                &_exts[((long) match) - 1],
-                                                ctxt->cs_conv);
+        lms_name_from_path(&info.title, finfo->path, finfo->path_len,
+                           finfo->base, _exts[((long) match) - 1].len,
+                           ctxt->cs_conv);
 
     info.id = finfo->id;