Skip to content

Commit

Permalink
Improve name
Browse files Browse the repository at this point in the history
  • Loading branch information
mthrok committed May 8, 2022
1 parent b8f3449 commit b016d0e
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion torchaudio/csrc/ffmpeg/decoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Decoder::Decoder(
AVCodecParameters* pParam,
const std::string& decoder_name,
const std::map<std::string, std::string>& decoder_option)
: pCodecContext(get_codec_context(pParam->codec_id, decoder_name)) {
: pCodecContext(get_decode_context(pParam->codec_id, decoder_name)) {
init_codec_context(pCodecContext, pParam, decoder_name, decoder_option);
}

Expand Down
10 changes: 5 additions & 5 deletions torchaudio/csrc/ffmpeg/ffmpeg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ std::string join(std::vector<std::string> vars) {

} // namespace

AVFormatContextPtr get_format_context(
AVFormatContextPtr get_input_format_context(
const std::string& src,
const std::string& device,
const std::map<std::string, std::string>& option) {
Expand Down Expand Up @@ -145,7 +145,7 @@ void AVCodecContextDeleter::operator()(AVCodecContext* p) {
};

namespace {
const AVCodec* get_codec(
const AVCodec* get_decode_codec(
enum AVCodecID codec_id,
const std::string& decoder_name) {
const AVCodec* pCodec = decoder_name.empty()
Expand All @@ -167,10 +167,10 @@ const AVCodec* get_codec(

} // namespace

AVCodecContextPtr get_codec_context(
AVCodecContextPtr get_decode_context(
enum AVCodecID codec_id,
const std::string& decoder_name) {
const AVCodec* pCodec = get_codec(codec_id, decoder_name);
const AVCodec* pCodec = get_decode_codec(codec_id, decoder_name);

AVCodecContext* pCodecContext = avcodec_alloc_context3(pCodec);
if (!pCodecContext) {
Expand All @@ -184,7 +184,7 @@ void init_codec_context(
AVCodecParameters* pParams,
const std::string& decoder_name,
const std::map<std::string, std::string>& decoder_option) {
const AVCodec* pCodec = get_codec(pParams->codec_id, decoder_name);
const AVCodec* pCodec = get_decode_codec(pParams->codec_id, decoder_name);

if (avcodec_parameters_to_context(pCodecContext, pParams) < 0) {
throw std::runtime_error("Failed to set CodecContext parameter.");
Expand Down
4 changes: 2 additions & 2 deletions torchaudio/csrc/ffmpeg/ffmpeg.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ struct AVFormatContextPtr
};

// create format context for reading media
AVFormatContextPtr get_format_context(
AVFormatContextPtr get_input_format_context(
const std::string& src,
const std::string& device,
const std::map<std::string, std::string>& option);
Expand Down Expand Up @@ -125,7 +125,7 @@ struct AVCodecContextPtr
};

// Allocate codec context from either decoder name or ID
AVCodecContextPtr get_codec_context(
AVCodecContextPtr get_decode_context(
enum AVCodecID codec_id,
const std::string& decoder);

Expand Down
2 changes: 1 addition & 1 deletion torchaudio/csrc/ffmpeg/streamer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Streamer::Streamer(
const std::string& src,
const std::string& device,
const std::map<std::string, std::string>& option)
: pFormatContext(get_format_context(src, device, option)) {
: pFormatContext(get_input_format_context(src, device, option)) {
if (avformat_find_stream_info(pFormatContext, nullptr) < 0)
throw std::runtime_error("Failed to find stream information.");

Expand Down

0 comments on commit b016d0e

Please sign in to comment.