MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / input_thread

Function input_thread

fftools/ffmpeg_demux.c:727–833  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

725}
726
727static int input_thread(void *arg)
728{
729 Demuxer *d = arg;
730 InputFile *f = &d->f;
731
732 DemuxThreadContext dt;
733
734 int ret = 0;
735
736 ret = demux_thread_init(&dt);
737 if (ret < 0)
738 goto finish;
739
740 thread_set_name(f);
741
742 discard_unused_programs(f);
743
744 d->read_started = 1;
745 d->wallclock_start = av_gettime_relative();
746
747 while (1) {
748 DemuxStream *ds;
749 unsigned send_flags = 0;
750
751 ret = av_read_frame(f->ctx, dt.pkt_demux);
752
753 if (ret == AVERROR(EAGAIN)) {
754 av_usleep(10000);
755 continue;
756 }
757 if (ret < 0) {
758 int ret_bsf;
759
760 if (ret == AVERROR_EOF)
761 av_log(d, AV_LOG_VERBOSE, "EOF while reading input\n");
762 else {
763 av_log(d, AV_LOG_ERROR, "Error during demuxing: %s\n",
764 av_err2str(ret));
765 ret = exit_on_error ? ret : 0;
766 }
767
768 ret_bsf = demux_bsf_flush(d, &dt);
769 ret = err_merge(ret == AVERROR_EOF ? 0 : ret, ret_bsf);
770
771 if (d->loop) {
772 /* signal looping to our consumers */
773 dt.pkt_demux->stream_index = -1;
774 ret = sch_demux_send(d->sch, f->index, dt.pkt_demux, 0);
775 if (ret >= 0)
776 ret = seek_to_start(d, (Timestamp){ .ts = dt.pkt_demux->pts,
777 .tb = dt.pkt_demux->time_base });
778 if (ret >= 0)
779 continue;
780
781 /* fallthrough to the error path */
782 }
783
784 break;

Callers

nothing calls this directly

Calls 15

demux_thread_initFunction · 0.85
discard_unused_programsFunction · 0.85
av_gettime_relativeFunction · 0.85
av_read_frameFunction · 0.85
av_usleepFunction · 0.85
av_logFunction · 0.85
demux_bsf_flushFunction · 0.85
err_mergeFunction · 0.85
sch_demux_sendFunction · 0.85
seek_to_startFunction · 0.85
av_pkt_dump_log2Function · 0.85
ds_from_istFunction · 0.85

Tested by

no test coverage detected