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

Function ff_parse_key_value

libavformat/utils.c:507–559  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

505}
506
507void ff_parse_key_value(const char *str, ff_parse_key_val_cb callback_get_buf,
508 void *context)
509{
510 const char *ptr = str;
511
512 /* Parse key=value pairs. */
513 for (;;) {
514 const char *key;
515 char *dest = NULL, *dest_end;
516 int key_len, dest_len = 0;
517
518 /* Skip whitespace and potential commas. */
519 while (*ptr && (av_isspace(*ptr) || *ptr == ','))
520 ptr++;
521 if (!*ptr)
522 break;
523
524 key = ptr;
525
526 if (!(ptr = strchr(key, '=')))
527 break;
528 ptr++;
529 key_len = ptr - key;
530
531 callback_get_buf(context, key, key_len, &dest, &dest_len);
532 dest_end = dest ? dest + dest_len - 1 : NULL;
533
534 if (*ptr == '\"') {
535 ptr++;
536 while (*ptr && *ptr != '\"') {
537 if (*ptr == '\\') {
538 if (!ptr[1])
539 break;
540 if (dest && dest < dest_end)
541 *dest++ = ptr[1];
542 ptr += 2;
543 } else {
544 if (dest && dest < dest_end)
545 *dest++ = *ptr;
546 ptr++;
547 }
548 }
549 if (*ptr == '\"')
550 ptr++;
551 } else {
552 for (; *ptr && !(av_isspace(*ptr) || *ptr == ','); ptr++)
553 if (dest && dest < dest_end)
554 *dest++ = *ptr;
555 }
556 if (dest)
557 *dest = 0;
558 }
559}
560
561int avformat_network_init(void)
562{

Callers 2

parse_playlistFunction · 0.85

Calls 1

av_isspaceFunction · 0.85

Tested by

no test coverage detected