Skip to content

Commit

Permalink
replace ff_codec_id_string() with avcodec_get_name()
Browse files Browse the repository at this point in the history
This enables removing libavcodec/utils-mythtv.c
  • Loading branch information
ulmus-scott authored and bennettpeter committed Nov 26, 2021
1 parent 650498d commit 5c984da
Show file tree
Hide file tree
Showing 14 changed files with 31 additions and 31 deletions.
4 changes: 2 additions & 2 deletions mythtv/external/FFmpeg/libavformat/mpegts-mythtv.c
Expand Up @@ -2092,7 +2092,7 @@ static void mpegts_add_stream(MpegTSContext *ts, int id, pmt_entry_t* item,

av_log(NULL, AV_LOG_DEBUG, "mpegts_add_stream: "
"stream #%d, has id 0x%x and codec %s, type %s at 0x%x\n",
st->index, st->id, ff_codec_id_string(st->codecpar->codec_id),
st->index, st->id, avcodec_get_name(st->codecpar->codec_id),
av_get_media_type_string(st->codecpar->codec_type), st);
} else {
PESContext *pes = NULL;
Expand Down Expand Up @@ -2155,7 +2155,7 @@ static void mpegts_add_stream(MpegTSContext *ts, int id, pmt_entry_t* item,

av_log(NULL, AV_LOG_DEBUG, "mpegts_add_stream: "
"stream #%d, has id 0x%x and codec %s, type %s at 0x%x\n",
st->index, st->id, ff_codec_id_string(st->codecpar->codec_id),
st->index, st->id, avcodec_get_name(st->codecpar->codec_id),
av_get_media_type_string(st->codecpar->codec_type), st);
}
add_pid_to_pmt(ts, id, pid);
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmyth/audio/audiooutputbase.cpp
Expand Up @@ -629,7 +629,7 @@ void AudioOutputBase::Reconfigure(const AudioSettings &orig_settings)
}

