From 8c3b27ce279f1f0904af3c220d92acfa1f20a70e Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Thu, 16 Jan 2014 15:40:37 +0100 Subject: Change libavcodec CODEC_ID_* to AV_CODEC_ID_* CODEC_ID_* have been replaced with AV_CODEC_ID_* in new libavcodec versions. Update the code to use those new identifiers. Added a compatibility code to ffmpeg_compat.h --- source/blender/blenkernel/intern/writeffmpeg.c | 74 +++++++++++++------------- 1 file changed, 37 insertions(+), 37 deletions(-) (limited to 'source/blender/blenkernel/intern/writeffmpeg.c') diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c index d975e60146f..38f80e7cee6 100644 --- a/source/blender/blenkernel/intern/writeffmpeg.c +++ b/source/blender/blenkernel/intern/writeffmpeg.c @@ -70,8 +70,8 @@ #include "ffmpeg_compat.h" static int ffmpeg_type = 0; -static int ffmpeg_codec = CODEC_ID_MPEG4; -static int ffmpeg_audio_codec = CODEC_ID_NONE; +static int ffmpeg_codec = AV_CODEC_ID_MPEG4; +static int ffmpeg_audio_codec = AV_CODEC_ID_NONE; static int ffmpeg_video_bitrate = 1150; static int ffmpeg_audio_bitrate = 128; static int ffmpeg_gop_size = 12; @@ -119,7 +119,7 @@ static void delete_picture(AVFrame *f) static int request_float_audio_buffer(int codec_id) { /* If any of these codecs, we prefer the float sample format (if supported) */ - return codec_id == CODEC_ID_AAC || codec_id == CODEC_ID_AC3 || codec_id == CODEC_ID_VORBIS; + return codec_id == AV_CODEC_ID_AAC || codec_id == AV_CODEC_ID_AC3 || codec_id == AV_CODEC_ID_VORBIS; } #ifdef WITH_AUDASPACE @@ -474,7 +474,7 @@ static int ffmpeg_proprty_valid(AVCodecContext *c, const char *prop_name, IDProp if (strcmp(prop_name, "video") == 0) { if (strcmp(curr->name, "bf") == 0) { /* flash codec doesn't support b frames */ - valid &= c->codec_id != CODEC_ID_FLV1; + valid &= c->codec_id != AV_CODEC_ID_FLV1; } } @@ -580,29 +580,29 @@ static AVStream *alloc_video_stream(RenderData *rd, int codec_id, AVFormatContex c->codec_tag = (('D' << 24) + ('I' << 16) + ('V' << 8) + 'X'); } - if (codec_id == CODEC_ID_H264) { + if (codec_id == AV_CODEC_ID_H264) { /* correct wrong default ffmpeg param which crash x264 */ c->qmin = 10; c->qmax = 51; } /* Keep lossless encodes in the RGB domain. */ - if (codec_id == CODEC_ID_HUFFYUV) { + if (codec_id == AV_CODEC_ID_HUFFYUV) { /* HUFFYUV was PIX_FMT_YUV422P before */ c->pix_fmt = PIX_FMT_RGB32; } - if (codec_id == CODEC_ID_FFV1) { + if (codec_id == AV_CODEC_ID_FFV1) { c->pix_fmt = PIX_FMT_RGB32; } - if (codec_id == CODEC_ID_QTRLE) { + if (codec_id == AV_CODEC_ID_QTRLE) { if (rd->im_format.planes == R_IMF_PLANES_RGBA) { c->pix_fmt = PIX_FMT_ARGB; } } - if (codec_id == CODEC_ID_PNG) { + if (codec_id == AV_CODEC_ID_PNG) { if (rd->im_format.planes == R_IMF_PLANES_RGBA) { c->pix_fmt = PIX_FMT_ARGB; } @@ -638,7 +638,7 @@ static AVStream *alloc_video_stream(RenderData *rd, int codec_id, AVFormatContex return NULL; } - if (codec_id == CODEC_ID_QTRLE) { + if (codec_id == AV_CODEC_ID_QTRLE) { /* normally it should be enough to have buffer with actual image size, * but some codecs like QTRLE might store extra information in this buffer, * so it should be a way larger */ @@ -828,7 +828,7 @@ static int start_ffmpeg_impl(struct RenderData *rd, int rectx, int recty, Report of->oformat = fmt; of->packet_size = rd->ffcodecdata.mux_packet_size; - if (ffmpeg_audio_codec != CODEC_ID_NONE) { + if (ffmpeg_audio_codec != AV_CODEC_ID_NONE) { ffmpeg_dict_set_int(&opts, "muxrate", rd->ffcodecdata.mux_rate); } else { @@ -850,32 +850,32 @@ static int start_ffmpeg_impl(struct RenderData *rd, int rectx, int recty, Report fmt->video_codec = ffmpeg_codec; break; case FFMPEG_OGG: - fmt->video_codec = CODEC_ID_THEORA; + fmt->video_codec = AV_CODEC_ID_THEORA; break; case FFMPEG_DV: - fmt->video_codec = CODEC_ID_DVVIDEO; + fmt->video_codec = AV_CODEC_ID_DVVIDEO; break; case FFMPEG_MPEG1: - fmt->video_codec = CODEC_ID_MPEG1VIDEO; + fmt->video_codec = AV_CODEC_ID_MPEG1VIDEO; break; case FFMPEG_MPEG2: - fmt->video_codec = CODEC_ID_MPEG2VIDEO; + fmt->video_codec = AV_CODEC_ID_MPEG2VIDEO; break; case FFMPEG_H264: - fmt->video_codec = CODEC_ID_H264; + fmt->video_codec = AV_CODEC_ID_H264; break; case FFMPEG_XVID: - fmt->video_codec = CODEC_ID_MPEG4; + fmt->video_codec = AV_CODEC_ID_MPEG4; break; case FFMPEG_FLV: - fmt->video_codec = CODEC_ID_FLV1; + fmt->video_codec = AV_CODEC_ID_FLV1; break; case FFMPEG_MPEG4: default: - fmt->video_codec = CODEC_ID_MPEG4; + fmt->video_codec = AV_CODEC_ID_MPEG4; break; } - if (fmt->video_codec == CODEC_ID_DVVIDEO) { + if (fmt->video_codec == AV_CODEC_ID_DVVIDEO) { if (rectx != 720) { BKE_report(reports, RPT_ERROR, "Render width has to be 720 pixels for DV!"); return 0; @@ -891,15 +891,15 @@ static int start_ffmpeg_impl(struct RenderData *rd, int rectx, int recty, Report } if (ffmpeg_type == FFMPEG_DV) { - fmt->audio_codec = CODEC_ID_PCM_S16LE; - if (ffmpeg_audio_codec != CODEC_ID_NONE && rd->ffcodecdata.audio_mixrate != 48000 && rd->ffcodecdata.audio_channels != 2) { + fmt->audio_codec = AV_CODEC_ID_PCM_S16LE; + if (ffmpeg_audio_codec != AV_CODEC_ID_NONE && rd->ffcodecdata.audio_mixrate != 48000 && rd->ffcodecdata.audio_channels != 2) { BKE_report(reports, RPT_ERROR, "FFMPEG only supports 48khz / stereo audio for DV!"); av_dict_free(&opts); return 0; } } - if (fmt->video_codec != CODEC_ID_NONE) { + if (fmt->video_codec != AV_CODEC_ID_NONE) { video_stream = alloc_video_stream(rd, fmt->video_codec, of, rectx, recty, error, sizeof(error)); PRINT("alloc video stream %p\n", video_stream); if (!video_stream) { @@ -913,7 +913,7 @@ static int start_ffmpeg_impl(struct RenderData *rd, int rectx, int recty, Report } } - if (ffmpeg_audio_codec != CODEC_ID_NONE) { + if (ffmpeg_audio_codec != AV_CODEC_ID_NONE) { audio_stream = alloc_audio_stream(rd, fmt->audio_codec, of, error, sizeof(error)); if (!audio_stream) { if (error[0]) @@ -1418,7 +1418,7 @@ static void ffmpeg_set_expert_options(RenderData *rd) if (rd->ffcodecdata.properties) IDP_FreeProperty(rd->ffcodecdata.properties); - if (codec_id == CODEC_ID_H264) { + if (codec_id == AV_CODEC_ID_H264) { /* * All options here are for x264, but must be set via ffmpeg. * The names are therefore different - Search for "x264 to FFmpeg option mapping" @@ -1461,7 +1461,7 @@ static void ffmpeg_set_expert_options(RenderData *rd) if (rd->ffcodecdata.flags & FFMPEG_LOSSLESS_OUTPUT) BKE_ffmpeg_property_add_string(rd, "video", "cqp:0"); } - else if (codec_id == CODEC_ID_DNXHD) { + else if (codec_id == AV_CODEC_ID_DNXHD) { if (rd->ffcodecdata.flags & FFMPEG_LOSSLESS_OUTPUT) BKE_ffmpeg_property_add_string(rd, "video", "mbd:rd"); } @@ -1525,7 +1525,7 @@ void BKE_ffmpeg_preset_set(RenderData *rd, int preset) case FFMPEG_PRESET_H264: rd->ffcodecdata.type = FFMPEG_AVI; - rd->ffcodecdata.codec = CODEC_ID_H264; + rd->ffcodecdata.codec = AV_CODEC_ID_H264; rd->ffcodecdata.video_bitrate = 6000; rd->ffcodecdata.gop_size = isntsc ? 18 : 15; rd->ffcodecdata.rc_max_rate = 9000; @@ -1540,11 +1540,11 @@ void BKE_ffmpeg_preset_set(RenderData *rd, int preset) case FFMPEG_PRESET_XVID: if (preset == FFMPEG_PRESET_XVID) { rd->ffcodecdata.type = FFMPEG_AVI; - rd->ffcodecdata.codec = CODEC_ID_MPEG4; + rd->ffcodecdata.codec = AV_CODEC_ID_MPEG4; } else if (preset == FFMPEG_PRESET_THEORA) { rd->ffcodecdata.type = FFMPEG_OGG; // XXX broken - rd->ffcodecdata.codec = CODEC_ID_THEORA; + rd->ffcodecdata.codec = AV_CODEC_ID_THEORA; } rd->ffcodecdata.video_bitrate = 6000; @@ -1571,7 +1571,7 @@ void BKE_ffmpeg_image_type_verify(RenderData *rd, ImageFormatData *imf) rd->ffcodecdata.audio_codec <= 0 || rd->ffcodecdata.video_bitrate <= 1) { - rd->ffcodecdata.codec = CODEC_ID_MPEG2VIDEO; + rd->ffcodecdata.codec = AV_CODEC_ID_MPEG2VIDEO; BKE_ffmpeg_preset_set(rd, FFMPEG_PRESET_DVD); } @@ -1582,26 +1582,26 @@ void BKE_ffmpeg_image_type_verify(RenderData *rd, ImageFormatData *imf) audio = 1; } else if (imf->imtype == R_IMF_IMTYPE_H264) { - if (rd->ffcodecdata.codec != CODEC_ID_H264) { + if (rd->ffcodecdata.codec != AV_CODEC_ID_H264) { BKE_ffmpeg_preset_set(rd, FFMPEG_PRESET_H264); audio = 1; } } else if (imf->imtype == R_IMF_IMTYPE_XVID) { - if (rd->ffcodecdata.codec != CODEC_ID_MPEG4) { + if (rd->ffcodecdata.codec != AV_CODEC_ID_MPEG4) { BKE_ffmpeg_preset_set(rd, FFMPEG_PRESET_XVID); audio = 1; } } else if (imf->imtype == R_IMF_IMTYPE_THEORA) { - if (rd->ffcodecdata.codec != CODEC_ID_THEORA) { + if (rd->ffcodecdata.codec != AV_CODEC_ID_THEORA) { BKE_ffmpeg_preset_set(rd, FFMPEG_PRESET_THEORA); audio = 1; } } if (audio && rd->ffcodecdata.audio_codec < 0) { - rd->ffcodecdata.audio_codec = CODEC_ID_NONE; + rd->ffcodecdata.audio_codec = AV_CODEC_ID_NONE; rd->ffcodecdata.audio_bitrate = 128; } } @@ -1615,14 +1615,14 @@ int BKE_ffmpeg_alpha_channel_is_supported(RenderData *rd) { int codec = rd->ffcodecdata.codec; - if (codec == CODEC_ID_QTRLE) + if (codec == AV_CODEC_ID_QTRLE) return TRUE; - if (codec == CODEC_ID_PNG) + if (codec == AV_CODEC_ID_PNG) return TRUE; #ifdef FFMPEG_FFV1_ALPHA_SUPPORTED - if (codec == CODEC_ID_FFV1) + if (codec == AV_CODEC_ID_FFV1) return TRUE; #endif -- cgit v1.2.3