Browse code

Merge remote-tracking branch 'qatar/master'

* qatar/master:
Fix 'heigth' vs. 'height' typos.
lavc/lavf: use unique private classes.
lavc: use designated initializers for av_codec_context_class

Conflicts:
libavdevice/fbdev.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>

Michael Niedermayer authored on 2011/10/06 10:42:14
Showing 7 changed files
... ...
@@ -486,13 +486,13 @@ the computed values for @var{x} and @var{y}. They are evaluated for
486 486
 each new frame.
487 487
 
488 488
 @item in_w, in_h
489
-the input width and heigth
489
+the input width and height
490 490
 
491 491
 @item iw, ih
492 492
 same as @var{in_w} and @var{in_h}
493 493
 
494 494
 @item out_w, out_h
495
-the output (cropped) width and heigth
495
+the output (cropped) width and height
496 496
 
497 497
 @item ow, oh
498 498
 same as @var{out_w} and @var{out_h}
... ...
@@ -1548,13 +1548,13 @@ the corresponding mathematical approximated values for e
1548 1548
 (euler number), pi (greek PI), phi (golden ratio)
1549 1549
 
1550 1550
 @item in_w, in_h
1551
-the input video width and heigth
1551
+the input video width and height
1552 1552
 
1553 1553
 @item iw, ih
1554 1554
 same as @var{in_w} and @var{in_h}
1555 1555
 
1556 1556
 @item out_w, out_h
1557
-the output width and heigth, that is the size of the padded area as
1557
+the output width and height, that is the size of the padded area as
1558 1558
 specified by the @var{width} and @var{height} expressions
1559 1559
 
1560 1560
 @item ow, oh
... ...
@@ -1667,13 +1667,13 @@ the corresponding mathematical approximated values for e
1667 1667
 (euler number), pi (greek PI), phi (golden ratio)
1668 1668
 
1669 1669
 @item in_w, in_h
1670
-the input width and heigth
1670
+the input width and height
1671 1671
 
1672 1672
 @item iw, ih
1673 1673
 same as @var{in_w} and @var{in_h}
1674 1674
 
1675 1675
 @item out_w, out_h
1676
-the output (cropped) width and heigth
1676
+the output (cropped) width and height
1677 1677
 
1678 1678
 @item ow, oh
1679 1679
 same as @var{out_w} and @var{out_h}
... ...
@@ -2318,7 +2318,7 @@ alpha specifier. The default value is "black".
2318 2318
 
2319 2319
 @item frame_size
2320 2320
 Specify the size of the sourced video, it may be a string of the form
2321
-@var{width}x@var{heigth}, or the name of a size abbreviation. The
2321
+@var{width}x@var{height}, or the name of a size abbreviation. The
2322 2322
 default value is "320x240".
2323 2323
 
2324 2324
 @item frame_rate
... ...
@@ -1463,7 +1463,7 @@ static const AVOption options[] = {
1463 1463
 };
1464 1464
 
