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

Function show_stream

ffprobe.c:116–202  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

114}
115
116static void show_stream(AVFormatContext *fmt_ctx, int stream_idx)
117{
118 AVStream *stream = fmt_ctx->streams[stream_idx];
119 AVCodecContext *dec_ctx;
120 AVCodec *dec;
121 char val_str[128];
122 AVMetadataTag *tag = NULL;
123 char a, b, c, d;
124 AVRational display_aspect_ratio;
125
126 printf("[STREAM]\n");
127
128 printf("index=%d\n", stream->index);
129
130 if ((dec_ctx = stream->codec)) {
131 if ((dec = dec_ctx->codec)) {
132 printf("codec_name=%s\n", dec->name);
133 printf("codec_long_name=%s\n", dec->long_name);
134 } else {
135 printf("codec_name=unknown\n");
136 }
137
138 printf("codec_type=%s\n", media_type_string(dec_ctx->codec_type));
139 printf("codec_time_base=%d/%d\n", dec_ctx->time_base.num, dec_ctx->time_base.den);
140
141 /* print AVI/FourCC tag */
142 a = dec_ctx->codec_tag & 0xff;
143 b = dec_ctx->codec_tag>>8 & 0xff;
144 c = dec_ctx->codec_tag>>16 & 0xff;
145 d = dec_ctx->codec_tag>>24 & 0xff;
146 printf("codec_tag_string=");
147 if (isprint(a)) printf("%c", a); else printf("[%d]", a);
148 if (isprint(b)) printf("%c", b); else printf("[%d]", b);
149 if (isprint(c)) printf("%c", c); else printf("[%d]", c);
150 if (isprint(d)) printf("%c", d); else printf("[%d]", d);
151 printf("\ncodec_tag=0x%04x\n", dec_ctx->codec_tag);
152
153 switch (dec_ctx->codec_type) {
154 case AVMEDIA_TYPE_VIDEO:
155 printf("width=%d\n", dec_ctx->width);
156 printf("height=%d\n", dec_ctx->height);
157 printf("has_b_frames=%d\n", dec_ctx->has_b_frames);
158 if (dec_ctx->sample_aspect_ratio.num) {
159 printf("sample_aspect_ratio=%d:%d\n", dec_ctx->sample_aspect_ratio.num,
160 dec_ctx->sample_aspect_ratio.den);
161 av_reduce(&display_aspect_ratio.num, &display_aspect_ratio.den,
162 dec_ctx->width * dec_ctx->sample_aspect_ratio.num,
163 dec_ctx->height * dec_ctx->sample_aspect_ratio.den,
164 1024*1024);
165 printf("display_aspect_ratio=%d:%d\n", display_aspect_ratio.num,
166 display_aspect_ratio.den);
167 }
168 printf("pix_fmt=%s\n", dec_ctx->pix_fmt != PIX_FMT_NONE ?
169 av_pix_fmt_descriptors[dec_ctx->pix_fmt].name : "unknown");
170 break;
171
172 case AVMEDIA_TYPE_AUDIO:
173 printf("sample_rate=%s\n", value_string(val_str, sizeof(val_str),

Callers 1

probe_fileFunction · 0.85

Calls 6

media_type_stringFunction · 0.85
av_reduceFunction · 0.85
value_stringFunction · 0.85
av_get_bits_per_sampleFunction · 0.85
time_value_stringFunction · 0.85
av_metadata_getFunction · 0.85

Tested by

no test coverage detected