|
141 | 141 | #define AV_ALLOCATE_FRAME() av_frame_alloc() |
142 | 142 | #define AV_ALLOCATE_IMAGE(av_frame, pix_fmt, width, height) av_image_alloc(av_frame->data, av_frame->linesize, width, height, pix_fmt, 1) |
143 | 143 | #define AV_RESET_FRAME(av_frame) av_frame_unref(av_frame) |
144 | | - #define AV_FREE_FRAME(av_frame) av_frame_free(av_frame) |
| 144 | + #define AV_FREE_FRAME(av_frame) if (av_frame) av_frame_free(av_frame) |
145 | 145 | #define AV_FREE_PACKET(av_packet) av_packet_unref(av_packet) |
146 | 146 | #define AV_FREE_CONTEXT(av_context) avcodec_free_context(&av_context) |
147 | 147 | #define AV_GET_CODEC_TYPE(av_stream) av_stream->codecpar->codec_type |
|
176 | 176 | #define AV_ALLOCATE_FRAME() av_frame_alloc() |
177 | 177 | #define AV_ALLOCATE_IMAGE(av_frame, pix_fmt, width, height) av_image_alloc(av_frame->data, av_frame->linesize, width, height, pix_fmt, 1) |
178 | 178 | #define AV_RESET_FRAME(av_frame) av_frame_unref(av_frame) |
179 | | - #define AV_FREE_FRAME(av_frame) av_frame_free(av_frame) |
| 179 | + #define AV_FREE_FRAME(av_frame) if(av_frame) av_frame_free(av_frame) |
180 | 180 | #define AV_FREE_PACKET(av_packet) av_packet_unref(av_packet) |
181 | 181 | #define AV_FREE_CONTEXT(av_context) avcodec_free_context(&av_context) |
182 | 182 | #define AV_GET_CODEC_TYPE(av_stream) av_stream->codecpar->codec_type |
|
211 | 211 | #define AV_ALLOCATE_FRAME() av_frame_alloc() |
212 | 212 | #define AV_ALLOCATE_IMAGE(av_frame, pix_fmt, width, height) avpicture_alloc((AVPicture *) av_frame, pix_fmt, width, height) |
213 | 213 | #define AV_RESET_FRAME(av_frame) av_frame_unref(av_frame) |
214 | | - #define AV_FREE_FRAME(av_frame) av_frame_free(av_frame) |
| 214 | + #define AV_FREE_FRAME(av_frame) if (av_frame) av_frame_free(av_frame) |
215 | 215 | #define AV_FREE_PACKET(av_packet) av_packet_unref(av_packet) |
216 | 216 | #define AV_FREE_CONTEXT(av_context) avcodec_close(av_context) |
217 | 217 | #define AV_GET_CODEC_TYPE(av_stream) av_stream->codec->codec_type |
|
241 | 241 | #define AV_ALLOCATE_FRAME() avcodec_alloc_frame() |
242 | 242 | #define AV_ALLOCATE_IMAGE(av_frame, pix_fmt, width, height) avpicture_alloc((AVPicture *) av_frame, pix_fmt, width, height) |
243 | 243 | #define AV_RESET_FRAME(av_frame) avcodec_get_frame_defaults(av_frame) |
244 | | - #define AV_FREE_FRAME(av_frame) avcodec_free_frame(av_frame) |
| 244 | + #define AV_FREE_FRAME(av_frame) if(av_frame) avcodec_free_frame(av_frame) |
245 | 245 | #define AV_FREE_PACKET(av_packet) av_free_packet(av_packet) |
246 | 246 | #define AV_FREE_CONTEXT(av_context) avcodec_close(av_context) |
247 | 247 | #define AV_GET_CODEC_TYPE(av_stream) av_stream->codec->codec_type |
|
0 commit comments