]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/r3d.c
avformat: Constify all muxer/demuxers
[ffmpeg] / libavformat / r3d.c
index 7aa0c5a2c38d7327b2e9fa08bd9e731c80329eb7..004efac3557a0163696f66a2504f5cb85b7812ac 100644 (file)
@@ -56,6 +56,7 @@ static int r3d_read_red1(AVFormatContext *s)
     R3DContext *r3d = s->priv_data;
     char filename[258];
     int tmp;
+    int ret;
     int av_unused tmp2;
     AVRational framerate;
 
@@ -97,7 +98,9 @@ static int r3d_read_red1(AVFormatContext *s)
     r3d->audio_channels = avio_r8(s->pb); // audio channels
     av_log(s, AV_LOG_TRACE, "audio channels %d\n", tmp);
 
-    avio_read(s->pb, filename, 257);
+    ret = avio_read(s->pb, filename, 257);
+    if (ret < 257)
+        return ret < 0 ? ret : AVERROR_EOF;
     filename[sizeof(filename)-1] = 0;
     av_dict_set(&st->metadata, "filename", filename, 0);
 
@@ -322,7 +325,8 @@ static int r3d_read_reda(AVFormatContext *s, AVPacket *pkt, Atom *atom)
 
     pkt->stream_index = 1;
     pkt->dts = dts;
-    if (st->codecpar->sample_rate)
+
+    if (st->codecpar->sample_rate && samples > 0)
         pkt->duration = av_rescale(samples, st->time_base.den, st->codecpar->sample_rate);
     av_log(s, AV_LOG_TRACE, "pkt dts %"PRId64" duration %"PRId64" samples %d sample rate %d\n",
             pkt->dts, pkt->duration, samples, st->codecpar->sample_rate);
@@ -396,7 +400,7 @@ static int r3d_seek(AVFormatContext *s, int stream_index, int64_t sample_time, i
     return 0;
 }
 
-AVInputFormat ff_r3d_demuxer = {
+const AVInputFormat ff_r3d_demuxer = {
     .name           = "r3d",
     .long_name      = NULL_IF_CONFIG_SMALL("REDCODE R3D"),
     .priv_data_size = sizeof(R3DContext),