VBAUDIO(QString("Original codec was %1, %2, %3 kHz, %4 channels")
.arg(ff_codec_id_string(m_codec),
.arg(avcodec_get_name(m_codec),
m_outputSettings->FormatToString(m_format))
.arg(m_sampleRate/1000)
.arg(m_sourceChannels));
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmyth/audio/audiooutputdigitalencoder.cpp
Expand Up @@ -105,7 +105,7 @@ bool AudioOutputDigitalEncoder::Init(
{
LOG(VB_AUDIO, LOG_INFO, LOC +
QString("Init codecid=%1, br=%2, sr=%3, ch=%4")
.arg(ff_codec_id_string(codec_id)) .arg(bitrate)
.arg(avcodec_get_name(codec_id)) .arg(bitrate)
.arg(samplerate) .arg(channels));

if (!(m_inbuf || m_framebuf || m_outbuf))
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmyth/audio/spdifencoder.cpp
Expand Up @@ -82,7 +82,7 @@ SPDIFEncoder::SPDIFEncoder(const QString& muxer, AVCodecID codec_id)
}

LOG(VB_AUDIO, LOG_INFO, LOC + QString("Creating %1 encoder (for %2)")
.arg(muxer, ff_codec_id_string(codec_id)));
.arg(muxer, avcodec_get_name(codec_id)));

m_complete = true;
}
Expand Down
28 changes: 14 additions & 14 deletions mythtv/libs/libmythtv/decoders/avformatdecoder.cpp
Expand Up @@ -1502,7 +1502,7 @@ void AvFormatDecoder::InitVideoCodec(AVStream *stream, AVCodecContext *enc,
{
LOG(VB_PLAYBACK, LOG_INFO, LOC +
QString("InitVideoCodec ID:%1 Type:%2 Size:%3x%4")
.arg(ff_codec_id_string(enc->codec_id),
.arg(avcodec_get_name(enc->codec_id),
ff_codec_type_string(enc->codec_type))
.arg(enc->width).arg(enc->height));

Expand Down Expand Up @@ -2033,7 +2033,7 @@ int AvFormatDecoder::ScanStreams(bool novideo)
LOG(VB_PLAYBACK, LOG_INFO, LOC +
QString("Stream #%1: ID: 0x%2 Codec ID: %3 Type: %4 Bitrate: %5")
.arg(strm).arg(static_cast<uint64_t>(m_ic->streams[strm]->id), 0, 16)
.arg(ff_codec_id_string(par->codec_id),
.arg(avcodec_get_name(par->codec_id),
codectype).arg(par->bit_rate));

switch (par->codec_type)
Expand Down Expand Up @@ -2094,12 +2094,12 @@ int AvFormatDecoder::ScanStreams(bool novideo)
QString("Warning, audio codec 0x%1 id(%2) "
"type (%3) already open, leaving it alone.")
.arg(reinterpret_cast<unsigned long long>(enc), 0, 16)
.arg(ff_codec_id_string(enc->codec_id),
.arg(avcodec_get_name(enc->codec_id),
ff_codec_type_string(enc->codec_type)));
}
LOG(VB_GENERAL, LOG_INFO, LOC +
QString("codec %1 has %2 channels")
.arg(ff_codec_id_string(par->codec_id))
.arg(avcodec_get_name(par->codec_id))
.arg(par->channels));

m_bitrate += par->bit_rate;
Expand Down Expand Up @@ -2157,7 +2157,7 @@ int AvFormatDecoder::ScanStreams(bool novideo)
continue;

LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("Looking for decoder for %1")
.arg(ff_codec_id_string(par->codec_id)));
.arg(avcodec_get_name(par->codec_id)));

if (par->codec_id == AV_CODEC_ID_PROBE)
{
Expand All @@ -2176,7 +2176,7 @@ int AvFormatDecoder::ScanStreams(bool novideo)
{
LOG(VB_GENERAL, LOG_ERR, LOC +
QString("Could not find decoder for codec (%1), ignoring.")
.arg(ff_codec_id_string(par->codec_id)));
.arg(avcodec_get_name(par->codec_id)));

// Nigel's bogus codec-debug. Dump the list of codecs & decoders,
// and have one last attempt to find a decoder. This is usually
Expand Down Expand Up @@ -2225,8 +2225,8 @@ int AvFormatDecoder::ScanStreams(bool novideo)
{
LOG(VB_PLAYBACK, LOG_INFO, LOC +
QString("Already opened codec not matching (%1 vs %2). Reopening")
.arg(ff_codec_id_string(enc->codec_id),
ff_codec_id_string(enc->codec->id)));
.arg(avcodec_get_name(enc->codec_id),
avcodec_get_name(enc->codec->id)));
m_codecMap.FreeCodecContext(m_ic->streams[strm]);
enc = m_codecMap.GetCodecContext(m_ic->streams[strm]);
}
Expand Down Expand Up @@ -2359,7 +2359,7 @@ int AvFormatDecoder::ScanStreams(bool novideo)
LOG(VB_PLAYBACK, LOG_INFO, LOC +
QString("Selected track #%1: ID: 0x%2 Codec ID: %3 Profile: %4 Type: %5 Bitrate: %6")
.arg(selTrack).arg(static_cast<uint64_t>(stream->id), 0, 16)
.arg(ff_codec_id_string(enc->codec_id),
.arg(avcodec_get_name(enc->codec_id),
avcodec_profile_name(enc->codec_id, enc->profile),
codectype,
QString::number(enc->bit_rate)));
Expand Down Expand Up @@ -2579,7 +2579,7 @@ bool AvFormatDecoder::OpenAVCodec(AVCodecContext *avctx, const AVCodec *codec)
LOG(VB_GENERAL, LOG_ERR, LOC +
QString("Could not open codec 0x%1, id(%2) type(%3) "
"ignoring. reason %4").arg((uint64_t)avctx,0,16)
.arg(ff_codec_id_string(avctx->codec_id),
.arg(avcodec_get_name(avctx->codec_id),
ff_codec_type_string(avctx->codec_type),
av_make_error_stdstring(error, ret)));
return false;
Expand All @@ -2588,7 +2588,7 @@ bool AvFormatDecoder::OpenAVCodec(AVCodecContext *avctx, const AVCodec *codec)
LOG(VB_GENERAL, LOG_INFO, LOC +
QString("Opened codec 0x%1, id(%2) type(%3)")
.arg((uint64_t)avctx,0,16)
.arg(ff_codec_id_string(avctx->codec_id),
.arg(avcodec_get_name(avctx->codec_id),
ff_codec_type_string(avctx->codec_type)));
return true;
}
Expand Down Expand Up @@ -5083,7 +5083,7 @@ bool AvFormatDecoder::GetFrame(DecodeType decodetype, bool &Retry)
QString("No codec for stream index %1, type(%2) id(%3:%4)")
.arg(pkt->stream_index)
.arg(ff_codec_type_string(codec_type),
ff_codec_id_string(curstream->codecpar->codec_id))
avcodec_get_name(curstream->codecpar->codec_id))
.arg(curstream->codecpar->codec_id));
// Process Stream Change in case we have no audio
if (codec_type == AVMEDIA_TYPE_AUDIO && !m_audio->HasAudioIn())
Expand Down Expand Up @@ -5142,7 +5142,7 @@ bool AvFormatDecoder::GetFrame(DecodeType decodetype, bool &Retry)
{
LOG(VB_GENERAL, LOG_ERR, LOC +
QString("Decoding - id(%1) type(%2)")
.arg(ff_codec_id_string(ctx->codec_id),
.arg(avcodec_get_name(ctx->codec_id),
ff_codec_type_string(ctx->codec_type)));
have_err = true;
break;
Expand Down Expand Up @@ -5239,7 +5239,7 @@ QString AvFormatDecoder::GetRawEncodingType(void)
int stream = m_selectedTrack[kTrackTypeVideo].m_av_stream_index;
if (stream < 0 || !m_ic)
return QString();
return ff_codec_id_string(m_ic->streams[stream]->codecpar->codec_id);
return avcodec_get_name(m_ic->streams[stream]->codecpar->codec_id);
}

void AvFormatDecoder::SetDisablePassThrough(bool disable)
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/decoders/avformatdecoder.h
Expand Up @@ -72,7 +72,7 @@ class AudioInfo
QString toString() const
{
return QString("id(%1) %2Hz %3ch %4bps %5 (profile %6)")
.arg(ff_codec_id_string(m_codecId),4).arg(m_sampleRate,6)
.arg(avcodec_get_name(m_codecId),4).arg(m_sampleRate,6)
.arg(m_channels,2).arg(AudioOutputSettings::FormatToBits(format),2)
.arg((m_doPassthru) ? "pt":"",3).arg(m_codecProfile);
}
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/decoders/mythcodeccontext.cpp
Expand Up @@ -314,7 +314,7 @@ void MythCodecContext::InitVideoCodec(AVCodecContext *Context,
LOG(VB_PLAYBACK, LOG_INFO, LOC +
QString("Using software scaling to convert pixel format %1 for "
"codec %2").arg(av_get_pix_fmt_name(Context->pix_fmt),
ff_codec_id_string(Context->codec_id)));
avcodec_get_name(Context->codec_id)));
}
}

Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/decoders/mythnvdeccontext.cpp
Expand Up @@ -47,7 +47,7 @@ MythCodecID MythNVDECContext::GetSupportedCodec(AVCodecContext **Context,
if (!FrameTypeIsSupported(*Context, FMT_NVDEC))
return failure;

QString codecstr = ff_codec_id_string((*Context)->codec_id);
QString codecstr = avcodec_get_name((*Context)->codec_id);
QString profile = avcodec_profile_name((*Context)->codec_id, (*Context)->profile);
QString pixfmt = av_get_pix_fmt_name((*Context)->pix_fmt);

Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/decoders/mythvaapicontext.cpp
Expand Up @@ -140,7 +140,7 @@ MythCodecID MythVAAPIContext::GetSupportedCodec(AVCodecContext** Context,
if (!Decoder.startsWith("vaapi") || vendor.isEmpty() || qEnvironmentVariableIsSet("NO_VAAPI"))
return failure;

const auto * codec = ff_codec_id_string((*Context)->codec_id);
const auto * codec = avcodec_get_name((*Context)->codec_id);
const auto * profile = avcodec_profile_name((*Context)->codec_id, (*Context)->profile);
const auto * pixfmt = av_get_pix_fmt_name((*Context)->pix_fmt);

Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/decoders/mythvdpaucontext.cpp
Expand Up @@ -131,7 +131,7 @@ MythCodecID MythVDPAUContext::GetSupportedCodec(AVCodecContext **Context,
if (!FrameTypeIsSupported(*Context, FMT_VDPAU))
return failure;

QString codec = ff_codec_id_string((*Context)->codec_id);
QString codec = avcodec_get_name((*Context)->codec_id);
QString profile = avcodec_profile_name((*Context)->codec_id, (*Context)->profile);
QString pixfmt = av_get_pix_fmt_name((*Context)->pix_fmt);

Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/decoders/mythvtbcontext.cpp
Expand Up @@ -107,7 +107,7 @@ MythCodecID MythVTBContext::GetSupportedCodec(AVCodecContext **Context,
if (mythprofile == MythCodecContext::NoProfile)
return failure;

QString codec = ff_codec_id_string((*Context)->codec_id);
QString codec = avcodec_get_name((*Context)->codec_id);
QString profile = avcodec_profile_name((*Context)->codec_id, (*Context)->profile);
QString pixfmt = av_get_pix_fmt_name((*Context)->pix_fmt);

Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/mythplayerui.cpp
Expand Up @@ -812,7 +812,7 @@ void MythPlayerUI::GetPlaybackData(InfoMap& Map)

void MythPlayerUI::GetCodecDescription(InfoMap& Map)
{
Map["audiocodec"] = ff_codec_id_string(m_audio.GetCodec());
Map["audiocodec"] = avcodec_get_name(m_audio.GetCodec());
Map["audiochannels"] = QString::number(m_audio.GetOrigChannels());

int width = m_videoDispDim.width();
Expand Down
8 changes: 4 additions & 4 deletions mythtv/libs/libmythtv/recorders/recorderbase.cpp
Expand Up @@ -451,7 +451,7 @@ void RecorderBase::FinishRecording(void)
recFile->m_containerFormat = m_containerFormat;

// Video
recFile->m_videoCodec = ff_codec_id_string(m_primaryVideoCodec);
recFile->m_videoCodec = avcodec_get_name(m_primaryVideoCodec);
switch (m_curRecording->QueryAverageAspectRatio())
{
case MARK_ASPECT_1_1 :
Expand All @@ -476,7 +476,7 @@ void RecorderBase::FinishRecording(void)
recFile->m_videoFrameRate = (double)m_curRecording->QueryAverageFrameRate() / 1000.0;

// Audio
recFile->m_audioCodec = ff_codec_id_string(m_primaryAudioCodec);
recFile->m_audioCodec = avcodec_get_name(m_primaryAudioCodec);

recFile->Save();
}
Expand Down Expand Up @@ -821,7 +821,7 @@ void RecorderBase::VideoCodecChange(AVCodecID vCodec)
{
if (m_curRecording && m_curRecording->GetRecordingFile())
{
m_curRecording->GetRecordingFile()->m_videoCodec = ff_codec_id_string(vCodec);
m_curRecording->GetRecordingFile()->m_videoCodec = avcodec_get_name(vCodec);
m_curRecording->GetRecordingFile()->Save();
}
}
Expand All @@ -830,7 +830,7 @@ void RecorderBase::AudioCodecChange(AVCodecID aCodec)
{
if (m_curRecording && m_curRecording->GetRecordingFile())
{
m_curRecording->GetRecordingFile()->m_audioCodec = ff_codec_id_string(aCodec);
m_curRecording->GetRecordingFile()->m_audioCodec = avcodec_get_name(aCodec);
m_curRecording->GetRecordingFile()->Save();
}
}
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/recordingfile.h
Expand Up @@ -46,7 +46,7 @@ class MTV_PUBLIC RecordingFile

AVContainer m_containerFormat {formatUnknown};

QString m_videoCodec; // ff_codec_id_string
QString m_videoCodec; // avcodec_get_name
QSize m_videoResolution;
double m_videoAspectRatio {0.0};
double m_videoFrameRate {0.0};
Expand Down

0 comments on commit 5c984da

Please sign in to comment.