]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/sapdec.c
mpeg12dec: reset first_field with picture_structure changes.
[ffmpeg] / libavformat / sapdec.c
index 5351e9883daef5abb528cb83dc012f096f87ae55..9ce069e199adc5b24595b1d3fa302bd3abe8a798 100644 (file)
@@ -52,7 +52,7 @@ static int sap_read_close(AVFormatContext *s)
 {
     struct SAPState *sap = s->priv_data;
     if (sap->sdp_ctx)
-        av_close_input_file(sap->sdp_ctx);
+        avformat_close_input(&sap->sdp_ctx);
     if (sap->ann_fd)
         ffurl_close(sap->ann_fd);
     av_freep(&sap->sdp);
@@ -85,7 +85,8 @@ static int sap_read_header(AVFormatContext *s,
 
     ff_url_join(url, sizeof(url), "udp", NULL, host, port, "?localport=%d",
                 port);
-    ret = ffurl_open(&sap->ann_fd, url, AVIO_FLAG_READ);
+    ret = ffurl_open(&sap->ann_fd, url, AVIO_FLAG_READ,
+                     &s->interrupt_callback, NULL);
     if (ret)
         goto fail;
 
@@ -157,17 +158,19 @@ static int sap_read_header(AVFormatContext *s,
     }
     sap->sdp_ctx->max_delay = s->max_delay;
     sap->sdp_ctx->pb        = &sap->sdp_pb;
+    sap->sdp_ctx->interrupt_callback = s->interrupt_callback;
     ret = avformat_open_input(&sap->sdp_ctx, "temp.sdp", infmt, NULL);
     if (ret < 0)
         goto fail;
     if (sap->sdp_ctx->ctx_flags & AVFMTCTX_NOHEADER)
         s->ctx_flags |= AVFMTCTX_NOHEADER;
     for (i = 0; i < sap->sdp_ctx->nb_streams; i++) {
-        AVStream *st = av_new_stream(s, i);
+        AVStream *st = avformat_new_stream(s, NULL);
         if (!st) {
             ret = AVERROR(ENOMEM);
             goto fail;
         }
+        st->id = i;
         avcodec_copy_context(st->codec, sap->sdp_ctx->streams[i]->codec);
         st->time_base = sap->sdp_ctx->streams[i]->time_base;
     }
@@ -211,11 +214,12 @@ static int sap_fetch_packet(AVFormatContext *s, AVPacket *pkt)
     if (s->ctx_flags & AVFMTCTX_NOHEADER) {
         while (sap->sdp_ctx->nb_streams > s->nb_streams) {
             int i = s->nb_streams;
-            AVStream *st = av_new_stream(s, i);
+            AVStream *st = avformat_new_stream(s, NULL);
             if (!st) {
                 av_free_packet(pkt);
                 return AVERROR(ENOMEM);
             }
+            st->id = i;
             avcodec_copy_context(st->codec, sap->sdp_ctx->streams[i]->codec);
             st->time_base = sap->sdp_ctx->streams[i]->time_base;
         }