X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavformat%2Fdxa.c;h=78e7290837e1c1cfe75936591fd3ca7dab138a0c;hb=3c3b8003a13d9c3668c0bb6d79d2376da3b2b352;hp=1e1d50581cb7894537f82421a334a3861989a0ca;hpb=ca402f32e392590a81a1381dab41c4f9c2c2f98a;p=ffmpeg diff --git a/libavformat/dxa.c b/libavformat/dxa.c index 1e1d50581cb..78e7290837e 100644 --- a/libavformat/dxa.c +++ b/libavformat/dxa.c @@ -19,8 +19,11 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include + #include "libavutil/intreadwrite.h" #include "avformat.h" +#include "internal.h" #include "riff.h" #define DXA_EXTRA_SIZE 9 @@ -50,7 +53,7 @@ static int dxa_probe(AVProbeData *p) return 0; } -static int dxa_read_header(AVFormatContext *s, AVFormatParameters *ap) +static int dxa_read_header(AVFormatContext *s) { AVIOContext *pb = s->pb; DXAContext *c = s->priv_data; @@ -87,7 +90,7 @@ static int dxa_read_header(AVFormatContext *s, AVFormatParameters *ap) h = avio_rb16(pb); c->has_sound = 0; - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return -1; @@ -100,12 +103,14 @@ static int dxa_read_header(AVFormatContext *s, AVFormatParameters *ap) avio_skip(pb, 16); fsize = avio_rl32(pb); - ast = av_new_stream(s, 0); + ast = avformat_new_stream(s, NULL); if (!ast) return -1; ret = ff_get_wav_header(pb, ast->codec, fsize); if (ret < 0) return ret; + if (ast->codec->sample_rate > 0) + avpriv_set_pts_info(ast, 64, 1, ast->codec->sample_rate); // find 'data' chunk while(avio_tell(pb) < c->vidpos && !pb->eof_reached){ tag = avio_rl32(pb); @@ -123,11 +128,11 @@ static int dxa_read_header(AVFormatContext *s, AVFormatParameters *ap) /* now we are ready: build format streams */ st->codec->codec_type = AVMEDIA_TYPE_VIDEO; - st->codec->codec_id = CODEC_ID_DXA; + st->codec->codec_id = AV_CODEC_ID_DXA; st->codec->width = w; st->codec->height = h; av_reduce(&den, &num, den, num, (1UL<<31)-1); - av_set_pts_info(st, 33, num, den); + avpriv_set_pts_info(st, 33, num, den); /* flags & 0x80 means that image is interlaced, * flags & 0x40 means that image has double height * either way set true height @@ -187,7 +192,8 @@ static int dxa_read_packet(AVFormatContext *s, AVPacket *pkt) avio_read(s->pb, buf + 4, DXA_EXTRA_SIZE - 4); size = AV_RB32(buf + 5); if(size > 0xFFFFFF){ - av_log(s, AV_LOG_ERROR, "Frame size is too big: %d\n", size); + av_log(s, AV_LOG_ERROR, "Frame size is too big: %"PRIu32"\n", + size); return -1; } if(av_new_packet(pkt, size + DXA_EXTRA_SIZE + pal_size) < 0) @@ -213,10 +219,10 @@ static int dxa_read_packet(AVFormatContext *s, AVPacket *pkt) } AVInputFormat ff_dxa_demuxer = { - "dxa", - NULL_IF_CONFIG_SMALL("DXA"), - sizeof(DXAContext), - dxa_probe, - dxa_read_header, - dxa_read_packet, + .name = "dxa", + .long_name = NULL_IF_CONFIG_SMALL("DXA"), + .priv_data_size = sizeof(DXAContext), + .read_probe = dxa_probe, + .read_header = dxa_read_header, + .read_packet = dxa_read_packet, };