Commit Graph

1376 Commits

Author SHA1 Message Date
Loïc Branstett f93de3ef23 stream/demux: move remaining callbacks to their respective ops struct
This commit moves the remaining callbacks of stream/demux: pf_read/
pf_block/pf_seek/pf_readdir and pf_demux into their operations table,
aiming at unifying all the callbacks under a unique place.
This is a follow-up to the introduction of typed controls callbacks
for stream and demux.

Like for the typed controls callbacks if no operation is provided
(ie, stream_t/demux_t.ops is NULL) by a module, the legacy pf_* will be
used instead as a fallback.

The commit doesn't migrate any of modules yet.
2023-03-24 10:51:36 +00:00
Francois Cartegnie f7bb59d9f5 demux: mp4: always check and use next edit list
directly skips empty edits and avoids stopping
on last track sample (fixes loop playback)
2023-03-24 01:04:39 +00:00
Steve Lhomme caca6ffbc3 input: don't compile local ControlInsertDemuxFilter without sout support
Just as the function above, it's never called in that case.
2023-02-28 09:06:57 +00:00
Steve Lhomme b770c6400a input: don't lock to write stats if there are none 2023-02-23 16:33:00 +00:00
Steve Lhomme 95611d782b input: reset normal time on error
As the comment says, an error should be considered as VLC_TICK_0.
Since the value may not be constant we should reset it when needed.
2023-02-04 15:22:27 +00:00
Marvin Scholz 388cb0b646 input: update capabilities on end and error
When the input is stopped or an error occurred, the capabilities
should reflect that, so that on_capabilities_changed is invoked
as expected.

Fix #27047
2022-09-17 07:25:44 +00:00
Francois Cartegnie 42b767af6e input: use double for vlc_tick_t conversions
1111 becomes 1111000064 due to imprecision
2022-08-30 15:31:07 +00:00
Thomas Guillem a76000e590 input: pass dir_path to DEMUX/STREAM SET_RECORD_STATE
If NULL, it continue to use default directories or the
"input-record-path" variable.
2022-08-13 08:45:38 +00:00
Denis Charmet 7c49e1c488 input: compress viewpoint input events 2022-08-08 20:40:01 +02:00
Thomas Guillem a680a82b05 input: use double for the position
input_SendEventTimes() used by the es_out was already using double.
2022-08-06 14:39:45 +00:00
Steve Lhomme f896e42e7a core: set names to threads created in the core 2022-04-27 12:45:10 +00:00
Steve Lhomme fcb83785ba input: remove thread priority hacking
It had no effect on POSIX platforms. Thread synchronization and TSAN analysis
is more useful than thread priorities.
2022-04-27 08:16:28 +00:00
Steve Lhomme b469857dec vlc_threads: remove the thread priority when creating a thread
It is not used in POSIX systems. On other system it probably don't make a
difference anymore, only Windows has actual useful values for
VLC_THREAD_PRIORITY_XXX. The synchronization is more important than having some
threads called more often than others.
2022-04-27 08:16:28 +00:00
Alaric Senat caf66c9129 input: source: properly release on `SlaveAdd` failure
Fix a leak happening when an input slave fails to load.
Leak detected with asan:

```
Direct leak of 120 byte(s) in 1 object(s) allocated from:
    #0 0x7f56cb985ad7 in calloc (/lib64/libasan.so.6)
    #1 0x7f56cad22849 in InputSourceNew src/input/input.c:2605
    #2 0x7f56cad2c9ca in input_SlaveSourceAdd src/input/input.c:3408
    #3 0x7f56cad0f838 in LoadSlaves src/input/input.c:1164
    #4 0x7f56cad1219a in Init src/input/input.c:1360
    #5 0x7f56cad06092 in Run src/input/input.c:466
    #6 0x7f56c9998b19 in start_thread (/lib64/libc.so.6)
```
2022-04-06 21:34:40 +00:00
Alaric Senat 83ffc43701 input: refactor `SlaveSourceAdd` error handling 2022-04-06 21:34:40 +00:00
Thomas Guillem 28a9b74b35 input: merge all Create functions
They are all internal now, it's ok to require unused arguments for a given type.
2022-03-17 06:46:51 +00:00
Thomas Guillem dee5364c81 input: rename/move input_create_option
Rename it to input_type, expose it via input_internal.h (usable by
input.c / es_out.c), and pass it to es_out in order to avoid fetching
input_thread_t private data.
2022-03-17 06:46:51 +00:00
Alexandre Janniaux 8f208ac330 src: fix typos
Typos found and reworked from codespell.
2022-01-08 15:19:32 +00:00
Rémi Denis-Courmont f617968196 input: absolute URLs do not necessarily have ://
This accepts a lone ':', which is not followed by two forward slashes
if the URL lacks a host part.
2021-09-19 18:02:31 +00:00
Rémi Denis-Courmont b3be9953d3 input: avoid one strdup() 2021-09-16 19:32:34 +00:00
Rémi Denis-Courmont c14e203212 input: pass full MRL to InputGetExtraFiles*() 2021-09-16 19:32:34 +00:00
Rémi Denis-Courmont 236414495c input: call vlc_uri2path() directly
...and skip redundant reverse conversion w/ vlc_path2uri().
2021-09-16 19:32:34 +00:00
Zhao Zhili f7f22ceab1 input: fix parent object of module_unneed "meta reader" 2021-09-09 09:31:29 +00:00
Alaric Senat 85e1eb7a50 input: fix input-slave url parsing regression
Fix a regression introduced by bbdaa0b64a
where some access MRL would, by design, make the url parsing fail.
Url parsing failing should not be a blocker to add the input slave,
instead we just warn the user that we couldn't deduce the slave file
type based on the given MRL.

