#include "libavutil/channel_layout.h"
#include "avformat.h"
#include "internal.h"
+#include "rawenc.h"
typedef struct {
uint64_t cumulated_size;
}
return 0;
}
-
-static int amr_write_packet(AVFormatContext *s, AVPacket *pkt)
-{
- avio_write(s->pb, pkt->data, pkt->size);
- return 0;
-}
#endif /* CONFIG_AMR_MUXER */
static int amr_probe(const AVProbeData *p)
AVStream *st;
uint8_t header[9];
- avio_read(pb, header, 6);
+ if (avio_read(pb, header, 6) != 6)
+ return AVERROR_INVALIDDATA;
st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
if (memcmp(header, AMR_header, 6)) {
- avio_read(pb, header + 6, 3);
+ if (avio_read(pb, header + 6, 3) != 3)
+ return AVERROR_INVALIDDATA;
if (memcmp(header, AMRWB_header, 9)) {
return -1;
}
read = avio_read(s->pb, pkt->data + 1, size - 1);
if (read != size - 1) {
- av_packet_unref(pkt);
if (read < 0)
return read;
return AVERROR(EIO);
.audio_codec = AV_CODEC_ID_AMR_NB,
.video_codec = AV_CODEC_ID_NONE,
.write_header = amr_write_header,
- .write_packet = amr_write_packet,
+ .write_packet = ff_raw_write_packet,
.flags = AVFMT_NOTIMESTAMPS,
};
#endif