X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavformat%2Fg723_1.c;h=a12a47a1ae777d1472988a4bcdd049d53ed9d890;hb=e37f161e66e042d6c2c7470c4d9881df9427fc4a;hp=19441a1b19da87893587f851ed43e582c9ef7018;hpb=6ace8374bacf33e5f3407cb50e928e7533eb5e92;p=ffmpeg diff --git a/libavformat/g723_1.c b/libavformat/g723_1.c index 19441a1b19d..a12a47a1ae7 100644 --- a/libavformat/g723_1.c +++ b/libavformat/g723_1.c @@ -25,14 +25,15 @@ */ #include "avformat.h" +#include "internal.h" static const uint8_t frame_size[4] = {24, 20, 4, 1}; -static int g723_1_init(AVFormatContext *s, AVFormatParameters *ap) +static int g723_1_init(AVFormatContext *s) { AVStream *st; - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); @@ -41,7 +42,7 @@ static int g723_1_init(AVFormatContext *s, AVFormatParameters *ap) st->codec->channels = 1; st->codec->sample_rate = 8000; - av_set_pts_info(st, 64, 1, st->codec->sample_rate); + avpriv_set_pts_info(st, 64, 1, st->codec->sample_rate); return 0; } @@ -50,8 +51,8 @@ static int g723_1_read_packet(AVFormatContext *s, AVPacket *pkt) { int size, byte, ret; - pkt->pos = url_ftell(s->pb); - byte = get_byte(s->pb); + pkt->pos = avio_tell(s->pb); + byte = avio_r8(s->pb); size = frame_size[byte & 3]; ret = av_new_packet(pkt, size); @@ -62,7 +63,7 @@ static int g723_1_read_packet(AVFormatContext *s, AVPacket *pkt) pkt->duration = 240; pkt->stream_index = 0; - ret = get_buffer(s->pb, pkt->data + 1, size - 1); + ret = avio_read(s->pb, pkt->data + 1, size - 1); if (ret < size - 1) { av_free_packet(pkt); return ret < 0 ? ret : AVERROR_EOF; @@ -72,12 +73,10 @@ static int g723_1_read_packet(AVFormatContext *s, AVPacket *pkt) } AVInputFormat ff_g723_1_demuxer = { - "g723_1", - NULL_IF_CONFIG_SMALL("G.723.1 format"), - 0, - NULL, - g723_1_init, - g723_1_read_packet, + .name = "g723_1", + .long_name = NULL_IF_CONFIG_SMALL("G.723.1 format"), + .read_header = g723_1_init, + .read_packet = g723_1_read_packet, .extensions = "tco,rco", .flags = AVFMT_GENERIC_INDEX };