Fix compiler warnings due to missings casts in minimalaudiosmil.c. Make the file compile with the stricter C++ compiler.

Fixes #1974
This commit is contained in:
mark 2006-11-16 09:18:15 +00:00
parent 11f4d2899b
commit de4c77a7f5

View file

@ -298,7 +298,7 @@ read_stream_into_memory(LivesupportMinimalAudioSmil * smil,
return; return;
} }
*outbuffer = g_malloc(length); *outbuffer = (guint8*)g_malloc(length);
*outlength = length; *outlength = length;
memcpy(*outbuffer, buffer, length); memcpy(*outbuffer, buffer, length);
} }
@ -312,12 +312,12 @@ get_body_element(xmlDocPtr document)
{ {
xmlNode * node = document->children; xmlNode * node = document->children;
if (!node || strcmp(node->name, "smil")) { if (!node || strcmp((const char*)node->name, "smil")) {
return 0; return 0;
} }
for (node = node->children; node; node = node->next) { for (node = node->children; node; node = node->next) {
if (node->type == XML_ELEMENT_NODE if (node->type == XML_ELEMENT_NODE
&& !strcmp(node->name, "body")) { && !strcmp((const char*)node->name, "body")) {
return node; return node;
} }
@ -358,7 +358,7 @@ handle_animate_element(LivesupportMinimalAudioSmil * smil,
/* TODO: support attribute values that are represented with /* TODO: support attribute values that are represented with
* more than one text node, in all content assignments below */ * more than one text node, in all content assignments below */
if (!strcmp(attr->name, "attributeName")) { if (!strcmp((const char*)attr->name, "attributeName")) {
if ((node = attr->children) && node->type == XML_TEXT_NODE) { if ((node = attr->children) && node->type == XML_TEXT_NODE) {
cstr = (gchar*) node->content; cstr = (gchar*) node->content;
/* we only support soundLevel animation at the moment */ /* we only support soundLevel animation at the moment */
@ -367,7 +367,7 @@ handle_animate_element(LivesupportMinimalAudioSmil * smil,
return 0; return 0;
} }
} }
} else if (!strcmp(attr->name, "calcMode")) { } else if (!strcmp((const char*)attr->name, "calcMode")) {
if ((node = attr->children) && node->type == XML_TEXT_NODE) { if ((node = attr->children) && node->type == XML_TEXT_NODE) {
cstr = (gchar*) node->content; cstr = (gchar*) node->content;
/* we only support linear calc mode at the moment */ /* we only support linear calc mode at the moment */
@ -376,7 +376,7 @@ handle_animate_element(LivesupportMinimalAudioSmil * smil,
return 0; return 0;
} }
} }
} else if (!strcmp(attr->name, "fill")) { } else if (!strcmp((const char*)attr->name, "fill")) {
if ((node = attr->children) && node->type == XML_TEXT_NODE) { if ((node = attr->children) && node->type == XML_TEXT_NODE) {
cstr = (gchar*) node->content; cstr = (gchar*) node->content;
/* we only support freeze fill at the moment */ /* we only support freeze fill at the moment */
@ -385,7 +385,7 @@ handle_animate_element(LivesupportMinimalAudioSmil * smil,
return 0; return 0;
} }
} }
} else if (!strcmp(attr->name, "from")) { } else if (!strcmp((const char*)attr->name, "from")) {
if ((node = attr->children) && node->type == XML_TEXT_NODE) { if ((node = attr->children) && node->type == XML_TEXT_NODE) {
cstr = (gchar*) node->content; cstr = (gchar*) node->content;
if (!smil_parse_percent(cstr, &from)) { if (!smil_parse_percent(cstr, &from)) {
@ -393,7 +393,7 @@ handle_animate_element(LivesupportMinimalAudioSmil * smil,
return 0; return 0;
} }
} }
} else if (!strcmp(attr->name, "to")) { } else if (!strcmp((const char*)attr->name, "to")) {
if ((node = attr->children) && node->type == XML_TEXT_NODE) { if ((node = attr->children) && node->type == XML_TEXT_NODE) {
cstr = (gchar*) node->content; cstr = (gchar*) node->content;
if (!smil_parse_percent(cstr, &to)) { if (!smil_parse_percent(cstr, &to)) {
@ -401,7 +401,7 @@ handle_animate_element(LivesupportMinimalAudioSmil * smil,
return 0; return 0;
} }
} }
} else if (!strcmp(attr->name, "begin")) { } else if (!strcmp((const char*)attr->name, "begin")) {
if ((node = attr->children) && node->type == XML_TEXT_NODE) { if ((node = attr->children) && node->type == XML_TEXT_NODE) {
gint64 i; gint64 i;
@ -409,7 +409,7 @@ handle_animate_element(LivesupportMinimalAudioSmil * smil,
i = smil_clock_value_to_nanosec(cstr) + offset; i = smil_clock_value_to_nanosec(cstr) + offset;
begin = ((double) i) / NSEC_PER_SEC_FLOAT; begin = ((double) i) / NSEC_PER_SEC_FLOAT;
} }
} else if (!strcmp(attr->name, "end")) { } else if (!strcmp((const char*)attr->name, "end")) {
if ((node = attr->children) && node->type == XML_TEXT_NODE) { if ((node = attr->children) && node->type == XML_TEXT_NODE) {
gint64 i; gint64 i;
@ -435,7 +435,7 @@ handle_animate_element(LivesupportMinimalAudioSmil * smil,
/* now create a volenv element */ /* now create a volenv element */
len = strlen(namePrefix) + strlen("_volenv_XXXXXXXXXX") + 1; len = strlen(namePrefix) + strlen("_volenv_XXXXXXXXXX") + 1;
str = g_malloc(len); str = (gchar*)g_malloc(len);
g_snprintf(str, len, "%s_volenv_%d", namePrefix, index); g_snprintf(str, len, "%s_volenv_%d", namePrefix, index);
if (!(volenv = gst_element_factory_make("volenv", str))) { if (!(volenv = gst_element_factory_make("volenv", str))) {
GST_WARNING("can't create a required gstreamer element"); GST_WARNING("can't create a required gstreamer element");
@ -445,7 +445,7 @@ handle_animate_element(LivesupportMinimalAudioSmil * smil,
g_free(str); g_free(str);
/* insert the control points */ /* insert the control points */
str = g_malloc(64); str = (gchar*)g_malloc(64);
/* insert an initial volume level at 0.0 */ /* insert an initial volume level at 0.0 */
if (begin <= 0.0) { if (begin <= 0.0) {
g_snprintf(str, 64, "0.0:%lf", from); g_snprintf(str, 64, "0.0:%lf", from);
@ -516,19 +516,19 @@ handle_audio_element(LivesupportMinimalAudioSmil * smil,
/* TODO: support attribute values that are represented with /* TODO: support attribute values that are represented with
* more than one text node, in all content assignments below */ * more than one text node, in all content assignments below */
if (!strcmp(attr->name, "src")) { if (!strcmp((const char*)attr->name, "src")) {
if ((node = attr->children) && node->type == XML_TEXT_NODE) { if ((node = attr->children) && node->type == XML_TEXT_NODE) {
src = (gchar*) node->content; src = (gchar*) node->content;
} }
} else if (!strcmp(attr->name, "begin")) { } else if (!strcmp((const char*)attr->name, "begin")) {
if ((node = attr->children) && node->type == XML_TEXT_NODE) { if ((node = attr->children) && node->type == XML_TEXT_NODE) {
begin = (gchar*) node->content; begin = (gchar*) node->content;
} }
} else if (!strcmp(attr->name, "clipBegin")) { } else if (!strcmp((const char*)attr->name, "clipBegin")) {
if ((node = attr->children) && node->type == XML_TEXT_NODE) { if ((node = attr->children) && node->type == XML_TEXT_NODE) {
clipBegin = (gchar*) node->content; clipBegin = (gchar*) node->content;
} }
} else if (!strcmp(attr->name, "clipEnd")) { } else if (!strcmp((const char*)attr->name, "clipEnd")) {
if ((node = attr->children) && node->type == XML_TEXT_NODE) { if ((node = attr->children) && node->type == XML_TEXT_NODE) {
clipEnd = (gchar*) node->content; clipEnd = (gchar*) node->content;
} }
@ -561,7 +561,7 @@ handle_audio_element(LivesupportMinimalAudioSmil * smil,
/* now create a partial play element */ /* now create a partial play element */
len = strlen("partialplay_XXXXXXXXXX") + 1; len = strlen("partialplay_XXXXXXXXXX") + 1;
name = g_malloc(len); name = (gchar*)g_malloc(len);
g_snprintf(name, len, "partialplay_%d", index); g_snprintf(name, len, "partialplay_%d", index);
if (!(pplay = gst_element_factory_make("partialplay", name))) { if (!(pplay = gst_element_factory_make("partialplay", name))) {
GST_WARNING("can't create a required gstreamer element"); GST_WARNING("can't create a required gstreamer element");
@ -574,7 +574,7 @@ handle_audio_element(LivesupportMinimalAudioSmil * smil,
+ strlen(clipBegin) + strlen(clipBegin)
+ (clipEnd ? strlen(clipEnd) : 0) + (clipEnd ? strlen(clipEnd) : 0)
+ 3; + 3;
str = g_malloc(sizeof(gchar) * len); str = (gchar*)g_malloc(sizeof(gchar) * len);
g_snprintf(str, len, "%s;%s-%s", g_snprintf(str, len, "%s;%s-%s",
begin, clipBegin, clipEnd ? clipEnd : ""); begin, clipBegin, clipEnd ? clipEnd : "");
g_object_set(G_OBJECT(pplay), "config", str, NULL); g_object_set(G_OBJECT(pplay), "config", str, NULL);
@ -588,7 +588,7 @@ handle_audio_element(LivesupportMinimalAudioSmil * smil,
if (node->type == XML_ELEMENT_NODE) { if (node->type == XML_ELEMENT_NODE) {
GstElement * elem = 0; GstElement * elem = 0;
if (!strcmp(node->name, "animate")) { if (!strcmp((const char*)node->name, "animate")) {
elem = handle_animate_element(smil, bin, nsBegin, elem = handle_animate_element(smil, bin, nsBegin,
node, name, ix); node, name, ix);
} else { } else {
@ -662,7 +662,7 @@ handle_par_element(LivesupportMinimalAudioSmil * smil,
if (node->type == XML_ELEMENT_NODE) { if (node->type == XML_ELEMENT_NODE) {
GstElement * element = 0; GstElement * element = 0;
if (!strcmp(node->name, "audio")) { if (!strcmp((const char*)node->name, "audio")) {
element = handle_audio_element(smil, element = handle_audio_element(smil,
GST_BIN(pipeline), GST_BIN(pipeline),
node, node,
@ -735,7 +735,7 @@ process_smil_file(LivesupportMinimalAudioSmil * smil)
if (node->type == XML_ELEMENT_NODE) { if (node->type == XML_ELEMENT_NODE) {
GstElement * element = 0; GstElement * element = 0;
if (!strcmp(node->name, "par")) { if (!strcmp((const char*)node->name, "par")) {
element = handle_par_element(smil, node); element = handle_par_element(smil, node);
} else { } else {
GST_WARNING("unsupported SMIL element %s found", GST_WARNING("unsupported SMIL element %s found",
@ -767,7 +767,7 @@ static GstElementStateReturn
livesupport_minimal_audio_smil_change_state(GstElement * element) livesupport_minimal_audio_smil_change_state(GstElement * element)
{ {
LivesupportMinimalAudioSmil * smil; LivesupportMinimalAudioSmil * smil;
GstElementState transition = GST_STATE_TRANSITION(element); GstElementState transition = (GstElementState)GST_STATE_TRANSITION(element);
smil = LIVESUPPORT_MINIMAL_AUDIO_SMIL(element); smil = LIVESUPPORT_MINIMAL_AUDIO_SMIL(element);
@ -918,7 +918,7 @@ livesupport_minimal_audio_smil_class_init(
gobject_class = (GObjectClass *) klass; gobject_class = (GObjectClass *) klass;
gstelement_class = (GstElementClass *) klass; gstelement_class = (GstElementClass *) klass;
parent_class = g_type_class_ref(GST_TYPE_BIN); parent_class = (GstBinClass*)g_type_class_ref(GST_TYPE_BIN);
gobject_class->dispose = livesupport_minimal_audio_smil_dispose; gobject_class->dispose = livesupport_minimal_audio_smil_dispose;
gstelement_class->change_state = gstelement_class->change_state =
@ -953,7 +953,7 @@ livesupport_minimal_audio_smil_get_type(void)
minimal_audio_smil_type = g_type_register_static(GST_TYPE_BIN, minimal_audio_smil_type = g_type_register_static(GST_TYPE_BIN,
"LivesupportMinimalAudioSmil", "LivesupportMinimalAudioSmil",
&minimal_audio_smil_info, &minimal_audio_smil_info,
0); (GTypeFlags) 0);
GST_DEBUG_CATEGORY_INIT(minimal_audio_smil_debug, GST_DEBUG_CATEGORY_INIT(minimal_audio_smil_debug,
"minimalaudiosmil", "minimalaudiosmil",