Mercurial > mplayer.hg
comparison libmpcodecs/vf_zrmjpeg.c @ 31959:f957f330aa6d
Introduce init_avcodec function to avoid duplicated FFmpeg initializations.
Vlad Seryakov, vseryakov gmail com
author | diego |
---|---|
date | Sat, 04 Sep 2010 08:11:31 +0000 |
parents | a972c1a4a012 |
children | e613306a8556 |
comparison
equal
deleted
inserted
replaced
31958:4cccb69779ef | 31959:f957f330aa6d |
---|---|
60 /// Printout with vf_zrmjpeg: prefix at ERROR level | 60 /// Printout with vf_zrmjpeg: prefix at ERROR level |
61 #define ERROR(...) mp_msg(MSGT_DECVIDEO, MSGL_ERR, "vf_zrmjpeg: " __VA_ARGS__) | 61 #define ERROR(...) mp_msg(MSGT_DECVIDEO, MSGL_ERR, "vf_zrmjpeg: " __VA_ARGS__) |
62 /// Printout with vf_zrmjpeg: prefix at WARNING level | 62 /// Printout with vf_zrmjpeg: prefix at WARNING level |
63 #define WARNING(...) mp_msg(MSGT_DECVIDEO, MSGL_WARN, \ | 63 #define WARNING(...) mp_msg(MSGT_DECVIDEO, MSGL_WARN, \ |
64 "vf_zrmjpeg: " __VA_ARGS__) | 64 "vf_zrmjpeg: " __VA_ARGS__) |
65 | |
66 // "local" flag in vd_ffmpeg.c. If not set, avcodec_init() et. al. need to be called | |
67 // set when init is done, so that initialization is not done twice. | |
68 extern int avcodec_initialized; | |
69 | 65 |
70 /// The get_pixels() routine to use. The real routine comes from dsputil | 66 /// The get_pixels() routine to use. The real routine comes from dsputil |
71 static void (*get_pixels)(DCTELEM *restrict block, const uint8_t *pixels, int line_size); | 67 static void (*get_pixels)(DCTELEM *restrict block, const uint8_t *pixels, int line_size); |
72 | 68 |
73 /* Begin excessive code duplication ************************************/ | 69 /* Begin excessive code duplication ************************************/ |
471 j->s->mjpeg_hsample[2] = 1; // 1 appearance of V horizontally | 467 j->s->mjpeg_hsample[2] = 1; // 1 appearance of V horizontally |
472 | 468 |
473 j->cheap_upsample = cu; | 469 j->cheap_upsample = cu; |
474 j->bw = b; | 470 j->bw = b; |
475 | 471 |
476 // Is this needed? | 472 init_avcodec(); |
477 /* if libavcodec is used by the decoder then we must not | |
478 * initialize again, but if it is not initialized then we must | |
479 * initialize it here. */ | |
480 if (!avcodec_initialized) { | |
481 avcodec_init(); | |
482 avcodec_register_all(); | |
483 avcodec_initialized=1; | |
484 } | |
485 | 473 |
486 // Build mjpeg huffman code tables, setting up j->s->mjpeg_ctx | 474 // Build mjpeg huffman code tables, setting up j->s->mjpeg_ctx |
487 if (ff_mjpeg_encode_init(j->s) < 0) { | 475 if (ff_mjpeg_encode_init(j->s) < 0) { |
488 av_free(j->s); | 476 av_free(j->s); |
489 av_free(j); | 477 av_free(j); |
917 | 905 |
918 priv->quality = 2; | 906 priv->quality = 2; |
919 priv->hdec = 1; | 907 priv->hdec = 1; |
920 priv->vdec = 1; | 908 priv->vdec = 1; |
921 | 909 |
922 /* if libavcodec is already initialized, we must not initialize it | 910 init_avcodec(); |
923 * again, but if it is not initialized then we mustinitialize it now. */ | |
924 if (!avcodec_initialized) { | |
925 /* we need to initialize libavcodec */ | |
926 avcodec_init(); | |
927 avcodec_register_all(); | |
928 avcodec_initialized=1; | |
929 } | |
930 | 911 |
931 if (args) { | 912 if (args) { |
932 char *arg, *tmp, *ptr, junk; | 913 char *arg, *tmp, *ptr, junk; |
933 int last = 0, input; | 914 int last = 0, input; |
934 | 915 |