1465 1465
 static const AVClass ac3_decoder_class = {
1466
-    .class_name = "(E-)AC3 decoder",
1466
+    .class_name = "AC3 decoder",
1467 1467
     .item_name  = av_default_item_name,
1468 1468
     .option     = options,
1469 1469
     .version    = LIBAVUTIL_VERSION_INT,
... ...
@@ -1485,6 +1485,12 @@ AVCodec ff_ac3_decoder = {
1485 1485
 };
1486 1486
 
1487 1487
 #if CONFIG_EAC3_DECODER
1488
+static const AVClass eac3_decoder_class = {
1489
+    .class_name = "E-AC3 decoder",
1490
+    .item_name  = av_default_item_name,
1491
+    .option     = options,
1492
+    .version    = LIBAVUTIL_VERSION_INT,
1493
+};
1488 1494
 AVCodec ff_eac3_decoder = {
1489 1495
     .name = "eac3",
1490 1496
     .type = AVMEDIA_TYPE_AUDIO,
... ...
@@ -1497,6 +1503,6 @@ AVCodec ff_eac3_decoder = {
1497 1497
     .sample_fmts = (const enum AVSampleFormat[]) {
1498 1498
         AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_NONE
1499 1499
     },
1500
-    .priv_class = &ac3_decoder_class,
1500
+    .priv_class = &eac3_decoder_class,
1501 1501
 };
1502 1502
 #endif
... ...
@@ -122,7 +122,7 @@ static int dnxhd_decode_header(DNXHDContext *ctx, const uint8_t *buf, int buf_si
122 122
     ctx->height = AV_RB16(buf + 0x18);
123 123
     ctx->width  = AV_RB16(buf + 0x1a);
124 124
 
125
-    av_dlog(ctx->avctx, "width %d, heigth %d\n", ctx->width, ctx->height);
125
+    av_dlog(ctx->avctx, "width %d, height %d\n", ctx->width, ctx->height);
126 126
 
127 127
     if (buf[0x21] & 0x40) {
128 128
         ctx->avctx->pix_fmt = PIX_FMT_YUV422P10;
... ...
@@ -517,7 +517,14 @@ static const AVOption options[]={
517 517
 #undef D
518 518
 #undef DEFAULT
519 519
 
520
-static const AVClass av_codec_context_class = { "AVCodecContext", context_to_name, options, LIBAVUTIL_VERSION_INT, OFFSET(log_level_offset), .opt_find = opt_find};
520
+static const AVClass av_codec_context_class = {
521
+    .class_name              = "AVCodecContext",
522
+    .item_name               = context_to_name,
523
+    .option                  = options,
524
+    .version                 = LIBAVUTIL_VERSION_INT,
525
+    .log_level_offset_offset = OFFSET(log_level_offset),
526
+    .opt_find                = opt_find,
527
+};
521 528
 
522 529
 void avcodec_get_context_defaults2(AVCodecContext *s, enum AVMediaType codec_type){
523 530
     int flags=0;
... ...
@@ -84,7 +84,7 @@ typedef struct {
84 84
     int64_t time_frame;      ///< time for the next frame to output (in 1/1000000 units)
85 85
 
86 86
     int fd;                  ///< framebuffer device file descriptor
87
-    int width, heigth;       ///< assumed frame resolution
87
+    int width, height;       ///< assumed frame resolution
88 88
     int frame_linesize;      ///< linesize of the output frame, it is assumed to be constant
89 89
     int bytes_per_pixel;
90 90
 
... ...
@@ -147,10 +147,10 @@ av_cold static int fbdev_read_header(AVFormatContext *avctx,
147 147
     }
148 148
 
149 149
     fbdev->width           = fbdev->varinfo.xres;
150
-    fbdev->heigth          = fbdev->varinfo.yres;
150
+    fbdev->height          = fbdev->varinfo.yres;
151 151
     fbdev->bytes_per_pixel = (fbdev->varinfo.bits_per_pixel + 7) >> 3;
152 152
     fbdev->frame_linesize  = fbdev->width * fbdev->bytes_per_pixel;
153
-    fbdev->frame_size      = fbdev->frame_linesize * fbdev->heigth;
153
+    fbdev->frame_size      = fbdev->frame_linesize * fbdev->height;
154 154
     fbdev->time_frame      = AV_NOPTS_VALUE;
155 155
     fbdev->data = mmap(NULL, fbdev->fixinfo.smem_len, PROT_READ, MAP_SHARED, fbdev->fd, 0);
156 156
     if (fbdev->data == MAP_FAILED) {
... ...
@@ -162,15 +162,15 @@ av_cold static int fbdev_read_header(AVFormatContext *avctx,
162 162
     st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
163 163
     st->codec->codec_id   = CODEC_ID_RAWVIDEO;
164 164
     st->codec->width      = fbdev->width;
165
-    st->codec->height     = fbdev->heigth;
165
+    st->codec->height     = fbdev->height;
166 166
     st->codec->pix_fmt    = pix_fmt;
167 167
     st->codec->time_base  = (AVRational){fbdev->framerate_q.den, fbdev->framerate_q.num};
168 168
     st->codec->bit_rate   =
169
-        fbdev->width * fbdev->heigth * fbdev->bytes_per_pixel * av_q2d(fbdev->framerate_q) * 8;
169
+        fbdev->width * fbdev->height * fbdev->bytes_per_pixel * av_q2d(fbdev->framerate_q) * 8;
170 170
 
171 171
     av_log(avctx, AV_LOG_INFO,
172 172
            "w:%d h:%d bpp:%d pixfmt:%s fps:%d/%d bit_rate:%d\n",
173
-           fbdev->width, fbdev->heigth, fbdev->varinfo.bits_per_pixel,
173
+           fbdev->width, fbdev->height, fbdev->varinfo.bits_per_pixel,
174 174
            av_pix_fmt_descriptors[pix_fmt].name,
175 175
            fbdev->framerate_q.num, fbdev->framerate_q.den,
176 176
            st->codec->bit_rate);
... ...
@@ -225,7 +225,7 @@ static int fbdev_read_packet(AVFormatContext *avctx, AVPacket *pkt)
225 225
                         fbdev->varinfo.yoffset * fbdev->fixinfo.line_length;
226 226
     pout = pkt->data;
227 227
 
228
-    for (i = 0; i < fbdev->heigth; i++) {
228
+    for (i = 0; i < fbdev->height; i++) {
229 229
         memcpy(pout, pin, fbdev->frame_linesize);
230 230
         pin  += fbdev->fixinfo.line_length;
231 231
         pout += fbdev->frame_linesize;
... ...
@@ -469,15 +469,14 @@ static const AVOption options[] = {
469 469
     { NULL },
470 470
 };
471 471
 
472
+/* input */
473
+#if CONFIG_IMAGE2_DEMUXER
472 474
 static const AVClass img2_class = {
473 475
     .class_name = "image2 demuxer",
474 476
     .item_name  = av_default_item_name,
475 477
     .option     = options,
476 478
     .version    = LIBAVUTIL_VERSION_INT,
477 479
 };
478
-
479
-/* input */
480
-#if CONFIG_IMAGE2_DEMUXER
481 480
 AVInputFormat ff_image2_demuxer = {
482 481
     .name           = "image2",
483 482
     .long_name      = NULL_IF_CONFIG_SMALL("image2 sequence"),
... ...
@@ -490,13 +489,19 @@ AVInputFormat ff_image2_demuxer = {
490 490
 };
491 491
 #endif
492 492
 #if CONFIG_IMAGE2PIPE_DEMUXER
493
+static const AVClass img2pipe_class = {
494
+    .class_name = "image2pipe demuxer",
495
+    .item_name  = av_default_item_name,
496
+    .option     = options,
497
+    .version    = LIBAVUTIL_VERSION_INT,
498
+};
493 499
 AVInputFormat ff_image2pipe_demuxer = {
494 500
     .name           = "image2pipe",
495 501
     .long_name      = NULL_IF_CONFIG_SMALL("piped image2 sequence"),
496 502
     .priv_data_size = sizeof(VideoData),
497 503
     .read_header    = read_header,
498 504
     .read_packet    = read_packet,
499
-    .priv_class     = &img2_class,
505
+    .priv_class     = &img2pipe_class,
500 506
 };
501 507
 #endif
502 508
 
... ...
@@ -48,11 +48,12 @@ static const AVOption options[] = {
48 48
     { NULL },
49 49
 };
50 50
 
51
-static const AVClass mov_muxer_class = {
52
-    .class_name = "MOV/3GP/MP4/3G2 muxer",
53
-    .item_name  = av_default_item_name,
54
-    .option     = options,
55
-    .version    = LIBAVUTIL_VERSION_INT,
51
+#define MOV_CLASS(flavor)\
52
+static const AVClass flavor ## _muxer_class = {\
53
+    .class_name = #flavor " muxer",\
54
+    .item_name  = av_default_item_name,\
55
+    .option     = options,\
56
+    .version    = LIBAVUTIL_VERSION_INT,\
56 57
 };
57 58
 
58 59
 //FIXME support 64 bit variant with wide placeholders
... ...
@@ -2351,6 +2352,7 @@ static int mov_write_trailer(AVFormatContext *s)
2351 2351
 }
2352 2352
 
2353 2353
 #if CONFIG_MOV_MUXER
2354
+MOV_CLASS(mov)
2354 2355
 AVOutputFormat ff_mov_muxer = {
2355 2356
     .name              = "mov",
2356 2357
     .long_name         = NULL_IF_CONFIG_SMALL("MOV format"),
... ...
@@ -2371,6 +2373,7 @@ AVOutputFormat ff_mov_muxer = {
2371 2371
 };
2372 2372
 #endif
2373 2373
 #if CONFIG_TGP_MUXER
2374
+MOV_CLASS(tgp)
2374 2375
 AVOutputFormat ff_tgp_muxer = {
2375 2376
     .name              = "3gp",
2376 2377
     .long_name         = NULL_IF_CONFIG_SMALL("3GP format"),
... ...
@@ -2383,10 +2386,11 @@ AVOutputFormat ff_tgp_muxer = {
2383 2383
     .write_trailer     = mov_write_trailer,
2384 2384
     .flags = AVFMT_GLOBALHEADER,
2385 2385
     .codec_tag = (const AVCodecTag* const []){codec_3gp_tags, 0},
2386
-    .priv_class = &mov_muxer_class,
2386
+    .priv_class = &tgp_muxer_class,
2387 2387
 };
2388 2388
 #endif
2389 2389
 #if CONFIG_MP4_MUXER
2390
+MOV_CLASS(mp4)
2390 2391
 AVOutputFormat ff_mp4_muxer = {
2391 2392
     .name              = "mp4",
2392 2393
     .long_name         = NULL_IF_CONFIG_SMALL("MP4 format"),
... ...
@@ -2404,10 +2408,11 @@ AVOutputFormat ff_mp4_muxer = {
2404 2404
     .write_trailer     = mov_write_trailer,
2405 2405
     .flags = AVFMT_GLOBALHEADER,
2406 2406
     .codec_tag = (const AVCodecTag* const []){ff_mp4_obj_type, 0},
2407
-    .priv_class = &mov_muxer_class,
2407
+    .priv_class = &mp4_muxer_class,
2408 2408
 };
2409 2409
 #endif
2410 2410
 #if CONFIG_PSP_MUXER
2411
+MOV_CLASS(psp)
2411 2412
 AVOutputFormat ff_psp_muxer = {
2412 2413
     .name              = "psp",
2413 2414
     .long_name         = NULL_IF_CONFIG_SMALL("PSP MP4 format"),
... ...
@@ -2424,10 +2429,11 @@ AVOutputFormat ff_psp_muxer = {
2424 2424
     .write_trailer     = mov_write_trailer,
2425 2425
     .flags = AVFMT_GLOBALHEADER,
2426 2426
     .codec_tag = (const AVCodecTag* const []){ff_mp4_obj_type, 0},
2427
-    .priv_class = &mov_muxer_class,
2427
+    .priv_class = &psp_muxer_class,
2428 2428
 };
2429 2429
 #endif
2430 2430
 #if CONFIG_TG2_MUXER
2431
+MOV_CLASS(tg2)
2431 2432
 AVOutputFormat ff_tg2_muxer = {
2432 2433
     .name              = "3g2",
2433 2434
     .long_name         = NULL_IF_CONFIG_SMALL("3GP2 format"),
... ...
@@ -2440,10 +2446,11 @@ AVOutputFormat ff_tg2_muxer = {
2440 2440
     .write_trailer     = mov_write_trailer,
2441 2441
     .flags = AVFMT_GLOBALHEADER,
2442 2442
     .codec_tag = (const AVCodecTag* const []){codec_3gp_tags, 0},
2443
-    .priv_class = &mov_muxer_class,
2443
+    .priv_class = &tg2_muxer_class,
2444 2444
 };
2445 2445
 #endif
2446 2446
 #if CONFIG_IPOD_MUXER
2447
+MOV_CLASS(ipod)
2447 2448
 AVOutputFormat ff_ipod_muxer = {
2448 2449
     .name              = "ipod",
2449 2450
     .long_name         = NULL_IF_CONFIG_SMALL("iPod H.264 MP4 format"),
... ...
@@ -2457,6 +2464,6 @@ AVOutputFormat ff_ipod_muxer = {
2457 2457
     .write_trailer     = mov_write_trailer,
2458 2458
     .flags = AVFMT_GLOBALHEADER,
2459 2459
     .codec_tag = (const AVCodecTag* const []){codec_ipod_tags, 0},
2460
-    .priv_class = &mov_muxer_class,
2460
+    .priv_class = &ipod_muxer_class,
2461 2461
 };
2462 2462
 #endif