Skip to content

Commit 527acfe

Browse files
committed
FFmpegWriter: (a/v)_codec => (a/v)_codec_ctx
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.
1 parent 2c6d25e commit 527acfe

File tree

3 files changed

+93
-93
lines changed

3 files changed

+93
-93
lines changed

include/FFmpegUtilities.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
#ifndef IS_FFMPEG_3_2
4141
#define IS_FFMPEG_3_2 (LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57, 64, 101))
4242
#endif
43-
43+
4444
#ifndef HAVE_HW_ACCEL
4545
#define HAVE_HW_ACCEL (LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57, 107, 100))
4646
#endif
@@ -178,13 +178,13 @@
178178
#define AV_OUTPUT_CONTEXT(output_context, path) avformat_alloc_output_context2( output_context, NULL, NULL, path)
179179
#define AV_OPTION_FIND(priv_data, name) av_opt_find(priv_data, name, NULL, 0, 0)
180180
#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);
181-
#define AV_FORMAT_NEW_STREAM(oc, st_codec, av_codec, av_st) av_st = avformat_new_stream(oc, NULL);\
181+
#define AV_FORMAT_NEW_STREAM(oc, st_codec_ctx, av_codec, av_st) av_st = avformat_new_stream(oc, NULL);\
182182
if (!av_st) \
183183
throw OutOfMemory("Could not allocate memory for the video stream.", path); \
184184
c = avcodec_alloc_context3(av_codec); \
185-
st_codec = c; \
185+
st_codec_ctx = c; \
186186
av_st->codecpar->codec_id = av_codec->id;
187-
#define AV_COPY_PARAMS_FROM_CONTEXT(av_stream, av_codec) avcodec_parameters_from_context(av_stream->codecpar, av_codec);
187+
#define AV_COPY_PARAMS_FROM_CONTEXT(av_stream, av_codec_ctx) avcodec_parameters_from_context(av_stream->codecpar, av_codec_ctx);
188188
#elif IS_FFMPEG_3_2
189189
#define AV_REGISTER_ALL av_register_all();
190190
#define AVCODEC_REGISTER_ALL avcodec_register_all();

include/FFmpegWriter.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,8 @@ namespace openshot {
164164
AVOutputFormat *fmt;
165165
AVFormatContext *oc;
166166
AVStream *audio_st, *video_st;
167-
AVCodecContext *video_codec;
168-
AVCodecContext *audio_codec;
167+
AVCodecContext *video_codec_ctx;
168+
AVCodecContext *audio_codec_ctx;
169169
SwsContext *img_convert_ctx;
170170
double audio_pts, video_pts;
171171
int16_t *samples;

0 commit comments

Comments
 (0)