Fixes #26055
2021-09-06 08:59:10 +00:00
Rémi Denis-Courmont f5033c4d93 sout: inline/remove sout_instance_ControlsPace() 2021-07-15 17:23:03 +00:00
Thomas Guillem 3fca93ef6e input: auto select all (perfectly) matched slaves
Historically, only local slaves or one added via the "input-slave" are
automatically selected. This commit adds autoselection for slaves found
by a network directory demuxer. To avoid false positives, only perfectly
matched slaves are auto-selected.

There is still a difference between local and network slaves:
 - Any matched local slaves will be auto-selected
 - Only perfectly matched network slaves will be auto-selected

Fixes #25673
2021-05-12 07:27:13 +00:00
Thomas Guillem 55e5f20484 input: simplify forced slave handling
We can add more than one forced slave, the es_out will only select the
first one (or all, depending on the es out mode option).
2021-05-12 07:27:13 +00:00
Thomas Guillem f994a4b823 input: rename SLAVE_TYPE_AUDIO to SLAVE_TYPE_GENERIC
Indeed, video slaves are also valid.
2021-05-12 07:27:13 +00:00
Thomas Guillem 1e03d1bd94 input: remove category handling when loading a slave
Since it's not used anymore.
2021-05-12 07:27:13 +00:00
Thomas Guillem df0a1b2f0e input: simplify slave auto selection
No need to store the forced state per category as the es_out won't
select track over the previous one.
2021-05-12 07:27:13 +00:00
Thomas Guillem 58ba032623 input: don't override item and capabilities from the slave
InputSourceInit() is called to initialize the master and all slaves
inputs. Some initialisation concerned only the master, so move them out to a
new function: InitProperties().

This fixes the input slaves overriding some item properties
(attachment) and the master capabilities.
2021-05-07 08:51:35 +00:00
Thomas Guillem 5ab5fbe154 input: don't duplicate properties from the master source 2021-05-07 08:51:35 +00:00
Thomas Guillem ea0fb02760 input: add input_CanPaceControl() 2021-05-07 08:51:35 +00:00
Alaric Senat 4f7522e620 input: parse `:input-slave" options earlier
Move the option parsing right before the input-item slaves copy.  This
avoid input-slaves unnecessary duplication each time the input is
reparsed as the input-item slaves copy itself avoid duplicating.

Fixes #19977
2021-04-26 11:28:04 +00:00
Alaric Senat bbdaa0b64a input: add url parsing of `input-slave` option
As shown in #25549, we need to extract the path from the url in order to
check the file extension without the eventual HTTP's options noise.

Fixes: #25549
Signed-off-by: Thomas Guillem <thomas@gllm.fr>
2021-04-08 14:28:39 +02:00
Alaric Senat 08a3c76355 input: fix `input-slave` option for subtitles
Since c34d719f, all files passed by the option `input-slave` were set as
audio tracks no matter what.
Theses changes force subtitle demux on files with a known spu extension.

Fixes #25549

Signed-off-by: Thomas Guillem <thomas@gllm.fr>
2021-04-01 10:06:35 +02:00
Thomas Guillem 07b50f6db4 input: add input_SetProgramId
Select a program id when the input thread is not running.
2021-02-08 10:24:32 +01:00
Rémi Denis-Courmont 1d35035903 resource: remove now always NULL parameter 2021-01-21 21:52:23 +02:00
Rémi Denis-Courmont 603b9ced95 input: add input_resource_PutSout()
This mimicks input_resource_PutVout(), except in the case that the
second parameter is NULL:
- PutVout() asserts that that is not the case.
- PutSout() destroys the resource sout.
It is unclear if this is really intended. If not, this should be
addressed later on (this patch makes no functional changes).
2021-01-21 21:52:23 +02:00
Rémi Denis-Courmont 002ee12f61 input: call input_resource_TerminateSout()
(no functional changes)
2021-01-21 21:52:23 +02:00
Francois Cartegnie 3781e1dca6 input: unknown length is zero
This partially reverts commit d348527277.
2020-12-14 16:36:03 +01:00
Hugo Beauzée-Luyssen a7c322902c input: Fix potential use of an uninitialized pointer 2020-12-04 10:21:25 +01:00
Hugo Beauzée-Luyssen ce1a28b094 input: Also free empty attachments arrays 2020-11-26 12:47:39 +01:00
Hugo Beauzée-Luyssen 4deb73b6f6 input: Add a missing #ifdef ENABLE_SOUT
sout_instance_ControlsPace is not built nor provided by missing.c when
building with --disable-sout
2020-11-25 16:36:30 +01:00
Hugo Beauzée-Luyssen 67f30f947d input: Emit an event when new attachments are found 2020-11-19 10:35:21 +01:00
Hugo Beauzée-Luyssen 88306b2b7c input: Fix missing mutex unlock on error path 2020-11-18 12:20:59 +01:00
Hugo Beauzée-Luyssen ce2bf1200c input: Remove now unused attachment_demux 2020-11-18 12:20:59 +01:00
Hugo Beauzée-Luyssen 9f2ce559c1 input: Compare attachments themselves when updating them
Since they are now refcounted, we can compare the pointers themselves
instead of relying on the demux they originally came from.
2020-11-18 12:20:59 +01:00
Hugo Beauzée-Luyssen c986285099 input: Simplify AppendAttachment prototype 2020-11-18 12:20:59 +01:00
Hugo Beauzée-Luyssen 165ccf2cdf input: Refcount attachments
Instead of performing a deep copy every time they are fetched
2020-11-18 12:20:59 +01:00