MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / fill_timecode

Function fill_timecode

libavformat/imf_cpl.c:229–270  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

227}
228
229static int fill_timecode(xmlNodePtr cpl_element, FFIMFCPL *cpl)
230{
231 xmlNodePtr tc_element = NULL;
232 xmlNodePtr element = NULL;
233 xmlChar *tc_str = NULL;
234 int df = 0;
235 int comps[4];
236 int ret = 0;
237
238 tc_element = ff_imf_xml_get_child_element_by_name(cpl_element, "CompositionTimecode");
239 if (!tc_element)
240 return 0;
241
242 element = ff_imf_xml_get_child_element_by_name(tc_element, "TimecodeDropFrame");
243 if (!element)
244 return AVERROR_INVALIDDATA;
245
246 if (ff_imf_xml_read_boolean(element, &df))
247 return AVERROR_INVALIDDATA;
248
249 element = ff_imf_xml_get_child_element_by_name(tc_element, "TimecodeStartAddress");
250 if (!element)
251 return AVERROR_INVALIDDATA;
252
253 tc_str = xmlNodeListGetString(element->doc, element->xmlChildrenNode, 1);
254 if (!tc_str)
255 return AVERROR_INVALIDDATA;
256 ret = parse_cpl_tc_type(tc_str, comps);
257 xmlFree(tc_str);
258 if (ret)
259 return ret;
260
261 cpl->tc = av_malloc(sizeof(AVTimecode));
262 if (!cpl->tc)
263 return AVERROR(ENOMEM);
264 ret = av_timecode_init_from_components(cpl->tc, cpl->edit_rate,
265 df ? AV_TIMECODE_FLAG_DROPFRAME : 0,
266 comps[0], comps[1], comps[2], comps[3],
267 NULL);
268
269 return ret;
270}
271
272static int fill_edit_rate(xmlNodePtr cpl_element, FFIMFCPL *cpl)
273{

Callers 1

Calls 5

ff_imf_xml_read_booleanFunction · 0.85
parse_cpl_tc_typeFunction · 0.85
av_mallocFunction · 0.50

Tested by

no test coverage detected