X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavformat%2Flibnut.c;h=757f9d252a7a7347ff11f3ab2d245f5465c50e3c;hb=b5a69e79c579e6e15e2019ffd34ef0e09aeab586;hp=7628abdfb8c571f9366c9ff2fc88ea1fc18c2725;hpb=dbb38bc389e1af5ed465ed370887d6af4da0cb40;p=ffmpeg diff --git a/libavformat/libnut.c b/libavformat/libnut.c index 7628abdfb8c..757f9d252a7 100644 --- a/libavformat/libnut.c +++ b/libavformat/libnut.c @@ -26,6 +26,7 @@ */ #include "avformat.h" +#include "internal.h" #include "riff.h" #include @@ -70,6 +71,8 @@ static int nut_write_header(AVFormatContext * avf) { int i; priv->s = s = av_mallocz((avf->nb_streams + 1) * sizeof*s); + if(!s) + return AVERROR(ENOMEM); for (i = 0; i < avf->nb_streams; i++) { AVCodecContext * codec = avf->streams[i]->codec; @@ -92,7 +95,7 @@ static int nut_write_header(AVFormatContext * avf) { for (j = 0; j < s[i].fourcc_len; j++) s[i].fourcc[j] = (fourcc >> (j*8)) & 0xFF; ff_parse_specific_params(codec, &num, &ssize, &denom); - av_set_pts_info(avf->streams[i], 60, denom, num); + avpriv_set_pts_info(avf->streams[i], 60, denom, num); s[i].time_base.num = denom; s[i].time_base.den = num; @@ -204,9 +207,13 @@ static int nut_read_header(AVFormatContext * avf, AVFormatParameters * ap) { nut_stream_header_tt * s; int ret, i; + if(!nut) + return -1; + if ((ret = nut_read_headers(nut, &s, NULL))) { av_log(avf, AV_LOG_ERROR, " NUT error: %s\n", nut_error(ret)); nut_demuxer_uninit(nut); + priv->nut = NULL; return -1; } @@ -223,10 +230,15 @@ static int nut_read_header(AVFormatContext * avf, AVFormatParameters * ap) { st->codec->extradata_size = s[i].codec_specific_len; if (st->codec->extradata_size) { st->codec->extradata = av_mallocz(st->codec->extradata_size); + if(!st->codec->extradata){ + nut_demuxer_uninit(nut); + priv->nut = NULL; + return AVERROR(ENOMEM); + } memcpy(st->codec->extradata, s[i].codec_specific, st->codec->extradata_size); } - av_set_pts_info(avf->streams[i], 60, s[i].time_base.num, s[i].time_base.den); + avpriv_set_pts_info(avf->streams[i], 60, s[i].time_base.num, s[i].time_base.den); st->start_time = 0; st->duration = s[i].max_pts;