MCPcopy Create free account
hub / github.com/HandBrake/HandBrake / encavcodecaInit

Function encavcodecaInit

libhb/encavcodecaudio.c:46–362  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

44};
45
46static int encavcodecaInit(hb_work_object_t *w, hb_job_t *job)
47{
48 const AVCodec *codec;
49 AVCodecContext *context;
50 hb_audio_t *audio = w->audio;
51
52 hb_work_private_t *pv = calloc(1, sizeof(hb_work_private_t));
53 w->private_data = pv;
54 pv->job = job;
55 pv->list = hb_list_init();
56 pv->last_pts = AV_NOPTS_VALUE;
57 pv->pkt = av_packet_alloc();
58
59 if (pv->pkt == NULL)
60 {
61 hb_error("encavcodecaInit: av_packet_alloc failed");
62 return 1;
63 }
64
65 // channel count, layout and matrix encoding
66 int matrix_encoding;
67 uint64_t in_channel_layout = hb_ff_mixdown_xlat(audio->config.out.mixdown,
68 &matrix_encoding);
69 uint64_t out_channel_layout = hb_ff_mixdown_xlat(audio->config.out.mixdown,
70 &matrix_encoding);
71 pv->out_discrete_channels =
72 hb_mixdown_get_discrete_channel_count(audio->config.out.mixdown);
73
74 // default settings and options
75 AVDictionary *av_opts = NULL;
76 const char *codec_name = NULL;
77 enum AVCodecID codec_id = AV_CODEC_ID_NONE;
78 enum AVSampleFormat sample_fmt = AV_SAMPLE_FMT_FLTP;
79 int bits_per_raw_sample = 0;
80 int profile = AV_PROFILE_UNKNOWN;
81
82 // override with encoder-specific values
83 switch (audio->config.out.codec)
84 {
85 case HB_ACODEC_AC3:
86 codec_id = AV_CODEC_ID_AC3;
87 if (matrix_encoding != AV_MATRIX_ENCODING_NONE)
88 av_dict_set(&av_opts, "dsur_mode", "on", 0);
89 break;
90
91 case HB_ACODEC_FFEAC3:
92 codec_id = AV_CODEC_ID_EAC3;
93 if (matrix_encoding != AV_MATRIX_ENCODING_NONE)
94 av_dict_set(&av_opts, "dsur_mode", "on", 0);
95 break;
96
97 case HB_ACODEC_FDK_AAC:
98 case HB_ACODEC_FDK_HAAC:
99 codec_name = "libfdk_aac";
100 sample_fmt = AV_SAMPLE_FMT_S16;
101 bits_per_raw_sample = 16;
102 switch (audio->config.out.codec)
103 {

Callers

nothing calls this directly

Calls 10

hb_list_initFunction · 0.85
hb_errorFunction · 0.85
hb_ff_mixdown_xlatFunction · 0.85
hb_ff_set_sample_fmtFunction · 0.85
hb_avcodec_openFunction · 0.85
hb_logFunction · 0.85
hb_set_extradataFunction · 0.85

Tested by

no test coverage detected