Update api so it will compile again.
Showing the changes to libavcodec/api-example.c (1 of 2 files). Show all
Unified · Split
| @@ -74,7 +74,7 @@ static void audio_encode_example(const char *filename) · 73 unmodified lines | ||
| 74 | 74 | c->channels = 2; |
| 75 | 75 | |
| 76 | 76 | /* open it */ |
| 77 | − if (avcodec_open(c, codec) < 0) { | |
| 77 | + if (avcodec_open2(c, codec, NULL) < 0) { | |
| 78 | 78 | fprintf(stderr, "could not open codec\n"); |
| 79 | 79 | exit(1); |
| 80 | 80 | } |
| @@ -139,7 +139,7 @@ static void audio_decode_example(const char *outfilename, const char *filename) · 58 unmodified lines | ||
| 139 | 139 | c = avcodec_alloc_context3(codec); |
| 140 | 140 | |
| 141 | 141 | /* open it */ |
| 142 | − if (avcodec_open(c, codec) < 0) { | |
| 142 | + if (avcodec_open2(c, codec, NULL) < 0) { | |
| 143 | 143 | fprintf(stderr, "could not open codec\n"); |
| 144 | 144 | exit(1); |
| 145 | 145 | } |
| @@ -242,7 +242,7 @@ static void video_encode_example(const char *filename) · 96 unmodified lines | ||
| 242 | 242 | c->pix_fmt = PIX_FMT_YUV420P; |
| 243 | 243 | |
| 244 | 244 | /* open it */ |
| 245 | − if (avcodec_open(c, codec) < 0) { | |
| 245 | + if (avcodec_open2(c, codec, NULL) < 0) { | |
| 246 | 246 | fprintf(stderr, "could not open codec\n"); |
| 247 | 247 | exit(1); |
| 248 | 248 | } |
| @@ -369,7 +369,7 @@ static void video_decode_example(const char *outfilename, const char *filename) · 120 unmodified lines | ||
| 369 | 369 | available in the bitstream. */ |
| 370 | 370 | |
| 371 | 371 | /* open it */ |
| 372 | − if (avcodec_open(c, codec) < 0) { | |
| 372 | + if (avcodec_open2(c, codec, NULL) < 0) { | |
| 373 | 373 | fprintf(stderr, "could not open codec\n"); |
| 374 | 374 | exit(1); |
| 375 | 375 | } |
| @@ -456,9 +456,6 @@ int main(int argc, char **argv) · 80 unmodified lines | ||
| 456 | 456 | { |
| 457 | 457 | const char *filename; |
| 458 | 458 | |
| 459 | − /* must be called before using avcodec lib */ | |
| 460 | − avcodec_init(); | |
| 461 | − | |
| 462 | 459 | /* register all the codecs */ |
| 463 | 460 | avcodec_register_all(); |
| 464 | 461 | |