mirror of
https://github.com/xenia-project/FFmpeg.git
synced 2024-11-24 12:09:55 +00:00
avformat/utils: Do not use "i" as a context pointer, "i" is normally the integer counter in loops
This avoids surprising developers. Its bad to surprise developers with such unexpected things. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
beb3aea48e
commit
b4a1ccfc41
@ -3461,7 +3461,7 @@ static int extract_extradata_check(AVStream *st)
|
||||
|
||||
static int extract_extradata_init(AVStream *st)
|
||||
{
|
||||
AVStreamInternal *i = st->internal;
|
||||
AVStreamInternal *sti = st->internal;
|
||||
const AVBitStreamFilter *f;
|
||||
int ret;
|
||||
|
||||
@ -3474,66 +3474,66 @@ static int extract_extradata_init(AVStream *st)
|
||||
if (!ret)
|
||||
goto finish;
|
||||
|
||||
i->extract_extradata.pkt = av_packet_alloc();
|
||||
if (!i->extract_extradata.pkt)
|
||||
sti->extract_extradata.pkt = av_packet_alloc();
|
||||
if (!sti->extract_extradata.pkt)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
ret = av_bsf_alloc(f, &i->extract_extradata.bsf);
|
||||
ret = av_bsf_alloc(f, &sti->extract_extradata.bsf);
|
||||
if (ret < 0)
|
||||
goto fail;
|
||||
|
||||
ret = avcodec_parameters_copy(i->extract_extradata.bsf->par_in,
|
||||
ret = avcodec_parameters_copy(sti->extract_extradata.bsf->par_in,
|
||||
st->codecpar);
|
||||
if (ret < 0)
|
||||
goto fail;
|
||||
|
||||
i->extract_extradata.bsf->time_base_in = st->time_base;
|
||||
sti->extract_extradata.bsf->time_base_in = st->time_base;
|
||||
|
||||
ret = av_bsf_init(i->extract_extradata.bsf);
|
||||
ret = av_bsf_init(sti->extract_extradata.bsf);
|
||||
if (ret < 0)
|
||||
goto fail;
|
||||
|
||||
finish:
|
||||
i->extract_extradata.inited = 1;
|
||||
sti->extract_extradata.inited = 1;
|
||||
|
||||
return 0;
|
||||
fail:
|
||||
av_bsf_free(&i->extract_extradata.bsf);
|
||||
av_packet_free(&i->extract_extradata.pkt);
|
||||
av_bsf_free(&sti->extract_extradata.bsf);
|
||||
av_packet_free(&sti->extract_extradata.pkt);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int extract_extradata(AVStream *st, AVPacket *pkt)
|
||||
{
|
||||
AVStreamInternal *i = st->internal;
|
||||
AVStreamInternal *sti = st->internal;
|
||||
AVPacket *pkt_ref;
|
||||
int ret;
|
||||
|
||||
if (!i->extract_extradata.inited) {
|
||||
if (!sti->extract_extradata.inited) {
|
||||
ret = extract_extradata_init(st);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (i->extract_extradata.inited && !i->extract_extradata.bsf)
|
||||
if (sti->extract_extradata.inited && !sti->extract_extradata.bsf)
|
||||
return 0;
|
||||
|
||||
pkt_ref = i->extract_extradata.pkt;
|
||||
pkt_ref = sti->extract_extradata.pkt;
|
||||
ret = av_packet_ref(pkt_ref, pkt);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
ret = av_bsf_send_packet(i->extract_extradata.bsf, pkt_ref);
|
||||
ret = av_bsf_send_packet(sti->extract_extradata.bsf, pkt_ref);
|
||||
if (ret < 0) {
|
||||
av_packet_unref(pkt_ref);
|
||||
return ret;
|
||||
}
|
||||
|
||||
while (ret >= 0 && !i->avctx->extradata) {
|
||||
while (ret >= 0 && !sti->avctx->extradata) {
|
||||
int extradata_size;
|
||||
uint8_t *extradata;
|
||||
|
||||
ret = av_bsf_receive_packet(i->extract_extradata.bsf, pkt_ref);
|
||||
ret = av_bsf_receive_packet(sti->extract_extradata.bsf, pkt_ref);
|
||||
if (ret < 0) {
|
||||
if (ret != AVERROR(EAGAIN) && ret != AVERROR_EOF)
|
||||
return ret;
|
||||
@ -3544,13 +3544,13 @@ static int extract_extradata(AVStream *st, AVPacket *pkt)
|
||||
&extradata_size);
|
||||
|
||||
if (extradata) {
|
||||
i->avctx->extradata = av_mallocz(extradata_size + AV_INPUT_BUFFER_PADDING_SIZE);
|
||||
if (!i->avctx->extradata) {
|
||||
sti->avctx->extradata = av_mallocz(extradata_size + AV_INPUT_BUFFER_PADDING_SIZE);
|
||||
if (!sti->avctx->extradata) {
|
||||
av_packet_unref(pkt_ref);
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
memcpy(i->avctx->extradata, extradata, extradata_size);
|
||||
i->avctx->extradata_size = extradata_size;
|
||||
memcpy(sti->avctx->extradata, extradata, extradata_size);
|
||||
sti->avctx->extradata_size = extradata_size;
|
||||
}
|
||||
av_packet_unref(pkt_ref);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user