diff -rupN tvheadend/src/libav.c tvheadend-new/src/libav.c --- tvheadend/src/libav.c 2013-11-05 13:46:05.604185775 +0100 +++ tvheadend-new/src/libav.c 2013-11-05 13:49:08.226680742 +0100 @@ -50,47 +50,47 @@ libav_log_callback(void *ptr, int level, /** * 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(stream * 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 -rupN tvheadend/src/libav.h tvheadend-new/src/libav.h --- tvheadend/src/libav.h 2013-11-05 13:46:05.604185775 +0100 +++ tvheadend-new/src/libav.h 2013-11-05 13:49:08.182680141 +0100 @@ -19,12 +19,16 @@ #ifndef LIBAV_H_ #define LIBAV_H_ +/* Workaround for new libav API */ +#ifndef AVCODEC_MAX_AUDIO_FRAME_SIZE + #define AVCODEC_MAX_AUDIO_FRAME_SIZE 192000 +#endif #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 -rupN tvheadend/src/plumbing/transcoding.c tvheadend-new/src/plumbing/transcoding.c --- tvheadend/src/plumbing/transcoding.c 2013-11-05 13:46:05.604185775 +0100 +++ tvheadend-new/src/plumbing/transcoding.c 2013-11-05 13:49:08.222680687 +0100 @@ -120,7 +120,7 @@ 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); @@ -149,7 +149,7 @@ transcoder_get_decoder(streaming_compone 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); @@ -215,7 +215,7 @@ transcoder_stream_subtitle(transcoder_st if (ictx->codec_id == CODEC_ID_NONE) { ictx->codec_id = icodec->id; - if (avcodec_open(ictx, icodec) < 0) { + if (avcodec_open2(ictx, icodec, NULL) ) { tvhlog(LOG_ERR, "transcode", "Unable to open %s decoder", icodec->name); ts->ts_index = 0; goto cleanup; @@ -272,7 +272,7 @@ transcoder_stream_audio(transcoder_strea if (ictx->codec_id == CODEC_ID_NONE) { ictx->codec_id = icodec->id; - if (avcodec_open(ictx, icodec) < 0) { + if (avcodec_open2(ictx, icodec, NULL) ) { tvhlog(LOG_ERR, "transcode", "Unable to open %s decoder", icodec->name); ts->ts_index = 0; goto cleanup; @@ -391,7 +391,7 @@ transcoder_stream_audio(transcoder_strea if (octx->codec_id == CODEC_ID_NONE) { octx->codec_id = ocodec->id; - if (avcodec_open(octx, ocodec) < 0) { + if (avcodec_open2(octx, ocodec, NULL) ) { tvhlog(LOG_ERR, "transcode", "Unable to open %s encoder", ocodec->name); ts->ts_index = 0; goto cleanup; @@ -477,7 +477,7 @@ transcoder_stream_video(transcoder_strea if (ictx->codec_id == CODEC_ID_NONE) { ictx->codec_id = icodec->id; - if (avcodec_open(ictx, icodec) < 0) { + if (avcodec_open2(ictx, icodec, NULL) ) { tvhlog(LOG_ERR, "transcode", "Unable to open %s decoder", icodec->name); ts->ts_index = 0; goto cleanup; @@ -852,8 +852,8 @@ transcoder_init_subtitle(transcoder_t *t ss->sub_icodec = icodec; ss->sub_ocodec = ocodec; - ss->sub_ictx = avcodec_alloc_context(); - ss->sub_octx = avcodec_alloc_context(); + ss->sub_ictx = avcodec_alloc_context3(NULL); + ss->sub_octx = avcodec_alloc_context3(NULL); ss->sub_ictx->codec_type = AVMEDIA_TYPE_SUBTITLE; ss->sub_octx->codec_type = AVMEDIA_TYPE_SUBTITLE; @@ -944,8 +944,8 @@ transcoder_init_audio(transcoder_t *t, s as->aud_icodec = icodec; as->aud_ocodec = ocodec; - as->aud_ictx = avcodec_alloc_context(); - as->aud_octx = avcodec_alloc_context(); + as->aud_ictx = avcodec_alloc_context3(NULL); + as->aud_octx = avcodec_alloc_context3(NULL); as->aud_ictx->codec_type = AVMEDIA_TYPE_AUDIO; as->aud_octx->codec_type = AVMEDIA_TYPE_AUDIO; @@ -1054,8 +1054,8 @@ transcoder_init_video(transcoder_t *t, s vs->vid_icodec = icodec; vs->vid_ocodec = ocodec; - vs->vid_ictx = avcodec_alloc_context(); - vs->vid_octx = avcodec_alloc_context(); + vs->vid_ictx = avcodec_alloc_context3(NULL); + vs->vid_octx = avcodec_alloc_context3(NULL); avcodec_get_context_defaults3(vs->vid_ictx, icodec); avcodec_get_context_defaults3(vs->vid_octx, ocodec);