]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/utvideoenc.c
avcodec: Remove deprecated AVCodecContext.coded_frame
[ffmpeg] / libavcodec / utvideoenc.c
index 5c87eb50ac96986a221f1998c58c8e23657bdfe2..670e48aa9f9c9f78345fdd110b7e9c98dc4dbaa9 100644 (file)
@@ -43,12 +43,6 @@ typedef struct HuffEntry {
     uint32_t code;
 } HuffEntry;
 
-#if FF_API_PRIVATE_OPT
-static const int ut_pred_order[5] = {
-    PRED_LEFT, PRED_MEDIAN, PRED_MEDIAN, PRED_NONE, PRED_GRADIENT
-};
-#endif
-
 /* Compare huffman tree nodes */
 static int ut_huff_cmp_len(const void *a, const void *b)
 {
@@ -140,28 +134,6 @@ static av_cold int utvideo_encode_init(AVCodecContext *avctx)
     ff_bswapdsp_init(&c->bdsp);
     ff_llvidencdsp_init(&c->llvidencdsp);
 
-#if FF_API_PRIVATE_OPT
-FF_DISABLE_DEPRECATION_WARNINGS
-    /* Check the prediction method, and error out if unsupported */
-    if (avctx->prediction_method < 0 || avctx->prediction_method > 4) {
-        av_log(avctx, AV_LOG_WARNING,
-               "Prediction method %d is not supported in Ut Video.\n",
-               avctx->prediction_method);
-        return AVERROR_OPTION_NOT_FOUND;
-    }
-
-    if (avctx->prediction_method == FF_PRED_PLANE) {
-        av_log(avctx, AV_LOG_ERROR,
-               "Plane prediction is not supported in Ut Video.\n");
-        return AVERROR_OPTION_NOT_FOUND;
-    }
-
-    /* Convert from libavcodec prediction type to Ut Video's */
-    if (avctx->prediction_method)
-        c->frame_pred = ut_pred_order[avctx->prediction_method];
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
-
     if (c->frame_pred == PRED_GRADIENT) {
         av_log(avctx, AV_LOG_ERROR, "Gradient prediction is not supported.\n");
         return AVERROR_OPTION_NOT_FOUND;
@@ -398,13 +370,11 @@ static int write_huff_codes(uint8_t *src, uint8_t *dst, int dst_size,
     if (count)
         put_bits(&pb, 32 - count, 0);
 
-    /* Get the amount of bits written */
-    count = put_bits_count(&pb);
-
     /* Flush the rest with zeroes */
     flush_put_bits(&pb);
 
-    return count;
+    /* Return the amount of bytes written */
+    return put_bytes_output(&pb);
 }
 
 static int encode_plane(AVCodecContext *avctx, uint8_t *src,
@@ -512,11 +482,11 @@ static int encode_plane(AVCodecContext *avctx, uint8_t *src,
 
         /*
          * Write the huffman codes to a buffer,
-         * get the offset in bits and convert to bytes.
+         * get the offset in bytes.
          */
         offset += write_huff_codes(dst + sstart * width, c->slice_bits,
                                    width * height + 4, width,
-                                   send - sstart, he) >> 3;
+                                   send - sstart, he);
 
         slice_len = offset - slice_len;
 
@@ -651,15 +621,8 @@ static int utvideo_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
      * At least currently Ut Video is IDR only.
      * Set flags accordingly.
      */
-#if FF_API_CODED_FRAME
-FF_DISABLE_DEPRECATION_WARNINGS
-    avctx->coded_frame->key_frame = 1;
-    avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I;
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
-
-    pkt->size   = bytestream2_tell_p(&pb);
     pkt->flags |= AV_PKT_FLAG_KEY;
+    pkt->size   = bytestream2_tell_p(&pb);
 
     /* Packet should be done */
     *got_packet = 1;