]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/r3d.c
ffmpeg: preserve avg_frame_rate on stream copy.
[ffmpeg] / libavformat / r3d.c
index 4658ea1e5d6b6619bef2a8597a36793166b72da4..75fc4a4c962427d982baf806da4819577edfcd71 100644 (file)
@@ -52,7 +52,7 @@ static int read_atom(AVFormatContext *s, Atom *atom)
 
 static int r3d_read_red1(AVFormatContext *s)
 {
-    AVStream *st = av_new_stream(s, 0);
+    AVStream *st = avformat_new_stream(s, NULL);
     char filename[258];
     int tmp;
     int av_unused tmp2;
@@ -89,7 +89,7 @@ static int r3d_read_red1(AVFormatContext *s)
     tmp = avio_r8(s->pb); // audio channels
     av_dlog(s, "audio channels %d\n", tmp);
     if (tmp > 0) {
-        AVStream *ast = av_new_stream(s, 1);
+        AVStream *ast = avformat_new_stream(s, NULL);
         if (!ast)
             return AVERROR(ENOMEM);
         ast->codec->codec_type = AVMEDIA_TYPE_AUDIO;
@@ -365,7 +365,8 @@ static int r3d_seek(AVFormatContext *s, int stream_index, int64_t sample_time, i
             frame_num, sample_time);
 
     if (frame_num < r3d->video_offsets_count) {
-        avio_seek(s->pb, r3d->video_offsets_count, SEEK_SET);
+        if (avio_seek(s->pb, r3d->video_offsets_count, SEEK_SET) < 0)
+            return -1;
     } else {
         av_log(s, AV_LOG_ERROR, "could not seek to frame %d\n", frame_num);
         return -1;