]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
updated 'AVCodec' to 'const AVCodec'
authoralingherghescu <alin_gherghescu@yahoo.com>
Wed, 22 Mar 2023 04:51:42 +0000 (21:51 -0700)
committerFlole998 <Flole998@users.noreply.github.com>
Sat, 1 Apr 2023 13:31:53 +0000 (15:31 +0200)
- updated 'AVCodec' to 'const AVCodec'
- "avctx->refcounted_frames = 1;" deprecated (not required with: avcodec_receive_frame())

src/transcoding/codec.h
src/transcoding/codec/codec.c
src/transcoding/codec/internals.h
src/transcoding/codec/profile.c
src/transcoding/codec/profile_video_class.c
src/transcoding/transcode/context.c
src/transcoding/transcode/internals.h
src/transcoding/transcode/stream.c

index c274c40ba210fb479213c409998f0b170bba4216..dd41c84f8ed594bdd11887738d7f88676103d2fb 100644 (file)
@@ -59,7 +59,7 @@ struct tvh_codec {
     const char *name;
     size_t size;
     const codec_profile_class_t *idclass;
-    AVCodec *codec;
+    const AVCodec *codec;
     const AVProfile *profiles;
     int (*profile_init)(TVHCodecProfile *, htsmsg_t *conf);
     void (*profile_destroy)(TVHCodecProfile *);
@@ -114,7 +114,7 @@ tvh_codec_profile_get_name(TVHCodecProfile *self);
 const char *
 tvh_codec_profile_get_title(TVHCodecProfile *self);
 
-AVCodec *
+const AVCodec *
 tvh_codec_profile_get_avcodec(TVHCodecProfile *self);
 
 
index 93885d9a6558261198bfd19d59083508a11a19d0..631d362073526dbd96c48fc2ba57a19b046bd5be 100644 (file)
@@ -79,21 +79,21 @@ extern TVHCodec tvh_codec_omx_h264;
 /* AVCodec ================================================================== */
 
 static enum AVMediaType
-codec_get_type(AVCodec *self)
+codec_get_type(const AVCodec *self)
 {
     return self->type;
 }
 
 
 static const char *
-codec_get_type_string(AVCodec *self)
+codec_get_type_string(const AVCodec *self)
 {
     return av_get_media_type_string(self->type);
 }
 
 
 const char *
-codec_get_title(AVCodec *self)
+codec_get_title(const AVCodec *self)
 {
     static __thread char codec_title[TVH_TITLE_LEN];
 
@@ -113,7 +113,7 @@ codec_get_title(AVCodec *self)
 /* TVHCodec ================================================================= */
 
 static void
-tvh_codec_video_init(TVHVideoCodec *self, AVCodec *codec)
+tvh_codec_video_init(TVHVideoCodec *self, const AVCodec *codec)
 {
     if (!self->pix_fmts) {
         self->pix_fmts = codec->pix_fmts;
@@ -121,7 +121,7 @@ tvh_codec_video_init(TVHVideoCodec *self, AVCodec *codec)
 }
 
 static void
-tvh_codec_audio_init(TVHAudioCodec *self, AVCodec *codec)
+tvh_codec_audio_init(TVHAudioCodec *self, const AVCodec *codec)
 {
     static int default_sample_rates[] = {
         44100, 48000, 96000, 192000, 0
@@ -142,7 +142,7 @@ tvh_codec_audio_init(TVHAudioCodec *self, AVCodec *codec)
 
 
 static void
-tvh_codec_init(TVHCodec *self, AVCodec *codec)
+tvh_codec_init(TVHCodec *self, const AVCodec *codec)
 {
     if (!self->profiles) {
         self->profiles = codec->profiles;
@@ -164,7 +164,7 @@ static void
 tvh_codec_register(TVHCodec *self)
 {
     static const size_t min_size = sizeof(TVHCodecProfile);
-    AVCodec *codec = NULL;
+    const AVCodec *codec = NULL;
 
     if (tvh_str_default(self->name, NULL) == NULL ||
         self->size < min_size || !self->idclass) {
@@ -221,7 +221,7 @@ tvh_codec_get_type_string(TVHCodec *self)
 }
 
 
-AVCodec *
+const AVCodec *
 tvh_codec_get_codec(TVHCodec *self)
 {
     return self->codec;
index 5e79c3fc1b3cab9430cc7f14e2f21f8785f4bd0b..f7a7ac96ce052c13273740c70ae0f9d539cfa8cd 100644 (file)
@@ -132,7 +132,7 @@ codec_profile_class_profile_get_opts(void *obj, uint32_t opts);
 /* AVCodec ================================================================== */
 
 const char *
-codec_get_title(AVCodec *self);
+codec_get_title(const AVCodec *self);
 
 
 /* TVHCodec ================================================================= */
@@ -143,7 +143,7 @@ tvh_codec_get_type(TVHCodec *self);
 const char *
 tvh_codec_get_type_string(TVHCodec *self);
 
-AVCodec *
+const AVCodec *
 tvh_codec_get_codec(TVHCodec *self);
 
 int
index 202e17a7dbff189e9817ba42d2776454928c4997..fd051463674a4edad2c0b988d7fe0df577cada0d 100644 (file)
@@ -197,7 +197,7 @@ tvh_codec_profile_get_title(TVHCodecProfile *self)
 }
 
 
-AVCodec *
+const AVCodec *
 tvh_codec_profile_get_avcodec(TVHCodecProfile *self)
 {
     TVHCodec *codec = tvh_codec_profile_get_codec(self);
@@ -211,7 +211,7 @@ tvh_codec_profile_is_copy(TVHCodecProfile *self, tvh_ssc_t *ssc)
 {
     const idclass_t *idclass = NULL;
     const codec_profile_class_t *codec_profile_class = NULL;
-    AVCodec *avcodec = NULL;
+    const AVCodec *avcodec = NULL;
     tvh_sct_t out_type = SCT_UNKNOWN;
 
 
index c5ac19f05a64e2f4cf94151716d1d762371055f6..35bd9353a3e5d3b5be44d21f4e3882c4e111064b 100644 (file)
@@ -140,7 +140,7 @@ static int
 codec_profile_video_class_deinterlace_set(void *obj, const void *val)
 {
     TVHVideoCodecProfile *self = (TVHVideoCodecProfile *)obj;
-    AVCodec *avcodec = NULL;
+    const AVCodec *avcodec = NULL;
 
     if (self &&
         (avcodec = tvh_codec_profile_get_avcodec((TVHCodecProfile *)self))) {
index 8e4534095d37f5281f18fff39b5088e795ea60e4..d951a92464b87cbcdad650710831f703a40525fa 100644 (file)
@@ -183,13 +183,12 @@ _context_wrap(TVHContext *self, AVPacket *avpkt, th_pkt_t *pkt)
 // creation
 
 static AVCodecContext *
-tvh_context_alloc_avctx(TVHContext *context, AVCodec *avcodec)
+tvh_context_alloc_avctx(TVHContext *context, const AVCodec *avcodec)
 {
     AVCodecContext *avctx = NULL;
 
     if ((avctx = avcodec_alloc_context3(avcodec))) {
         avctx->strict_std_compliance = FF_COMPLIANCE_EXPERIMENTAL;
-        avctx->refcounted_frames = 1;
         avctx->opaque = context;
     }
     return avctx;
@@ -197,7 +196,7 @@ tvh_context_alloc_avctx(TVHContext *context, AVCodec *avcodec)
 
 
 static int
-tvh_context_setup(TVHContext *self, AVCodec *iavcodec, AVCodec *oavcodec)
+tvh_context_setup(TVHContext *self, const AVCodec *iavcodec, const AVCodec *oavcodec)
 {
     enum AVMediaType media_type = iavcodec->type;
     const char *media_type_name = av_get_media_type_string(media_type);
@@ -684,7 +683,7 @@ tvh_context_handle(TVHContext *self, th_pkt_t *pkt)
 
 TVHContext *
 tvh_context_create(TVHStream *stream, TVHCodecProfile *profile,
-                   AVCodec *iavcodec, AVCodec *oavcodec, pktbuf_t *input_gh)
+                   const AVCodec *iavcodec, const AVCodec *oavcodec, pktbuf_t *input_gh)
 {
     TVHContext *self = NULL;
 
index 65dd188ab8d621e92b1c0e5ef5e32b721b11de76..e0776cec40b06a98e5dfd08fee0128ea4437d0c5 100644 (file)
@@ -191,7 +191,7 @@ tvh_context_deliver(TVHContext *self, th_pkt_t *pkt);
 
 TVHContext *
 tvh_context_create(TVHStream *stream, TVHCodecProfile *profile,
-                   AVCodec *iavcodec, AVCodec *oavcodec, pktbuf_t *input_gh);
+                   const AVCodec *iavcodec, const AVCodec *oavcodec, pktbuf_t *input_gh);
 
 void
 tvh_context_destroy(TVHContext *self);
index 0435404d6b27f8925af1253c77cd6faebe8135f9..b3117e3bcb9c05ed24252c82d99ac8d1a5148fdd 100644 (file)
@@ -56,7 +56,7 @@ static int
 tvh_stream_setup(TVHStream *self, TVHCodecProfile *profile, tvh_ssc_t *ssc)
 {
     enum AVCodecID icodec_id = streaming_component_type2codec_id(ssc->es_type);
-    AVCodec *icodec = NULL, *ocodec = NULL;
+    const AVCodec *icodec = NULL, *ocodec = NULL;
 
     if (icodec_id == AV_CODEC_ID_NONE) {
         tvh_stream_log(self, LOG_ERR, "unknown decoder id for '%s'",