Browse code

Replace all uses of av_close_input_file() with avformat_close_input().

Anton Khirnov authored on 2011/12/11 18:38:28
Showing 14 changed files
... ...
@@ -523,7 +523,7 @@ void exit_program(int ret)
523 523
         av_dict_free(&output_files[i].opts);
524 524
     }
525 525
     for(i=0;i<nb_input_files;i++) {
526
-        av_close_input_file(input_files[i].ctx);
526
+        avformat_close_input(&input_files[i].ctx);
527 527
     }
528 528
     for (i = 0; i < nb_input_streams; i++) {
529 529
         av_freep(&input_streams[i].decoded_frame);
... ...
@@ -3023,7 +3023,7 @@ static int opt_input_file(OptionsContext *o, const char *opt, const char *filena
3023 3023
     ret = avformat_find_stream_info(ic, opts);
3024 3024
     if (ret < 0) {
3025 3025
         av_log(NULL, AV_LOG_FATAL, "%s: could not find codec parameters\n", filename);
3026
-        av_close_input_file(ic);
3026
+        avformat_close_input(&ic);
3027 3027
         exit_program(1);
3028 3028
     }
3029 3029
 
... ...
@@ -2593,8 +2593,7 @@ static int decode_thread(void *arg)
2593 2593
     if (is->subtitle_stream >= 0)
2594 2594
         stream_component_close(is, is->subtitle_stream);
2595 2595
     if (is->ic) {
2596
-        av_close_input_file(is->ic);
2597
-        is->ic = NULL; /* safety */
2596
+        avformat_close_input(&is->ic);
2598 2597
     }
2599 2598
     avio_set_interrupt_cb(NULL);
2600 2599
 
... ...
@@ -325,7 +325,7 @@ static int probe_file(const char *filename)
325 325
     if (do_show_format)
326 326
         show_format(fmt_ctx);
327 327
 
328
-    av_close_input_file(fmt_ctx);
328
+    avformat_close_input(&fmt_ctx);
329 329
     return 0;
330 330
 }
331 331
 
... ...
@@ -849,7 +849,7 @@ static void close_connection(HTTPContext *c)
849 849
             if (st->codec->codec)
850 850
                 avcodec_close(st->codec);
851 851
         }
852
-        av_close_input_file(c->fmt_in);
852
+        avformat_close_input(&c->fmt_in);
853 853
     }
854 854
 
855 855
     /* free RTP output streams if any */
... ...
@@ -2169,7 +2169,7 @@ static int open_input_stream(HTTPContext *c, const char *info)
2169 2169
     c->fmt_in = s;
2170 2170
     if (strcmp(s->iformat->name, "ffm") && avformat_find_stream_info(c->fmt_in, NULL) < 0) {
2171 2171
         http_log("Could not find stream info '%s'\n", input_filename);
2172
-        av_close_input_file(s);
2172
+        avformat_close_input(&s);
2173 2173
         return -1;
2174 2174
     }
2175 2175
 
... ...
@@ -2311,8 +2311,7 @@ static int http_prepare_data(HTTPContext *c)
2311 2311
                     return 0;
2312 2312
                 } else {
2313 2313
                     if (c->stream->loop) {
2314
-                        av_close_input_file(c->fmt_in);
2315
-                        c->fmt_in = NULL;
2314
+                        avformat_close_input(&c->fmt_in);
2316 2315
                         if (open_input_stream(c, "") < 0)
2317 2316
                             goto no_loop;
2318 2317
                         goto redo;
... ...
@@ -2736,7 +2735,7 @@ static int http_receive_data(HTTPContext *c)
2736 2736
 
2737 2737
             /* Now we have the actual streams */
2738 2738
             if (s->nb_streams != feed->nb_streams) {
2739
-                av_close_input_file(s);
2739
+                avformat_close_input(&s);
2740 2740
                 av_free(pb);
2741 2741
                 http_log("Feed '%s' stream number does not match registered feed\n",
2742 2742
                          c->stream->feed_filename);
... ...
@@ -2749,7 +2748,7 @@ static int http_receive_data(HTTPContext *c)
2749 2749
                 avcodec_copy_context(fst->codec, st->codec);
2750 2750
             }
2751 2751
 
2752
-            av_close_input_file(s);
2752
+            avformat_close_input(&s);
2753 2753
             av_free(pb);
2754 2754
         }
2755 2755
         c->buffer_ptr = c->buffer;
... ...
@@ -3629,7 +3628,7 @@ static void build_file_streams(void)
3629 3629
                 if (avformat_find_stream_info(infile, NULL) < 0) {
3630 3630
                     http_log("Could not find codec parameters from '%s'\n",
3631 3631
                              stream->feed_filename);
3632
-                    av_close_input_file(infile);
3632
+                    avformat_close_input(&infile);
3633 3633
                     goto fail;
3634 3634
                 }
3635 3635
                 extract_mpeg4_header(infile);
... ...
@@ -3637,7 +3636,7 @@ static void build_file_streams(void)
3637 3637
                 for(i=0;i<infile->nb_streams;i++)
3638 3638
                     add_av_stream1(stream, infile->streams[i]->codec, 1);
3639 3639
 
3640
-                av_close_input_file(infile);
3640
+                avformat_close_input(&infile);
3641 3641
             }
3642 3642
         }
3643 3643
     }
