/* If there is a user-supplied mutex locking routine, call it. */
if (ff_lockmgr_cb) {
- if ((*ff_lockmgr_cb)(&codec_mutex, AV_LOCK_OBTAIN))
- return -1;
+ if ((ret = (*ff_lockmgr_cb)(&codec_mutex, AV_LOCK_OBTAIN)) < 0)
+ return ret;
}
entangled_thread_counter++;
if (entangled_thread_counter != 1) {
av_log(avctx, AV_LOG_ERROR, "Insufficient thread locking around avcodec_open/close()\n");
- ret = -1;
+ ret = AVERROR(EINVAL);
goto end;
}
const char *codec_string = av_codec_is_encoder(codec) ? "encoder" : "decoder";
AVCodec *codec2;
av_log(NULL, AV_LOG_ERROR,
- "%s '%s' is experimental but experimental codecs are not enabled, "
- "Add '-strict %d' if you want to use it.\n",
+ "The %s '%s' is experimental but experimental codecs are not enabled, "
+ "add '-strict %d' if you want to use it.\n",
codec_string, codec->name, FF_COMPLIANCE_EXPERIMENTAL);
codec2 = av_codec_is_encoder(codec) ? avcodec_find_encoder(codec->id) : avcodec_find_decoder(codec->id);
if (!(codec2->capabilities & CODEC_CAP_EXPERIMENTAL))
- av_log(NULL, AV_LOG_ERROR, "Or use the non experimental %s '%s'.\n",
+ av_log(NULL, AV_LOG_ERROR, "Alternatively use the non experimental %s '%s'.\n",
codec_string, codec2->name);
ret = AVERROR_EXPERIMENTAL;
goto free_and_end;
return ret;
}
-#if FF_API_OLD_DECODE_AUDIO
+#if FF_API_OLD_ENCODE_AUDIO
int attribute_align_arg avcodec_encode_audio(AVCodecContext *avctx,
uint8_t *buf, int buf_size,
const short *samples)
if ((avctx->coded_width || avctx->coded_height) && av_image_check_size(avctx->coded_width, avctx->coded_height, 0, avctx))
return AVERROR(EINVAL);
+ avcodec_get_frame_defaults(picture);
+
if ((avctx->codec->capabilities & CODEC_CAP_DELAY) || avpkt->size || (avctx->active_thread_type & FF_THREAD_FRAME)) {
int did_split = av_packet_split_side_data(&tmp);
apply_param_change(avctx, &tmp);
return AVERROR(EINVAL);
}
+ avcodec_get_frame_defaults(frame);
+
if ((avctx->codec->capabilities & CODEC_CAP_DELAY) || avpkt->size) {
uint8_t *side;
int side_size;