Skip to content

Commit

Permalink
Fixed preconditions for postprocessing (see #3064)
Browse files Browse the repository at this point in the history
  • Loading branch information
lminiero committed Sep 13, 2022
1 parent fb39add commit 524988b
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
4 changes: 2 additions & 2 deletions postprocessing/pp-av1.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

/* MP4 output */
static AVFormatContext *fctx;
#if LIBAVCODEC_VER_AT_LEAST(57, 25)
#if LIBAVCODEC_VER_AT_LEAST(58, 18)
static AVStream *vStream;
#endif
static uint16_t max_width = 0, max_height = 0;
Expand All @@ -43,7 +43,7 @@ const char **janus_pp_av1_get_extensions(void) {
int janus_pp_av1_create(char *destination, char *metadata, gboolean faststart, const char *extension) {
if(destination == NULL)
return -1;
#if !LIBAVCODEC_VER_AT_LEAST(57, 25)
#if !LIBAVCODEC_VER_AT_LEAST(58, 18)
JANUS_LOG(LOG_ERR, "This version of libavcodec doesn't support AV1...\n");
return -1;
#else
Expand Down
5 changes: 5 additions & 0 deletions postprocessing/pp-avformat.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@
(LIBAVCODEC_VERSION_MAJOR == major && \
LIBAVCODEC_VERSION_MINOR >= minor))

#define LIBAVFORMAT_VER_AT_LEAST(major, minor) \
(LIBAVFORMAT_VERSION_MAJOR > major || \
(LIBAVFORMAT_VERSION_MAJOR == major && \
LIBAVFORMAT_VERSION_MINOR >= minor))

#if LIBAVCODEC_VER_AT_LEAST(51, 42)
#define PIX_FMT_YUV420P AV_PIX_FMT_YUV420P
#endif
Expand Down
4 changes: 4 additions & 0 deletions postprocessing/pp-h264.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,9 @@ int janus_pp_h264_create(char *destination, char *metadata, gboolean faststart,
JANUS_LOG(LOG_ERR, "Error opening file for output (%d, %s)\n", res, av_err2str(res));
return -1;
}
#if LIBAVFORMAT_VER_AT_LEAST(58, 7)
fctx->url = g_strdup(filename);
#endif
if(avformat_write_header(fctx, &options) < 0) {
JANUS_LOG(LOG_ERR, "Error writing header\n");
return -1;
Expand Down Expand Up @@ -554,7 +556,9 @@ void janus_pp_h264_close(void) {
}
if(fctx != NULL) {
avio_close(fctx->pb);
#if LIBAVFORMAT_VER_AT_LEAST(58, 7)
g_free(fctx->url);
#endif
av_free(fctx);
}
}
4 changes: 4 additions & 0 deletions postprocessing/pp-h265.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,9 @@ int janus_pp_h265_create(char *destination, char *metadata, gboolean faststart,
JANUS_LOG(LOG_ERR, "Error opening file for output (%d, %s)\n", res, av_err2str(res));
return -1;
}
#if LIBAVFORMAT_VER_AT_LEAST(58, 7)
fctx->url = g_strdup(filename);
#endif
if(avformat_write_header(fctx, &options) < 0) {
JANUS_LOG(LOG_ERR, "Error writing header\n");
return -1;
Expand Down Expand Up @@ -643,7 +645,9 @@ void janus_pp_h265_close(void) {
}
if(fctx != NULL) {
avio_close(fctx->pb);
#if LIBAVFORMAT_VER_AT_LEAST(58, 7)
g_free(fctx->url);
#endif
av_free(fctx);
}
}

0 comments on commit 524988b

Please sign in to comment.