diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index f993dbcff96cff9fc4494b70dda5f87517a7e6fc..3d99518990b269c9fc40fe6b12ac728ff15001f5 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -1311,7 +1311,7 @@ const AVClass *avformat_get_class(void);
  *
  * @return newly created stream or NULL on error.
  */
-AVStream *avformat_new_stream(AVFormatContext *s, AVCodec *c);
+AVStream *avformat_new_stream(AVFormatContext *s, const AVCodec *c);
 
 AVProgram *av_new_program(AVFormatContext *s, int id);
 
diff --git a/libavformat/utils.c b/libavformat/utils.c
index cd4161ff82f8dabadf54c905c2755abcbc429d54..fb5742b815af0f89d9ed020cc10888d10047532b 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -3101,7 +3101,7 @@ AVStream *av_new_stream(AVFormatContext *s, int id)
 }
 #endif
 
-AVStream *avformat_new_stream(AVFormatContext *s, AVCodec *c)
+AVStream *avformat_new_stream(AVFormatContext *s, const AVCodec *c)
 {
     AVStream *st;
     int i;