Skip to content

Commit

Permalink
FFmpegWriter: (a/v)_codec => (a/v)_codec_ctx
Browse files Browse the repository at this point in the history
The audio_codec and video_codec vars have type AVCodecContext.
Renaming them to reflect that makes the code easier to follow.

A couple of places in FFmpegUtilities macros that also used
context variables named _codec got the same fix.
  • Loading branch information
ferdnyc committed Mar 22, 2020
1 parent 2c6d25e commit 527acfe
Show file tree
Hide file tree
Showing 3 changed files with 93 additions and 93 deletions.
8 changes: 4 additions & 4 deletions include/FFmpegUtilities.h
Expand Up @@ -40,7 +40,7 @@
#ifndef IS_FFMPEG_3_2
#define IS_FFMPEG_3_2 (LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57, 64, 101))
#endif

#ifndef HAVE_HW_ACCEL
#define HAVE_HW_ACCEL (LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57, 107, 100))
#endif
Expand Down Expand Up @@ -178,13 +178,13 @@
#define AV_OUTPUT_CONTEXT(output_context, path) avformat_alloc_output_context2( output_context, NULL, NULL, path)
#define AV_OPTION_FIND(priv_data, name) av_opt_find(priv_data, name, NULL, 0, 0)
#define AV_OPTION_SET( av_stream, priv_data, name, value, avcodec) av_opt_set(priv_data, name, value, 0); avcodec_parameters_from_context(av_stream->codecpar, avcodec);
#define AV_FORMAT_NEW_STREAM(oc, st_codec, av_codec, av_st) av_st = avformat_new_stream(oc, NULL);\
#define AV_FORMAT_NEW_STREAM(oc, st_codec_ctx, av_codec, av_st) av_st = avformat_new_stream(oc, NULL);\
if (!av_st) \
throw OutOfMemory("Could not allocate memory for the video stream.", path); \
c = avcodec_alloc_context3(av_codec); \
st_codec = c; \
st_codec_ctx = c; \
av_st->codecpar->codec_id = av_codec->id;
#define AV_COPY_PARAMS_FROM_CONTEXT(av_stream, av_codec) avcodec_parameters_from_context(av_stream->codecpar, av_codec);
#define AV_COPY_PARAMS_FROM_CONTEXT(av_stream, av_codec_ctx) avcodec_parameters_from_context(av_stream->codecpar, av_codec_ctx);
#elif IS_FFMPEG_3_2
#define AV_REGISTER_ALL av_register_all();
#define AVCODEC_REGISTER_ALL avcodec_register_all();
Expand Down
4 changes: 2 additions & 2 deletions include/FFmpegWriter.h
Expand Up @@ -164,8 +164,8 @@ namespace openshot {
AVOutputFormat *fmt;
AVFormatContext *oc;
AVStream *audio_st, *video_st;
AVCodecContext *video_codec;
AVCodecContext *audio_codec;
AVCodecContext *video_codec_ctx;
AVCodecContext *audio_codec_ctx;
SwsContext *img_convert_ctx;
double audio_pts, video_pts;
int16_t *samples;
Expand Down

0 comments on commit 527acfe

Please sign in to comment.