mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
avformat/nutenc: Add goto fail in nut_write_headers()
It allows to combine several ffio_free_dyn_buf(). Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
This commit is contained in:
parent
2ffa8be53b
commit
9b9a61ca77
@ -632,8 +632,7 @@ static int write_headers(AVFormatContext *avctx, AVIOContext *bc)
|
|||||||
for (i = 0; i < nut->avf->nb_streams; i++) {
|
for (i = 0; i < nut->avf->nb_streams; i++) {
|
||||||
ret = write_streamheader(avctx, dyn_bc, nut->avf->streams[i], i);
|
ret = write_streamheader(avctx, dyn_bc, nut->avf->streams[i], i);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
ffio_free_dyn_buf(&dyn_bc);
|
goto fail;
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
put_packet(nut, bc, dyn_bc, STREAM_STARTCODE);
|
put_packet(nut, bc, dyn_bc, STREAM_STARTCODE);
|
||||||
}
|
}
|
||||||
@ -646,16 +645,14 @@ static int write_headers(AVFormatContext *avctx, AVIOContext *bc)
|
|||||||
if (ret > 0)
|
if (ret > 0)
|
||||||
put_packet(nut, bc, dyn_bc, INFO_STARTCODE);
|
put_packet(nut, bc, dyn_bc, INFO_STARTCODE);
|
||||||
else if (ret < 0) {
|
else if (ret < 0) {
|
||||||
ffio_free_dyn_buf(&dyn_bc);
|
goto fail;
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < nut->avf->nb_chapters; i++) {
|
for (i = 0; i < nut->avf->nb_chapters; i++) {
|
||||||
ret = write_chapter(nut, dyn_bc, i);
|
ret = write_chapter(nut, dyn_bc, i);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
ffio_free_dyn_buf(&dyn_bc);
|
goto fail;
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
put_packet(nut, bc, dyn_bc, INFO_STARTCODE);
|
put_packet(nut, bc, dyn_bc, INFO_STARTCODE);
|
||||||
}
|
}
|
||||||
@ -663,9 +660,11 @@ static int write_headers(AVFormatContext *avctx, AVIOContext *bc)
|
|||||||
nut->last_syncpoint_pos = INT_MIN;
|
nut->last_syncpoint_pos = INT_MIN;
|
||||||
nut->header_count++;
|
nut->header_count++;
|
||||||
|
|
||||||
|
ret = 0;
|
||||||
|
fail:
|
||||||
ffio_free_dyn_buf(&dyn_bc);
|
ffio_free_dyn_buf(&dyn_bc);
|
||||||
|
|
||||||
return 0;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int nut_write_header(AVFormatContext *s)
|
static int nut_write_header(AVFormatContext *s)
|
||||||
|
Loading…
Reference in New Issue
Block a user