* commit '6064f697a321174232a3fad351afb21150c3e9e5': lavc: Enable side data only packets by default Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>tags/n3.0
| @@ -2596,7 +2596,6 @@ static int init_output_stream(OutputStream *ost, char *error, int error_len) | |||||
| } | } | ||||
| if (!av_dict_get(ost->encoder_opts, "threads", NULL, 0)) | if (!av_dict_get(ost->encoder_opts, "threads", NULL, 0)) | ||||
| av_dict_set(&ost->encoder_opts, "threads", "auto", 0); | av_dict_set(&ost->encoder_opts, "threads", "auto", 0); | ||||
| av_dict_set(&ost->encoder_opts, "side_data_only_packets", "1", 0); | |||||
| if (ost->enc->type == AVMEDIA_TYPE_AUDIO && | if (ost->enc->type == AVMEDIA_TYPE_AUDIO && | ||||
| !codec->defaults && | !codec->defaults && | ||||
| !av_dict_get(ost->encoder_opts, "b", NULL, 0) && | !av_dict_get(ost->encoder_opts, "b", NULL, 0) && | ||||
| @@ -1352,7 +1352,9 @@ typedef struct AVPacketSideData { | |||||
| * then passed to muxers. | * then passed to muxers. | ||||
| * | * | ||||
| * For video, it should typically contain one compressed frame. For audio it may | * For video, it should typically contain one compressed frame. For audio it may | ||||
| * contain several compressed frames. | |||||
| * contain several compressed frames. Encoders are allowed to output empty | |||||
| * packets, with no compressed data, containing only side data | |||||
| * (e.g. to update some stream parameters at the end of encoding). | |||||
| * | * | ||||
| * AVPacket is one of the few structs in FFmpeg, whose size is a part of public | * AVPacket is one of the few structs in FFmpeg, whose size is a part of public | ||||
| * ABI. Thus it may be allocated on stack and no new fields can be added to it | * ABI. Thus it may be allocated on stack and no new fields can be added to it | ||||
| @@ -3105,20 +3107,20 @@ typedef struct AVCodecContext { | |||||
| */ | */ | ||||
| uint64_t vbv_delay; | uint64_t vbv_delay; | ||||
| #if FF_API_SIDEDATA_ONLY_PKT | |||||
| /** | /** | ||||
| * Encoding only. Allow encoders to output packets that do not contain any | |||||
| * encoded data, only side data. | |||||
| * Encoding only and set by default. Allow encoders to output packets | |||||
| * that do not contain any encoded data, only side data. | |||||
| * | * | ||||
| * Some encoders need to output such packets, e.g. to update some stream | * Some encoders need to output such packets, e.g. to update some stream | ||||
| * parameters at the end of encoding. | * parameters at the end of encoding. | ||||
| * | * | ||||
| * All callers are strongly recommended to set this option to 1 and update | |||||
| * their code to deal with such packets, since this behaviour may become | |||||
| * always enabled in the future (then this option will be deprecated and | |||||
| * later removed). To avoid ABI issues when this happens, the callers should | |||||
| * use AVOptions to set this field. | |||||
| * @deprecated this field disables the default behaviour and | |||||
| * it is kept only for compatibility. | |||||
| */ | */ | ||||
| attribute_deprecated | |||||
| int side_data_only_packets; | int side_data_only_packets; | ||||
| #endif | |||||
| /** | /** | ||||
| * Audio only. The number of "priming" samples (padding) inserted by the | * Audio only. The number of "priming" samples (padding) inserted by the | ||||
| @@ -1346,7 +1346,13 @@ static int flac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, | |||||
| av_md5_final(s->md5ctx, s->md5sum); | av_md5_final(s->md5ctx, s->md5sum); | ||||
| write_streaminfo(s, avctx->extradata); | write_streaminfo(s, avctx->extradata); | ||||
| #if FF_API_SIDEDATA_ONLY_PKT | |||||
| FF_DISABLE_DEPRECATION_WARNINGS | |||||
| if (avctx->side_data_only_packets && !s->flushed) { | if (avctx->side_data_only_packets && !s->flushed) { | ||||
| FF_ENABLE_DEPRECATION_WARNINGS | |||||
| #else | |||||
| if (!s->flushed) { | |||||
| #endif | |||||
| uint8_t *side_data = av_packet_new_side_data(avpkt, AV_PKT_DATA_NEW_EXTRADATA, | uint8_t *side_data = av_packet_new_side_data(avpkt, AV_PKT_DATA_NEW_EXTRADATA, | ||||
| avctx->extradata_size); | avctx->extradata_size); | ||||
| if (!side_data) | if (!side_data) | ||||
| @@ -490,7 +490,9 @@ static const AVOption avcodec_options[] = { | |||||
| {"auto", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_SUB_CHARENC_MODE_AUTOMATIC}, INT_MIN, INT_MAX, S|D, "sub_charenc_mode"}, | {"auto", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_SUB_CHARENC_MODE_AUTOMATIC}, INT_MIN, INT_MAX, S|D, "sub_charenc_mode"}, | ||||
| {"pre_decoder", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_SUB_CHARENC_MODE_PRE_DECODER}, INT_MIN, INT_MAX, S|D, "sub_charenc_mode"}, | {"pre_decoder", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_SUB_CHARENC_MODE_PRE_DECODER}, INT_MIN, INT_MAX, S|D, "sub_charenc_mode"}, | ||||
| {"refcounted_frames", NULL, OFFSET(refcounted_frames), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1, A|V|D }, | {"refcounted_frames", NULL, OFFSET(refcounted_frames), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1, A|V|D }, | ||||
| {"side_data_only_packets", NULL, OFFSET(side_data_only_packets), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, A|V|E }, | |||||
| #if FF_API_SIDEDATA_ONLY_PKT | |||||
| {"side_data_only_packets", NULL, OFFSET(side_data_only_packets), AV_OPT_TYPE_INT, { .i64 = 1 }, 0, 1, A|V|E }, | |||||
| #endif | |||||
| {"skip_alpha", "Skip processing alpha", OFFSET(skip_alpha), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, 1, V|D }, | {"skip_alpha", "Skip processing alpha", OFFSET(skip_alpha), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, 1, V|D }, | ||||
| {"field_order", "Field order", OFFSET(field_order), AV_OPT_TYPE_INT, {.i64 = AV_FIELD_UNKNOWN }, 0, 5, V|D|E, "field_order" }, | {"field_order", "Field order", OFFSET(field_order), AV_OPT_TYPE_INT, {.i64 = AV_FIELD_UNKNOWN }, 0, 5, V|D|E, "field_order" }, | ||||
| {"progressive", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = AV_FIELD_PROGRESSIVE }, 0, 0, V|D|E, "field_order" }, | {"progressive", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = AV_FIELD_PROGRESSIVE }, 0, 0, V|D|E, "field_order" }, | ||||
| @@ -179,5 +179,8 @@ | |||||
| #ifndef FF_API_WITHOUT_PREFIX | #ifndef FF_API_WITHOUT_PREFIX | ||||
| #define FF_API_WITHOUT_PREFIX (LIBAVCODEC_VERSION_MAJOR < 59) | #define FF_API_WITHOUT_PREFIX (LIBAVCODEC_VERSION_MAJOR < 59) | ||||
| #endif | #endif | ||||
| #ifndef FF_API_SIDEDATA_ONLY_PKT | |||||
| #define FF_API_SIDEDATA_ONLY_PKT (LIBAVCODEC_VERSION_MAJOR < 59) | |||||
| #endif | |||||
| #endif /* AVCODEC_VERSION_H */ | #endif /* AVCODEC_VERSION_H */ | ||||