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