MCPcopy Create free account
hub / github.com/byhook/ffmpeg4android / check_init_output_file

Function check_init_output_file

ffmpeg-single-cmd/src/main/cpp/ffmpeg_mod.c:2941–2985  ·  view source on GitHub ↗

open the muxer when all the streams are initialized */

Source from the content-addressed store, hash-verified

2939
2940/* open the muxer when all the streams are initialized */
2941static int check_init_output_file(OutputFile *of, int file_index)
2942{
2943 int ret, i;
2944
2945 for (i = 0; i < of->ctx->nb_streams; i++) {
2946 OutputStream *ost = output_streams[of->ost_index + i];
2947 if (!ost->initialized)
2948 return 0;
2949 }
2950
2951 of->ctx->interrupt_callback = int_cb;
2952
2953 ret = avformat_write_header(of->ctx, &of->opts);
2954 if (ret < 0) {
2955 av_log(NULL, AV_LOG_ERROR,
2956 "Could not write header for output file #%d "
2957 "(incorrect codec parameters ?): %s\n",
2958 file_index, av_err2str(ret));
2959 return ret;
2960 }
2961 //assert_avoptions(of->opts);
2962 of->header_written = 1;
2963
2964 av_dump_format(of->ctx, file_index, of->ctx->filename, 1);
2965
2966 if (sdp_filename || want_sdp)
2967 print_sdp();
2968
2969 /* flush the muxing queues */
2970 for (i = 0; i < of->ctx->nb_streams; i++) {
2971 OutputStream *ost = output_streams[of->ost_index + i];
2972
2973 /* try to improve muxing time_base (only possible if nothing has been written yet) */
2974 if (!av_fifo_size(ost->muxing_queue))
2975 ost->mux_timebase = ost->st->time_base;
2976
2977 while (av_fifo_size(ost->muxing_queue)) {
2978 AVPacket pkt;
2979 av_fifo_generic_read(ost->muxing_queue, &pkt, sizeof(pkt), NULL);
2980 write_packet(of, &pkt, ost, 1);
2981 }
2982 }
2983
2984 return 0;
2985}
2986
2987static int init_output_bsfs(OutputStream *ost)
2988{

Callers 2

init_output_streamFunction · 0.85
transcode_initFunction · 0.85

Calls 2

print_sdpFunction · 0.85
write_packetFunction · 0.85

Tested by

no test coverage detected