mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-03-17 20:17:55 +02:00
fftools/ffmpeg: pass the muxer context explicitly to some functions
Stop accessing OutputFile.ctx. This will be useful in the following commits, where it will become hidden.
This commit is contained in:
parent
662364b2ef
commit
16aea9a38b
@ -2125,10 +2125,10 @@ static int opt_streamid(void *optctx, const char *opt, const char *arg)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int copy_chapters(InputFile *ifile, OutputFile *ofile, int copy_metadata)
|
static int copy_chapters(InputFile *ifile, OutputFile *ofile, AVFormatContext *os,
|
||||||
|
int copy_metadata)
|
||||||
{
|
{
|
||||||
AVFormatContext *is = ifile->ctx;
|
AVFormatContext *is = ifile->ctx;
|
||||||
AVFormatContext *os = ofile->ctx;
|
|
||||||
AVChapter **tmp;
|
AVChapter **tmp;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -2168,14 +2168,14 @@ static int copy_chapters(InputFile *ifile, OutputFile *ofile, int copy_metadata)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int set_dispositions(OutputFile *of)
|
static int set_dispositions(OutputFile *of, AVFormatContext *ctx)
|
||||||
{
|
{
|
||||||
int nb_streams[AVMEDIA_TYPE_NB] = { 0 };
|
int nb_streams[AVMEDIA_TYPE_NB] = { 0 };
|
||||||
int have_default[AVMEDIA_TYPE_NB] = { 0 };
|
int have_default[AVMEDIA_TYPE_NB] = { 0 };
|
||||||
int have_manual = 0;
|
int have_manual = 0;
|
||||||
|
|
||||||
// first, copy the input dispositions
|
// first, copy the input dispositions
|
||||||
for (int i = 0; i< of->ctx->nb_streams; i++) {
|
for (int i = 0; i < ctx->nb_streams; i++) {
|
||||||
OutputStream *ost = output_streams[of->ost_index + i];
|
OutputStream *ost = output_streams[of->ost_index + i];
|
||||||
|
|
||||||
nb_streams[ost->st->codecpar->codec_type]++;
|
nb_streams[ost->st->codecpar->codec_type]++;
|
||||||
@ -2192,7 +2192,7 @@ static int set_dispositions(OutputFile *of)
|
|||||||
|
|
||||||
if (have_manual) {
|
if (have_manual) {
|
||||||
// process manually set dispositions - they override the above copy
|
// process manually set dispositions - they override the above copy
|
||||||
for (int i = 0; i< of->ctx->nb_streams; i++) {
|
for (int i = 0; i < ctx->nb_streams; i++) {
|
||||||
OutputStream *ost = output_streams[of->ost_index + i];
|
OutputStream *ost = output_streams[of->ost_index + i];
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
@ -2218,7 +2218,7 @@ static int set_dispositions(OutputFile *of)
|
|||||||
// For each media type with more than one stream, find a suitable stream to
|
// For each media type with more than one stream, find a suitable stream to
|
||||||
// mark as default, unless one is already marked default.
|
// mark as default, unless one is already marked default.
|
||||||
// "Suitable" means the first of that type, skipping attached pictures.
|
// "Suitable" means the first of that type, skipping attached pictures.
|
||||||
for (int i = 0; i< of->ctx->nb_streams; i++) {
|
for (int i = 0; i < ctx->nb_streams; i++) {
|
||||||
OutputStream *ost = output_streams[of->ost_index + i];
|
OutputStream *ost = output_streams[of->ost_index + i];
|
||||||
enum AVMediaType type = ost->st->codecpar->codec_type;
|
enum AVMediaType type = ost->st->codecpar->codec_type;
|
||||||
|
|
||||||
@ -2760,7 +2760,7 @@ loop_end:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (o->chapters_input_file >= 0)
|
if (o->chapters_input_file >= 0)
|
||||||
copy_chapters(input_files[o->chapters_input_file], of,
|
copy_chapters(input_files[o->chapters_input_file], of, oc,
|
||||||
!o->metadata_chapters_manual);
|
!o->metadata_chapters_manual);
|
||||||
|
|
||||||
/* copy global metadata by default */
|
/* copy global metadata by default */
|
||||||
@ -2913,7 +2913,7 @@ loop_end:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
err = set_dispositions(of);
|
err = set_dispositions(of, oc);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
av_log(NULL, AV_LOG_FATAL, "Error setting output stream dispositions\n");
|
av_log(NULL, AV_LOG_FATAL, "Error setting output stream dispositions\n");
|
||||||
exit_program(1);
|
exit_program(1);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user