Skip to content

Commit

Permalink
Avoid using UTF8 encoding (not needed, OTP26 only)
Browse files Browse the repository at this point in the history
  • Loading branch information
dmorn committed Nov 10, 2023
1 parent 0139148 commit 1ce15bf
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions c_src/libav.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ void enif_get_demuxer(ErlNifEnv *env, ERL_NIF_TERM term, Demuxer **ctx) {

ERL_NIF_TERM enif_make_error(ErlNifEnv *env, char *err) {
return enif_make_tuple2(env, enif_make_atom(env, "error"),
enif_make_string(env, err, ERL_NIF_UTF8));
enif_make_string(env, err, ERL_NIF_LATIN1));
}

ERL_NIF_TERM enif_make_av_error(ErlNifEnv *env, int errn) {
Expand Down Expand Up @@ -146,7 +146,7 @@ ERL_NIF_TERM enif_make_stream_map(ErlNifEnv *env, AVStream *stream) {
enif_make_map_put(env, map, enif_make_atom(env, "codec_type"),
enif_make_int(env, params->codec_type), &map);
enif_make_map_put(env, map, enif_make_atom(env, "codec_name"),
enif_make_string(env, codec_name, ERL_NIF_UTF8), &map);
enif_make_string(env, codec_name, ERL_NIF_LATIN1), &map);
enif_make_map_put(env, map, enif_make_atom(env, "codec_params"),
enif_make_resource(env, codec_params_res), &map);

Expand All @@ -156,7 +156,7 @@ ERL_NIF_TERM enif_make_stream_map(ErlNifEnv *env, AVStream *stream) {
enif_make_map_put(env, map, enif_make_atom(env, "sample_rate"),
enif_make_int(env, params->sample_rate), &map);
enif_make_map_put(env, map, enif_make_atom(env, "sample_format"),
enif_make_string(env, sample_fmt, ERL_NIF_UTF8), &map);
enif_make_string(env, sample_fmt, ERL_NIF_LATIN1), &map);

// This is done to allow the erlang garbage collector to take care
// of freeing this resource when needed.
Expand Down Expand Up @@ -320,7 +320,7 @@ ERL_NIF_TERM enif_decoder_stream_format(ErlNifEnv *env, int argc,
enif_make_map_put(
env, map, enif_make_atom(env, "sample_format"),
enif_make_string(env, av_get_sample_fmt_name(ctx->output.sample_format),
ERL_NIF_UTF8),
ERL_NIF_LATIN1),
&map);
}

Expand Down

0 comments on commit 1ce15bf

Please sign in to comment.