mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-05 06:58:56 +00:00
design: audiosinks: fix missing markup
This commit is contained in:
parent
69010fa4ee
commit
8f5a43d8e7
1 changed files with 34 additions and 30 deletions
|
@ -27,41 +27,45 @@
|
||||||
The design is based on a set of base classes and the concept of a
|
The design is based on a set of base classes and the concept of a
|
||||||
ringbuffer of samples.
|
ringbuffer of samples.
|
||||||
|
|
||||||
+-----------+ - provide preroll, rendering, timing
|
```
|
||||||
+ basesink + - caps nego
|
+-----------+ - provide preroll, rendering, timing
|
||||||
+-----+-----+
|
+ basesink + - caps nego
|
||||||
|
|
+-----+-----+
|
||||||
+-----V----------+ - manages ringbuffer
|
|
|
||||||
+ audiobasesink + - manages scheduling (push/pull)
|
+-----V----------+ - manages ringbuffer
|
||||||
+-----+----------+ - manages clock/query/seek
|
+ audiobasesink + - manages scheduling (push/pull)
|
||||||
| - manages scheduling of samples in the ringbuffer
|
+-----+----------+ - manages clock/query/seek
|
||||||
| - manages caps parsing
|
| - manages scheduling of samples in the ringbuffer
|
||||||
|
|
| - manages caps parsing
|
||||||
+-----V------+ - default ringbuffer implementation with a GThread
|
|
|
||||||
+ audiosink + - subclasses provide open/read/close methods
|
+-----V------+ - default ringbuffer implementation with a GThread
|
||||||
+------------+
|
+ audiosink + - subclasses provide open/read/close methods
|
||||||
|
+------------+
|
||||||
|
```
|
||||||
|
|
||||||
The ringbuffer is a contiguous piece of memory divided into segtotal
|
The ringbuffer is a contiguous piece of memory divided into segtotal
|
||||||
pieces of segments. Each segment has segsize bytes.
|
pieces of segments. Each segment has segsize bytes.
|
||||||
|
|
||||||
play position
|
```
|
||||||
v
|
play position
|
||||||
+---+---+---+-------------------------------------+----------+
|
v
|
||||||
+ 0 | 1 | 2 | .... | segtotal |
|
+---+---+---+-------------------------------------+----------+
|
||||||
+---+---+---+-------------------------------------+----------+
|
+ 0 | 1 | 2 | .... | segtotal |
|
||||||
<--->
|
+---+---+---+-------------------------------------+----------+
|
||||||
segsize bytes = N samples * bytes_per_sample.
|
<--->
|
||||||
|
segsize bytes = N samples * bytes_per_sample.
|
||||||
|
```
|
||||||
|
|
||||||
The ringbuffer has a play position, which is expressed in segments. The
|
The ringbuffer has a play position, which is expressed in segments. The
|
||||||
play position is where the device is currently reading samples from the
|
play position is where the device is currently reading samples from the
|
||||||
buffer.
|
buffer.
|
||||||
|
|
||||||
The ringbuffer can be put to the PLAYING or STOPPED state.
|
The ringbuffer can be put to the `PLAYING` or `STOPPED` state.
|
||||||
|
|
||||||
In the STOPPED state no samples are played to the device and the play
|
In the `STOPPED` state no samples are played to the device and the play
|
||||||
pointer does not advance.
|
pointer does not advance.
|
||||||
|
|
||||||
In the PLAYING state samples are written to the device and the
|
In the `PLAYING` state samples are written to the device and the
|
||||||
ringbuffer should call a configurable callback after each segment is
|
ringbuffer should call a configurable callback after each segment is
|
||||||
written to the device. In this state the play pointer is advanced after
|
written to the device. In this state the play pointer is advanced after
|
||||||
each segment is written.
|
each segment is written.
|
||||||
|
@ -79,7 +83,7 @@ possible.
|
||||||
Whenever new samples are to be put into the ringbuffer, the position of
|
Whenever new samples are to be put into the ringbuffer, the position of
|
||||||
the read pointer is taken. The required write position is taken and the
|
the read pointer is taken. The required write position is taken and the
|
||||||
diff is made between the required and actual position. If the difference
|
diff is made between the required and actual position. If the difference
|
||||||
is \<0, the sample is too late. If the difference is bigger than
|
is `< 0`, the sample is too late. If the difference is bigger than
|
||||||
segtotal, the writing part has to wait for the play pointer to advance.
|
segtotal, the writing part has to wait for the play pointer to advance.
|
||||||
|
|
||||||
### Scheduling
|
### Scheduling
|
||||||
|
@ -107,7 +111,7 @@ element. These samples will then be placed in the ringbuffer at the
|
||||||
next play position. It is assumed that the getrange function returns
|
next play position. It is assumed that the getrange function returns
|
||||||
fast enough to fill the ringbuffer before the play pointer reaches
|
fast enough to fill the ringbuffer before the play pointer reaches
|
||||||
the write pointer.
|
the write pointer.
|
||||||
|
|
||||||
In this mode, the ringbuffer is usually kept as empty as possible.
|
In this mode, the ringbuffer is usually kept as empty as possible.
|
||||||
There is no context switch needed between the elements that create
|
There is no context switch needed between the elements that create
|
||||||
the samples and the actual writing of the samples to the device.
|
the samples and the actual writing of the samples to the device.
|
||||||
|
@ -115,15 +119,15 @@ the samples and the actual writing of the samples to the device.
|
||||||
#### DMA mode
|
#### DMA mode
|
||||||
|
|
||||||
Elements that can do DMA based access to the audio device have to
|
Elements that can do DMA based access to the audio device have to
|
||||||
subclass from the GstAudioBaseSink class and wrap the DMA ringbuffer
|
subclass from the `GstAudioBaseSink` class and wrap the DMA ringbuffer
|
||||||
in a subclass of GstRingBuffer.
|
in a subclass of `GstRingBuffer`.
|
||||||
|
|
||||||
The ringbuffer subclass should trigger a callback after writing or
|
The ringbuffer subclass should trigger a callback after writing or
|
||||||
playing each sample to the device. This callback can be triggered
|
playing each sample to the device. This callback can be triggered
|
||||||
from a thread or from a signal from the audio device.
|
from a thread or from a signal from the audio device.
|
||||||
|
|
||||||
### Clocks
|
### Clocks
|
||||||
|
|
||||||
The GstAudioBaseSink class will use the ringbuffer to act as a clock
|
The `GstAudioBaseSink` class will use the ringbuffer to act as a clock
|
||||||
provider. It can do this by using the play pointer and the delay to
|
provider. It can do this by using the play pointer and the delay to
|
||||||
calculate the clock time.
|
calculate the clock time.
|
||||||
|
|
Loading…
Reference in a new issue