History

fftools/ffmpeg_mux: move OutputStream.enc_ctx to Encoder

The encoding AVCodecContext is a part of the encoder, and so should live there.

Anton Khirnov committed 2 years ago

Commit 64f3feb1 parent 434377a5 files · +62 −54Browse files

Unified · Split

5 files
  1. fftools/ffmpeg.c +3 −3
  2. fftools/ffmpeg.h +2 −1
  3. fftools/ffmpeg_enc.c +24 −9
  4. fftools/ffmpeg_mux.c +2 −6
  5. fftools/ffmpeg_mux_init.c +31 −35
fftools/ffmpeg.c+3−3
@@ -728,7 +728,7 @@ static void print_stream_maps(void) · 727 unmodified lines
728 av_log(NULL, AV_LOG_INFO, " (graph %d)", ost->filter->graph->index);728 av_log(NULL, AV_LOG_INFO, " (graph %d)", ost->filter->graph->index);
729 729
730 av_log(NULL, AV_LOG_INFO, " -> Stream #%d:%d (%s)\n", ost->file->index,730 av_log(NULL, AV_LOG_INFO, " -> Stream #%d:%d (%s)\n", ost->file->index,
731 ost->index, ost->enc_ctx->codec->name);731 ost->index, ost->enc->enc_ctx->codec->name);
732 continue;732 continue;
733 }733 }
734 734
@@ -737,9 +737,9 @@ static void print_stream_maps(void) · 2 unmodified lines
737 ost->ist->index,737 ost->ist->index,
738 ost->file->index,738 ost->file->index,
739 ost->index);739 ost->index);
740 if (ost->enc_ctx) {740 if (ost->enc) {
741 const AVCodec *in_codec = ost->ist->dec;741 const AVCodec *in_codec = ost->ist->dec;
742 const AVCodec *out_codec = ost->enc_ctx->codec;742 const AVCodec *out_codec = ost->enc->enc_ctx->codec;
743 const char *decoder_name = "?";743 const char *decoder_name = "?";
744 const char *in_codec_name = "?";744 const char *in_codec_name = "?";
745 const char *encoder_name = "?";745 const char *encoder_name = "?";
fftools/ffmpeg.h+2−1
@@ -572,6 +572,8 @@ typedef struct KeyframeForceCtx { · 571 unmodified lines
572typedef struct Encoder {572typedef struct Encoder {
573 const AVClass *class;573 const AVClass *class;
574 574
575 AVCodecContext *enc_ctx;
576
575 // number of frames/samples sent to the encoder577 // number of frames/samples sent to the encoder
576 uint64_t frames_encoded;578 uint64_t frames_encoded;
577 uint64_t samples_encoded;579 uint64_t samples_encoded;
@@ -602,7 +604,6 @@ typedef struct OutputStream { · 24 unmodified lines
602 AVStream *st; /* stream in the output file */604 AVStream *st; /* stream in the output file */
603 605
604 Encoder *enc;606 Encoder *enc;
605 AVCodecContext *enc_ctx;
606 607
607 /* video only */608 /* video only */
608#if FFMPEG_OPT_TOP609#if FFMPEG_OPT_TOP
fftools/ffmpeg_enc.c+24−9
@@ -75,6 +75,10 @@ void enc_free(Encoder **penc) · 74 unmodified lines
75 if (!enc)75 if (!enc)
76 return;76 return;
77 77
78 if (enc->enc_ctx)
79 av_freep(&enc->enc_ctx->stats_in);
80 avcodec_free_context(&enc->enc_ctx);
81
78 av_freep(penc);82 av_freep(penc);
79}83}
80 84
@@ -96,6 +100,7 @@ int enc_alloc(Encoder **penc, const AVCodec *codec, · 15 unmodified lines
96 Scheduler *sch, unsigned sch_idx, void *log_parent)100 Scheduler *sch, unsigned sch_idx, void *log_parent)
97{101{
98 EncoderPriv *ep;102 EncoderPriv *ep;
103 int ret = 0;
99 104
100 *penc = NULL;105 *penc = NULL;
101 106
@@ -111,9 +116,18 @@ int enc_alloc(Encoder **penc, const AVCodec *codec, · 9 unmodified lines
111 116
112 snprintf(ep->log_name, sizeof(ep->log_name), "enc:%s", codec->name);117 snprintf(ep->log_name, sizeof(ep->log_name), "enc:%s", codec->name);
113 118
119 ep->e.enc_ctx = avcodec_alloc_context3(codec);
120 if (!ep->e.enc_ctx) {
121 ret = AVERROR(ENOMEM);
122 goto fail;
123 }
124
114 *penc = &ep->e;125 *penc = &ep->e;
115 126
116 return 0;127 return 0;
128fail:
129 enc_free((Encoder**)&ep);
130 return ret;
117}131}
118 132
119static int hw_device_setup_for_encode(Encoder *e, AVCodecContext *enc_ctx,133static int hw_device_setup_for_encode(Encoder *e, AVCodecContext *enc_ctx,
@@ -173,7 +187,7 @@ int enc_open(void *opaque, const AVFrame *frame) · 53 unmodified lines
173 InputStream *ist = ost->ist;187 InputStream *ist = ost->ist;
174 Encoder *e = ost->enc;188 Encoder *e = ost->enc;
175 EncoderPriv *ep = ep_from_enc(e);189 EncoderPriv *ep = ep_from_enc(e);
176 AVCodecContext *enc_ctx = ost->enc_ctx;190 AVCodecContext *enc_ctx = e->enc_ctx;
177 Decoder *dec = NULL;191 Decoder *dec = NULL;
178 const AVCodec *enc = enc_ctx->codec;192 const AVCodec *enc = enc_ctx->codec;
179 OutputFile *of = ost->file;193 OutputFile *of = ost->file;
@@ -372,7 +386,7 @@ static int do_subtitle_out(OutputFile *of, OutputStream *ost, const AVSubtitle * · 192 unmodified lines
372 if ((of->start_time != AV_NOPTS_VALUE && sub->pts < of->start_time))386 if ((of->start_time != AV_NOPTS_VALUE && sub->pts < of->start_time))
373 return 0;387 return 0;
374 388
375 enc = ost->enc_ctx;389 enc = e->enc_ctx;
376 390
377 /* Note: DVB subtitle need one packet to draw them and one other391 /* Note: DVB subtitle need one packet to draw them and one other
378 packet to clear them */392 packet to clear them */
@@ -524,10 +538,11 @@ static inline double psnr(double d) · 145 unmodified lines
524 538
525static int update_video_stats(OutputStream *ost, const AVPacket *pkt, int write_vstats)539static int update_video_stats(OutputStream *ost, const AVPacket *pkt, int write_vstats)
526{540{
527 EncoderPriv *ep = ep_from_enc(ost->enc);541 Encoder *e = ost->enc;
542 EncoderPriv *ep = ep_from_enc(e);
528 const uint8_t *sd = av_packet_get_side_data(pkt, AV_PKT_DATA_QUALITY_STATS,543 const uint8_t *sd = av_packet_get_side_data(pkt, AV_PKT_DATA_QUALITY_STATS,
529 NULL);544 NULL);
530 AVCodecContext *enc = ost->enc_ctx;545 AVCodecContext *enc = e->enc_ctx;
531 enum AVPictureType pict_type;546 enum AVPictureType pict_type;
532 int64_t frame_number;547 int64_t frame_number;
533 double ti1, bitrate, avg_bitrate;548 double ti1, bitrate, avg_bitrate;
@@ -591,7 +606,7 @@ static int encode_frame(OutputFile *of, OutputStream *ost, AVFrame *frame, · 57 unmodified lines
591{606{
592 Encoder *e = ost->enc;607 Encoder *e = ost->enc;
593 EncoderPriv *ep = ep_from_enc(e);608 EncoderPriv *ep = ep_from_enc(e);
594 AVCodecContext *enc = ost->enc_ctx;609 AVCodecContext *enc = e->enc_ctx;
595 const char *type_desc = av_get_media_type_string(enc->codec_type);610 const char *type_desc = av_get_media_type_string(enc->codec_type);
596 const char *action = frame ? "encode" : "flush";611 const char *action = frame ? "encode" : "flush";
597 int ret;612 int ret;
@@ -775,7 +790,7 @@ static int frame_encode(OutputStream *ost, AVFrame *frame, AVPacket *pkt) · 177 unmodified lines
775 return AVERROR_EOF;790 return AVERROR_EOF;
776 791
777 if (type == AVMEDIA_TYPE_VIDEO) {792 if (type == AVMEDIA_TYPE_VIDEO) {
778 frame->quality = ost->enc_ctx->global_quality;793 frame->quality = e->enc_ctx->global_quality;
779 frame->pict_type = forced_kf_apply(e, &ost->kf, frame);794 frame->pict_type = forced_kf_apply(e, &ost->kf, frame);
780 795
781#if FFMPEG_OPT_TOP796#if FFMPEG_OPT_TOP
@@ -785,8 +800,8 @@ static int frame_encode(OutputStream *ost, AVFrame *frame, AVPacket *pkt) · 3 unmodified lines
785 }800 }
786#endif801#endif
787 } else {802 } else {
788 if (!(ost->enc_ctx->codec->capabilities & AV_CODEC_CAP_PARAM_CHANGE) &&803 if (!(e->enc_ctx->codec->capabilities & AV_CODEC_CAP_PARAM_CHANGE) &&
789 ost->enc_ctx->ch_layout.nb_channels != frame->ch_layout.nb_channels) {804 e->enc_ctx->ch_layout.nb_channels != frame->ch_layout.nb_channels) {
790 av_log(e, AV_LOG_ERROR,805 av_log(e, AV_LOG_ERROR,
791 "Audio channel count changed and encoder does not support parameter changes\n");806 "Audio channel count changed and encoder does not support parameter changes\n");
792 return 0;807 return 0;
@@ -801,7 +816,7 @@ static void enc_thread_set_name(const OutputStream *ost) · 8 unmodified lines
801{816{
802 char name[16];817 char name[16];
803 snprintf(name, sizeof(name), "enc%d:%d:%s", ost->file->index, ost->index,818 snprintf(name, sizeof(name), "enc%d:%d:%s", ost->file->index, ost->index,
804 ost->enc_ctx->codec->name);819 ost->enc->enc_ctx->codec->name);
805 ff_thread_setname(name);820 ff_thread_setname(name);
806}821}
807 822
fftools/ffmpeg_mux.c+2−6
@@ -661,8 +661,8 @@ static int check_written(OutputFile *of) · 660 unmodified lines
661 661
662 total_packets_written += packets_written;662 total_packets_written += packets_written;
663 663
664 if (ost->enc_ctx &&664 if (ost->enc &&
665 (ost->enc_ctx->flags & (AV_CODEC_FLAG_PASS1 | AV_CODEC_FLAG_PASS2))665 (ost->enc->enc_ctx->flags & (AV_CODEC_FLAG_PASS1 | AV_CODEC_FLAG_PASS2))
666 != AV_CODEC_FLAG_PASS1)666 != AV_CODEC_FLAG_PASS1)
667 pass1_used = 0;667 pass1_used = 0;
668 668
@@ -837,10 +837,6 @@ static void ost_free(OutputStream **post) · 168 unmodified lines
837 837
838 av_freep(&ost->attachment_filename);838 av_freep(&ost->attachment_filename);
839 839
840 if (ost->enc_ctx)
841 av_freep(&ost->enc_ctx->stats_in);
842 avcodec_free_context(&ost->enc_ctx);
843
844 enc_stats_uninit(&ost->enc_stats_pre);840 enc_stats_uninit(&ost->enc_stats_pre);
845 enc_stats_uninit(&ost->enc_stats_post);841 enc_stats_uninit(&ost->enc_stats_post);
846 enc_stats_uninit(&ms->stats);842 enc_stats_uninit(&ms->stats);
fftools/ffmpeg_mux_init.c+31−35
@@ -555,7 +555,7 @@ static enum AVPixelFormat pix_fmt_parse(OutputStream *ost, const char *name) · 554 unmodified lines
555 return AV_PIX_FMT_NONE;555 return AV_PIX_FMT_NONE;
556 }556 }
557 557
558 ret = avcodec_get_supported_config(ost->enc_ctx, NULL, AV_CODEC_CONFIG_PIX_FORMAT,558 ret = avcodec_get_supported_config(ost->enc->enc_ctx, NULL, AV_CODEC_CONFIG_PIX_FORMAT,
559 0, (const void **) &fmts, NULL);559 0, (const void **) &fmts, NULL);
560 if (ret < 0)560 if (ret < 0)
561 return AV_PIX_FMT_NONE;561 return AV_PIX_FMT_NONE;
@@ -587,7 +587,7 @@ static enum AVPixelFormat pix_fmt_parse(OutputStream *ost, const char *name) · 25 unmodified lines
587 }587 }
588 588
589 if (fmts && !fmt_in_list(fmts, fmt))589 if (fmts && !fmt_in_list(fmts, fmt))
590 fmt = choose_pixel_fmt(ost->enc_ctx, fmt);590 fmt = choose_pixel_fmt(ost->enc->enc_ctx, fmt);
591 591
592 return fmt;592 return fmt;
593}593}
@@ -632,8 +632,8 @@ static int new_stream_video(Muxer *mux, const OptionsContext *o, · 38 unmodified lines
632 ost->frame_aspect_ratio = q;632 ost->frame_aspect_ratio = q;
633 }633 }
634 634
635 if (ost->enc_ctx) {635 if (ost->enc) {
636 AVCodecContext *video_enc = ost->enc_ctx;636 AVCodecContext *video_enc = ost->enc->enc_ctx;
637 const char *p = NULL, *fps_mode = NULL;637 const char *p = NULL, *fps_mode = NULL;
638 const char *frame_size = NULL;638 const char *frame_size = NULL;
639 const char *frame_pix_fmt = NULL;639 const char *frame_pix_fmt = NULL;
@@ -746,10 +746,10 @@ static int new_stream_video(Muxer *mux, const OptionsContext *o, · 106 unmodified lines
746 ost->logfile_prefix ? ost->logfile_prefix :746 ost->logfile_prefix ? ost->logfile_prefix :
747 DEFAULT_PASS_LOGFILENAME_PREFIX,747 DEFAULT_PASS_LOGFILENAME_PREFIX,
748 ost_idx);748 ost_idx);
749 if (!strcmp(ost->enc_ctx->codec->name, "libx264") || !strcmp(ost->enc_ctx->codec->name, "libvvenc")) {749 if (!strcmp(video_enc->codec->name, "libx264") || !strcmp(video_enc->codec->name, "libvvenc")) {
750 if (av_opt_is_set_to_default_by_name(ost->enc_ctx, "stats",750 if (av_opt_is_set_to_default_by_name(video_enc, "stats",
751 AV_OPT_SEARCH_CHILDREN) > 0)751 AV_OPT_SEARCH_CHILDREN) > 0)
752 av_opt_set(ost->enc_ctx, "stats", logfilename,752 av_opt_set(video_enc, "stats", logfilename,
753 AV_OPT_SEARCH_CHILDREN);753 AV_OPT_SEARCH_CHILDREN);
754 } else {754 } else {
755 if (video_enc->flags & AV_CODEC_FLAG_PASS2) {755 if (video_enc->flags & AV_CODEC_FLAG_PASS2) {
@@ -842,8 +842,8 @@ static int new_stream_audio(Muxer *mux, const OptionsContext *o, · 86 unmodified lines
842 AVFormatContext *oc = mux->fc;842 AVFormatContext *oc = mux->fc;
843 AVStream *st = ost->st;843 AVStream *st = ost->st;
844 844
845 if (ost->enc_ctx) {845 if (ost->enc) {
846 AVCodecContext *audio_enc = ost->enc_ctx;846 AVCodecContext *audio_enc = ost->enc->enc_ctx;
847 int channels = 0;847 int channels = 0;
848 const char *layout = NULL;848 const char *layout = NULL;
849 const char *sample_fmt = NULL;849 const char *sample_fmt = NULL;
@@ -881,8 +881,8 @@ static int new_stream_subtitle(Muxer *mux, const OptionsContext *o, · 31 unmodified lines
881 881
882 st = ost->st;882 st = ost->st;
883 883
884 if (ost->enc_ctx) {884 if (ost->enc) {
885 AVCodecContext *subtitle_enc = ost->enc_ctx;885 AVCodecContext *subtitle_enc = ost->enc->enc_ctx;
886 886
887 AVCodecDescriptor const *input_descriptor =887 AVCodecDescriptor const *input_descriptor =
888 avcodec_descriptor_get(ost->ist->par->codec_id);888 avcodec_descriptor_get(ost->ist->par->codec_id);
@@ -923,7 +923,7 @@ ost_bind_filter(const Muxer *mux, MuxStream *ms, OutputFilter *ofilter, · 34 unmodified lines
923 const ViewSpecifier *vs)923 const ViewSpecifier *vs)
924{924{
925 OutputStream *ost = &ms->ost;925 OutputStream *ost = &ms->ost;
926 AVCodecContext *enc_ctx = ost->enc_ctx;926 AVCodecContext *enc_ctx = ost->enc->enc_ctx;
927 char name[16];927 char name[16];
928 int ret;928 int ret;
929 929
@@ -1245,10 +1245,6 @@ static int ost_add(Muxer *mux, const OptionsContext *o, enum AVMediaType type, · 315 unmodified lines
1245 }1245 }
1246 1246
1247 if (enc) {1247 if (enc) {
1248 ost->enc_ctx = avcodec_alloc_context3(enc);
1249 if (!ost->enc_ctx)
1250 return AVERROR(ENOMEM);
1251
1252 ret = sch_add_enc(mux->sch, encoder_thread, ost,1248 ret = sch_add_enc(mux->sch, encoder_thread, ost,
1253 ost->type == AVMEDIA_TYPE_SUBTITLE ? NULL : enc_open);1249 ost->type == AVMEDIA_TYPE_SUBTITLE ? NULL : enc_open);
1254 if (ret < 0)1250 if (ret < 0)
@@ -1290,21 +1286,21 @@ static int ost_add(Muxer *mux, const OptionsContext *o, enum AVMediaType type, · 35 unmodified lines
1290 if (!ms->pkt)1286 if (!ms->pkt)
1291 return AVERROR(ENOMEM);1287 return AVERROR(ENOMEM);
1292 1288
1293 if (ost->enc_ctx) {1289 if (ost->enc) {
1294 AVIOContext *s = NULL;1290 AVIOContext *s = NULL;
1295 char *buf = NULL, *arg = NULL;1291 char *buf = NULL, *arg = NULL;
1296 const char *enc_stats_pre = NULL, *enc_stats_post = NULL, *mux_stats = NULL;1292 const char *enc_stats_pre = NULL, *enc_stats_post = NULL, *mux_stats = NULL;
1297 const char *enc_time_base = NULL, *preset = NULL;1293 const char *enc_time_base = NULL, *preset = NULL;
1298 1294
1299 ret = filter_codec_opts(o->g->codec_opts, ost->enc_ctx->codec_id,1295 ret = filter_codec_opts(o->g->codec_opts, enc->id,
1300 oc, st, ost->enc_ctx->codec, &encoder_opts,1296 oc, st, enc, &encoder_opts,
1301 &mux->enc_opts_used);1297 &mux->enc_opts_used);
1302 if (ret < 0)1298 if (ret < 0)
1303 goto fail;1299 goto fail;
1304 1300
1305 opt_match_per_stream_str(ost, &o->presets, oc, st, &preset);1301 opt_match_per_stream_str(ost, &o->presets, oc, st, &preset);
1306 opt_match_per_stream_int(ost, &o->autoscale, oc, st, &autoscale);1302 opt_match_per_stream_int(ost, &o->autoscale, oc, st, &autoscale);
1307 if (preset && (!(ret = get_preset_file_2(preset, ost->enc_ctx->codec->name, &s)))) {1303 if (preset && (!(ret = get_preset_file_2(preset, enc->name, &s)))) {
1308 AVBPrint bprint;1304 AVBPrint bprint;
1309 av_bprint_init(&bprint, 0, AV_BPRINT_SIZE_UNLIMITED);1305 av_bprint_init(&bprint, 0, AV_BPRINT_SIZE_UNLIMITED);
1310 do {1306 do {
@@ -1404,7 +1400,7 @@ static int ost_add(Muxer *mux, const OptionsContext *o, enum AVMediaType type, · 93 unmodified lines
1404 1400
1405 threads_manual = !!av_dict_get(encoder_opts, "threads", NULL, 0);1401 threads_manual = !!av_dict_get(encoder_opts, "threads", NULL, 0);
1406 1402
1407 ret = av_opt_set_dict2(ost->enc_ctx, &encoder_opts, AV_OPT_SEARCH_CHILDREN);1403 ret = av_opt_set_dict2(ost->enc->enc_ctx, &encoder_opts, AV_OPT_SEARCH_CHILDREN);
1408 if (ret < 0) {1404 if (ret < 0) {
1409 av_log(ost, AV_LOG_ERROR, "Error applying encoder options: %s\n",1405 av_log(ost, AV_LOG_ERROR, "Error applying encoder options: %s\n",
1410 av_err2str(ret));1406 av_err2str(ret));
@@ -1417,7 +1413,7 @@ static int ost_add(Muxer *mux, const OptionsContext *o, enum AVMediaType type, · 6 unmodified lines
1417 1413
1418 // default to automatic thread count1414 // default to automatic thread count
1419 if (!threads_manual)1415 if (!threads_manual)
1420 ost->enc_ctx->thread_count = 0;1416 ost->enc->enc_ctx->thread_count = 0;
1421 } else {1417 } else {
1422 ret = filter_codec_opts(o->g->codec_opts, AV_CODEC_ID_NONE, oc, st,1418 ret = filter_codec_opts(o->g->codec_opts, AV_CODEC_ID_NONE, oc, st,
1423 NULL, &encoder_opts,1419 NULL, &encoder_opts,
@@ -1429,8 +1425,8 @@ static int ost_add(Muxer *mux, const OptionsContext *o, enum AVMediaType type, · 5 unmodified lines
1429 1425
1430 if (o->bitexact) {1426 if (o->bitexact) {
1431 ost->bitexact = 1;1427 ost->bitexact = 1;
1432 } else if (ost->enc_ctx) {1428 } else if (ost->enc) {
1433 ost->bitexact = !!(ost->enc_ctx->flags & AV_CODEC_FLAG_BITEXACT);1429 ost->bitexact = !!(ost->enc->enc_ctx->flags & AV_CODEC_FLAG_BITEXACT);
1434 }1430 }
1435 1431
1436 if (enc) {1432 if (enc) {
@@ -1482,14 +1478,14 @@ static int ost_add(Muxer *mux, const OptionsContext *o, enum AVMediaType type, · 45 unmodified lines
1482 }1478 }
1483 ost->st->codecpar->codec_tag = tag;1479 ost->st->codecpar->codec_tag = tag;
1484 ms->par_in->codec_tag = tag;1480 ms->par_in->codec_tag = tag;
1485 if (ost->enc_ctx)1481 if (ost->enc)
1486 ost->enc_ctx->codec_tag = tag;1482 ost->enc->enc_ctx->codec_tag = tag;
1487 }1483 }
1488 1484
1489 opt_match_per_stream_dbl(ost, &o->qscale, oc, st, &qscale);1485 opt_match_per_stream_dbl(ost, &o->qscale, oc, st, &qscale);
1490 if (ost->enc_ctx && qscale >= 0) {1486 if (ost->enc && qscale >= 0) {
1491 ost->enc_ctx->flags |= AV_CODEC_FLAG_QSCALE;1487 ost->enc->enc_ctx->flags |= AV_CODEC_FLAG_QSCALE;
1492 ost->enc_ctx->global_quality = FF_QP2LAMBDA * qscale;1488 ost->enc->enc_ctx->global_quality = FF_QP2LAMBDA * qscale;
1493 }1489 }
1494 1490
1495 if (ms->sch_idx >= 0) {1491 if (ms->sch_idx >= 0) {
@@ -1511,8 +1507,8 @@ static int ost_add(Muxer *mux, const OptionsContext *o, enum AVMediaType type, · 15 unmodified lines
1511 opt_match_per_stream_int(ost, &o->fix_sub_duration_heartbeat,1507 opt_match_per_stream_int(ost, &o->fix_sub_duration_heartbeat,
1512 oc, st, &ost->fix_sub_duration_heartbeat);1508 oc, st, &ost->fix_sub_duration_heartbeat);
1513 1509
1514 if (oc->oformat->flags & AVFMT_GLOBALHEADER && ost->enc_ctx)1510 if (oc->oformat->flags & AVFMT_GLOBALHEADER && ost->enc)
1515 ost->enc_ctx->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;1511 ost->enc->enc_ctx->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
1516 1512
1517 opt_match_per_stream_int(ost, &o->copy_initial_nonkeyframes,1513 opt_match_per_stream_int(ost, &o->copy_initial_nonkeyframes,
1518 oc, st, &ms->copy_initial_nonkeyframes);1514 oc, st, &ms->copy_initial_nonkeyframes);
@@ -2047,7 +2043,7 @@ static int setup_sync_queues(Muxer *mux, AVFormatContext *oc, · 528 unmodified lines
2047 int limit_frames = 0, limit_frames_av_enc = 0;2043 int limit_frames = 0, limit_frames_av_enc = 0;
2048 2044
2049#define IS_AV_ENC(ost, type) \2045#define IS_AV_ENC(ost, type) \
2050 (ost->enc_ctx && (type == AVMEDIA_TYPE_VIDEO || type == AVMEDIA_TYPE_AUDIO))2046 (ost->enc && (type == AVMEDIA_TYPE_VIDEO || type == AVMEDIA_TYPE_AUDIO))
2051#define IS_INTERLEAVED(type) (type != AVMEDIA_TYPE_ATTACHMENT)2047#define IS_INTERLEAVED(type) (type != AVMEDIA_TYPE_ATTACHMENT)
2052 2048
2053 for (int i = 0; i < oc->nb_streams; i++) {2049 for (int i = 0; i < oc->nb_streams; i++) {
@@ -2059,8 +2055,8 @@ static int setup_sync_queues(Muxer *mux, AVFormatContext *oc, · 5 unmodified lines
2059 2055
2060 nb_interleaved += IS_INTERLEAVED(type);2056 nb_interleaved += IS_INTERLEAVED(type);
2061 nb_av_enc += IS_AV_ENC(ost, type);2057 nb_av_enc += IS_AV_ENC(ost, type);
2062 nb_audio_fs += (ost->enc_ctx && type == AVMEDIA_TYPE_AUDIO &&2058 nb_audio_fs += (ost->enc && type == AVMEDIA_TYPE_AUDIO &&
2063 !(ost->enc_ctx->codec->capabilities & AV_CODEC_CAP_VARIABLE_FRAME_SIZE));2059 !(ost->enc->enc_ctx->codec->capabilities & AV_CODEC_CAP_VARIABLE_FRAME_SIZE));
2064 2060
2065 limit_frames |= ms->max_frames < INT64_MAX;2061 limit_frames |= ms->max_frames < INT64_MAX;
2066 limit_frames_av_enc |= (ms->max_frames < INT64_MAX) && IS_AV_ENC(ost, type);2062 limit_frames_av_enc |= (ms->max_frames < INT64_MAX) && IS_AV_ENC(ost, type);
@@ -3193,7 +3189,7 @@ static int process_forced_keyframes(Muxer *mux, const OptionsContext *o) · 1126 unmodified lines
3193 mux->fc, ost->st, &forced_keyframes);3189 mux->fc, ost->st, &forced_keyframes);
3194 3190
3195 if (!(ost->type == AVMEDIA_TYPE_VIDEO &&3191 if (!(ost->type == AVMEDIA_TYPE_VIDEO &&
3196 ost->enc_ctx && forced_keyframes))3192 ost->enc && forced_keyframes))
3197 continue;3193 continue;
3198 3194
3199 if (!strncmp(forced_keyframes, "expr:", 5)) {3195 if (!strncmp(forced_keyframes, "expr:", 5)) {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t