X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavformat%2F4xm.c;h=ccbe3add3f497f2efd89cb0e3e91a3afeb1405b6;hb=4bf3c8f226252e18de8051fd0d417c1d39857b67;hp=622413494852b7c43074019f8bd2067559452c0a;hpb=dfc2c4d900e48fa788ad9364ac408c01cfb62b94;p=ffmpeg diff --git a/libavformat/4xm.c b/libavformat/4xm.c index 62241349485..ccbe3add3f4 100644 --- a/libavformat/4xm.c +++ b/libavformat/4xm.c @@ -28,8 +28,9 @@ */ #include "libavutil/intreadwrite.h" -#include "libavutil/intfloat_readwrite.h" +#include "libavutil/intfloat.h" #include "avformat.h" +#include "internal.h" #define RIFF_TAG MKTAG('R', 'I', 'F', 'F') #define FOURXMV_TAG MKTAG('4', 'X', 'M', 'V') @@ -130,7 +131,7 @@ static int fourxm_read_header(AVFormatContext *s, size = AV_RL32(&header[i + 4]); if (fourcc_tag == std__TAG) { - fourxm->fps = av_int2flt(AV_RL32(&header[i + 12])); + fourxm->fps = av_int2float(AV_RL32(&header[i + 12])); } else if (fourcc_tag == vtrk_TAG) { /* check that there is enough data */ if (size != vtrk_SIZE) { @@ -141,12 +142,12 @@ static int fourxm_read_header(AVFormatContext *s, fourxm->height = AV_RL32(&header[i + 40]); /* allocate a new AVStream */ - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st){ ret= AVERROR(ENOMEM); goto fail; } - av_set_pts_info(st, 60, 1, fourxm->fps); + avpriv_set_pts_info(st, 60, 1, fourxm->fps); fourxm->video_stream_index = st->index; @@ -173,13 +174,15 @@ static int fourxm_read_header(AVFormatContext *s, goto fail; } if (current_track + 1 > fourxm->track_count) { - fourxm->track_count = current_track + 1; fourxm->tracks = av_realloc(fourxm->tracks, - fourxm->track_count * sizeof(AudioTrack)); + (current_track + 1) * sizeof(AudioTrack)); if (!fourxm->tracks) { - ret= AVERROR(ENOMEM); + ret = AVERROR(ENOMEM); goto fail; } + memset(&fourxm->tracks[fourxm->track_count], 0, + sizeof(AudioTrack) * (current_track + 1 - fourxm->track_count)); + fourxm->track_count = current_track + 1; } fourxm->tracks[current_track].adpcm = AV_RL32(&header[i + 12]); fourxm->tracks[current_track].channels = AV_RL32(&header[i + 36]); @@ -196,13 +199,14 @@ static int fourxm_read_header(AVFormatContext *s, i += 8 + size; /* allocate a new AVStream */ - st = av_new_stream(s, current_track); + st = avformat_new_stream(s, NULL); if (!st){ ret= AVERROR(ENOMEM); goto fail; } - av_set_pts_info(st, 60, 1, fourxm->tracks[current_track].sample_rate); + st->id = current_track; + avpriv_set_pts_info(st, 60, 1, fourxm->tracks[current_track].sample_rate); fourxm->tracks[current_track].stream_index = st->index;