• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/ap/gpl/minidlna/ffmpeg-2.3.4/

Lines Matching defs:wctx

283     int  (*init)  (WriterContext *wctx);
284 void (*uninit)(WriterContext *wctx);
286 void (*print_section_header)(WriterContext *wctx);
287 void (*print_section_footer)(WriterContext *wctx);
288 void (*print_integer) (WriterContext *wctx, const char *, long long int);
289 void (*print_rational) (WriterContext *wctx, AVRational *q, char *sep);
290 void (*print_string) (WriterContext *wctx, const char *, const char *);
326 WriterContext *wctx = p;
327 return wctx->writer->name;
361 static void writer_close(WriterContext **wctx)
365 if (!*wctx)
368 if ((*wctx)->writer->uninit)
369 (*wctx)->writer->uninit(*wctx);
371 av_bprint_finalize(&(*wctx)->section_pbuf[i], NULL);
372 if ((*wctx)->writer->priv_class)
373 av_opt_free((*wctx)->priv);
374 av_freep(&((*wctx)->priv));
375 av_opt_free(*wctx);
376 av_freep(wctx);
388 static int writer_open(WriterContext **wctx, const Writer *writer, const char *args,
393 if (!(*wctx = av_mallocz(sizeof(WriterContext)))) {
398 if (!((*wctx)->priv = av_mallocz(writer->priv_size))) {
403 (*wctx)->class = &writer_class;
404 (*wctx)->writer = writer;
405 (*wctx)->level = -1;
406 (*wctx)->sections = sections;
407 (*wctx)->nb_sections = nb_sections;
409 av_opt_set_defaults(*wctx);
412 void *priv_ctx = (*wctx)->priv;
423 av_log(*wctx, AV_LOG_ERROR, "Failed to parse option string '%s' provided to writer context\n", args);
429 if ((ret = av_opt_set(*wctx, opt->key, opt->value, AV_OPT_SEARCH_CHILDREN)) < 0) {
430 av_log(*wctx, AV_LOG_ERROR, "Failed to set option '%s' with value '%s' provided to writer context\n",
442 const uint8_t *p = (*wctx)->string_validation_replacement;
447 ret = av_utf8_decode(&code, &p, endp, (*wctx)->string_validation_utf8_flags);
452 av_log(wctx, AV_LOG_ERROR,
454 bp.str, (*wctx)->string_validation_replacement);
461 av_bprint_init(&(*wctx)->section_pbuf[i], 1, AV_BPRINT_SIZE_UNLIMITED);
463 if ((*wctx)->writer->init)
464 ret = (*wctx)->writer->init(*wctx);
471 writer_close(wctx);
475 static inline void writer_print_section_header(WriterContext *wctx,
479 wctx->level++;
480 av_assert0(wctx->level < SECTION_MAX_NB_LEVELS);
481 parent_section_id = wctx->level ?
482 (wctx->section[wctx->level-1])->id : SECTION_ID_NONE;
484 wctx->nb_item[wctx->level] = 0;
485 wctx->section[wctx->level] = &wctx->sections[section_id];
488 wctx->nb_section_packet = wctx->nb_section_frame =
489 wctx->nb_section_packet_frame = 0;
491 wctx->nb_section_packet_frame = section_id == SECTION_ID_PACKET ?
492 wctx->nb_section_packet : wctx->nb_section_frame;
495 if (wctx->writer->print_section_header)
496 wctx->writer->print_section_header(wctx);
499 static inline void writer_print_section_footer(WriterContext *wctx)
501 int section_id = wctx->section[wctx->level]->id;
502 int parent_section_id = wctx->level ?
503 wctx->section[wctx->level-1]->id : SECTION_ID_NONE;
506 wctx->nb_item[wctx->level-1]++;
508 if (section_id == SECTION_ID_PACKET) wctx->nb_section_packet++;
509 else wctx->nb_section_frame++;
511 if (wctx->writer->print_section_footer)
512 wctx->writer->print_section_footer(wctx);
513 wctx->level--;
516 static inline void writer_print_integer(WriterContext *wctx,
519 const struct section *section = wctx->section[wctx->level];
522 wctx->writer->print_integer(wctx, key, val);
523 wctx->nb_item[wctx->level]++;
527 static inline int validate_string(WriterContext *wctx, char **dstp, const char *src)
541 if (av_utf8_decode(&code, &p, endp, wctx->string_validation_utf8_flags) < 0) {
545 av_log(wctx, AV_LOG_DEBUG,
553 switch (wctx->string_validation) {
555 av_log(wctx, AV_LOG_ERROR,
562 av_bprintf(&dstbuf, "%s", wctx->string_validation_replacement);
567 if (!invalid || wctx->string_validation == WRITER_STRING_VALIDATION_IGNORE)
571 if (invalid_chars_nb && wctx->string_validation == WRITER_STRING_VALIDATION_REPLACE) {
572 av_log(wctx, AV_LOG_WARNING,
574 invalid_chars_nb, src, wctx->string_validation_replacement);
585 static inline int writer_print_string(WriterContext *wctx,
588 const struct section *section = wctx->section[wctx->level];
592 && !(wctx->writer->flags & WRITER_FLAG_DISPLAY_OPTIONAL_FIELDS))
598 ret = validate_string(wctx, &key1, key);
600 ret = validate_string(wctx, &val1, val);
602 wctx->writer->print_string(wctx, key1, val1);
605 av_log(wctx, AV_LOG_ERROR,
612 wctx->writer->print_string(wctx, key, val);
615 wctx->nb_item[wctx->level]++;
621 static inline void writer_print_rational(WriterContext *wctx,
627 writer_print_string(wctx, key, buf.str, 0);
630 static void writer_print_time(WriterContext *wctx, const char *key,
636 writer_print_string(wctx, key, "N/A", PRINT_STRING_OPT);
643 writer_print_string(wctx, key, buf, 0);
647 static void writer_print_ts(WriterContext *wctx, const char *key, int64_t ts, int is_duration)
650 writer_print_string(wctx, key, "N/A", PRINT_STRING_OPT);
652 writer_print_integer(wctx, key, ts);
656 static void writer_print_data(WriterContext *wctx, const char *name,
680 writer_print_string(wctx, name, bp.str, 0);
756 static void default_print_section_header(WriterContext *wctx)
758 DefaultContext *def = wctx->priv;
760 const struct section *section = wctx->section[wctx->level];
761 const struct section *parent_section = wctx->level ?
762 wctx->section[wctx->level-1] : NULL;
764 av_bprint_clear(&wctx->section_pbuf[wctx->level]);
767 def->nested_section[wctx->level] = 1;
768 av_bprintf(&wctx->section_pbuf[wctx->level], "%s%s:",
769 wctx->section_pbuf[wctx->level-1].str,
774 if (def->noprint_wrappers || def->nested_section[wctx->level])
781 static void default_print_section_footer(WriterContext *wctx)
783 DefaultContext *def = wctx->priv;
784 const struct section *section = wctx->section[wctx->level];
787 if (def->noprint_wrappers || def->nested_section[wctx->level])
794 static void default_print_str(WriterContext *wctx, const char *key, const char *value)
796 DefaultContext *def = wctx->priv;
799 printf("%s%s=", wctx->section_pbuf[wctx->level].str, key);
803 static void default_print_int(WriterContext *wctx, const char *key, long long int value)
805 DefaultContext *def = wctx->priv;
808 printf("%s%s=", wctx->section_pbuf[wctx->level].str, key);
904 static av_cold int compact_init(WriterContext *wctx)
906 CompactContext *compact = wctx->priv;
909 av_log(wctx, AV_LOG_ERROR, "Item separator '%s' specified, but must contain a single character\n",
919 av_log(wctx, AV_LOG_ERROR, "Unknown escape mode '%s'\n", compact->escape_mode_str);
926 static void compact_print_section_header(WriterContext *wctx)
928 CompactContext *compact = wctx->priv;
929 const struct section *section = wctx->section[wctx->level];
930 const struct section *parent_section = wctx->level ?
931 wctx->section[wctx->level-1] : NULL;
932 compact->terminate_line[wctx->level] = 1;
933 compact->has_nested_elems[wctx->level] = 0;
935 av_bprint_clear(&wctx->section_pbuf[wctx->level]);
938 compact->nested_section[wctx->level] = 1;
939 compact->has_nested_elems[wctx->level-1] = 1;
940 av_bprintf(&wctx->section_pbuf[wctx->level], "%s%s:",
941 wctx->section_pbuf[wctx->level-1].str,
943 wctx->nb_item[wctx->level] = wctx->nb_item[wctx->level-1];
945 if (parent_section && compact->has_nested_elems[wctx->level-1] &&
947 compact->terminate_line[wctx->level-1] = 0;
956 static void compact_print_section_footer(WriterContext *wctx)
958 CompactContext *compact = wctx->priv;
960 if (!compact->nested_section[wctx->level] &&
961 compact->terminate_line[wctx->level] &&
962 !(wctx->section[wctx->level]->flags & (SECTION_FLAG_IS_WRAPPER|SECTION_FLAG_IS_ARRAY)))
966 static void compact_print_str(WriterContext *wctx, const char *key, const char *value)
968 CompactContext *compact = wctx->priv;
971 if (wctx->nb_item[wctx->level]) printf("%c", compact->item_sep);
973 printf("%s%s=", wctx->section_pbuf[wctx->level].str, key);
975 printf("%s", compact->escape_str(&buf, value, compact->item_sep, wctx));
979 static void compact_print_int(WriterContext *wctx, const char *key, long long int value)
981 CompactContext *compact = wctx->priv;
983 if (wctx->nb_item[wctx->level]) printf("%c", compact->item_sep);
985 printf("%s%s=", wctx->section_pbuf[wctx->level].str, key);
1054 static av_cold int flat_init(WriterContext *wctx)
1056 FlatContext *flat = wctx->priv;
1059 av_log(wctx, AV_LOG_ERROR, "Item separator '%s' specified, but must contain a single character\n",
1101 static void flat_print_section_header(WriterContext *wctx)
1103 FlatContext *flat = wctx->priv;
1104 AVBPrint *buf = &wctx->section_pbuf[wctx->level];
1105 const struct section *section = wctx->section[wctx->level];
1106 const struct section *parent_section = wctx->level ?
1107 wctx->section[wctx->level-1] : NULL;
1113 av_bprintf(buf, "%s", wctx->section_pbuf[wctx->level-1].str);
1117 av_bprintf(buf, "%s%s", wctx->section[wctx->level]->name, flat->sep_str);
1121 wctx->nb_section_packet_frame : wctx->nb_item[wctx->level-1];
1127 static void flat_print_int(WriterContext *wctx, const char *key, long long int value)
1129 printf("%s%s=%lld\n", wctx->section_pbuf[wctx->level].str, key, value);
1132 static void flat_print_str(WriterContext *wctx, const char *key, const char *value)
1134 FlatContext *flat = wctx->priv;
1137 printf("%s", wctx->section_pbuf[wctx->level].str);
1201 static void ini_print_section_header(WriterContext *wctx)
1203 INIContext *ini = wctx->priv;
1204 AVBPrint *buf = &wctx->section_pbuf[wctx->level];
1205 const struct section *section = wctx->section[wctx->level];
1206 const struct section *parent_section = wctx->level ?
1207 wctx->section[wctx->level-1] : NULL;
1215 if (wctx->nb_item[wctx->level-1])
1218 av_bprintf(buf, "%s", wctx->section_pbuf[wctx->level-1].str);
1221 av_bprintf(buf, "%s%s", buf->str[0] ? "." : "", wctx->section[wctx->level]->name);
1225 wctx->nb_section_packet_frame : wctx->nb_item[wctx->level-1];
1234 static void ini_print_str(WriterContext *wctx, const char *key, const char *value)
1245 static void ini_print_int(WriterContext *wctx, const char *key, long long int value)
1280 static av_cold int json_init(WriterContext *wctx)
1282 JSONContext *json = wctx->priv;
1312 static void json_print_section_header(WriterContext *wctx)
1314 JSONContext *json = wctx->priv;
1316 const struct section *section = wctx->section[wctx->level];
1317 const struct section *parent_section = wctx->level ?
1318 wctx->section[wctx->level-1] : NULL;
1320 if (wctx->level && wctx->nb_item[wctx->level-1])
1328 json_escape_str(&buf, section->name, wctx);
1350 static void json_print_section_footer(WriterContext *wctx)
1352 JSONContext *json = wctx->priv;
1353 const struct section *section = wctx->section[wctx->level];
1355 if (wctx->level == 0) {
1372 static inline void json_print_item_str(WriterContext *wctx,
1378 printf("\"%s\":", json_escape_str(&buf, key, wctx));
1380 printf(" \"%s\"", json_escape_str(&buf, value, wctx));
1384 static void json_print_str(WriterContext *wctx, const char *key, const char *value)
1386 JSONContext *json = wctx->priv;
1388 if (wctx->nb_item[wctx->level])
1392 json_print_item_str(wctx, key, value);
1395 static void json_print_int(WriterContext *wctx, const char *key, long long int value)
1397 JSONContext *json = wctx->priv;
1400 if (wctx->nb_item[wctx->level])
1406 printf("\"%s\": %lld", json_escape_str(&buf, key, wctx), value);
1445 static av_cold int xml_init(WriterContext *wctx)
1447 XMLContext *xml = wctx->priv;
1453 av_log(wctx, AV_LOG_ERROR, \
1463 av_log(wctx, AV_LOG_ERROR,
1493 static void xml_print_section_header(WriterContext *wctx)
1495 XMLContext *xml = wctx->priv;
1496 const struct section *section = wctx->section[wctx->level];
1497 const struct section *parent_section = wctx->level ?
1498 wctx->section[wctx->level-1] : NULL;
1500 if (wctx->level == 0) {
1520 wctx->level && wctx->nb_item[wctx->level-1])
1533 static void xml_print_section_footer(WriterContext *wctx)
1535 XMLContext *xml = wctx->priv;
1536 const struct section *section = wctx->section[wctx->level];
1538 if (wctx->level == 0) {
1552 static void xml_print_str(WriterContext *wctx, const char *key, const char *value)
1555 XMLContext *xml = wctx->priv;
1556 const struct section *section = wctx->section[wctx->level];
1563 section->element_name, xml_escape_str(&buf, key, wctx));
1565 printf(" value=\"%s\"/>\n", xml_escape_str(&buf, value, wctx));
1567 if (wctx->nb_item[wctx->level])
1569 printf("%s=\"%s\"", key, xml_escape_str(&buf, value, wctx));
1575 static void xml_print_int(WriterContext *wctx, const char *key, long long int value)
1577 if (wctx->nb_item[wctx->level])
2386 static int probe_file(WriterContext *wctx, const char *filename)
2422 wctx->writer->flags & WRITER_FLAG_PUT_PACKETS_AND_FRAMES_IN_SAME_CHAPTER)
2429 writer_print_section_header(wctx, section_id);
2430 ret = read_packets(wctx, fmt_ctx);
2432 writer_print_section_footer(wctx);
2437 ret = show_programs(wctx, fmt_ctx);
2442 ret = show_streams(wctx, fmt_ctx);
2446 ret = show_chapters(wctx, fmt_ctx);
2450 ret = show_format(wctx, fmt_ctx);
2916 WriterContext *wctx;
2981 if ((ret = writer_open(&wctx, w, w_args,
2984 wctx->string_validation_utf8_flags |= AV_UTF8_FLAG_EXCLUDE_XML_INVALID_CONTROL_CODES;
2986 writer_print_section_header(wctx, SECTION_ID_ROOT);
2989 ffprobe_show_program_version(wctx);
2991 ffprobe_show_library_versions(wctx);
3001 ret = probe_file(wctx, input_filename);
3003 show_error(wctx, ret);
3006 writer_print_section_footer(wctx);
3007 writer_close(&wctx);