History

tools: do not use av_pix_fmt_descriptors directly.

Anton Khirnov committed 14 years ago

Commit b7f10101 parent d2fcb353 files · +16 −10Browse files

Unified · Split

3 files
  1. avprobe.c +3 −3
  2. cmdutils.c +11 −5
  3. tools/graph2dot.c +2 −2
avprobe.c+3−3
@@ -584,6 +584,7 @@ static void show_stream(AVFormatContext *fmt_ctx, int stream_idx) · 583 unmodified lines
584 const char *profile;584 const char *profile;
585 char val_str[128];585 char val_str[128];
586 AVRational display_aspect_ratio;586 AVRational display_aspect_ratio;
587 const AVPixFmtDescriptor *desc;
587 588
588 probe_object_header("stream");589 probe_object_header("stream");
589 590
@@ -629,9 +630,8 @@ static void show_stream(AVFormatContext *fmt_ctx, int stream_idx) · 39 unmodified lines
629 rational_string(val_str, sizeof(val_str), ":",630 rational_string(val_str, sizeof(val_str), ":",
630 &display_aspect_ratio));631 &display_aspect_ratio));
631 }632 }
632 probe_str("pix_fmt",633 desc = av_pix_fmt_desc_get(dec_ctx->pix_fmt);
633 dec_ctx->pix_fmt != AV_PIX_FMT_NONE ?634 probe_str("pix_fmt", desc ? desc->name : "unknown");
634 av_pix_fmt_descriptors[dec_ctx->pix_fmt].name : "unknown");
635 probe_int("level", dec_ctx->level);635 probe_int("level", dec_ctx->level);
636 break;636 break;
637 637
cmdutils.c+11−5
@@ -866,7 +866,7 @@ int show_filters(void *optctx, const char *opt, const char *arg) · 865 unmodified lines
866 866
867int show_pix_fmts(void *optctx, const char *opt, const char *arg)867int show_pix_fmts(void *optctx, const char *opt, const char *arg)
868{868{
869 enum AVPixelFormat pix_fmt;869 const AVPixFmtDescriptor *pix_desc = NULL;
870 870
871 printf("Pixel formats:\n"871 printf("Pixel formats:\n"
872 "I.... = Supported Input format for conversion\n"872 "I.... = Supported Input format for conversion\n"
@@ -882,8 +882,8 @@ int show_pix_fmts(void *optctx, const char *opt, const char *arg) · 9 unmodified lines
882# define sws_isSupportedOutput(x) 0882# define sws_isSupportedOutput(x) 0
883#endif883#endif
884 884
885 for (pix_fmt = 0; pix_fmt < AV_PIX_FMT_NB; pix_fmt++) {885 while ((pix_desc = av_pix_fmt_desc_next(pix_desc))) {
886 const AVPixFmtDescriptor *pix_desc = &av_pix_fmt_descriptors[pix_fmt];886 enum AVPixelFormat pix_fmt = av_pix_fmt_desc_get_id(pix_desc);
887 printf("%c%c%c%c%c %-16s %d %2d\n",887 printf("%c%c%c%c%c %-16s %d %2d\n",
888 sws_isSupportedInput (pix_fmt) ? 'I' : '.',888 sws_isSupportedInput (pix_fmt) ? 'I' : '.',
889 sws_isSupportedOutput(pix_fmt) ? 'O' : '.',889 sws_isSupportedOutput(pix_fmt) ? 'O' : '.',
@@ -1282,13 +1282,19 @@ void *grow_array(void *array, int elem_size, int *size, int new_size) · 392 unmodified lines
1282 1282
1283static int alloc_buffer(FrameBuffer **pool, AVCodecContext *s, FrameBuffer **pbuf)1283static int alloc_buffer(FrameBuffer **pool, AVCodecContext *s, FrameBuffer **pbuf)
1284{1284{
1285 FrameBuffer *buf = av_mallocz(sizeof(*buf));1285 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->pix_fmt);
1286 FrameBuffer *buf;
1286 int i, ret;1287 int i, ret;
1287 const int pixel_size = av_pix_fmt_descriptors[s->pix_fmt].comp[0].step_minus1+1;1288 int pixel_size;
1288 int h_chroma_shift, v_chroma_shift;1289 int h_chroma_shift, v_chroma_shift;
1289 int edge = 32; // XXX should be avcodec_get_edge_width(), but that fails on svq11290 int edge = 32; // XXX should be avcodec_get_edge_width(), but that fails on svq1
1290 int w = s->width, h = s->height;1291 int w = s->width, h = s->height;
1291 1292
1293 if (!desc)
1294 return AVERROR(EINVAL);
1295 pixel_size = desc->comp[0].step_minus1 + 1;
1296
1297 buf = av_mallocz(sizeof(*buf));
1292 if (!buf)1298 if (!buf)
1293 return AVERROR(ENOMEM);1299 return AVERROR(ENOMEM);
1294 1300
tools/graph2dot.c+2−2
@@ -80,10 +80,10 @@ static void print_digraph(FILE *outfile, AVFilterGraph *graph) · 79 unmodified lines
80 fprintf(outfile, "\"%s\" -> \"%s\"",80 fprintf(outfile, "\"%s\" -> \"%s\"",
81 filter_ctx_label, dst_filter_ctx_label);81 filter_ctx_label, dst_filter_ctx_label);
82 if (link->type == AVMEDIA_TYPE_VIDEO) {82 if (link->type == AVMEDIA_TYPE_VIDEO) {
83 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(link->format);
83 fprintf(outfile,84 fprintf(outfile,
84 " [ label= \"fmt:%s w:%d h:%d tb:%d/%d\" ]",85 " [ label= \"fmt:%s w:%d h:%d tb:%d/%d\" ]",
85 av_pix_fmt_descriptors[link->format].name,86 desc->name, link->w, link->h, link->time_base.num,
86 link->w, link->h, link->time_base.num,
87 link->time_base.den);87 link->time_base.den);
88 } else if (link->type == AVMEDIA_TYPE_AUDIO) {88 } else if (link->type == AVMEDIA_TYPE_AUDIO) {
89 char buf[255];89 char buf[255];

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t