/* FFprobe context */
static const char *input_filename;
static const char *print_input_filename;
-static AVInputFormat *iformat = NULL;
+static const AVInputFormat *iformat = NULL;
static struct AVHashContext *hash;
CHECK_COMPLIANCE(show_private_data, "private");
CHECK_COMPLIANCE(show_value_unit, "unit");
CHECK_COMPLIANCE(use_value_prefix, "prefix");
-
- if (do_show_frames && do_show_packets) {
- av_log(wctx, AV_LOG_ERROR,
- "Interleaved frames and packets are not allowed in XSD. "
- "Select only one between the -show_frames and the -show_packets options.\n");
- return AVERROR(EINVAL);
- }
}
return 0;
}
-static const char *xml_escape_str(AVBPrint *dst, const char *src, void *log_ctx)
-{
- const char *p;
-
- for (p = src; *p; p++) {
- switch (*p) {
- case '&' : av_bprintf(dst, "%s", "&"); break;
- case '<' : av_bprintf(dst, "%s", "<"); break;
- case '>' : av_bprintf(dst, "%s", ">"); break;
- case '"' : av_bprintf(dst, "%s", """); break;
- case '\'': av_bprintf(dst, "%s", "'"); break;
- default: av_bprint_chars(dst, *p, 1);
- }
- }
-
- return dst->str;
-}
-
#define XML_INDENT() printf("%*c", xml->indent_level * 4, ' ')
static void xml_print_section_header(WriterContext *wctx)
if (section->flags & SECTION_FLAG_HAS_VARIABLE_FIELDS) {
XML_INDENT();
+ av_bprint_escape(&buf, key, NULL,
+ AV_ESCAPE_MODE_XML, AV_ESCAPE_FLAG_XML_DOUBLE_QUOTES);
printf("<%s key=\"%s\"",
- section->element_name, xml_escape_str(&buf, key, wctx));
+ section->element_name, buf.str);
av_bprint_clear(&buf);
- printf(" value=\"%s\"/>\n", xml_escape_str(&buf, value, wctx));
+
+ av_bprint_escape(&buf, value, NULL,
+ AV_ESCAPE_MODE_XML, AV_ESCAPE_FLAG_XML_DOUBLE_QUOTES);
+ printf(" value=\"%s\"/>\n", buf.str);
} else {
if (wctx->nb_item[wctx->level])
printf(" ");
- printf("%s=\"%s\"", key, xml_escape_str(&buf, value, wctx));
+
+ av_bprint_escape(&buf, value, NULL,
+ AV_ESCAPE_MODE_XML, AV_ESCAPE_FLAG_XML_DOUBLE_QUOTES);
+ printf("%s=\"%s\"", key, buf.str);
}
av_bprint_finalize(&buf, NULL);
const ReadInterval *interval, int64_t *cur_ts)
{
AVFormatContext *fmt_ctx = ifile->fmt_ctx;
- AVPacket pkt;
+ AVPacket *pkt = NULL;
AVFrame *frame = NULL;
int ret = 0, i = 0, frame_count = 0;
int64_t start = -INT64_MAX, end = interval->end;
int has_start = 0, has_end = interval->has_end && !interval->end_is_offset;
- av_init_packet(&pkt);
-
av_log(NULL, AV_LOG_VERBOSE, "Processing read interval ");
log_read_interval(interval, NULL, AV_LOG_VERBOSE);
ret = AVERROR(ENOMEM);
goto end;
}
- while (!av_read_frame(fmt_ctx, &pkt)) {
+ pkt = av_packet_alloc();
+ if (!pkt) {
+ ret = AVERROR(ENOMEM);
+ goto end;
+ }
+ while (!av_read_frame(fmt_ctx, pkt)) {
if (fmt_ctx->nb_streams > nb_streams) {
REALLOCZ_ARRAY_STREAM(nb_streams_frames, nb_streams, fmt_ctx->nb_streams);
REALLOCZ_ARRAY_STREAM(nb_streams_packets, nb_streams, fmt_ctx->nb_streams);
REALLOCZ_ARRAY_STREAM(selected_streams, nb_streams, fmt_ctx->nb_streams);
nb_streams = fmt_ctx->nb_streams;
}
- if (selected_streams[pkt.stream_index]) {
- AVRational tb = ifile->streams[pkt.stream_index].st->time_base;
+ if (selected_streams[pkt->stream_index]) {
+ AVRational tb = ifile->streams[pkt->stream_index].st->time_base;
- if (pkt.pts != AV_NOPTS_VALUE)
- *cur_ts = av_rescale_q(pkt.pts, tb, AV_TIME_BASE_Q);
+ if (pkt->pts != AV_NOPTS_VALUE)
+ *cur_ts = av_rescale_q(pkt->pts, tb, AV_TIME_BASE_Q);
if (!has_start && *cur_ts != AV_NOPTS_VALUE) {
start = *cur_ts;
frame_count++;
if (do_read_packets) {
if (do_show_packets)
- show_packet(w, ifile, &pkt, i++);
- nb_streams_packets[pkt.stream_index]++;
+ show_packet(w, ifile, pkt, i++);
+ nb_streams_packets[pkt->stream_index]++;
}
if (do_read_frames) {
int packet_new = 1;
- while (process_frame(w, ifile, frame, &pkt, &packet_new) > 0);
+ while (process_frame(w, ifile, frame, pkt, &packet_new) > 0);
}
}
- av_packet_unref(&pkt);
+ av_packet_unref(pkt);
}
- av_packet_unref(&pkt);
+ av_packet_unref(pkt);
//Flush remaining frames that are cached in the decoder
for (i = 0; i < fmt_ctx->nb_streams; i++) {
- pkt.stream_index = i;
+ pkt->stream_index = i;
if (do_read_frames)
- while (process_frame(w, ifile, frame, &pkt, &(int){1}) > 0);
+ while (process_frame(w, ifile, frame, pkt, &(int){1}) > 0);
}
end:
av_frame_free(&frame);
+ av_packet_free(&pkt);
if (ret < 0) {
av_log(NULL, AV_LOG_ERROR, "Could not read packets in interval ");
log_read_interval(interval, NULL, AV_LOG_ERROR);
const AVOption *opt = NULL;
while (opt = av_opt_next(dec_ctx->priv_data,opt)) {
uint8_t *str;
- if (opt->flags) continue;
+ if (!(opt->flags & AV_OPT_FLAG_EXPORT)) continue;
if (av_opt_get(dec_ctx->priv_data, opt->name, 0, &str) >= 0) {
print_str(opt->name, str);
av_free(str);
PRINT_DISPOSITION(CLEAN_EFFECTS, "clean_effects");
PRINT_DISPOSITION(ATTACHED_PIC, "attached_pic");
PRINT_DISPOSITION(TIMED_THUMBNAILS, "timed_thumbnails");
+ PRINT_DISPOSITION(CAPTIONS, "captions");
+ PRINT_DISPOSITION(DESCRIPTIONS, "descriptions");
+ PRINT_DISPOSITION(METADATA, "metadata");
+ PRINT_DISPOSITION(DEPENDENT, "dependent");
+ PRINT_DISPOSITION(STILL_IMAGE, "still_image");
writer_print_section_footer(w);
}