Commit Graph

10 Commits

Author SHA1 Message Date
JohannesItten d2095d14d3 Read info about source from source/flow_def 2026-07-09 12:43:10 +03:00
JohannesItten a16cc7c3b7 docs: document .ts-only audio pacing limitation in videoin
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-05 12:54:23 +03:00
JohannesItten 7047690647 fix: resync video_index to MXL clock to prevent falling behind
After each video frame sleep, use mxlGetCurrentIndex instead of a
simple +1 increment — if audio processing ate into the next frame's
time we now skip the stale index rather than writing a late grain.
Same pattern ndiin already uses.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-05 12:49:23 +03:00
JohannesItten 0298cf9b48 refactor: VideoReader and videoin post-audio review cleanup
VideoReader:
- Remove unused #include <iostream>
- Remove dead AudioInfo::samples and ::channel_stride fields
- Rename have_video → has_video (consistent with has_audio)
- Rename get_next_frame → read_next (returns audio too, not just frames)
- Fix outdated comment on read_next
- Remove trailing blank line in allocate_audio_conversion_buffers

videoin:
- Remove redundant FFmpeg includes (VideoReader.hpp provides them)
- Fix bug: mxlFlowWriterGetMaxWriteLengthSamples called with invalid
  audio_writer when mxlCreateFlowWriter fails — moved inside else branch
- Rename call site: get_next_frame → read_next
- Rename have_video → has_video at call sites
- Use = nullptr for audio_writer (consistent with video_writer)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-05 12:44:35 +03:00
itten 166efc3c59 Some fixes. For a now we fully support only .ts, due to huge problem with h264/hevc audio bursts 2026-07-05 12:39:06 +03:00
itten b2534efb0f audio works, holy shit 2026-07-04 03:24:20 +03:00
JohannesItten 96475acf62 refactor: VideoReader and videoin cleanup
VideoReader:
- Guard get_source_info/allocate_conversion_buffers behind have_video
  check — prevents crash on audio-only files
- Remove unused audiobuf parameter from get_next_frame
- Remove dead return statements after throw
- Remove unused SourceInfo::stride field and AudioInfo struct
- Pass const std::string& instead of by value in constructor/open_file
- Remove redundant struct keyword on SourceInfo source_info{}
- Fix video_stream_index never guarded against -1 in open_file
- Check av_image_alloc and avcodec_parameters_to_context return values
- Remove extra av_packet_unref after seek (was harmless but confusing)
- Use SWS_BILINEAR for sws_getContext flags instead of 0
- Replace NULL with nullptr in sws_getContext
- Remove unused #include <libavutil/pixdesc.h>

videoin main.cpp:
- Early return if have_video is false after open
- Inline make_video_flow_def call (remove intermediate variable)
- Add grain count log line matching other nodes
- Change continue to break when get_next_frame returns false
- Make video_rate const
- Remove double blank line before main()
- Remove trailing spaces

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-03 19:13:19 +03:00
JohannesItten bb7d1bb5a3 fix: VideoReader bugs — stride, memory, audio detection, UB
Pass MXL grain stride (from sliceSizes[0]) into get_next_frame so
YUV422P10toV210 writes with the correct line width instead of a
self-computed value that may not match the MXL buffer.

Fix audio stream detection: condition was inverted (!= -1 → == -1),
so the first audio stream was never picked up.

Add return false at end of get_next_frame to fix UB when g_running
goes false and the loop exits without returning.

Replace av_frame_unref/av_packet_unref with av_frame_free/av_packet_free
in destructor — unref only releases data, not the struct itself.

Add av_freep(&p10_data[0]) in destructor to free av_image_alloc memory.

Remove unused p10_buffer and v210_buffer allocations.

Read filename from config("file") instead of hardcoded path.
Add early return if mxlCreateFlowWriter fails.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-03 19:11:18 +03:00
itten 32a8fa9837 refactored videoin to NodeBase 2026-07-03 18:48:11 +03:00
itten 2c43f356d1 it's alive 2026-07-03 14:01:13 +03:00