1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-03-28 12:32:17 +02:00

avformat/mux, utils: Use dedicated pointer for AVStreamInternal

This gets rid of ugly "->internal" and is in preparation for removing
AVStreamInternal altogether.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt 2021-08-24 19:07:51 +02:00
parent fed0282508
commit 9f05b3ba60
2 changed files with 542 additions and 474 deletions

View File

@ -253,6 +253,7 @@ static int init_muxer(AVFormatContext *s, AVDictionary **options)
for (unsigned i = 0; i < s->nb_streams; i++) { for (unsigned i = 0; i < s->nb_streams; i++) {
AVStream *const st = s->streams[i]; AVStream *const st = s->streams[i];
AVStreamInternal *const sti = st->internal;
AVCodecParameters *const par = st->codecpar; AVCodecParameters *const par = st->codecpar;
const AVCodecDescriptor *desc; const AVCodecDescriptor *desc;
@ -303,9 +304,9 @@ static int init_muxer(AVFormatContext *s, AVDictionary **options)
desc = avcodec_descriptor_get(par->codec_id); desc = avcodec_descriptor_get(par->codec_id);
if (desc && desc->props & AV_CODEC_PROP_REORDER) if (desc && desc->props & AV_CODEC_PROP_REORDER)
st->internal->reorder = 1; sti->reorder = 1;
st->internal->is_intra_only = ff_is_intra_only(par->codec_id); sti->is_intra_only = ff_is_intra_only(par->codec_id);
if (of->codec_tag) { if (of->codec_tag) {
if ( par->codec_tag if ( par->codec_tag
@ -385,6 +386,7 @@ static int init_pts(AVFormatContext *s)
/* init PTS generation */ /* init PTS generation */
for (unsigned i = 0; i < s->nb_streams; i++) { for (unsigned i = 0; i < s->nb_streams; i++) {
AVStream *const st = s->streams[i]; AVStream *const st = s->streams[i];
AVStreamInternal *const sti = st->internal;
int64_t den = AV_NOPTS_VALUE; int64_t den = AV_NOPTS_VALUE;
switch (st->codecpar->codec_type) { switch (st->codecpar->codec_type) {
@ -398,16 +400,16 @@ static int init_pts(AVFormatContext *s)
break; break;
} }
if (!st->internal->priv_pts) if (!sti->priv_pts)
st->internal->priv_pts = av_mallocz(sizeof(*st->internal->priv_pts)); sti->priv_pts = av_mallocz(sizeof(*sti->priv_pts));
if (!st->internal->priv_pts) if (!sti->priv_pts)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
if (den != AV_NOPTS_VALUE) { if (den != AV_NOPTS_VALUE) {
if (den <= 0) if (den <= 0)
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
frac_init(st->internal->priv_pts, 0, 0, den); frac_init(sti->priv_pts, 0, 0, den);
} }
} }
@ -507,6 +509,7 @@ FF_DISABLE_DEPRECATION_WARNINGS
static int compute_muxer_pkt_fields(AVFormatContext *s, AVStream *st, AVPacket *pkt) static int compute_muxer_pkt_fields(AVFormatContext *s, AVStream *st, AVPacket *pkt)
{ {
FFFormatContext *const si = ffformatcontext(s); FFFormatContext *const si = ffformatcontext(s);
AVStreamInternal *const sti = st->internal;
int delay = st->codecpar->video_delay; int delay = st->codecpar->video_delay;
int frame_size; int frame_size;
@ -523,7 +526,7 @@ static int compute_muxer_pkt_fields(AVFormatContext *s, AVStream *st, AVPacket *
if (s->debug & FF_FDEBUG_TS) if (s->debug & FF_FDEBUG_TS)
av_log(s, AV_LOG_DEBUG, "compute_muxer_pkt_fields: pts:%s dts:%s cur_dts:%s b:%d size:%d st:%d\n", av_log(s, AV_LOG_DEBUG, "compute_muxer_pkt_fields: pts:%s dts:%s cur_dts:%s b:%d size:%d st:%d\n",
av_ts2str(pkt->pts), av_ts2str(pkt->dts), av_ts2str(st->internal->cur_dts), delay, pkt->size, pkt->stream_index); av_ts2str(pkt->pts), av_ts2str(pkt->dts), av_ts2str(sti->cur_dts), delay, pkt->size, pkt->stream_index);
if (pkt->pts == AV_NOPTS_VALUE && pkt->dts != AV_NOPTS_VALUE && delay == 0) if (pkt->pts == AV_NOPTS_VALUE && pkt->dts != AV_NOPTS_VALUE && delay == 0)
pkt->pts = pkt->dts; pkt->pts = pkt->dts;
@ -537,28 +540,28 @@ static int compute_muxer_pkt_fields(AVFormatContext *s, AVStream *st, AVPacket *
} }
pkt->dts = pkt->dts =
// pkt->pts= st->cur_dts; // pkt->pts= st->cur_dts;
pkt->pts = st->internal->priv_pts->val; pkt->pts = sti->priv_pts->val;
} }
//calculate dts from pts //calculate dts from pts
if (pkt->pts != AV_NOPTS_VALUE && pkt->dts == AV_NOPTS_VALUE && delay <= MAX_REORDER_DELAY) { if (pkt->pts != AV_NOPTS_VALUE && pkt->dts == AV_NOPTS_VALUE && delay <= MAX_REORDER_DELAY) {
st->internal->pts_buffer[0] = pkt->pts; sti->pts_buffer[0] = pkt->pts;
for (int i = 1; i < delay + 1 && st->internal->pts_buffer[i] == AV_NOPTS_VALUE; i++) for (int i = 1; i < delay + 1 && sti->pts_buffer[i] == AV_NOPTS_VALUE; i++)
st->internal->pts_buffer[i] = pkt->pts + (i - delay - 1) * pkt->duration; sti->pts_buffer[i] = pkt->pts + (i - delay - 1) * pkt->duration;
for (int i = 0; i<delay && st->internal->pts_buffer[i] > st->internal->pts_buffer[i + 1]; i++) for (int i = 0; i<delay && sti->pts_buffer[i] > sti->pts_buffer[i + 1]; i++)
FFSWAP(int64_t, st->internal->pts_buffer[i], st->internal->pts_buffer[i + 1]); FFSWAP(int64_t, sti->pts_buffer[i], sti->pts_buffer[i + 1]);
pkt->dts = st->internal->pts_buffer[0]; pkt->dts = sti->pts_buffer[0];
} }
if (st->internal->cur_dts && st->internal->cur_dts != AV_NOPTS_VALUE && if (sti->cur_dts && sti->cur_dts != AV_NOPTS_VALUE &&
((!(s->oformat->flags & AVFMT_TS_NONSTRICT) && ((!(s->oformat->flags & AVFMT_TS_NONSTRICT) &&
st->codecpar->codec_type != AVMEDIA_TYPE_SUBTITLE && st->codecpar->codec_type != AVMEDIA_TYPE_SUBTITLE &&
st->codecpar->codec_type != AVMEDIA_TYPE_DATA && st->codecpar->codec_type != AVMEDIA_TYPE_DATA &&
st->internal->cur_dts >= pkt->dts) || st->internal->cur_dts > pkt->dts)) { sti->cur_dts >= pkt->dts) || sti->cur_dts > pkt->dts)) {
av_log(s, AV_LOG_ERROR, av_log(s, AV_LOG_ERROR,
"Application provided invalid, non monotonically increasing dts to muxer in stream %d: %s >= %s\n", "Application provided invalid, non monotonically increasing dts to muxer in stream %d: %s >= %s\n",
st->index, av_ts2str(st->internal->cur_dts), av_ts2str(pkt->dts)); st->index, av_ts2str(sti->cur_dts), av_ts2str(pkt->dts));
return AVERROR(EINVAL); return AVERROR(EINVAL);
} }
if (pkt->dts != AV_NOPTS_VALUE && pkt->pts != AV_NOPTS_VALUE && pkt->pts < pkt->dts) { if (pkt->dts != AV_NOPTS_VALUE && pkt->pts != AV_NOPTS_VALUE && pkt->pts < pkt->dts) {
@ -573,8 +576,8 @@ static int compute_muxer_pkt_fields(AVFormatContext *s, AVStream *st, AVPacket *
av_log(s, AV_LOG_DEBUG, "av_write_frame: pts2:%s dts2:%s\n", av_log(s, AV_LOG_DEBUG, "av_write_frame: pts2:%s dts2:%s\n",
av_ts2str(pkt->pts), av_ts2str(pkt->dts)); av_ts2str(pkt->pts), av_ts2str(pkt->dts));
st->internal->cur_dts = pkt->dts; sti->cur_dts = pkt->dts;
st->internal->priv_pts->val = pkt->dts; sti->priv_pts->val = pkt->dts;
/* update pts */ /* update pts */
switch (st->codecpar->codec_type) { switch (st->codecpar->codec_type) {
@ -586,12 +589,12 @@ static int compute_muxer_pkt_fields(AVFormatContext *s, AVStream *st, AVPacket *
/* HACK/FIXME, we skip the initial 0 size packets as they are most /* HACK/FIXME, we skip the initial 0 size packets as they are most
* likely equal to the encoder delay, but it would be better if we * likely equal to the encoder delay, but it would be better if we
* had the real timestamps from the encoder */ * had the real timestamps from the encoder */
if (frame_size >= 0 && (pkt->size || st->internal->priv_pts->num != st->internal->priv_pts->den >> 1 || st->internal->priv_pts->val)) { if (frame_size >= 0 && (pkt->size || sti->priv_pts->num != sti->priv_pts->den >> 1 || sti->priv_pts->val)) {
frac_add(st->internal->priv_pts, (int64_t)st->time_base.den * frame_size); frac_add(sti->priv_pts, (int64_t)st->time_base.den * frame_size);
} }
break; break;
case AVMEDIA_TYPE_VIDEO: case AVMEDIA_TYPE_VIDEO:
frac_add(st->internal->priv_pts, (int64_t)st->time_base.den * st->time_base.num); frac_add(sti->priv_pts, (int64_t)st->time_base.den * st->time_base.num);
break; break;
} }
return 0; return 0;
@ -642,6 +645,7 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt)
{ {
FFFormatContext *const si = ffformatcontext(s); FFFormatContext *const si = ffformatcontext(s);
AVStream *const st = s->streams[pkt->stream_index]; AVStream *const st = s->streams[pkt->stream_index];
AVStreamInternal *const sti = st->internal;
int ret; int ret;
// If the timestamp offsetting below is adjusted, adjust // If the timestamp offsetting below is adjusted, adjust
@ -656,7 +660,7 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt)
} }
if (s->avoid_negative_ts > 0) { if (s->avoid_negative_ts > 0) {
int64_t offset = st->internal->mux_ts_offset; int64_t offset = sti->mux_ts_offset;
int64_t ts = si->avoid_negative_ts_use_pts ? pkt->pts : pkt->dts; int64_t ts = si->avoid_negative_ts_use_pts ? pkt->pts : pkt->dts;
if (si->offset == AV_NOPTS_VALUE && ts != AV_NOPTS_VALUE && if (si->offset == AV_NOPTS_VALUE && ts != AV_NOPTS_VALUE &&
@ -666,7 +670,7 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt)
} }
if (si->offset != AV_NOPTS_VALUE && !offset) { if (si->offset != AV_NOPTS_VALUE && !offset) {
offset = st->internal->mux_ts_offset = offset = sti->mux_ts_offset =
av_rescale_q_rnd(si->offset, av_rescale_q_rnd(si->offset,
si->offset_timebase, si->offset_timebase,
st->time_base, st->time_base,
@ -739,13 +743,14 @@ static int check_packet(AVFormatContext *s, AVPacket *pkt)
static int prepare_input_packet(AVFormatContext *s, AVStream *st, AVPacket *pkt) static int prepare_input_packet(AVFormatContext *s, AVStream *st, AVPacket *pkt)
{ {
AVStreamInternal *const sti = st->internal;
#if !FF_API_COMPUTE_PKT_FIELDS2 #if !FF_API_COMPUTE_PKT_FIELDS2
/* sanitize the timestamps */ /* sanitize the timestamps */
if (!(s->oformat->flags & AVFMT_NOTIMESTAMPS)) { if (!(s->oformat->flags & AVFMT_NOTIMESTAMPS)) {
/* when there is no reordering (so dts is equal to pts), but /* when there is no reordering (so dts is equal to pts), but
* only one of them is set, set the other as well */ * only one of them is set, set the other as well */
if (!st->internal->reorder) { if (!sti->reorder) {
if (pkt->pts == AV_NOPTS_VALUE && pkt->dts != AV_NOPTS_VALUE) if (pkt->pts == AV_NOPTS_VALUE && pkt->dts != AV_NOPTS_VALUE)
pkt->pts = pkt->dts; pkt->pts = pkt->dts;
if (pkt->dts == AV_NOPTS_VALUE && pkt->pts != AV_NOPTS_VALUE) if (pkt->dts == AV_NOPTS_VALUE && pkt->pts != AV_NOPTS_VALUE)
@ -761,13 +766,13 @@ static int prepare_input_packet(AVFormatContext *s, AVStream *st, AVPacket *pkt)
/* check that the dts are increasing (or at least non-decreasing, /* check that the dts are increasing (or at least non-decreasing,
* if the format allows it */ * if the format allows it */
if (st->internal->cur_dts != AV_NOPTS_VALUE && if (sti->cur_dts != AV_NOPTS_VALUE &&
((!(s->oformat->flags & AVFMT_TS_NONSTRICT) && st->internal->cur_dts >= pkt->dts) || ((!(s->oformat->flags & AVFMT_TS_NONSTRICT) && sti->cur_dts >= pkt->dts) ||
st->internal->cur_dts > pkt->dts)) { sti->cur_dts > pkt->dts)) {
av_log(s, AV_LOG_ERROR, av_log(s, AV_LOG_ERROR,
"Application provided invalid, non monotonically increasing " "Application provided invalid, non monotonically increasing "
"dts to muxer in stream %d: %" PRId64 " >= %" PRId64 "\n", "dts to muxer in stream %d: %" PRId64 " >= %" PRId64 "\n",
st->index, st->internal->cur_dts, pkt->dts); st->index, sti->cur_dts, pkt->dts);
return AVERROR(EINVAL); return AVERROR(EINVAL);
} }
@ -779,7 +784,7 @@ static int prepare_input_packet(AVFormatContext *s, AVStream *st, AVPacket *pkt)
} }
#endif #endif
/* update flags */ /* update flags */
if (st->internal->is_intra_only) if (sti->is_intra_only)
pkt->flags |= AV_PKT_FLAG_KEY; pkt->flags |= AV_PKT_FLAG_KEY;
return 0; return 0;
@ -794,6 +799,7 @@ int ff_interleave_add_packet(AVFormatContext *s, AVPacket *pkt,
FFFormatContext *const si = ffformatcontext(s); FFFormatContext *const si = ffformatcontext(s);
PacketList **next_point, *this_pktl; PacketList **next_point, *this_pktl;
AVStream *st = s->streams[pkt->stream_index]; AVStream *st = s->streams[pkt->stream_index];
AVStreamInternal *const sti = st->internal;
int chunked = s->max_chunk_size || s->max_chunk_duration; int chunked = s->max_chunk_size || s->max_chunk_duration;
this_pktl = av_malloc(sizeof(PacketList)); this_pktl = av_malloc(sizeof(PacketList));
@ -810,27 +816,27 @@ int ff_interleave_add_packet(AVFormatContext *s, AVPacket *pkt,
av_packet_move_ref(&this_pktl->pkt, pkt); av_packet_move_ref(&this_pktl->pkt, pkt);
pkt = &this_pktl->pkt; pkt = &this_pktl->pkt;
if (st->internal->last_in_packet_buffer) { if (sti->last_in_packet_buffer) {
next_point = &(st->internal->last_in_packet_buffer->next); next_point = &(sti->last_in_packet_buffer->next);
} else { } else {
next_point = &si->packet_buffer; next_point = &si->packet_buffer;
} }
if (chunked) { if (chunked) {
uint64_t max= av_rescale_q_rnd(s->max_chunk_duration, AV_TIME_BASE_Q, st->time_base, AV_ROUND_UP); uint64_t max= av_rescale_q_rnd(s->max_chunk_duration, AV_TIME_BASE_Q, st->time_base, AV_ROUND_UP);
st->internal->interleaver_chunk_size += pkt->size; sti->interleaver_chunk_size += pkt->size;
st->internal->interleaver_chunk_duration += pkt->duration; sti->interleaver_chunk_duration += pkt->duration;
if ( (s->max_chunk_size && st->internal->interleaver_chunk_size > s->max_chunk_size) if ( (s->max_chunk_size && sti->interleaver_chunk_size > s->max_chunk_size)
|| (max && st->internal->interleaver_chunk_duration > max)) { || (max && sti->interleaver_chunk_duration > max)) {
st->internal->interleaver_chunk_size = 0; sti->interleaver_chunk_size = 0;
pkt->flags |= CHUNK_START; pkt->flags |= CHUNK_START;
if (max && st->internal->interleaver_chunk_duration > max) { if (max && sti->interleaver_chunk_duration > max) {
int64_t syncoffset = (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO)*max/2; int64_t syncoffset = (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO)*max/2;
int64_t syncto = av_rescale(pkt->dts + syncoffset, 1, max)*max - syncoffset; int64_t syncto = av_rescale(pkt->dts + syncoffset, 1, max)*max - syncoffset;
st->internal->interleaver_chunk_duration += (pkt->dts - syncto)/8 - max; sti->interleaver_chunk_duration += (pkt->dts - syncto)/8 - max;
} else } else
st->internal->interleaver_chunk_duration = 0; sti->interleaver_chunk_duration = 0;
} }
} }
if (*next_point) { if (*next_point) {
@ -855,7 +861,7 @@ next_non_null:
this_pktl->next = *next_point; this_pktl->next = *next_point;
st->internal->last_in_packet_buffer = *next_point = this_pktl; sti->last_in_packet_buffer = *next_point = this_pktl;
return 0; return 0;
} }
@ -905,11 +911,14 @@ int ff_interleave_packet_per_dts(AVFormatContext *s, AVPacket *out,
} }
for (unsigned i = 0; i < s->nb_streams; i++) { for (unsigned i = 0; i < s->nb_streams; i++) {
if (s->streams[i]->internal->last_in_packet_buffer) { const AVStream *const st = s->streams[i];
const AVStreamInternal *const sti = st->internal;
const AVCodecParameters *const par = st->codecpar;
if (sti->last_in_packet_buffer) {
++stream_count; ++stream_count;
} else if (s->streams[i]->codecpar->codec_type != AVMEDIA_TYPE_ATTACHMENT && } else if (par->codec_type != AVMEDIA_TYPE_ATTACHMENT &&
s->streams[i]->codecpar->codec_id != AV_CODEC_ID_VP8 && par->codec_id != AV_CODEC_ID_VP8 &&
s->streams[i]->codecpar->codec_id != AV_CODEC_ID_VP9) { par->codec_id != AV_CODEC_ID_VP9) {
++noninterleaved_count; ++noninterleaved_count;
} }
} }
@ -929,14 +938,16 @@ int ff_interleave_packet_per_dts(AVFormatContext *s, AVPacket *out,
AV_TIME_BASE_Q); AV_TIME_BASE_Q);
for (unsigned i = 0; i < s->nb_streams; i++) { for (unsigned i = 0; i < s->nb_streams; i++) {
const AVStream *const st = s->streams[i];
const AVStreamInternal *const sti = st->internal;
const PacketList *last = sti->last_in_packet_buffer;
int64_t last_dts; int64_t last_dts;
const PacketList *last = s->streams[i]->internal->last_in_packet_buffer;
if (!last) if (!last)
continue; continue;
last_dts = av_rescale_q(last->pkt.dts, last_dts = av_rescale_q(last->pkt.dts,
s->streams[i]->time_base, st->time_base,
AV_TIME_BASE_Q); AV_TIME_BASE_Q);
delta_dts = FFMAX(delta_dts, last_dts - top_dts); delta_dts = FFMAX(delta_dts, last_dts - top_dts);
} }
@ -966,6 +977,7 @@ int ff_interleave_packet_per_dts(AVFormatContext *s, AVPacket *out,
PacketList *pktl = si->packet_buffer; PacketList *pktl = si->packet_buffer;
AVPacket *const top_pkt = &pktl->pkt; AVPacket *const top_pkt = &pktl->pkt;
AVStream *const st = s->streams[top_pkt->stream_index]; AVStream *const st = s->streams[top_pkt->stream_index];
AVStreamInternal *const sti = st->internal;
int64_t top_dts = av_rescale_q(top_pkt->dts, st->time_base, int64_t top_dts = av_rescale_q(top_pkt->dts, st->time_base,
AV_TIME_BASE_Q); AV_TIME_BASE_Q);
@ -976,8 +988,8 @@ int ff_interleave_packet_per_dts(AVFormatContext *s, AVPacket *out,
if (!si->packet_buffer) if (!si->packet_buffer)
si->packet_buffer_end = NULL; si->packet_buffer_end = NULL;
if (st->internal->last_in_packet_buffer == pktl) if (sti->last_in_packet_buffer == pktl)
st->internal->last_in_packet_buffer = NULL; sti->last_in_packet_buffer = NULL;
av_packet_unref(&pktl->pkt); av_packet_unref(&pktl->pkt);
av_freep(&pktl); av_freep(&pktl);
@ -988,14 +1000,16 @@ int ff_interleave_packet_per_dts(AVFormatContext *s, AVPacket *out,
if (stream_count && flush) { if (stream_count && flush) {
PacketList *pktl = si->packet_buffer; PacketList *pktl = si->packet_buffer;
AVStream *const st = s->streams[pktl->pkt.stream_index]; AVStream *const st = s->streams[pktl->pkt.stream_index];
AVStreamInternal *const sti = st->internal;
*out = pktl->pkt; *out = pktl->pkt;
si->packet_buffer = pktl->next; si->packet_buffer = pktl->next;
if (!si->packet_buffer) if (!si->packet_buffer)
si->packet_buffer_end = NULL; si->packet_buffer_end = NULL;
if (st->internal->last_in_packet_buffer == pktl) if (sti->last_in_packet_buffer == pktl)
st->internal->last_in_packet_buffer = NULL; sti->last_in_packet_buffer = NULL;
av_freep(&pktl); av_freep(&pktl);
return 1; return 1;
@ -1050,7 +1064,7 @@ static int interleave_packet(AVFormatContext *s, AVPacket *out, AVPacket *in, in
return ff_interleave_packet_per_dts(s, out, in, flush); return ff_interleave_packet_per_dts(s, out, in, flush);
} }
static int check_bitstream(AVFormatContext *s, AVStream *st, AVPacket *pkt) static int check_bitstream(AVFormatContext *s, AVStreamInternal *sti, AVPacket *pkt)
{ {
int ret; int ret;
@ -1058,11 +1072,11 @@ static int check_bitstream(AVFormatContext *s, AVStream *st, AVPacket *pkt)
return 1; return 1;
if (s->oformat->check_bitstream) { if (s->oformat->check_bitstream) {
if (!st->internal->bitstream_checked) { if (!sti->bitstream_checked) {
if ((ret = s->oformat->check_bitstream(s, pkt)) < 0) if ((ret = s->oformat->check_bitstream(s, pkt)) < 0)
return ret; return ret;
else if (ret == 1) else if (ret == 1)
st->internal->bitstream_checked = 1; sti->bitstream_checked = 1;
} }
} }
@ -1114,7 +1128,8 @@ static int write_packet_common(AVFormatContext *s, AVStream *st, AVPacket *pkt,
static int write_packets_from_bsfs(AVFormatContext *s, AVStream *st, AVPacket *pkt, int interleaved) static int write_packets_from_bsfs(AVFormatContext *s, AVStream *st, AVPacket *pkt, int interleaved)
{ {
AVBSFContext *bsfc = st->internal->bsfc; AVStreamInternal *const sti = st->internal;
AVBSFContext *const bsfc = sti->bsfc;
int ret; int ret;
if ((ret = av_bsf_send_packet(bsfc, pkt)) < 0) { if ((ret = av_bsf_send_packet(bsfc, pkt)) < 0) {
@ -1147,20 +1162,22 @@ static int write_packets_from_bsfs(AVFormatContext *s, AVStream *st, AVPacket *p
static int write_packets_common(AVFormatContext *s, AVPacket *pkt, int interleaved) static int write_packets_common(AVFormatContext *s, AVPacket *pkt, int interleaved)
{ {
AVStream *st; AVStream *st;
AVStreamInternal *sti;
int ret = check_packet(s, pkt); int ret = check_packet(s, pkt);
if (ret < 0) if (ret < 0)
return ret; return ret;
st = s->streams[pkt->stream_index]; st = s->streams[pkt->stream_index];
sti = st->internal;
ret = prepare_input_packet(s, st, pkt); ret = prepare_input_packet(s, st, pkt);
if (ret < 0) if (ret < 0)
return ret; return ret;
ret = check_bitstream(s, st, pkt); ret = check_bitstream(s, sti, pkt);
if (ret < 0) if (ret < 0)
return ret; return ret;
if (st->internal->bsfc) { if (sti->bsfc) {
return write_packets_from_bsfs(s, st, pkt, interleaved); return write_packets_from_bsfs(s, st, pkt, interleaved);
} else { } else {
return write_packet_common(s, st, pkt, interleaved); return write_packet_common(s, st, pkt, interleaved);

File diff suppressed because it is too large Load Diff