diff --git a/configure b/configure index 1cc91c4e..0e3d2ec6 100755 --- a/configure +++ b/configure @@ -245,7 +245,7 @@ fi if enabled_or_auto libav; then has_libav=true - if $has_libav && ! check_pkg libavcodec "<=55.0.0"; then + if $has_libav && ! check_pkg libavcodec "<=56.0.0"; then has_libav=false fi @@ -257,7 +257,7 @@ if enabled_or_auto libav; then has_libav=false fi - if $has_libav && ! check_pkg libavformat "<=55.0.0"; then + if $has_libav && ! check_pkg libavformat "<=56.0.0"; then has_libav=false fi diff --git a/src/libav.c b/src/libav.c index 85d12770..c12c33f4 100644 --- a/src/libav.c +++ b/src/libav.c @@ -50,47 +50,47 @@ libav_log_callback(void *ptr, int level, const char *fmt, va_list vl) /** * Translate a component type to a libavcodec id */ -enum CodecID +enum AVCodecID streaming_component_type2codec_id(streaming_component_type_t type) { - enum CodecID codec_id = CODEC_ID_NONE; + enum AVCodecID codec_id = AV_CODEC_ID_NONE; switch(type) { case SCT_H264: - codec_id = CODEC_ID_H264; + codec_id = AV_CODEC_ID_H264; break; case SCT_MPEG2VIDEO: - codec_id = CODEC_ID_MPEG2VIDEO; + codec_id = AV_CODEC_ID_MPEG2VIDEO; break; case SCT_VP8: - codec_id = CODEC_ID_VP8; + codec_id = AV_CODEC_ID_VP8; break; case SCT_AC3: - codec_id = CODEC_ID_AC3; + codec_id = AV_CODEC_ID_AC3; break; case SCT_EAC3: - codec_id = CODEC_ID_EAC3; + codec_id = AV_CODEC_ID_EAC3; break; case SCT_AAC: - codec_id = CODEC_ID_AAC; + codec_id = AV_CODEC_ID_AAC; break; case SCT_MPEG2AUDIO: - codec_id = CODEC_ID_MP2; + codec_id = AV_CODEC_ID_MP2; break; case SCT_VORBIS: - codec_id = CODEC_ID_VORBIS; + codec_id = AV_CODEC_ID_VORBIS; break; case SCT_DVBSUB: - codec_id = CODEC_ID_DVB_SUBTITLE; + codec_id = AV_CODEC_ID_DVB_SUBTITLE; break; case SCT_TEXTSUB: - codec_id = CODEC_ID_TEXT; + codec_id = AV_CODEC_ID_TEXT; break; case SCT_TELETEXT: - codec_id = CODEC_ID_DVB_TELETEXT; + codec_id = AV_CODEC_ID_DVB_TELETEXT; break; default: - codec_id = CODEC_ID_NONE; + codec_id = AV_CODEC_ID_NONE; break; } @@ -102,45 +102,45 @@ streaming_component_type2codec_id(streaming_component_type_t type) * Translate a libavcodec id to a component type */ streaming_component_type_t -codec_id2streaming_component_type(enum CodecID id) +codec_id2streaming_component_type(enum AVCodecID id) { - streaming_component_type_t type = CODEC_ID_NONE; + streaming_component_type_t type = AV_CODEC_ID_NONE; switch(id) { - case CODEC_ID_H264: + case AV_CODEC_ID_H264: type = SCT_H264; break; - case CODEC_ID_MPEG2VIDEO: + case AV_CODEC_ID_MPEG2VIDEO: type = SCT_MPEG2VIDEO; break; - case CODEC_ID_VP8: + case AV_CODEC_ID_VP8: type = SCT_VP8; break; - case CODEC_ID_AC3: + case AV_CODEC_ID_AC3: type = SCT_AC3; break; - case CODEC_ID_EAC3: + case AV_CODEC_ID_EAC3: type = SCT_EAC3; break; - case CODEC_ID_AAC: + case AV_CODEC_ID_AAC: type = SCT_AAC; break; - case CODEC_ID_MP2: + case AV_CODEC_ID_MP2: type = SCT_MPEG2AUDIO; break; - case CODEC_ID_VORBIS: + case AV_CODEC_ID_VORBIS: type = SCT_VORBIS; break; - case CODEC_ID_DVB_SUBTITLE: + case AV_CODEC_ID_DVB_SUBTITLE: type = SCT_DVBSUB; break; - case CODEC_ID_TEXT: + case AV_CODEC_ID_TEXT: type = SCT_TEXTSUB; break; - case CODEC_ID_DVB_TELETEXT: + case AV_CODEC_ID_DVB_TELETEXT: type = SCT_TELETEXT; break; - case CODEC_ID_NONE: + case AV_CODEC_ID_NONE: type = SCT_NONE; break; default: diff --git a/src/libav.h b/src/libav.h index d34412d4..5217c5f0 100644 --- a/src/libav.h +++ b/src/libav.h @@ -23,8 +23,8 @@ #include #include "tvheadend.h" -enum CodecID streaming_component_type2codec_id(streaming_component_type_t type); -streaming_component_type_t codec_id2streaming_component_type(enum CodecID id); +enum AVCodecID streaming_component_type2codec_id(streaming_component_type_t type); +streaming_component_type_t codec_id2streaming_component_type(enum AVCodecID id); int libav_is_encoder(AVCodec *codec); void libav_init(void); diff --git a/src/plumbing/transcoding.c b/src/plumbing/transcoding.c index e1b1c599..b5575637 100644 --- a/src/plumbing/transcoding.c +++ b/src/plumbing/transcoding.c @@ -108,9 +108,9 @@ typedef struct transcoder { -#define WORKING_ENCODER(x) (x == CODEC_ID_H264 || x == CODEC_ID_MPEG2VIDEO || \ - x == CODEC_ID_VP8 || x == CODEC_ID_AAC || \ - x == CODEC_ID_MP2 || x == CODEC_ID_VORBIS) +#define WORKING_ENCODER(x) (x == AV_CODEC_ID_H264 || x == AV_CODEC_ID_MPEG2VIDEO || \ + x == AV_CODEC_ID_VP8 || x == AV_CODEC_ID_AAC || \ + x == AV_CODEC_ID_MP2 || x == AV_CODEC_ID_VORBIS) uint32_t transcoding_enabled = 0; @@ -121,11 +121,11 @@ uint32_t transcoding_enabled = 0; static AVCodec * transcoder_get_decoder(streaming_component_type_t ty) { - enum CodecID codec_id; + enum AVCodecID codec_id; AVCodec *codec; codec_id = streaming_component_type2codec_id(ty); - if (codec_id == CODEC_ID_NONE) { + if (codec_id == AV_CODEC_ID_NONE) { tvhlog(LOG_ERR, "transcode", "Unsupported input codec %s", streaming_component_type2txt(ty)); return NULL; @@ -150,11 +150,11 @@ transcoder_get_decoder(streaming_component_type_t ty) static AVCodec * transcoder_get_encoder(streaming_component_type_t ty) { - enum CodecID codec_id; + enum AVCodecID codec_id; AVCodec *codec; codec_id = streaming_component_type2codec_id(ty); - if (codec_id == CODEC_ID_NONE) { + if (codec_id == AV_CODEC_ID_NONE) { tvhlog(LOG_ERR, "transcode", "Unable to find %s codec", streaming_component_type2txt(ty)); return NULL; @@ -214,7 +214,7 @@ transcoder_stream_subtitle(transcoder_stream_t *ts, th_pkt_t *pkt) icodec = ss->sub_icodec; //ocodec = ss->sub_ocodec; - if (ictx->codec_id == CODEC_ID_NONE) { + if (ictx->codec_id == AV_CODEC_ID_NONE) { ictx->codec_id = icodec->id; if (avcodec_open2(ictx, icodec, NULL) < 0) { @@ -272,7 +272,7 @@ transcoder_stream_audio(transcoder_stream_t *ts, th_pkt_t *pkt) icodec = as->aud_icodec; ocodec = as->aud_ocodec; - if (ictx->codec_id == CODEC_ID_NONE) { + if (ictx->codec_id == AV_CODEC_ID_NONE) { ictx->codec_id = icodec->id; if (avcodec_open2(ictx, icodec, NULL) < 0) { @@ -391,7 +391,7 @@ transcoder_stream_audio(transcoder_stream_t *ts, th_pkt_t *pkt) break; } - if (octx->codec_id == CODEC_ID_NONE) { + if (octx->codec_id == AV_CODEC_ID_NONE) { octx->codec_id = ocodec->id; if (avcodec_open2(octx, ocodec, NULL) < 0) { @@ -478,7 +478,7 @@ transcoder_stream_video(transcoder_stream_t *ts, th_pkt_t *pkt) buf = out = deint = NULL; opts = NULL; - if (ictx->codec_id == CODEC_ID_NONE) { + if (ictx->codec_id == AV_CODEC_ID_NONE) { ictx->codec_id = icodec->id; if (avcodec_open2(ictx, icodec, NULL) < 0) { @@ -523,7 +523,7 @@ transcoder_stream_video(transcoder_stream_t *ts, th_pkt_t *pkt) vs->vid_enc_frame->sample_aspect_ratio.num = vs->vid_dec_frame->sample_aspect_ratio.num; vs->vid_enc_frame->sample_aspect_ratio.den = vs->vid_dec_frame->sample_aspect_ratio.den; - if(octx->codec_id == CODEC_ID_NONE) { + if(octx->codec_id == AV_CODEC_ID_NONE) { // Common settings octx->width = vs->vid_width ? vs->vid_width : ictx->width; octx->height = vs->vid_height ? vs->vid_height : ictx->height; @@ -534,7 +534,7 @@ transcoder_stream_video(transcoder_stream_t *ts, th_pkt_t *pkt) switch (ts->ts_type) { case SCT_MPEG2VIDEO: - octx->codec_id = CODEC_ID_MPEG2VIDEO; + octx->codec_id = AV_CODEC_ID_MPEG2VIDEO; octx->pix_fmt = PIX_FMT_YUV420P; octx->flags |= CODEC_FLAG_GLOBAL_HEADER; @@ -547,7 +547,7 @@ transcoder_stream_video(transcoder_stream_t *ts, th_pkt_t *pkt) break; case SCT_VP8: - octx->codec_id = CODEC_ID_VP8; + octx->codec_id = AV_CODEC_ID_VP8; octx->pix_fmt = PIX_FMT_YUV420P; octx->qmin = 10; @@ -561,7 +561,7 @@ transcoder_stream_video(transcoder_stream_t *ts, th_pkt_t *pkt) break; case SCT_H264: - octx->codec_id = CODEC_ID_H264; + octx->codec_id = AV_CODEC_ID_H264; octx->pix_fmt = PIX_FMT_YUV420P; octx->flags |= CODEC_FLAG_GLOBAL_HEADER; @@ -951,8 +951,8 @@ transcoder_init_audio(transcoder_t *t, streaming_start_component_t *ssc) as->aud_ictx->thread_count = sysconf(_SC_NPROCESSORS_ONLN); as->aud_octx->thread_count = sysconf(_SC_NPROCESSORS_ONLN); - as->aud_dec_size = AVCODEC_MAX_AUDIO_FRAME_SIZE*2; - as->aud_enc_size = AVCODEC_MAX_AUDIO_FRAME_SIZE*2; + as->aud_dec_size = 192000*2; + as->aud_enc_size = 192000*2; as->aud_dec_sample = av_malloc(as->aud_dec_size + FF_INPUT_BUFFER_PADDING_SIZE); as->aud_enc_sample = av_malloc(as->aud_enc_size + FF_INPUT_BUFFER_PADDING_SIZE);