History

examples: Properly free AVCodecContext

Vittorio Giovara committed 10 years ago

Commit 9833a401 parent 0e0538a1 file · +4 −8Browse files

Unified · Split

doc/examples/avcodec.c+4−8
@@ -213,8 +213,7 @@ static void audio_encode_example(const char *filename) · 212 unmodified lines
213213
214214 av_freep(&samples);
215215 av_frame_free(&frame);
216− avcodec_close(c);
217− av_free(c);
216+ avcodec_free_context(&c);
218217 }
219218
220219 /*
@@ -305,8 +304,7 @@ static void audio_decode_example(const char *outfilename, const char *filename) · 84 unmodified lines
305304 fclose(outfile);
306305 fclose(f);
307306
308− avcodec_close(c);
309− av_free(c);
307+ avcodec_free_context(&c);
310308 av_frame_free(&decoded_frame);
311309 }
312310
@@ -428,8 +426,7 @@ static void video_encode_example(const char *filename) · 115 unmodified lines
428426 fwrite(endcode, 1, sizeof(endcode), f);
429427 fclose(f);
430428
431− avcodec_close(c);
432− av_free(c);
429+ avcodec_free_context(&c);
433430 av_freep(&picture->data[0]);
434431 av_frame_free(&picture);
435432 printf("\n");
@@ -565,8 +562,7 @@ static void video_decode_example(const char *outfilename, const char *filename) · 129 unmodified lines
565562
566563 fclose(f);
567564
568− avcodec_close(c);
569− av_free(c);
565+ avcodec_free_context(&c);
570566 av_frame_free(&picture);
571567 printf("\n");
572568 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t