... ...
@@ -3727,7 +3726,7 @@ static void build_feed_streams(void)
3727 3727
                     http_log("Deleting feed file '%s' as stream counts differ (%d != %d)\n",
3728 3728
                         feed->feed_filename, s->nb_streams, feed->nb_streams);
3729 3729
 
3730
-                av_close_input_file(s);
3730
+                avformat_close_input(&s);
3731 3731
             } else
3732 3732
                 http_log("Deleting feed file '%s' as it appears to be corrupt\n",
3733 3733
                         feed->feed_filename);
... ...
@@ -192,7 +192,7 @@ static av_cold void uninit(AVFilterContext *ctx)
192 192
     if (movie->codec_ctx)
193 193
         avcodec_close(movie->codec_ctx);
194 194
     if (movie->format_ctx)
195
-        av_close_input_file(movie->format_ctx);
195
+        avformat_close_input(&movie->format_ctx);
196 196
     avfilter_unref_buffer(movie->picref);
197 197
     av_freep(&movie->frame);
198 198
 }
... ...
@@ -132,7 +132,7 @@ static void free_variant_list(AppleHTTPContext *c)
132 132
             ffurl_close(var->input);
133 133
         if (var->ctx) {
134 134
             var->ctx->pb = NULL;
135
-            av_close_input_file(var->ctx);
135
+            avformat_close_input(&var->ctx);
136 136
         }
137 137
         av_free(var);
138 138
     }
... ...
@@ -1365,7 +1365,7 @@ static int avi_read_close(AVFormatContext *s)
1365 1365
         if (ast) {
1366 1366
             if (ast->sub_ctx) {
1367 1367
                 av_freep(&ast->sub_ctx->pb);
1368
-                av_close_input_file(ast->sub_ctx);
1368
+                avformat_close_input(&ast->sub_ctx);
1369 1369
             }
1370 1370
             av_free(ast->sub_buffer);
1371 1371
             av_free_packet(&ast->sub_pkt);
... ...
@@ -368,7 +368,7 @@ static void mpegts_close_filter(MpegTSContext *ts, MpegTSFilter *filter)
368 368
         PESContext *pes = filter->u.pes_filter.opaque;
369 369
         av_freep(&pes->buffer);
370 370
         /* referenced private data will be freed later in
371
-         * av_close_input_file */
371
+         * avformat_close_input */
372 372
         if (!((PESContext *)filter->u.pes_filter.opaque)->st) {
373 373
             av_freep(&filter->u.pes_filter.opaque);
374 374
         }
... ...
@@ -544,7 +544,7 @@ rdt_free_context (PayloadContext *rdt)
544 544
             av_freep(&rdt->rmst[i]);
545 545
         }
546 546
     if (rdt->rmctx)
547
-        av_close_input_file(rdt->rmctx);
547
+        avformat_close_input(&rdt->rmctx);
548 548
     av_freep(&rdt->mlti_data);
549 549
     av_freep(&rdt->rmst);
550 550
     av_free(rdt);
... ...
@@ -108,8 +108,7 @@ int ff_wms_parse_sdp_a_line(AVFormatContext *s, const char *p)
108 108
                    "Failed to fix invalid RTSP-MS/ASF min_pktsize\n");
109 109
         init_packetizer(&pb, buf, len);
110 110
         if (rt->asf_ctx) {
111
-            av_close_input_file(rt->asf_ctx);
112
-            rt->asf_ctx = NULL;
111
+            avformat_close_input(&rt->asf_ctx);
113 112
         }
114 113
         if (!(rt->asf_ctx = avformat_alloc_context()))
115 114
             return AVERROR(ENOMEM);
... ...
@@ -580,8 +580,7 @@ void ff_rtsp_close_streams(AVFormatContext *s)
580 580
     }
581 581
     av_free(rt->rtsp_streams);
582 582
     if (rt->asf_ctx) {
583
-        av_close_input_file(rt->asf_ctx);
584
-        rt->asf_ctx = NULL;
583
+        avformat_close_input(&rt->asf_ctx);
585 584
     }
586 585
     av_free(rt->p);
587 586
     av_free(rt->recvbuf);
... ...
@@ -52,7 +52,7 @@ static int sap_read_close(AVFormatContext *s)
52 52
 {
53 53
     struct SAPState *sap = s->priv_data;
54 54
     if (sap->sdp_ctx)
55
-        av_close_input_file(sap->sdp_ctx);
55
+        avformat_close_input(&sap->sdp_ctx);
56 56
     if (sap->ann_fd)
57 57
         ffurl_close(sap->ann_fd);
58 58
     av_freep(&sap->sdp);
... ...
@@ -127,7 +127,7 @@ int main(int argc, char **argv)
127 127
         printf("ret:%-10s st:%2d flags:%d  ts:%s\n", ret_str(ret), stream_id, i&1, ts_buf);
128 128
     }
129 129
 
130
-    av_close_input_file(ic);
130
+    avformat_close_input(&ic);
131 131
 
132 132
     return 0;
133 133
 }
... ...
@@ -117,7 +117,7 @@ int main(int argc, char **argv)
117 117
             break;
118 118
     }
119 119
 
120
-    av_close_input_file(fctx);
120
+    avformat_close_input(&fctx);
121 121
 
122 122
     while (donotquit)
123 123
         sleep(60);