From: Leandro Dorileo Date: Wed, 7 Jan 2015 18:20:04 +0000 (-0200) Subject: dlna: don't match if no profile/level identified X-Git-Tag: release_0.5.0~12 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8a90741aa6ec13a40466777c7b8832343c2e0e46;p=platform%2Fupstream%2Flightmediascanner.git dlna: don't match if no profile/level identified Instead of providing an empty string for profile and level if we haven't parsed one from codec identifier initialize it to NULL and only use it to match the rules if we found the respective identifiers. --- diff --git a/src/lib/lightmediascanner_dlna.c b/src/lib/lightmediascanner_dlna.c index 0548c8e..764a207 100644 --- a/src/lib/lightmediascanner_dlna.c +++ b/src/lib/lightmediascanner_dlna.c @@ -194,12 +194,12 @@ _video_rule_match_stream(const struct lms_dlna_video_rule *rule, video->video.bitrate <= rule->bitrate->max)) return false; - if (rule->levels && + if (rule->levels && level && !_string_vector_has_value ((const char **)rule->levels->levels, level)) return false; - if (rule->profiles && + if (rule->profiles && profile && !_string_vector_has_value ((const char **)rule->profiles->profiles, profile)) return false; @@ -221,19 +221,17 @@ _match_video_profile(const struct lms_dlna_video_profile *video_rules, int i; const struct lms_dlna_video_profile *curr; char *tmp, *p; - const char *profile, *level; + const char *profile = NULL, *level = NULL; tmp = strdupa(video->codec.str); p = strstr(tmp, "-p"); - if (!p) profile = ""; - else { + if (p) { p[0] = '\0'; profile = p + 2; } p = strstr(profile, "-l"); - if (!p) level = ""; - else { + if (p) { p[0] = '\0'; level = p + 2; }