Unified · Split
| @@ -213,8 +213,7 @@ static void audio_encode_example(const char *filename) · 212 unmodified lines | ||
| 213 | 213 | |
| 214 | 214 | av_freep(&samples); |
| 215 | 215 | av_frame_free(&frame); |
| 216 | − avcodec_close(c); | |
| 217 | − av_free(c); | |
| 216 | + avcodec_free_context(&c); | |
| 218 | 217 | } |
| 219 | 218 | |
| 220 | 219 | /* |
| @@ -305,8 +304,7 @@ static void audio_decode_example(const char *outfilename, const char *filename) · 84 unmodified lines | ||
| 305 | 304 | fclose(outfile); |
| 306 | 305 | fclose(f); |
| 307 | 306 | |
| 308 | − avcodec_close(c); | |
| 309 | − av_free(c); | |
| 307 | + avcodec_free_context(&c); | |
| 310 | 308 | av_frame_free(&decoded_frame); |
| 311 | 309 | } |
| 312 | 310 | |
| @@ -428,8 +426,7 @@ static void video_encode_example(const char *filename) · 115 unmodified lines | ||
| 428 | 426 | fwrite(endcode, 1, sizeof(endcode), f); |
| 429 | 427 | fclose(f); |
| 430 | 428 | |
| 431 | − avcodec_close(c); | |
| 432 | − av_free(c); | |
| 429 | + avcodec_free_context(&c); | |
| 433 | 430 | av_freep(&picture->data[0]); |
| 434 | 431 | av_frame_free(&picture); |
| 435 | 432 | printf("\n"); |
| @@ -565,8 +562,7 @@ static void video_decode_example(const char *outfilename, const char *filename) · 129 unmodified lines | ||
| 565 | 562 | |
| 566 | 563 | fclose(f); |
| 567 | 564 | |
| 568 | − avcodec_close(c); | |
| 569 | − av_free(c); | |
| 565 | + avcodec_free_context(&c); | |
| 570 | 566 | av_frame_free(&picture); |
| 571 | 567 | printf("\n"); |
| 572 | 568 | } |