mirror of
				https://github.com/nyanmisaka/ffmpeg-rockchip.git
				synced 2025-10-31 04:26:37 +08:00 
			
		
		
		
	Use the new AVIOContext destructor.
This commit is contained in:
		| @@ -1178,7 +1178,7 @@ int main(int argc, char **argv) | |||||||
|     ret = probe_file(input_filename); |     ret = probe_file(input_filename); | ||||||
|     probe_footer(); |     probe_footer(); | ||||||
|     avio_flush(probe_out); |     avio_flush(probe_out); | ||||||
|     av_freep(&probe_out); |     avio_context_free(&probe_out); | ||||||
|     av_freep(&buffer); |     av_freep(&buffer); | ||||||
|     uninit_opts(); |     uninit_opts(); | ||||||
|     avformat_network_deinit(); |     avformat_network_deinit(); | ||||||
|   | |||||||
| @@ -901,7 +901,7 @@ static int read_gab2_sub(AVStream *st, AVPacket *pkt) | |||||||
|         return 1; |         return 1; | ||||||
|  |  | ||||||
| error: | error: | ||||||
|         av_freep(&pb); |         avio_context_free(&pb); | ||||||
|     } |     } | ||||||
|     return 0; |     return 0; | ||||||
| } | } | ||||||
| @@ -1576,7 +1576,7 @@ static int avi_read_close(AVFormatContext *s) | |||||||
|         AVIStream *ast = st->priv_data; |         AVIStream *ast = st->priv_data; | ||||||
|         if (ast) { |         if (ast) { | ||||||
|             if (ast->sub_ctx) { |             if (ast->sub_ctx) { | ||||||
|                 av_freep(&ast->sub_ctx->pb); |                 avio_context_free(&ast->sub_ctx->pb); | ||||||
|                 avformat_close_input(&ast->sub_ctx); |                 avformat_close_input(&ast->sub_ctx); | ||||||
|             } |             } | ||||||
|             av_free(ast->sub_buffer); |             av_free(ast->sub_buffer); | ||||||
|   | |||||||
| @@ -139,14 +139,14 @@ int ff_flac_parse_picture(AVFormatContext *s, uint8_t *buf, int buf_size) | |||||||
|     if (desc) |     if (desc) | ||||||
|         av_dict_set(&st->metadata, "title", desc, AV_DICT_DONT_STRDUP_VAL); |         av_dict_set(&st->metadata, "title", desc, AV_DICT_DONT_STRDUP_VAL); | ||||||
|  |  | ||||||
|     av_freep(&pb); |     avio_context_free(&pb); | ||||||
|  |  | ||||||
|     return 0; |     return 0; | ||||||
|  |  | ||||||
| fail: | fail: | ||||||
|     av_buffer_unref(&data); |     av_buffer_unref(&data); | ||||||
|     av_freep(&desc); |     av_freep(&desc); | ||||||
|     av_freep(&pb); |     avio_context_free(&pb); | ||||||
|  |  | ||||||
|     return ret; |     return ret; | ||||||
| } | } | ||||||
|   | |||||||
| @@ -143,8 +143,8 @@ static void hds_free(AVFormatContext *s) | |||||||
|             ff_format_io_close(s, &os->out); |             ff_format_io_close(s, &os->out); | ||||||
|         if (os->ctx && os->ctx_inited) |         if (os->ctx && os->ctx_inited) | ||||||
|             av_write_trailer(os->ctx); |             av_write_trailer(os->ctx); | ||||||
|         if (os->ctx && os->ctx->pb) |         if (os->ctx) | ||||||
|             av_free(os->ctx->pb); |             avio_context_free(&os->ctx->pb); | ||||||
|         if (os->ctx) |         if (os->ctx) | ||||||
|             avformat_free_context(os->ctx); |             avformat_free_context(os->ctx); | ||||||
|         av_free(os->metadata); |         av_free(os->metadata); | ||||||
|   | |||||||
| @@ -102,7 +102,7 @@ static int mpjpeg_read_probe(AVProbeData *p) | |||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     av_free(pb); |     avio_context_free(&pb); | ||||||
|  |  | ||||||
|     return ret; |     return ret; | ||||||
| } | } | ||||||
|   | |||||||
| @@ -324,7 +324,7 @@ get_cache: | |||||||
|                                   st, rdt->rmst[st->index], pkt); |                                   st, rdt->rmst[st->index], pkt); | ||||||
|         if (rdt->audio_pkt_cnt == 0 && |         if (rdt->audio_pkt_cnt == 0 && | ||||||
|             st->codecpar->codec_id == AV_CODEC_ID_AAC) |             st->codecpar->codec_id == AV_CODEC_ID_AAC) | ||||||
|             av_freep(&rdt->rmctx->pb); |             avio_context_free(&rdt->rmctx->pb); | ||||||
|     } |     } | ||||||
|     pkt->stream_index = st->index; |     pkt->stream_index = st->index; | ||||||
|     pkt->pts = *timestamp; |     pkt->pts = *timestamp; | ||||||
|   | |||||||
| @@ -184,10 +184,10 @@ static int open_null_ctx(AVIOContext **ctx) | |||||||
|     return 0; |     return 0; | ||||||
| } | } | ||||||
|  |  | ||||||
| static void close_null_ctx(AVIOContext *pb) | static void close_null_ctx(AVIOContext **pb) | ||||||
| { | { | ||||||
|     av_free(pb->buffer); |     av_free((*pb)->buffer); | ||||||
|     av_free(pb); |     avio_context_free(pb); | ||||||
| } | } | ||||||
|  |  | ||||||
| static void seg_free_context(SegmentContext *seg) | static void seg_free_context(SegmentContext *seg) | ||||||
| @@ -259,7 +259,7 @@ static int seg_write_header(AVFormatContext *s) | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     if (!seg->write_header_trailer) { |     if (!seg->write_header_trailer) { | ||||||
|         close_null_ctx(oc->pb); |         close_null_ctx(&oc->pb); | ||||||
|         if ((ret = s->io_open(s, &oc->pb, oc->filename, AVIO_FLAG_WRITE, NULL)) < 0) |         if ((ret = s->io_open(s, &oc->pb, oc->filename, AVIO_FLAG_WRITE, NULL)) < 0) | ||||||
|             goto fail; |             goto fail; | ||||||
|     } |     } | ||||||
| @@ -353,7 +353,7 @@ static int seg_write_trailer(struct AVFormatContext *s) | |||||||
|         if ((ret = open_null_ctx(&oc->pb)) < 0) |         if ((ret = open_null_ctx(&oc->pb)) < 0) | ||||||
|             goto fail; |             goto fail; | ||||||
|         ret = av_write_trailer(oc); |         ret = av_write_trailer(oc); | ||||||
|         close_null_ctx(oc->pb); |         close_null_ctx(&oc->pb); | ||||||
|     } else { |     } else { | ||||||
|         ret = segment_end(oc, 1); |         ret = segment_end(oc, 1); | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -187,8 +187,8 @@ static void ism_free(AVFormatContext *s) | |||||||
|         os->out = os->out2 = os->tail_out = NULL; |         os->out = os->out2 = os->tail_out = NULL; | ||||||
|         if (os->ctx && os->ctx_inited) |         if (os->ctx && os->ctx_inited) | ||||||
|             av_write_trailer(os->ctx); |             av_write_trailer(os->ctx); | ||||||
|         if (os->ctx && os->ctx->pb) |         if (os->ctx) | ||||||
|             av_free(os->ctx->pb); |             avio_context_free(&os->ctx->pb); | ||||||
|         if (os->ctx) |         if (os->ctx) | ||||||
|             avformat_free_context(os->ctx); |             avformat_free_context(os->ctx); | ||||||
|         av_free(os->private_str); |         av_free(os->private_str); | ||||||
|   | |||||||
| @@ -310,7 +310,9 @@ static av_cold int swf_read_close(AVFormatContext *avctx) | |||||||
|     inflateEnd(&s->zstream); |     inflateEnd(&s->zstream); | ||||||
|     av_freep(&s->zbuf_in); |     av_freep(&s->zbuf_in); | ||||||
|     av_freep(&s->zbuf_out); |     av_freep(&s->zbuf_out); | ||||||
|     av_freep(&s->zpb); |  | ||||||
|  |     avio_context_free(&s->zpb); | ||||||
|  |  | ||||||
|     return 0; |     return 0; | ||||||
| } | } | ||||||
| #endif | #endif | ||||||
|   | |||||||
| @@ -338,7 +338,7 @@ static void signal_init_ts(void) | |||||||
| static void finish(void) | static void finish(void) | ||||||
| { | { | ||||||
|     av_write_trailer(ctx); |     av_write_trailer(ctx); | ||||||
|     av_free(ctx->pb); |     avio_context_free(&ctx->pb); | ||||||
|     avformat_free_context(ctx); |     avformat_free_context(ctx); | ||||||
|     ctx = NULL; |     ctx = NULL; | ||||||
| } | } | ||||||
|   | |||||||
| @@ -313,7 +313,7 @@ static void wtvfile_close(AVIOContext *pb) | |||||||
|     av_free(wf->sectors); |     av_free(wf->sectors); | ||||||
|     av_free(wf); |     av_free(wf); | ||||||
|     av_free(pb->buffer); |     av_free(pb->buffer); | ||||||
|     av_free(pb); |     avio_context_free(&pb); | ||||||
| } | } | ||||||
|  |  | ||||||
| /* | /* | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Anton Khirnov
					Anton Khirnov