[FFmpeg-cvslog] fftools/ffmpeg_enc: constify the frame passed to enc_open()
Anton Khirnov
git at videolan.org
Tue Oct 10 13:46:10 EEST 2023
ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Thu Sep 14 18:00:40 2023 +0200| [33f058f2ecede72de13c2de8267f65ff625cda09] | committer: Anton Khirnov
fftools/ffmpeg_enc: constify the frame passed to enc_open()
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=33f058f2ecede72de13c2de8267f65ff625cda09
---
fftools/ffmpeg.h | 2 +-
fftools/ffmpeg_enc.c | 7 +++----
2 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
index 15790d3e0c..0983d026cd 100644
--- a/fftools/ffmpeg.h
+++ b/fftools/ffmpeg.h
@@ -817,7 +817,7 @@ int dec_packet(InputStream *ist, const AVPacket *pkt, int no_eof);
int enc_alloc(Encoder **penc, const AVCodec *codec);
void enc_free(Encoder **penc);
-int enc_open(OutputStream *ost, AVFrame *frame);
+int enc_open(OutputStream *ost, const AVFrame *frame);
int enc_subtitle(OutputFile *of, OutputStream *ost, const AVSubtitle *sub);
int enc_frame(OutputStream *ost, AVFrame *frame);
int enc_flush(void);
diff --git a/fftools/ffmpeg_enc.c b/fftools/ffmpeg_enc.c
index abcf2deb2d..fa4539664f 100644
--- a/fftools/ffmpeg_enc.c
+++ b/fftools/ffmpeg_enc.c
@@ -165,7 +165,7 @@ static int set_encoder_id(OutputFile *of, OutputStream *ost)
return 0;
}
-int enc_open(OutputStream *ost, AVFrame *frame)
+int enc_open(OutputStream *ost, const AVFrame *frame)
{
InputStream *ist = ost->ist;
Encoder *e = ost->enc;
@@ -183,9 +183,8 @@ int enc_open(OutputStream *ost, AVFrame *frame)
av_assert0(frame || (enc->type != AVMEDIA_TYPE_VIDEO && enc->type != AVMEDIA_TYPE_AUDIO));
if (frame) {
- fd = frame_data(frame);
- if (!fd)
- return AVERROR(ENOMEM);
+ av_assert0(frame->opaque_ref);
+ fd = (FrameData*)frame->opaque_ref->data;
}
ret = set_encoder_id(output_files[ost->file_index], ost);
More information about the ffmpeg-cvslog
mailing list