mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-28 20:53:54 +02:00
fftools/ffmpeg_mux: allocate sq_pkt in setup_sync_queues()
This is now possible since setup_sync_queues() can interact with Muxer.
This commit is contained in:
parent
65d106933a
commit
a55ca682e2
@ -671,14 +671,6 @@ int of_muxer_init(OutputFile *of, AVFormatContext *fc,
|
||||
if (strcmp(of->format->name, "rtp"))
|
||||
want_sdp = 0;
|
||||
|
||||
if (of->sq_mux) {
|
||||
mux->sq_pkt = av_packet_alloc();
|
||||
if (!mux->sq_pkt) {
|
||||
ret = AVERROR(ENOMEM);
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
|
||||
/* write the header for files with no streams */
|
||||
if (of->format->flags & AVFMT_NOSTREAMS && fc->nb_streams == 0) {
|
||||
ret = mux_check_init(of);
|
||||
|
@ -1040,8 +1040,9 @@ loop_end:
|
||||
}
|
||||
}
|
||||
|
||||
static int setup_sync_queues(OutputFile *of, AVFormatContext *oc, int64_t buf_size_us)
|
||||
static int setup_sync_queues(Muxer *mux, AVFormatContext *oc, int64_t buf_size_us)
|
||||
{
|
||||
OutputFile *of = &mux->of;
|
||||
int nb_av_enc = 0, nb_interleaved = 0;
|
||||
int limit_frames = 0, limit_frames_av_enc = 0;
|
||||
|
||||
@ -1103,6 +1104,10 @@ static int setup_sync_queues(OutputFile *of, AVFormatContext *oc, int64_t buf_si
|
||||
if (!of->sq_mux)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
mux->sq_pkt = av_packet_alloc();
|
||||
if (!mux->sq_pkt)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
for (int i = 0; i < oc->nb_streams; i++) {
|
||||
OutputStream *ost = output_streams[of->ost_index + i];
|
||||
enum AVMediaType type = ost->st->codecpar->codec_type;
|
||||
@ -1573,6 +1578,7 @@ static int set_dispositions(OutputFile *of, AVFormatContext *ctx)
|
||||
|
||||
int of_open(OptionsContext *o, const char *filename)
|
||||
{
|
||||
Muxer *mux;
|
||||
AVFormatContext *oc;
|
||||
int i, j, err;
|
||||
OutputFile *of;
|
||||
@ -1594,7 +1600,8 @@ int of_open(OptionsContext *o, const char *filename)
|
||||
}
|
||||
}
|
||||
|
||||
of = allocate_array_elem(&output_files, sizeof(Muxer), &nb_output_files);
|
||||
mux = allocate_array_elem(&output_files, sizeof(Muxer), &nb_output_files);
|
||||
of = &mux->of;
|
||||
|
||||
of->index = nb_output_files - 1;
|
||||
of->ost_index = nb_output_streams;
|
||||
@ -1869,7 +1876,7 @@ int of_open(OptionsContext *o, const char *filename)
|
||||
exit_program(1);
|
||||
}
|
||||
|
||||
err = setup_sync_queues(of, oc, o->shortest_buf_duration * AV_TIME_BASE);
|
||||
err = setup_sync_queues(mux, oc, o->shortest_buf_duration * AV_TIME_BASE);
|
||||
if (err < 0) {
|
||||
av_log(NULL, AV_LOG_FATAL, "Error setting up output sync queues\n");
|
||||
exit_program(1);
|
||||
|
Loading…
Reference in New Issue
Block a user