本文整理汇总了C++中Tags::SetTag方法的典型用法代码示例。如果您正苦于以下问题:C++ Tags::SetTag方法的具体用法?C++ Tags::SetTag怎么用?C++ Tags::SetTag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tags
的用法示例。
在下文中一共展示了Tags::SetTag方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
//.........这里部分代码省略.........
// Get tag name...should always succeed...no need to release
const gchar *name = gst_tag_list_nth_tag_name(tags, i);
if (!name)
{
continue;
}
// For each tag, determine its type and retrieve if possible
for (guint j = 0, jcnt = gst_tag_list_get_tag_size(tags, name); j < jcnt; j++)
{
const GValue *val;
val = gst_tag_list_get_value_index(tags, name, j);
if (G_VALUE_HOLDS_STRING(val))
{
string = wxString::FromUTF8(g_value_get_string(val));
}
else if (G_VALUE_HOLDS_UINT(val))
{
string.Printf(wxT("%u"), (unsigned int) g_value_get_uint(val));
}
else if (G_VALUE_HOLDS_DOUBLE(val))
{
string.Printf(wxT("%g"), g_value_get_double(val));
}
else if (G_VALUE_HOLDS_BOOLEAN(val))
{
string = g_value_get_boolean(val) ? wxT("true") : wxT("false");
}
else if (GST_VALUE_HOLDS_DATE_TIME(val))
{
GstDateTime *dt = (GstDateTime *) g_value_get_boxed(val);
gchar *str = gst_date_time_to_iso8601_string(dt);
string = wxString::FromUTF8(str).c_str();
g_free(str);
}
else if (G_VALUE_HOLDS(val, G_TYPE_DATE))
{
gchar *str = gst_value_serialize(val);
string = wxString::FromUTF8(str).c_str();
g_free(str);
}
else
{
wxLogMessage(wxT("Tag %s has unhandled type: %s"),
wxString::FromUTF8(name).c_str(),
wxString::FromUTF8(G_VALUE_TYPE_NAME(val)).c_str());
continue;
}
// Translate known tag names
wxString tag;
if (strcmp(name, GST_TAG_TITLE) == 0)
{
tag = TAG_TITLE;
}
else if (strcmp(name, GST_TAG_ARTIST) == 0)
{
tag = TAG_ARTIST;
}
else if (strcmp(name, GST_TAG_ALBUM) == 0)
{
tag = TAG_ALBUM;
}
else if (strcmp(name, GST_TAG_TRACK_NUMBER) == 0)
{
tag = TAG_TRACK;
}
else if (strcmp(name, GST_TAG_DATE) == 0)
{
tag = TAG_YEAR;
}
else if (strcmp(name, GST_TAG_GENRE) == 0)
{
tag = TAG_GENRE;
}
else if (strcmp(name, GST_TAG_COMMENT) == 0)
{
tag = TAG_COMMENTS;
}
else
{
tag = wxString::FromUTF8(name).c_str();
}
if (jcnt > 1)
{
tag.Printf(wxT("%s:%d"), tag.c_str(), j);
}
// Store the tag
mTags.SetTag(tag, string);
}
}
}