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

Function avformatInit

libhb/muxavformat.c:251–1323  ·  view source on GitHub ↗

* avformatInit ********************************************************************** * Allocates hb_mux_data_t structures, create file and write headers *********************************************************************/

Source from the content-addressed store, hash-verified

249 * Allocates hb_mux_data_t structures, create file and write headers
250 *********************************************************************/
251static int avformatInit( hb_mux_object_t * m )
252{
253 hb_job_t * job = m->job;
254 hb_audio_t * audio;
255 hb_mux_data_t * track;
256 int meta_mux;
257 int max_tracks;
258 int ii, jj, ret;
259
260 int clock_min, clock_max, clock;
261 hb_video_framerate_get_limits(&clock_min, &clock_max, &clock);
262
263 const char *muxer_name = NULL;
264
265 uint8_t default_track_flag = 1;
266 uint8_t need_fonts = 0;
267 char *lang;
268
269 m->pkt = av_packet_alloc();
270 m->empty_pkt = av_packet_alloc();
271
272 if (m->pkt == NULL || m->empty_pkt == NULL)
273 {
274 hb_error("muxavformat: av_packet_alloc failed");
275 goto error;
276 }
277
278 max_tracks = 1 + hb_list_count( job->list_audio ) +
279 hb_list_count( job->list_subtitle );
280 m->tracks = calloc(max_tracks, sizeof(hb_mux_data_t*));
281
282 if (m->tracks == NULL)
283 {
284 hb_error("muxavformat: calloc failed");
285 goto error;
286 }
287
288 AVDictionary * av_opts = NULL;
289 switch (job->mux)
290 {
291 case HB_MUX_AV_MP4:
292 m->time_base.num = 1;
293 m->time_base.den = 90000;
294 if( job->ipod_atom )
295 muxer_name = "ipod";
296 else
297 muxer_name = "mp4";
298 meta_mux = META_MUX_MP4;
299
300 av_dict_set(&av_opts, "brand", "mp42", 0);
301 av_dict_set(&av_opts, "strict", "experimental", 0);
302 if (job->optimize)
303 av_dict_set(&av_opts, "movflags", "faststart+disable_chpl+write_colr", 0);
304 else
305 av_dict_set(&av_opts, "movflags", "+disable_chpl+write_colr", 0);
306 break;
307
308 case HB_MUX_AV_MOV:

Callers

nothing calls this directly

Calls 15

hb_errorFunction · 0.85
hb_list_countFunction · 0.85
set_extradataFunction · 0.85
hb_output_color_primFunction · 0.85
hb_output_color_transferFunction · 0.85
hb_output_color_matrixFunction · 0.85
hb_mastering_hb_to_ffFunction · 0.85
hb_ambient_hb_to_ffFunction · 0.85
hb_dovi_hb_to_ffFunction · 0.85
hb_reduceFunction · 0.85

Tested by

no test coverage detected