You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

563 lines
19KB

  1. /*
  2. * Various pretty-printing functions for use within FFmpeg
  3. * Copyright (c) 2000, 2001, 2002 Fabrice Bellard
  4. *
  5. * This file is part of FFmpeg.
  6. *
  7. * FFmpeg is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU Lesser General Public
  9. * License as published by the Free Software Foundation; either
  10. * version 2.1 of the License, or (at your option) any later version.
  11. *
  12. * FFmpeg is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * Lesser General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Lesser General Public
  18. * License along with FFmpeg; if not, write to the Free Software
  19. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  20. */
  21. #include <stdio.h>
  22. #include <stdint.h>
  23. #include "libavutil/channel_layout.h"
  24. #include "libavutil/display.h"
  25. #include "libavutil/intreadwrite.h"
  26. #include "libavutil/log.h"
  27. #include "libavutil/mathematics.h"
  28. #include "libavutil/opt.h"
  29. #include "libavutil/avstring.h"
  30. #include "libavutil/replaygain.h"
  31. #include "libavutil/stereo3d.h"
  32. #include "avformat.h"
  33. #define HEXDUMP_PRINT(...) \
  34. do { \
  35. if (!f) \
  36. av_log(avcl, level, __VA_ARGS__); \
  37. else \
  38. fprintf(f, __VA_ARGS__); \
  39. } while (0)
  40. static void hex_dump_internal(void *avcl, FILE *f, int level,
  41. const uint8_t *buf, int size)
  42. {
  43. int len, i, j, c;
  44. for (i = 0; i < size; i += 16) {
  45. len = size - i;
  46. if (len > 16)
  47. len = 16;
  48. HEXDUMP_PRINT("%08x ", i);
  49. for (j = 0; j < 16; j++) {
  50. if (j < len)
  51. HEXDUMP_PRINT(" %02x", buf[i + j]);
  52. else
  53. HEXDUMP_PRINT(" ");
  54. }
  55. HEXDUMP_PRINT(" ");
  56. for (j = 0; j < len; j++) {
  57. c = buf[i + j];
  58. if (c < ' ' || c > '~')
  59. c = '.';
  60. HEXDUMP_PRINT("%c", c);
  61. }
  62. HEXDUMP_PRINT("\n");
  63. }
  64. }
  65. void av_hex_dump(FILE *f, const uint8_t *buf, int size)
  66. {
  67. hex_dump_internal(NULL, f, 0, buf, size);
  68. }
  69. void av_hex_dump_log(void *avcl, int level, const uint8_t *buf, int size)
  70. {
  71. hex_dump_internal(avcl, NULL, level, buf, size);
  72. }
  73. static void pkt_dump_internal(void *avcl, FILE *f, int level, const AVPacket *pkt,
  74. int dump_payload, AVRational time_base)
  75. {
  76. HEXDUMP_PRINT("stream #%d:\n", pkt->stream_index);
  77. HEXDUMP_PRINT(" keyframe=%d\n", (pkt->flags & AV_PKT_FLAG_KEY) != 0);
  78. HEXDUMP_PRINT(" duration=%0.3f\n", pkt->duration * av_q2d(time_base));
  79. /* DTS is _always_ valid after av_read_frame() */
  80. HEXDUMP_PRINT(" dts=");
  81. if (pkt->dts == AV_NOPTS_VALUE)
  82. HEXDUMP_PRINT("N/A");
  83. else
  84. HEXDUMP_PRINT("%0.3f", pkt->dts * av_q2d(time_base));
  85. /* PTS may not be known if B-frames are present. */
  86. HEXDUMP_PRINT(" pts=");
  87. if (pkt->pts == AV_NOPTS_VALUE)
  88. HEXDUMP_PRINT("N/A");
  89. else
  90. HEXDUMP_PRINT("%0.3f", pkt->pts * av_q2d(time_base));
  91. HEXDUMP_PRINT("\n");
  92. HEXDUMP_PRINT(" size=%d\n", pkt->size);
  93. if (dump_payload)
  94. av_hex_dump(f, pkt->data, pkt->size);
  95. }
  96. void av_pkt_dump2(FILE *f, const AVPacket *pkt, int dump_payload, const AVStream *st)
  97. {
  98. pkt_dump_internal(NULL, f, 0, pkt, dump_payload, st->time_base);
  99. }
  100. void av_pkt_dump_log2(void *avcl, int level, const AVPacket *pkt, int dump_payload,
  101. const AVStream *st)
  102. {
  103. pkt_dump_internal(avcl, NULL, level, pkt, dump_payload, st->time_base);
  104. }
  105. static void print_fps(double d, const char *postfix)
  106. {
  107. uint64_t v = lrintf(d * 100);
  108. if (!v)
  109. av_log(NULL, AV_LOG_INFO, "%1.4f %s", d, postfix);
  110. else if (v % 100)
  111. av_log(NULL, AV_LOG_INFO, "%3.2f %s", d, postfix);
  112. else if (v % (100 * 1000))
  113. av_log(NULL, AV_LOG_INFO, "%1.0f %s", d, postfix);
  114. else
  115. av_log(NULL, AV_LOG_INFO, "%1.0fk %s", d / 1000, postfix);
  116. }
  117. static void dump_metadata(void *ctx, AVDictionary *m, const char *indent)
  118. {
  119. if (m && !(av_dict_count(m) == 1 && av_dict_get(m, "language", NULL, 0))) {
  120. AVDictionaryEntry *tag = NULL;
  121. av_log(ctx, AV_LOG_INFO, "%sMetadata:\n", indent);
  122. while ((tag = av_dict_get(m, "", tag, AV_DICT_IGNORE_SUFFIX)))
  123. if (strcmp("language", tag->key)) {
  124. const char *p = tag->value;
  125. av_log(ctx, AV_LOG_INFO,
  126. "%s %-16s: ", indent, tag->key);
  127. while (*p) {
  128. char tmp[256];
  129. size_t len = strcspn(p, "\x8\xa\xb\xc\xd");
  130. av_strlcpy(tmp, p, FFMIN(sizeof(tmp), len+1));
  131. av_log(ctx, AV_LOG_INFO, "%s", tmp);
  132. p += len;
  133. if (*p == 0xd) av_log(ctx, AV_LOG_INFO, " ");
  134. if (*p == 0xa) av_log(ctx, AV_LOG_INFO, "\n%s %-16s: ", indent, "");
  135. if (*p) p++;
  136. }
  137. av_log(ctx, AV_LOG_INFO, "\n");
  138. }
  139. }
  140. }
  141. /* param change side data*/
  142. static void dump_paramchange(void *ctx, AVPacketSideData *sd)
  143. {
  144. int size = sd->size;
  145. const uint8_t *data = sd->data;
  146. uint32_t flags, channels, sample_rate, width, height;
  147. uint64_t layout;
  148. if (!data || sd->size < 4)
  149. goto fail;
  150. flags = AV_RL32(data);
  151. data += 4;
  152. size -= 4;
  153. if (flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT) {
  154. if (size < 4)
  155. goto fail;
  156. channels = AV_RL32(data);
  157. data += 4;
  158. size -= 4;
  159. av_log(ctx, AV_LOG_INFO, "channel count %"PRIu32", ", channels);
  160. }
  161. if (flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_LAYOUT) {
  162. if (size < 8)
  163. goto fail;
  164. layout = AV_RL64(data);
  165. data += 8;
  166. size -= 8;
  167. av_log(ctx, AV_LOG_INFO,
  168. "channel layout: %s, ", av_get_channel_name(layout));
  169. }
  170. if (flags & AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE) {
  171. if (size < 4)
  172. goto fail;
  173. sample_rate = AV_RL32(data);
  174. data += 4;
  175. size -= 4;
  176. av_log(ctx, AV_LOG_INFO, "sample_rate %"PRIu32", ", sample_rate);
  177. }
  178. if (flags & AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS) {
  179. if (size < 8)
  180. goto fail;
  181. width = AV_RL32(data);
  182. data += 4;
  183. size -= 4;
  184. height = AV_RL32(data);
  185. data += 4;
  186. size -= 4;
  187. av_log(ctx, AV_LOG_INFO, "width %"PRIu32" height %"PRIu32, width, height);
  188. }
  189. return;
  190. fail:
  191. av_log(ctx, AV_LOG_INFO, "unknown param");
  192. }
  193. /* replaygain side data*/
  194. static void print_gain(void *ctx, const char *str, int32_t gain)
  195. {
  196. av_log(ctx, AV_LOG_INFO, "%s - ", str);
  197. if (gain == INT32_MIN)
  198. av_log(ctx, AV_LOG_INFO, "unknown");
  199. else
  200. av_log(ctx, AV_LOG_INFO, "%f", gain / 100000.0f);
  201. av_log(ctx, AV_LOG_INFO, ", ");
  202. }
  203. static void print_peak(void *ctx, const char *str, uint32_t peak)
  204. {
  205. av_log(ctx, AV_LOG_INFO, "%s - ", str);
  206. if (!peak)
  207. av_log(ctx, AV_LOG_INFO, "unknown");
  208. else
  209. av_log(ctx, AV_LOG_INFO, "%f", (float) peak / UINT32_MAX);
  210. av_log(ctx, AV_LOG_INFO, ", ");
  211. }
  212. static void dump_replaygain(void *ctx, AVPacketSideData *sd)
  213. {
  214. AVReplayGain *rg;
  215. if (sd->size < sizeof(*rg)) {
  216. av_log(ctx, AV_LOG_INFO, "invalid data");
  217. return;
  218. }
  219. rg = (AVReplayGain*)sd->data;
  220. print_gain(ctx, "track gain", rg->track_gain);
  221. print_peak(ctx, "track peak", rg->track_peak);
  222. print_gain(ctx, "album gain", rg->album_gain);
  223. print_peak(ctx, "album peak", rg->album_peak);
  224. }
  225. static void dump_stereo3d(void *ctx, AVPacketSideData *sd)
  226. {
  227. AVStereo3D *stereo;
  228. if (sd->size < sizeof(*stereo)) {
  229. av_log(ctx, AV_LOG_INFO, "invalid data");
  230. return;
  231. }
  232. stereo = (AVStereo3D *)sd->data;
  233. switch (stereo->type) {
  234. case AV_STEREO3D_2D:
  235. av_log(ctx, AV_LOG_INFO, "2D");
  236. break;
  237. case AV_STEREO3D_SIDEBYSIDE:
  238. av_log(ctx, AV_LOG_INFO, "side by side");
  239. break;
  240. case AV_STEREO3D_TOPBOTTOM:
  241. av_log(ctx, AV_LOG_INFO, "top and bottom");
  242. break;
  243. case AV_STEREO3D_FRAMESEQUENCE:
  244. av_log(ctx, AV_LOG_INFO, "frame alternate");
  245. break;
  246. case AV_STEREO3D_CHECKERBOARD:
  247. av_log(ctx, AV_LOG_INFO, "checkerboard");
  248. break;
  249. case AV_STEREO3D_LINES:
  250. av_log(ctx, AV_LOG_INFO, "interleaved lines");
  251. break;
  252. case AV_STEREO3D_COLUMNS:
  253. av_log(ctx, AV_LOG_INFO, "interleaved columns");
  254. break;
  255. case AV_STEREO3D_SIDEBYSIDE_QUINCUNX:
  256. av_log(ctx, AV_LOG_INFO, "side by side (quincunx subsampling)");
  257. break;
  258. default:
  259. av_log(ctx, AV_LOG_WARNING, "unknown");
  260. break;
  261. }
  262. if (stereo->flags & AV_STEREO3D_FLAG_INVERT)
  263. av_log(ctx, AV_LOG_INFO, " (inverted)");
  264. }
  265. static void dump_audioservicetype(void *ctx, AVPacketSideData *sd)
  266. {
  267. enum AVAudioServiceType *ast = (enum AVAudioServiceType *)sd->data;
  268. if (sd->size < sizeof(*ast)) {
  269. av_log(ctx, AV_LOG_INFO, "invalid data");
  270. return;
  271. }
  272. switch (*ast) {
  273. case AV_AUDIO_SERVICE_TYPE_MAIN:
  274. av_log(ctx, AV_LOG_INFO, "main");
  275. break;
  276. case AV_AUDIO_SERVICE_TYPE_EFFECTS:
  277. av_log(ctx, AV_LOG_INFO, "effects");
  278. break;
  279. case AV_AUDIO_SERVICE_TYPE_VISUALLY_IMPAIRED:
  280. av_log(ctx, AV_LOG_INFO, "visually impaired");
  281. break;
  282. case AV_AUDIO_SERVICE_TYPE_HEARING_IMPAIRED:
  283. av_log(ctx, AV_LOG_INFO, "hearing impaired");
  284. break;
  285. case AV_AUDIO_SERVICE_TYPE_DIALOGUE:
  286. av_log(ctx, AV_LOG_INFO, "dialogue");
  287. break;
  288. case AV_AUDIO_SERVICE_TYPE_COMMENTARY:
  289. av_log(ctx, AV_LOG_INFO, "comentary");
  290. break;
  291. case AV_AUDIO_SERVICE_TYPE_EMERGENCY:
  292. av_log(ctx, AV_LOG_INFO, "emergency");
  293. break;
  294. case AV_AUDIO_SERVICE_TYPE_VOICE_OVER:
  295. av_log(ctx, AV_LOG_INFO, "voice over");
  296. break;
  297. case AV_AUDIO_SERVICE_TYPE_KARAOKE:
  298. av_log(ctx, AV_LOG_INFO, "karaoke");
  299. break;
  300. default:
  301. av_log(ctx, AV_LOG_WARNING, "unknown");
  302. break;
  303. }
  304. }
  305. static void dump_sidedata(void *ctx, AVStream *st, const char *indent)
  306. {
  307. int i;
  308. if (st->nb_side_data)
  309. av_log(ctx, AV_LOG_INFO, "%sSide data:\n", indent);
  310. for (i = 0; i < st->nb_side_data; i++) {
  311. AVPacketSideData sd = st->side_data[i];
  312. av_log(ctx, AV_LOG_INFO, "%s ", indent);
  313. switch (sd.type) {
  314. case AV_PKT_DATA_PALETTE:
  315. av_log(ctx, AV_LOG_INFO, "palette");
  316. break;
  317. case AV_PKT_DATA_NEW_EXTRADATA:
  318. av_log(ctx, AV_LOG_INFO, "new extradata");
  319. break;
  320. case AV_PKT_DATA_PARAM_CHANGE:
  321. av_log(ctx, AV_LOG_INFO, "paramchange: ");
  322. dump_paramchange(ctx, &sd);
  323. break;
  324. case AV_PKT_DATA_H263_MB_INFO:
  325. av_log(ctx, AV_LOG_INFO, "h263 macroblock info");
  326. break;
  327. case AV_PKT_DATA_REPLAYGAIN:
  328. av_log(ctx, AV_LOG_INFO, "replaygain: ");
  329. dump_replaygain(ctx, &sd);
  330. break;
  331. case AV_PKT_DATA_DISPLAYMATRIX:
  332. av_log(ctx, AV_LOG_INFO, "displaymatrix: rotation of %.2f degrees",
  333. av_display_rotation_get((int32_t *)sd.data));
  334. break;
  335. case AV_PKT_DATA_STEREO3D:
  336. av_log(ctx, AV_LOG_INFO, "stereo3d: ");
  337. dump_stereo3d(ctx, &sd);
  338. break;
  339. case AV_PKT_DATA_AUDIO_SERVICE_TYPE:
  340. av_log(ctx, AV_LOG_INFO, "audio service type: ");
  341. dump_audioservicetype(ctx, &sd);
  342. break;
  343. case AV_PKT_DATA_QUALITY_STATS:
  344. av_log(ctx, AV_LOG_INFO, "quality factor: %d, pict_type: %c", AV_RL32(sd.data), av_get_picture_type_char(sd.data[4]));
  345. break;
  346. default:
  347. av_log(ctx, AV_LOG_WARNING,
  348. "unknown side data type %d (%d bytes)", sd.type, sd.size);
  349. break;
  350. }
  351. av_log(ctx, AV_LOG_INFO, "\n");
  352. }
  353. }
  354. /* "user interface" functions */
  355. static void dump_stream_format(AVFormatContext *ic, int i,
  356. int index, int is_output)
  357. {
  358. char buf[256];
  359. int flags = (is_output ? ic->oformat->flags : ic->iformat->flags);
  360. AVStream *st = ic->streams[i];
  361. AVDictionaryEntry *lang = av_dict_get(st->metadata, "language", NULL, 0);
  362. char *separator = ic->dump_separator;
  363. char **codec_separator = av_opt_ptr(st->codec->av_class, st->codec, "dump_separator");
  364. int use_format_separator = !*codec_separator;
  365. if (use_format_separator)
  366. *codec_separator = av_strdup(separator);
  367. avcodec_string(buf, sizeof(buf), st->codec, is_output);
  368. if (use_format_separator)
  369. av_freep(codec_separator);
  370. av_log(NULL, AV_LOG_INFO, " Stream #%d:%d", index, i);
  371. /* the pid is an important information, so we display it */
  372. /* XXX: add a generic system */
  373. if (flags & AVFMT_SHOW_IDS)
  374. av_log(NULL, AV_LOG_INFO, "[0x%x]", st->id);
  375. if (lang)
  376. av_log(NULL, AV_LOG_INFO, "(%s)", lang->value);
  377. av_log(NULL, AV_LOG_DEBUG, ", %d, %d/%d", st->codec_info_nb_frames,
  378. st->time_base.num, st->time_base.den);
  379. av_log(NULL, AV_LOG_INFO, ": %s", buf);
  380. if (st->sample_aspect_ratio.num && // default
  381. av_cmp_q(st->sample_aspect_ratio, st->codec->sample_aspect_ratio)) {
  382. AVRational display_aspect_ratio;
  383. av_reduce(&display_aspect_ratio.num, &display_aspect_ratio.den,
  384. st->codec->width * st->sample_aspect_ratio.num,
  385. st->codec->height * st->sample_aspect_ratio.den,
  386. 1024 * 1024);
  387. av_log(NULL, AV_LOG_INFO, ", SAR %d:%d DAR %d:%d",
  388. st->sample_aspect_ratio.num, st->sample_aspect_ratio.den,
  389. display_aspect_ratio.num, display_aspect_ratio.den);
  390. }
  391. if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
  392. int fps = st->avg_frame_rate.den && st->avg_frame_rate.num;
  393. int tbr = st->r_frame_rate.den && st->r_frame_rate.num;
  394. int tbn = st->time_base.den && st->time_base.num;
  395. int tbc = st->codec->time_base.den && st->codec->time_base.num;
  396. if (fps || tbr || tbn || tbc)
  397. av_log(NULL, AV_LOG_INFO, "%s", separator);
  398. if (fps)
  399. print_fps(av_q2d(st->avg_frame_rate), tbr || tbn || tbc ? "fps, " : "fps");
  400. if (tbr)
  401. print_fps(av_q2d(st->r_frame_rate), tbn || tbc ? "tbr, " : "tbr");
  402. if (tbn)
  403. print_fps(1 / av_q2d(st->time_base), tbc ? "tbn, " : "tbn");
  404. if (tbc)
  405. print_fps(1 / av_q2d(st->codec->time_base), "tbc");
  406. }
  407. if (st->disposition & AV_DISPOSITION_DEFAULT)
  408. av_log(NULL, AV_LOG_INFO, " (default)");
  409. if (st->disposition & AV_DISPOSITION_DUB)
  410. av_log(NULL, AV_LOG_INFO, " (dub)");
  411. if (st->disposition & AV_DISPOSITION_ORIGINAL)
  412. av_log(NULL, AV_LOG_INFO, " (original)");
  413. if (st->disposition & AV_DISPOSITION_COMMENT)
  414. av_log(NULL, AV_LOG_INFO, " (comment)");
  415. if (st->disposition & AV_DISPOSITION_LYRICS)
  416. av_log(NULL, AV_LOG_INFO, " (lyrics)");
  417. if (st->disposition & AV_DISPOSITION_KARAOKE)
  418. av_log(NULL, AV_LOG_INFO, " (karaoke)");
  419. if (st->disposition & AV_DISPOSITION_FORCED)
  420. av_log(NULL, AV_LOG_INFO, " (forced)");
  421. if (st->disposition & AV_DISPOSITION_HEARING_IMPAIRED)
  422. av_log(NULL, AV_LOG_INFO, " (hearing impaired)");
  423. if (st->disposition & AV_DISPOSITION_VISUAL_IMPAIRED)
  424. av_log(NULL, AV_LOG_INFO, " (visual impaired)");
  425. if (st->disposition & AV_DISPOSITION_CLEAN_EFFECTS)
  426. av_log(NULL, AV_LOG_INFO, " (clean effects)");
  427. av_log(NULL, AV_LOG_INFO, "\n");
  428. dump_metadata(NULL, st->metadata, " ");
  429. dump_sidedata(NULL, st, " ");
  430. }
  431. void av_dump_format(AVFormatContext *ic, int index,
  432. const char *url, int is_output)
  433. {
  434. int i;
  435. uint8_t *printed = ic->nb_streams ? av_mallocz(ic->nb_streams) : NULL;
  436. if (ic->nb_streams && !printed)
  437. return;
  438. av_log(NULL, AV_LOG_INFO, "%s #%d, %s, %s '%s':\n",
  439. is_output ? "Output" : "Input",
  440. index,
  441. is_output ? ic->oformat->name : ic->iformat->name,
  442. is_output ? "to" : "from", url);
  443. dump_metadata(NULL, ic->metadata, " ");
  444. if (!is_output) {
  445. av_log(NULL, AV_LOG_INFO, " Duration: ");
  446. if (ic->duration != AV_NOPTS_VALUE) {
  447. int hours, mins, secs, us;
  448. int64_t duration = ic->duration + 5000;
  449. secs = duration / AV_TIME_BASE;
  450. us = duration % AV_TIME_BASE;
  451. mins = secs / 60;
  452. secs %= 60;
  453. hours = mins / 60;
  454. mins %= 60;
  455. av_log(NULL, AV_LOG_INFO, "%02d:%02d:%02d.%02d", hours, mins, secs,
  456. (100 * us) / AV_TIME_BASE);
  457. } else {
  458. av_log(NULL, AV_LOG_INFO, "N/A");
  459. }
  460. if (ic->start_time != AV_NOPTS_VALUE) {
  461. int secs, us;
  462. av_log(NULL, AV_LOG_INFO, ", start: ");
  463. secs = ic->start_time / AV_TIME_BASE;
  464. us = llabs(ic->start_time % AV_TIME_BASE);
  465. av_log(NULL, AV_LOG_INFO, "%d.%06d",
  466. secs, (int) av_rescale(us, 1000000, AV_TIME_BASE));
  467. }
  468. av_log(NULL, AV_LOG_INFO, ", bitrate: ");
  469. if (ic->bit_rate)
  470. av_log(NULL, AV_LOG_INFO, "%d kb/s", ic->bit_rate / 1000);
  471. else
  472. av_log(NULL, AV_LOG_INFO, "N/A");
  473. av_log(NULL, AV_LOG_INFO, "\n");
  474. }
  475. for (i = 0; i < ic->nb_chapters; i++) {
  476. AVChapter *ch = ic->chapters[i];
  477. av_log(NULL, AV_LOG_INFO, " Chapter #%d:%d: ", index, i);
  478. av_log(NULL, AV_LOG_INFO,
  479. "start %f, ", ch->start * av_q2d(ch->time_base));
  480. av_log(NULL, AV_LOG_INFO,
  481. "end %f\n", ch->end * av_q2d(ch->time_base));
  482. dump_metadata(NULL, ch->metadata, " ");
  483. }
  484. if (ic->nb_programs) {
  485. int j, k, total = 0;
  486. for (j = 0; j < ic->nb_programs; j++) {
  487. AVDictionaryEntry *name = av_dict_get(ic->programs[j]->metadata,
  488. "name", NULL, 0);
  489. av_log(NULL, AV_LOG_INFO, " Program %d %s\n", ic->programs[j]->id,
  490. name ? name->value : "");
  491. dump_metadata(NULL, ic->programs[j]->metadata, " ");
  492. for (k = 0; k < ic->programs[j]->nb_stream_indexes; k++) {
  493. dump_stream_format(ic, ic->programs[j]->stream_index[k],
  494. index, is_output);
  495. printed[ic->programs[j]->stream_index[k]] = 1;
  496. }
  497. total += ic->programs[j]->nb_stream_indexes;
  498. }
  499. if (total < ic->nb_streams)
  500. av_log(NULL, AV_LOG_INFO, " No Program\n");
  501. }
  502. for (i = 0; i < ic->nb_streams; i++)
  503. if (!printed[i])
  504. dump_stream_format(ic, i, index, is_output);
  505. av_free(printed);
  506. }