mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2026-06-16 04:32:47 +02:00
fftools: ffprobe: narrow variable scopes and adjust types
Prevents several integers of different sign comparison warnings.
This commit is contained in:
+31
-32
@@ -1002,7 +1002,7 @@ static void print_film_grain_params(AVTextFormatContext *tfc,
|
||||
avtext_print_section_footer(tfc);
|
||||
}
|
||||
|
||||
for (int uv = 0; uv < 2; uv++) {
|
||||
for (unsigned uv = 0; uv < 2; uv++) {
|
||||
if (!aom->num_uv_points[uv] && !aom->chroma_scaling_from_luma)
|
||||
continue;
|
||||
|
||||
@@ -1760,7 +1760,7 @@ static int read_interval_packets(AVTextFormatContext *tfc, InputFile *ifile,
|
||||
}
|
||||
av_packet_unref(pkt);
|
||||
//Flush remaining frames that are cached in the decoder
|
||||
for (i = 0; i < ifile->nb_streams; i++) {
|
||||
for (int i = 0; i < ifile->nb_streams; i++) {
|
||||
pkt->stream_index = i;
|
||||
if (do_read_frames) {
|
||||
while (process_frame(tfc, ifile, frame, pkt, &(int){1}) > 0);
|
||||
@@ -1792,14 +1792,14 @@ static void flush_buffers(InputFile *ifile)
|
||||
static int read_packets(AVTextFormatContext *tfc, InputFile *ifile)
|
||||
{
|
||||
AVFormatContext *fmt_ctx = ifile->fmt_ctx;
|
||||
int i, ret = 0;
|
||||
int ret = 0;
|
||||
int64_t cur_ts = fmt_ctx->start_time;
|
||||
|
||||
if (read_intervals_nb == 0) {
|
||||
ReadInterval interval = (ReadInterval) { .has_start = 0, .has_end = 0 };
|
||||
ret = read_interval_packets(tfc, ifile, &interval, &cur_ts);
|
||||
} else {
|
||||
for (i = 0; i < read_intervals_nb; i++) {
|
||||
for (int i = 0; i < read_intervals_nb; i++) {
|
||||
/* flushing buffers can reset parts of the private context which may be
|
||||
* read by show_streams(), so only flush between each read_interval */
|
||||
if (i)
|
||||
@@ -1816,7 +1816,7 @@ static int read_packets(AVTextFormatContext *tfc, InputFile *ifile)
|
||||
static void print_dispositions(AVTextFormatContext *tfc, uint32_t disposition, SectionID section_id)
|
||||
{
|
||||
avtext_print_section_header(tfc, NULL, section_id);
|
||||
for (int i = 0; i < sizeof(disposition) * CHAR_BIT; i++) {
|
||||
for (unsigned i = 0; i < sizeof(disposition) * CHAR_BIT; i++) {
|
||||
const char *disposition_str = av_disposition_to_string(1U << i);
|
||||
|
||||
if (disposition_str)
|
||||
@@ -2056,10 +2056,10 @@ static int show_stream(AVTextFormatContext *tfc, AVFormatContext *fmt_ctx, int s
|
||||
static int show_streams(AVTextFormatContext *tfc, InputFile *ifile)
|
||||
{
|
||||
AVFormatContext *fmt_ctx = ifile->fmt_ctx;
|
||||
int i, ret = 0;
|
||||
int ret = 0;
|
||||
|
||||
avtext_print_section_header(tfc, NULL, SECTION_ID_STREAMS);
|
||||
for (i = 0; i < ifile->nb_streams; i++)
|
||||
for (int i = 0; i < ifile->nb_streams; i++)
|
||||
if (selected_streams[i]) {
|
||||
ret = show_stream(tfc, fmt_ctx, i, &ifile->streams[i], 0);
|
||||
if (ret < 0)
|
||||
@@ -2073,7 +2073,7 @@ static int show_streams(AVTextFormatContext *tfc, InputFile *ifile)
|
||||
static int show_program(AVTextFormatContext *tfc, InputFile *ifile, AVProgram *program)
|
||||
{
|
||||
AVFormatContext *fmt_ctx = ifile->fmt_ctx;
|
||||
int i, ret = 0;
|
||||
int ret = 0;
|
||||
|
||||
avtext_print_section_header(tfc, NULL, SECTION_ID_PROGRAM);
|
||||
print_int("program_id", program->id);
|
||||
@@ -2087,7 +2087,7 @@ static int show_program(AVTextFormatContext *tfc, InputFile *ifile, AVProgram *p
|
||||
goto end;
|
||||
|
||||
avtext_print_section_header(tfc, NULL, SECTION_ID_PROGRAM_STREAMS);
|
||||
for (i = 0; i < program->nb_stream_indexes; i++) {
|
||||
for (unsigned i = 0; i < program->nb_stream_indexes; i++) {
|
||||
if (selected_streams[program->stream_index[i]]) {
|
||||
ret = show_stream(tfc, fmt_ctx, program->stream_index[i], &ifile->streams[program->stream_index[i]], IN_PROGRAM);
|
||||
if (ret < 0)
|
||||
@@ -2104,10 +2104,10 @@ end:
|
||||
static int show_programs(AVTextFormatContext *tfc, InputFile *ifile)
|
||||
{
|
||||
AVFormatContext *fmt_ctx = ifile->fmt_ctx;
|
||||
int i, ret = 0;
|
||||
int ret = 0;
|
||||
|
||||
avtext_print_section_header(tfc, NULL, SECTION_ID_PROGRAMS);
|
||||
for (i = 0; i < fmt_ctx->nb_programs; i++) {
|
||||
for (unsigned i = 0; i < fmt_ctx->nb_programs; i++) {
|
||||
AVProgram *program = fmt_ctx->programs[i];
|
||||
if (!program)
|
||||
continue;
|
||||
@@ -2131,7 +2131,7 @@ static void print_tile_grid_params(AVTextFormatContext *tfc, const AVStreamGroup
|
||||
print_int("width", tile_grid->width);
|
||||
print_int("height", tile_grid->height);
|
||||
avtext_print_section_header(tfc, NULL, SECTION_ID_STREAM_GROUP_SUBCOMPONENTS);
|
||||
for (int i = 0; i < tile_grid->nb_tiles; i++) {
|
||||
for (unsigned i = 0; i < tile_grid->nb_tiles; i++) {
|
||||
avtext_print_section_header(tfc, "tile_offset", SECTION_ID_STREAM_GROUP_SUBCOMPONENT);
|
||||
print_int("stream_index", tile_grid->offsets[i].idx);
|
||||
print_int("tile_horizontal_offset", tile_grid->offsets[i].horizontal);
|
||||
@@ -2169,7 +2169,7 @@ static void print_iamf_param_definition(AVTextFormatContext *tfc, const char *na
|
||||
print_int("constant_subblock_duration", param->constant_subblock_duration);
|
||||
if (param->nb_subblocks > 0)
|
||||
avtext_print_section_header(tfc, NULL, subsection_id);
|
||||
for (int i = 0; i < param->nb_subblocks; i++) {
|
||||
for (unsigned i = 0; i < param->nb_subblocks; i++) {
|
||||
const void *subblock = av_iamf_param_definition_get_subblock(param, i);
|
||||
switch(param->type) {
|
||||
case AV_IAMF_PARAMETER_DEFINITION_MIX_GAIN: {
|
||||
@@ -2218,7 +2218,7 @@ static void print_iamf_audio_element_params(AVTextFormatContext *tfc, const AVSt
|
||||
print_int("audio_element_type", audio_element->audio_element_type);
|
||||
print_int("default_w", audio_element->default_w);
|
||||
avtext_print_section_header(tfc, NULL, SECTION_ID_STREAM_GROUP_SUBCOMPONENTS);
|
||||
for (int i = 0; i < audio_element->nb_layers; i++) {
|
||||
for (unsigned i = 0; i < audio_element->nb_layers; i++) {
|
||||
const AVIAMFLayer *layer = audio_element->layers[i];
|
||||
char val_str[128];
|
||||
avtext_print_section_header(tfc, "IAMF Audio Layer", SECTION_ID_STREAM_GROUP_SUBCOMPONENT);
|
||||
@@ -2254,7 +2254,7 @@ static void print_iamf_submix_params(AVTextFormatContext *tfc, const AVIAMFSubmi
|
||||
print_int("nb_layouts", submix->nb_layouts);
|
||||
print_q("default_mix_gain", submix->default_mix_gain, '/');
|
||||
avtext_print_section_header(tfc, NULL, SECTION_ID_STREAM_GROUP_PIECES);
|
||||
for (int i = 0; i < submix->nb_elements; i++) {
|
||||
for (unsigned i = 0; i < submix->nb_elements; i++) {
|
||||
const AVIAMFSubmixElement *element = submix->elements[i];
|
||||
avtext_print_section_header(tfc, "IAMF Submix Element", SECTION_ID_STREAM_GROUP_PIECE);
|
||||
print_int("stream_id", element->audio_element_id);
|
||||
@@ -2277,7 +2277,7 @@ static void print_iamf_submix_params(AVTextFormatContext *tfc, const AVIAMFSubmi
|
||||
if (submix->output_mix_config)
|
||||
print_iamf_param_definition(tfc, "output_mix_config", submix->output_mix_config,
|
||||
SECTION_ID_STREAM_GROUP_PIECE);
|
||||
for (int i = 0; i < submix->nb_layouts; i++) {
|
||||
for (unsigned i = 0; i < submix->nb_layouts; i++) {
|
||||
const AVIAMFSubmixLayout *layout = submix->layouts[i];
|
||||
char val_str[128];
|
||||
avtext_print_section_header(tfc, "IAMF Submix Layout", SECTION_ID_STREAM_GROUP_PIECE);
|
||||
@@ -2307,7 +2307,7 @@ static void print_iamf_mix_presentation_params(AVTextFormatContext *tfc, const A
|
||||
print_str(annotation->key, annotation->value);
|
||||
avtext_print_section_footer(tfc); // SECTION_ID_STREAM_GROUP_SUBCOMPONENT
|
||||
}
|
||||
for (int i = 0; i < mix_presentation->nb_submixes; i++)
|
||||
for (unsigned i = 0; i < mix_presentation->nb_submixes; i++)
|
||||
print_iamf_submix_params(tfc, mix_presentation->submixes[i]);
|
||||
avtext_print_section_footer(tfc); // SECTION_ID_STREAM_GROUP_SUBCOMPONENTS
|
||||
avtext_print_section_footer(tfc); // SECTION_ID_STREAM_GROUP_COMPONENT
|
||||
@@ -2329,7 +2329,7 @@ static int show_stream_group(AVTextFormatContext *tfc, InputFile *ifile, AVStrea
|
||||
{
|
||||
AVFormatContext *fmt_ctx = ifile->fmt_ctx;
|
||||
AVBPrint pbuf;
|
||||
int i, ret = 0;
|
||||
int ret = 0;
|
||||
|
||||
av_bprint_init(&pbuf, 1, AV_BPRINT_SIZE_UNLIMITED);
|
||||
avtext_print_section_header(tfc, NULL, SECTION_ID_STREAM_GROUP);
|
||||
@@ -2354,7 +2354,7 @@ static int show_stream_group(AVTextFormatContext *tfc, InputFile *ifile, AVStrea
|
||||
goto end;
|
||||
|
||||
avtext_print_section_header(tfc, NULL, SECTION_ID_STREAM_GROUP_STREAMS);
|
||||
for (i = 0; i < stg->nb_streams; i++) {
|
||||
for (unsigned i = 0; i < stg->nb_streams; i++) {
|
||||
if (selected_streams[stg->streams[i]->index]) {
|
||||
ret = show_stream(tfc, fmt_ctx, stg->streams[i]->index, &ifile->streams[stg->streams[i]->index], IN_STREAM_GROUP);
|
||||
if (ret < 0)
|
||||
@@ -2372,10 +2372,10 @@ end:
|
||||
static int show_stream_groups(AVTextFormatContext *tfc, InputFile *ifile)
|
||||
{
|
||||
AVFormatContext *fmt_ctx = ifile->fmt_ctx;
|
||||
int i, ret = 0;
|
||||
int ret = 0;
|
||||
|
||||
avtext_print_section_header(tfc, NULL, SECTION_ID_STREAM_GROUPS);
|
||||
for (i = 0; i < fmt_ctx->nb_stream_groups; i++) {
|
||||
for (unsigned i = 0; i < fmt_ctx->nb_stream_groups; i++) {
|
||||
AVStreamGroup *stg = fmt_ctx->stream_groups[i];
|
||||
|
||||
ret = show_stream_group(tfc, ifile, stg);
|
||||
@@ -2389,10 +2389,10 @@ static int show_stream_groups(AVTextFormatContext *tfc, InputFile *ifile)
|
||||
static int show_chapters(AVTextFormatContext *tfc, InputFile *ifile)
|
||||
{
|
||||
AVFormatContext *fmt_ctx = ifile->fmt_ctx;
|
||||
int i, ret = 0;
|
||||
int ret = 0;
|
||||
|
||||
avtext_print_section_header(tfc, NULL, SECTION_ID_CHAPTERS);
|
||||
for (i = 0; i < fmt_ctx->nb_chapters; i++) {
|
||||
for (unsigned i = 0; i < fmt_ctx->nb_chapters; i++) {
|
||||
AVChapter *chapter = fmt_ctx->chapters[i];
|
||||
|
||||
avtext_print_section_header(tfc, NULL, SECTION_ID_CHAPTER);
|
||||
@@ -2512,7 +2512,7 @@ static const AVCodec *get_decoder_for_stream(AVFormatContext *fmt_ctx, AVStream
|
||||
static int open_input_file(InputFile *ifile, const char *filename,
|
||||
const char *print_filename)
|
||||
{
|
||||
int err, i;
|
||||
int err;
|
||||
AVFormatContext *fmt_ctx = NULL;
|
||||
const AVDictionaryEntry *t = NULL;
|
||||
int scan_all_pmts_set = 0;
|
||||
@@ -2553,7 +2553,7 @@ static int open_input_file(InputFile *ifile, const char *filename,
|
||||
|
||||
err = avformat_find_stream_info(fmt_ctx, opts);
|
||||
|
||||
for (i = 0; i < orig_nb_streams; i++)
|
||||
for (int i = 0; i < orig_nb_streams; i++)
|
||||
av_dict_free(&opts[i]);
|
||||
av_freep(&opts);
|
||||
|
||||
@@ -2571,7 +2571,7 @@ static int open_input_file(InputFile *ifile, const char *filename,
|
||||
ifile->nb_streams = fmt_ctx->nb_streams;
|
||||
|
||||
/* bind a decoder to each input stream */
|
||||
for (i = 0; i < fmt_ctx->nb_streams; i++) {
|
||||
for (unsigned i = 0; i < fmt_ctx->nb_streams; i++) {
|
||||
InputStream *ist = &ifile->streams[i];
|
||||
AVStream *stream = fmt_ctx->streams[i];
|
||||
const AVCodec *codec;
|
||||
@@ -2629,10 +2629,9 @@ static int open_input_file(InputFile *ifile, const char *filename,
|
||||
|
||||
static void close_input_file(InputFile *ifile)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* close decoder for each stream */
|
||||
for (i = 0; i < ifile->nb_streams; i++)
|
||||
for (int i = 0; i < ifile->nb_streams; i++)
|
||||
avcodec_free_context(&ifile->streams[i].dec_ctx);
|
||||
|
||||
av_freep(&ifile->streams);
|
||||
@@ -2645,7 +2644,7 @@ static int probe_file(AVTextFormatContext *tfc, const char *filename,
|
||||
const char *print_filename)
|
||||
{
|
||||
InputFile ifile = { 0 };
|
||||
int ret, i;
|
||||
int ret;
|
||||
int section_id;
|
||||
|
||||
do_analyze_frames = do_analyze_frames && do_show_streams;
|
||||
@@ -2665,7 +2664,7 @@ static int probe_file(AVTextFormatContext *tfc, const char *filename,
|
||||
REALLOCZ_ARRAY_STREAM(streams_with_closed_captions,0,ifile.fmt_ctx->nb_streams);
|
||||
REALLOCZ_ARRAY_STREAM(streams_with_film_grain,0,ifile.fmt_ctx->nb_streams);
|
||||
|
||||
for (i = 0; i < ifile.fmt_ctx->nb_streams; i++) {
|
||||
for (unsigned i = 0; i < ifile.fmt_ctx->nb_streams; i++) {
|
||||
if (stream_specifier) {
|
||||
ret = avformat_match_stream_specifier(ifile.fmt_ctx,
|
||||
ifile.fmt_ctx->streams[i],
|
||||
@@ -2883,9 +2882,9 @@ static inline void mark_section_show_entries(SectionID section_id,
|
||||
static int match_section(const char *section_name,
|
||||
int show_all_entries, AVDictionary *entries)
|
||||
{
|
||||
int i, ret = 0;
|
||||
int ret = 0;
|
||||
|
||||
for (i = 0; i < FF_ARRAY_ELEMS(sections); i++) {
|
||||
for (unsigned i = 0; i < FF_ARRAY_ELEMS(sections); i++) {
|
||||
const struct AVTextFormatSection *section = §ions[i];
|
||||
if (!strcmp(section_name, section->name) ||
|
||||
(section->unique_name && !strcmp(section_name, section->unique_name))) {
|
||||
|
||||
Reference in New Issue
Block a user