Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion libavcodec/av1dec.c
Original file line number Diff line number Diff line change
Expand Up @@ -1024,7 +1024,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
provider_oriented_code != 0x800)
break;

ret = ff_dovi_rpu_parse(&s->dovi, gb.buffer, gb.buffer_end - gb.buffer,
ret = ff_dovi_rpu_parse(&s->dovi, gb.buffer, bytestream2_get_bytes_left(&gb),
avctx->err_recognition);
if (ret < 0) {
av_log(avctx, AV_LOG_WARNING, "Error parsing DOVI OBU.\n");
Expand Down
28 changes: 6 additions & 22 deletions libavcodec/encode.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,10 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/

#include "libavutil/attributes.h"
#include "libavutil/avassert.h"
#include "libavutil/channel_layout.h"
#include "libavutil/emms.h"
#include "libavutil/frame.h"
#include "libavutil/imgutils.h"
#include "libavutil/internal.h"
#include "libavutil/mem.h"
#include "libavutil/pixdesc.h"
Expand Down Expand Up @@ -357,8 +355,6 @@ static int encode_receive_packet_internal(AVCodecContext *avctx, AVPacket *avpkt
if (avctx->codec->type == AVMEDIA_TYPE_VIDEO) {
if ((avctx->flags & AV_CODEC_FLAG_PASS1) && avctx->stats_out)
avctx->stats_out[0] = '\0';
if (av_image_check_size2(avctx->width, avctx->height, avctx->max_pixels, AV_PIX_FMT_NONE, 0, avctx))
return AVERROR(EINVAL);
}

if (ffcodec(avctx->codec)->cb_type == FF_CODEC_CB_TYPE_RECEIVE_PACKET) {
Expand Down Expand Up @@ -551,7 +547,7 @@ static int encode_preinit_video(AVCodecContext *avctx)
const enum AVPixelFormat *pix_fmts;
int ret, i, num_pix_fmts;

if (!av_get_pix_fmt_name(avctx->pix_fmt)) {
if (!pixdesc) {
av_log(avctx, AV_LOG_ERROR, "Invalid video pixel format: %d\n",
avctx->pix_fmt);
return AVERROR(EINVAL);
Expand Down Expand Up @@ -814,24 +810,12 @@ int ff_encode_alloc_frame(AVCodecContext *avctx, AVFrame *frame)
{
int ret;

switch (avctx->codec->type) {
case AVMEDIA_TYPE_VIDEO:
frame->format = avctx->pix_fmt;
if (frame->width <= 0 || frame->height <= 0) {
frame->width = FFMAX(avctx->width, avctx->coded_width);
frame->height = FFMAX(avctx->height, avctx->coded_height);
}
av_assert1(avctx->codec_type == AVMEDIA_TYPE_VIDEO);

break;
case AVMEDIA_TYPE_AUDIO:
frame->sample_rate = avctx->sample_rate;
frame->format = avctx->sample_fmt;
if (!frame->ch_layout.nb_channels) {
ret = av_channel_layout_copy(&frame->ch_layout, &avctx->ch_layout);
if (ret < 0)
return ret;
}
break;
frame->format = avctx->pix_fmt;
if (frame->width <= 0 || frame->height <= 0) {
frame->width = avctx->width;
frame->height = avctx->height;
}

ret = avcodec_default_get_buffer2(avctx, frame, 0);
Expand Down
2 changes: 1 addition & 1 deletion libavcodec/libdav1d.c
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
provider_oriented_code != 0x800)
break;

res = ff_dovi_rpu_parse(&dav1d->dovi, gb.buffer, gb.buffer_end - gb.buffer,
res = ff_dovi_rpu_parse(&dav1d->dovi, gb.buffer, bytestream2_get_bytes_left(&gb),
c->err_recognition);
if (res < 0) {
av_log(c, AV_LOG_WARNING, "Error parsing DOVI OBU.\n");
Expand Down
3 changes: 2 additions & 1 deletion libavcodec/wbmpdec.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ static int wbmp_decode_frame(AVCodecContext *avctx, AVFrame *p,
if (p->linesize[0] == (width + 7) / 8)
bytestream2_get_buffer(&gb, p->data[0], height * ((width + 7) / 8));
else
readbits(p->data[0], width, height, p->linesize[0], gb.buffer, gb.buffer_end - gb.buffer);
readbits(p->data[0], width, height, p->linesize[0],
gb.buffer, bytestream2_get_bytes_left(&gb));

*got_frame = 1;

Expand Down