Skip to content

Commit

Permalink
Improve codestyle
Browse files Browse the repository at this point in the history
Bump to v15
  • Loading branch information
palemieux authored Dec 28, 2021
1 parent 4937037 commit 225d3bd
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 23 deletions.
2 changes: 1 addition & 1 deletion imf-prepare-patches.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -e

PATCH_VERSION="14"
PATCH_VERSION="15"

PATCH_NAME="avformat/imf"

Expand Down
38 changes: 19 additions & 19 deletions libavformat/imf_cpl.c
Original file line number Diff line number Diff line change
Expand Up @@ -246,14 +246,14 @@ static int fill_base_resource(xmlNodePtr resource_elem, FFIMFBaseResource *resou
/* read EditRate */
if (!(element = ff_imf_xml_get_child_element_by_name(resource_elem, "EditRate"))) {
resource->edit_rate = cpl->edit_rate;
} else if (ret = ff_imf_xml_read_rational(element, &resource->edit_rate)) {
} else if ((ret = ff_imf_xml_read_rational(element, &resource->edit_rate))) {
av_log(NULL, AV_LOG_ERROR, "Invalid EditRate element found in a Resource\n");
return ret;
}

/* read EntryPoint */
if (element = ff_imf_xml_get_child_element_by_name(resource_elem, "EntryPoint")) {
if (ret = ff_imf_xml_read_uint32(element, &resource->entry_point)) {
if ((element = ff_imf_xml_get_child_element_by_name(resource_elem, "EntryPoint"))) {
if ((ret = ff_imf_xml_read_uint32(element, &resource->entry_point))) {
av_log(NULL, AV_LOG_ERROR, "Invalid EntryPoint element found in a Resource\n");
return ret;
}
Expand All @@ -266,22 +266,22 @@ static int fill_base_resource(xmlNodePtr resource_elem, FFIMFBaseResource *resou
av_log(NULL, AV_LOG_ERROR, "IntrinsicDuration element missing from Resource\n");
return AVERROR_INVALIDDATA;
}
if (ret = ff_imf_xml_read_uint32(element, &resource->duration)) {
if ((ret = ff_imf_xml_read_uint32(element, &resource->duration))) {
av_log(NULL, AV_LOG_ERROR, "Invalid IntrinsicDuration element found in a Resource\n");
return ret;
}
resource->duration -= resource->entry_point;

/* read SourceDuration */
if (element = ff_imf_xml_get_child_element_by_name(resource_elem, "SourceDuration")) {
if (ret = ff_imf_xml_read_uint32(element, &resource->duration)) {
if ((element = ff_imf_xml_get_child_element_by_name(resource_elem, "SourceDuration"))) {
if ((ret = ff_imf_xml_read_uint32(element, &resource->duration))) {
av_log(NULL, AV_LOG_ERROR, "SourceDuration element missing from Resource\n");
return ret;
}
}

/* read RepeatCount */
if (element = ff_imf_xml_get_child_element_by_name(resource_elem, "RepeatCount"))
if ((element = ff_imf_xml_get_child_element_by_name(resource_elem, "RepeatCount")))
ret = ff_imf_xml_read_uint32(element, &resource->repeat_count);

return ret;
Expand All @@ -294,12 +294,12 @@ static int fill_trackfile_resource(xmlNodePtr tf_resource_elem,
xmlNodePtr element = NULL;
int ret = 0;

if (ret = fill_base_resource(tf_resource_elem, (FFIMFBaseResource *)tf_resource, cpl))
if ((ret = fill_base_resource(tf_resource_elem, (FFIMFBaseResource *)tf_resource, cpl)))
return ret;

/* read TrackFileId */
if (element = ff_imf_xml_get_child_element_by_name(tf_resource_elem, "TrackFileId")) {
if (ret = ff_imf_xml_read_uuid(element, tf_resource->track_file_uuid)) {
if ((element = ff_imf_xml_get_child_element_by_name(tf_resource_elem, "TrackFileId"))) {
if ((ret = ff_imf_xml_read_uuid(element, tf_resource->track_file_uuid))) {
av_log(NULL, AV_LOG_ERROR, "Invalid TrackFileId element found in Resource\n");
return ret;
}
Expand All @@ -318,7 +318,7 @@ static int fill_marker_resource(xmlNodePtr marker_resource_elem,
xmlNodePtr element = NULL;
int ret = 0;

if (ret = fill_base_resource(marker_resource_elem, (FFIMFBaseResource *)marker_resource, cpl))
if ((ret = fill_base_resource(marker_resource_elem, (FFIMFBaseResource *)marker_resource, cpl)))
return ret;

/* read markers */
Expand Down Expand Up @@ -365,7 +365,7 @@ static int push_marker_sequence(xmlNodePtr marker_sequence_elem, FFIMFCPL *cpl)
av_log(NULL, AV_LOG_ERROR, "TrackId element missing from Sequence\n");
return AVERROR_INVALIDDATA;
}
if (ret = ff_imf_xml_read_uuid(track_id_elem, uuid)) {
if (ff_imf_xml_read_uuid(track_id_elem, uuid)) {
av_log(NULL, AV_LOG_ERROR, "Invalid TrackId element found in Sequence\n");
return AVERROR_INVALIDDATA;
}
Expand Down Expand Up @@ -453,7 +453,7 @@ static int push_main_audio_sequence(xmlNodePtr audio_sequence_elem, FFIMFCPL *cp
av_log(NULL, AV_LOG_ERROR, "TrackId element missing from audio sequence\n");
return AVERROR_INVALIDDATA;
}
if (ret = ff_imf_xml_read_uuid(track_id_elem, uuid)) {
if ((ret = ff_imf_xml_read_uuid(track_id_elem, uuid))) {
av_log(NULL, AV_LOG_ERROR, "Invalid TrackId element found in audio sequence\n");
return ret;
}
Expand Down Expand Up @@ -545,7 +545,7 @@ static int push_main_image_2d_sequence(xmlNodePtr image_sequence_elem, FFIMFCPL
av_log(NULL, AV_LOG_ERROR, "TrackId element missing from audio sequence\n");
return AVERROR_INVALIDDATA;
}
if (ret = ff_imf_xml_read_uuid(track_id_elem, uuid)) {
if ((ret = ff_imf_xml_read_uuid(track_id_elem, uuid))) {
av_log(NULL, AV_LOG_ERROR, "Invalid TrackId element found in audio sequence\n");
return ret;
}
Expand Down Expand Up @@ -677,13 +677,13 @@ int ff_imf_parse_cpl_from_xml_dom(xmlDocPtr doc, FFIMFCPL **cpl)
goto cleanup;
}

if (ret = fill_content_title(cpl_element, *cpl))
if ((ret = fill_content_title(cpl_element, *cpl)))
goto cleanup;
if (ret = fill_id(cpl_element, *cpl))
if ((ret = fill_id(cpl_element, *cpl)))
goto cleanup;
if (ret = fill_edit_rate(cpl_element, *cpl))
if ((ret = fill_edit_rate(cpl_element, *cpl)))
goto cleanup;
if (ret = fill_virtual_tracks(cpl_element, *cpl))
if ((ret = fill_virtual_tracks(cpl_element, *cpl)))
goto cleanup;

cleanup:
Expand Down Expand Up @@ -802,7 +802,7 @@ int ff_imf_parse_cpl(AVIOContext *in, FFIMFCPL **cpl)
ret = AVERROR_INVALIDDATA;
}

if (ret = ff_imf_parse_cpl_from_xml_dom(doc, cpl)) {
if ((ret = ff_imf_parse_cpl_from_xml_dom(doc, cpl))) {
av_log(NULL, AV_LOG_ERROR, "Cannot parse IMF CPL\n");
} else {
av_log(NULL,
Expand Down
6 changes: 3 additions & 3 deletions libavformat/imfdec.c
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ static int open_track_resource_context(AVFormatContext *s,
if ((ret = ff_copy_whiteblacklists(track_resource->ctx, s)) < 0)
goto cleanup;

if (ret = av_opt_set(track_resource->ctx, "format_whitelist", "mxf", 0))
if ((ret = av_opt_set(track_resource->ctx, "format_whitelist", "mxf", 0)))
goto cleanup;

if ((ret = av_dict_copy(&opts, c->avio_opts, 0)) < 0)
Expand Down Expand Up @@ -638,15 +638,15 @@ static int imf_read_header(AVFormatContext *s)
while (asset_map_path != NULL) {
av_log(s, AV_LOG_DEBUG, "start parsing IMF Asset Map: %s\n", asset_map_path);

if (ret = parse_assetmap(s, asset_map_path))
if ((ret = parse_assetmap(s, asset_map_path)))
return ret;

asset_map_path = av_strtok(NULL, ",", &tmp_str);
}

av_log(s, AV_LOG_DEBUG, "parsed IMF Asset Maps\n");

if (ret = open_cpl_tracks(s))
if ((ret = open_cpl_tracks(s)))
return ret;

av_log(s, AV_LOG_DEBUG, "parsed IMF package\n");
Expand Down

0 comments on commit 225d3bd

Please sign in to comment.