Skip to content

Commit bb73214

Browse files
committed
Fix ASSETMAP parsing
1 parent 12e59ed commit bb73214

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

libavformat/imfdec.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ typedef struct IMFAssetLocator {
7373
* Results from the parsing of one or more ASSETMAP XML files
7474
*/
7575
typedef struct IMFAssetLocatorMap {
76-
uint8_t asset_count;
76+
uint32_t asset_count;
7777
IMFAssetLocator *assets;
7878
} IMFAssetLocatorMap;
7979

@@ -158,6 +158,7 @@ static int parse_imf_asset_map_from_xml_dom(AVFormatContext *s,
158158
{
159159
xmlNodePtr asset_map_element = NULL;
160160
xmlNodePtr node = NULL;
161+
xmlNodePtr asset_element = NULL;
161162
char *uri;
162163
int ret = 0;
163164
IMFAssetLocator *asset = NULL;
@@ -192,21 +193,21 @@ static int parse_imf_asset_map_from_xml_dom(AVFormatContext *s,
192193
return AVERROR(ENOMEM);
193194
}
194195
asset_map->asset_count = 0;
195-
node = xmlFirstElementChild(node);
196-
while (node) {
197-
if (av_strcasecmp(node->name, "Asset") != 0)
196+
asset_element = xmlFirstElementChild(node);
197+
while (asset_element) {
198+
if (av_strcasecmp(asset_element->name, "Asset") != 0)
198199
continue;
199200

200201
asset = &(asset_map->assets[asset_map->asset_count]);
201202

202-
if (ff_xml_read_UUID(ff_xml_get_child_element_by_name(node, "Id"), asset->uuid)) {
203+
if (ff_xml_read_UUID(ff_xml_get_child_element_by_name(asset_element, "Id"), asset->uuid)) {
203204
av_log(s, AV_LOG_ERROR, "Could not parse UUID from asset in asset map.\n");
204205
return AVERROR_INVALIDDATA;
205206
}
206207

207208
av_log(s, AV_LOG_DEBUG, "Found asset id: " FF_UUID_FORMAT "\n", UID_ARG(asset->uuid));
208209

209-
if (!(node = ff_xml_get_child_element_by_name(node, "ChunkList"))) {
210+
if (!(node = ff_xml_get_child_element_by_name(asset_element, "ChunkList"))) {
210211
av_log(s, AV_LOG_ERROR, "Unable to parse asset map XML - missing ChunkList node\n");
211212
return AVERROR_INVALIDDATA;
212213
}
@@ -230,7 +231,7 @@ static int parse_imf_asset_map_from_xml_dom(AVFormatContext *s,
230231
av_log(s, AV_LOG_DEBUG, "Found asset absolute URI: %s\n", asset->absolute_uri);
231232

232233
asset_map->asset_count++;
233-
node = xmlNextElementSibling(node);
234+
asset_element = xmlNextElementSibling(asset_element);
234235
}
235236

236237
return ret;

0 commit comments

Comments
 (0)