Skip to content

Commit

Permalink
Remove unused functions (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinschweikert authored Oct 23, 2024
1 parent b0e5dc7 commit 8eaa9ca
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 28 deletions.
22 changes: 0 additions & 22 deletions c_src/xav/utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,6 @@
#include <libavutil/opt.h>
#include <stdint.h>

void print_supported_pix_fmts(AVCodec *codec) {
if (codec->pix_fmts == NULL) {
fprintf(stdout, "unknown\n");
} else {
for (int i = 0; codec->pix_fmts[i] != -1; i++) {
fprintf(stdout, "fmt: %d\n", codec->pix_fmts[i]);
}
}
}

void convert_to_rgb(AVFrame *src_frame, uint8_t *dst_data[], int dst_linesize[]) {
struct SwsContext *sws_ctx =
sws_getContext(src_frame->width, src_frame->height, src_frame->format, src_frame->width,
src_frame->height, AV_PIX_FMT_RGB24, SWS_BILINEAR, NULL, NULL, NULL);

av_image_alloc(dst_data, dst_linesize, src_frame->width, src_frame->height, AV_PIX_FMT_RGB24, 1);

// is this (const uint8_t * const*) cast really correct?
sws_scale(sws_ctx, (const uint8_t *const *)src_frame->data, src_frame->linesize, 0,
src_frame->height, dst_data, dst_linesize);
}

ERL_NIF_TERM xav_nif_ok(ErlNifEnv *env, ERL_NIF_TERM data_term) {
ERL_NIF_TERM ok_term = enif_make_atom(env, "ok");
return enif_make_tuple(env, 2, ok_term, data_term);
Expand Down
5 changes: 0 additions & 5 deletions c_src/xav/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#include <libavdevice/avdevice.h>
#include <libavformat/avformat.h>
#include <libavutil/avutil.h>
#include <libavutil/imgutils.h>
#include <libswresample/swresample.h>
#include <libswscale/swscale.h>

Expand All @@ -16,10 +15,6 @@

#define XAV_ALLOC(X) enif_alloc(X)
#define XAV_FREE(X) enif_free(X)

void print_supported_pix_fmts(AVCodec *codec);
void convert_to_rgb(AVFrame *src_frame, uint8_t *dst_data[], int dst_linesize[]);

ERL_NIF_TERM xav_nif_ok(ErlNifEnv *env, ERL_NIF_TERM data_term);
ERL_NIF_TERM xav_nif_error(ErlNifEnv *env, char *reason);
ERL_NIF_TERM xav_nif_raise(ErlNifEnv *env, char *msg);
Expand Down
1 change: 0 additions & 1 deletion c_src/xav/video_converter.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#include "video_converter.h"
#include "utils.h"

int video_converter_convert(AVFrame *src_frame, uint8_t *out_data[], int out_linesize[]) {
int ret;
Expand Down
1 change: 1 addition & 0 deletions c_src/xav/video_converter.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@

#include <libavutil/channel_layout.h>
#include <libavutil/imgutils.h>
#include <libswresample/swresample.h>
#include <libswscale/swscale.h>
#include <stdint.h>
Expand Down

0 comments on commit 8eaa9ca

Please sign in to comment.