Browse code

pgssubdec: stop using deprecated avcodec_set_dimensions

Anton Khirnov authored on 2013/10/27 18:02:26
Showing 1 changed files
... ...
@@ -27,6 +27,8 @@
27 27
 #include "avcodec.h"
28 28
 #include "dsputil.h"
29 29
 #include "bytestream.h"
30
+#include "internal.h"
31
+
30 32
 #include "libavutil/colorspace.h"
31 33
 #include "libavutil/imgutils.h"
32 34
 
... ...
@@ -272,13 +274,13 @@ static void parse_palette_segment(AVCodecContext *avctx,
272 272
  * @todo TODO: Implement cropping
273 273
  * @todo TODO: Implement forcing of subtitles
274 274
  */
275
-static void parse_presentation_segment(AVCodecContext *avctx,
276
-                                       const uint8_t *buf, int buf_size,
277
-                                       int64_t pts)
275
+static int parse_presentation_segment(AVCodecContext *avctx,
276
+                                      const uint8_t *buf, int buf_size,
277
+                                      int64_t pts)
278 278
 {
279 279
     PGSSubContext *ctx = avctx->priv_data;
280 280
 
281
-    int x, y;
281
+    int x, y, ret;
282 282
 
283 283
     int w = bytestream_get_be16(&buf);
284 284
     int h = bytestream_get_be16(&buf);
... ...
@@ -287,8 +289,9 @@ static void parse_presentation_segment(AVCodecContext *avctx,
287 287
 
288 288
     av_dlog(avctx, "Video Dimensions %dx%d\n",
289 289
             w, h);
290
-    if (av_image_check_size(w, h, 0, avctx) >= 0)
291
-        avcodec_set_dimensions(avctx, w, h);
290
+    ret = ff_set_dimensions(avctx, w, h);
291
+    if (ret < 0)
292
+        return ret;
292 293
 
293 294
     /* Skip 1 bytes of unknown, frame rate? */
294 295
     buf++;
... ...
@@ -306,7 +309,7 @@ static void parse_presentation_segment(AVCodecContext *avctx,
306 306
     ctx->presentation.object_number = bytestream_get_byte(&buf);
307 307
     ctx->presentation.composition_flag = 0;
308 308
     if (!ctx->presentation.object_number)
309
-        return;
309
+        return 0;
310 310
 
311 311
     /*
312 312
      * Skip 3 bytes of unknown:
... ...
@@ -332,6 +335,8 @@ static void parse_presentation_segment(AVCodecContext *avctx,
332 332
     /* Fill in dimensions */
333 333
     ctx->presentation.x = x;
334 334
     ctx->presentation.y = y;
335
+
336
+    return 0;
335 337
 }
336 338
 
337 339
 /**
... ...
@@ -413,7 +418,7 @@ static int decode(AVCodecContext *avctx, void *data, int *data_size,
413 413
     const uint8_t *buf_end;
414 414
     uint8_t       segment_type;
415 415
     int           segment_length;
416
-    int i;
416
+    int i, ret;
417 417
 
418 418
     av_dlog(avctx, "PGS sub packet:\n");
419 419
 
... ...
@@ -452,7 +457,9 @@ static int decode(AVCodecContext *avctx, void *data, int *data_size,
452 452
             parse_picture_segment(avctx, buf, segment_length);
453 453
             break;
454 454
         case PRESENTATION_SEGMENT:
455
-            parse_presentation_segment(avctx, buf, segment_length, avpkt->pts);
455
+            ret = parse_presentation_segment(avctx, buf, segment_length, avpkt->pts);
456
+            if (ret < 0)
457
+                return ret;
456 458
             break;
457 459
         case WINDOW_SEGMENT:
458 460
             /*