Lines Matching defs:oc
126 static void add_stream(OutputStream *ost, AVFormatContext *oc,
147 ost->st = avformat_new_stream(oc, NULL);
152 ost->st->id = oc->nb_streams-1;
210 if (oc->oformat->flags & AVFMT_GLOBALHEADER)
245 static void open_audio(AVFormatContext *oc, const AVCodec *codec,
340 static int write_audio_frame(AVFormatContext *oc, OutputStream *ost)
380 return write_frame(oc, c, ost->st, frame, ost->tmp_pkt);
409 static void open_video(AVFormatContext *oc, const AVCodec *codec,
521 static int write_video_frame(AVFormatContext *oc, OutputStream *ost)
523 return write_frame(oc, ost->enc, ost->st, get_video_frame(ost), ost->tmp_pkt);
526 static void close_stream(AVFormatContext *oc, OutputStream *ost)
544 AVFormatContext *oc;
570 avformat_alloc_output_context2(&oc, NULL, NULL, filename);
571 if (!oc) {
573 avformat_alloc_output_context2(&oc, NULL, "mpeg", filename);
575 if (!oc)
578 fmt = oc->oformat;
583 add_stream(&video_st, oc, &video_codec, fmt->video_codec);
588 add_stream(&audio_st, oc, &audio_codec, fmt->audio_codec);
596 open_video(oc, video_codec, &video_st, opt);
599 open_audio(oc, audio_codec, &audio_st, opt);
601 av_dump_format(oc, 0, filename, 1);
605 ret = avio_open(&oc->pb, filename, AVIO_FLAG_WRITE);
614 ret = avformat_write_header(oc, &opt);
626 encode_video = !write_video_frame(oc, &video_st);
628 encode_audio = !write_audio_frame(oc, &audio_st);
632 av_write_trailer(oc);
636 close_stream(oc, &video_st);
638 close_stream(oc, &audio_st);
642 avio_closep(&oc->pb);
645 avformat_free_context(oc);