AVPlay 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- avplay-1.0.0/AVPlay.egg-info/PKG-INFO +490 -0
- avplay-1.0.0/AVPlay.egg-info/SOURCES.txt +23 -0
- avplay-1.0.0/AVPlay.egg-info/dependency_links.txt +1 -0
- avplay-1.0.0/AVPlay.egg-info/requires.txt +3 -0
- avplay-1.0.0/AVPlay.egg-info/top_level.txt +1 -0
- avplay-1.0.0/LICENSE +21 -0
- avplay-1.0.0/PKG-INFO +490 -0
- avplay-1.0.0/av_play/__AV_Common.py +194 -0
- avplay-1.0.0/av_play/__AV_Instance.py +150 -0
- avplay-1.0.0/av_play/__AV_Interface.py +140 -0
- avplay-1.0.0/av_play/__AV_Player.py +300 -0
- avplay-1.0.0/av_play/__init__.py +63 -0
- avplay-1.0.0/av_play/__utils.py +40 -0
- avplay-1.0.0/av_play/audio_filter.py +10 -0
- avplay-1.0.0/av_play/fmod_audio_filter.py +162 -0
- avplay-1.0.0/av_play/fmod_audio_player.py +568 -0
- avplay-1.0.0/av_play/media_info.py +3 -0
- avplay-1.0.0/av_play/mpv_audio_filter.py +406 -0
- avplay-1.0.0/av_play/mpv_video_player.py +513 -0
- avplay-1.0.0/av_play/playlist.py +670 -0
- avplay-1.0.0/av_play/video_filter.py +11 -0
- avplay-1.0.0/av_play/vlc_audio_filter.py +84 -0
- avplay-1.0.0/av_play/vlc_video_player.py +510 -0
- avplay-1.0.0/setup.cfg +4 -0
- avplay-1.0.0/setup.py +38 -0
|
@@ -0,0 +1,490 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: AVPlay
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Audio and video playback library
|
|
5
|
+
Home-page: https://github.com/still_standing88/av-play/
|
|
6
|
+
Author: still-standing88
|
|
7
|
+
License: MIT
|
|
8
|
+
Keywords: project snapshot markdown llm documentation
|
|
9
|
+
Classifier: Development Status :: 4 - Beta
|
|
10
|
+
Classifier: Environment :: Console
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.6
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.7
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
+
Classifier: Topic :: Software Development :: Documentation
|
|
20
|
+
Classifier: Topic :: Utilities
|
|
21
|
+
Requires-Python: >=3.6
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
License-File: LICENSE
|
|
24
|
+
Requires-Dist: python-mpv
|
|
25
|
+
Requires-Dist: python-vlc
|
|
26
|
+
Requires-Dist: pyfmodex
|
|
27
|
+
|
|
28
|
+
# AVPlay
|
|
29
|
+
|
|
30
|
+
## Table of Contents
|
|
31
|
+
|
|
32
|
+
1. [**Introduction**](#1-introduction)
|
|
33
|
+
2. [**Installation & Configuration**](#2-installation--configuration)
|
|
34
|
+
3. [**Quick Start**](#3-quick-start)
|
|
35
|
+
4. [**Core Data Types & Enums**](#4-core-data-types--enums)
|
|
36
|
+
5. [**Player API**](#5-player-api)
|
|
37
|
+
- [Common Player Interface (`AVPlayer`)](#common-player-interface-avplayer)
|
|
38
|
+
- [FMOD Audio Player (`FMODAudioPlayer`)](#fmod-audio-player-fmodaudioplayer)
|
|
39
|
+
- [MPV Video Player (`MPVVideoPlayer`)](#mpv-video-player-mpvvideoplayer)
|
|
40
|
+
- [VLC Video Player (`VLCVideoPlayer`)](#vlc-video-player-vlcvideoplayer)
|
|
41
|
+
6. [**Media Instance API (`AVMediaInstance`)**](#6-media-instance-api-avmediainstance)
|
|
42
|
+
7. [**Audio & Video Filters**](#7-audio--video-filters)
|
|
43
|
+
- [FMOD Audio Filters](#fmod-audio-filters)
|
|
44
|
+
- [MPV Audio Filters](#mpv-audio-filters)
|
|
45
|
+
- [VLC Audio Filters](#vlc-audio-filters)
|
|
46
|
+
8. [**Playlist Management API**](#8-playlist-management-api)
|
|
47
|
+
- [`PlaylistEntry`](#playlistentry)
|
|
48
|
+
- [`Playlist`](#playlist)
|
|
49
|
+
- [`PlaylistManager`](#playlistmanager)
|
|
50
|
+
9. [**Utility Functions**](#9-utility-functions)
|
|
51
|
+
10. [**License**](#10-license)
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## 1. Introduction
|
|
56
|
+
|
|
57
|
+
AVPlay is a versatile media playback library that supports multiple media backends (both audio and video) all under a unified API. With added features such as playlist playback, applying audio filters, and more.
|
|
58
|
+
|
|
59
|
+
### Features
|
|
60
|
+
|
|
61
|
+
- **Multiple backends supported**, including:
|
|
62
|
+
- **MPV**: Video playback with FFmpeg supported filters
|
|
63
|
+
- **FMOD**: High performance and low latency playback, with high quality audio filters
|
|
64
|
+
- **VLC**: Simple media playback and widely supported formats
|
|
65
|
+
- **Flexible and consistent core API design**, which can be further extended to support more backends
|
|
66
|
+
- **Playlist management**: Easily load, create, manage, and save playlists in various formats (M3U, PLS, XSPF, JSON). Supports features like sorting, filtering, and shuffling
|
|
67
|
+
- **Apply high quality audio effects/filters** in real time
|
|
68
|
+
- And more
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## 2. Installation & Configuration
|
|
73
|
+
|
|
74
|
+
### Installation
|
|
75
|
+
|
|
76
|
+
1. **Install via PyPI**:
|
|
77
|
+
```bash
|
|
78
|
+
pip install AVPlay
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
AVPlay depends on the following libraries: *validators*, *music-tag*, and bindings for each of the supported backends: *python-mpv*, *pyfmodex*, and *python-vlc*.
|
|
82
|
+
|
|
83
|
+
2. **Install a native media backend**:
|
|
84
|
+
AVPlay requires at least 1 backend available on your system to function properly.
|
|
85
|
+
|
|
86
|
+
#### FMOD
|
|
87
|
+
1. Create an account and download FMOD from the [main website](https://www.fmod.com/download)
|
|
88
|
+
2. Install FMOD. Then locate the library files matching your machine's OS and architecture.
|
|
89
|
+
|
|
90
|
+
#### MPV
|
|
91
|
+
1. Download the libmpv library:
|
|
92
|
+
- **Windows**: You can find builds at [shinchiro's builds](https://sourceforge.net/projects/mpv-player-windows/files/libmpv/). You require mpv-2.dll
|
|
93
|
+
- **macOS**: `brew install mpv`
|
|
94
|
+
- **Linux**: `sudo apt-get install libmpv-dev` or `sudo dnf install mpv-libs-devel`
|
|
95
|
+
|
|
96
|
+
#### VLC
|
|
97
|
+
Install the full VLC Media Player application from the [official VideoLAN website](https://www.videolan.org/vlc/).
|
|
98
|
+
|
|
99
|
+
### Configuration
|
|
100
|
+
|
|
101
|
+
AVPlay uses environment variables to detect which backend to use and where to find its native libraries. You must set these before importing av_play.
|
|
102
|
+
|
|
103
|
+
```python
|
|
104
|
+
import os
|
|
105
|
+
|
|
106
|
+
# --- Example for FMOD ---
|
|
107
|
+
os.environ["USE_FMOD"] = "1"
|
|
108
|
+
# Path to the directory containing fmod.dll or libfmod.so
|
|
109
|
+
# Only the path to the folder where the library is located.
|
|
110
|
+
os.environ["FMOD_LIB_PATH"] = "./libs/fmod"
|
|
111
|
+
|
|
112
|
+
# Now import the library
|
|
113
|
+
import av_play
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
## 3. Quick Start
|
|
119
|
+
|
|
120
|
+
```python
|
|
121
|
+
import os
|
|
122
|
+
os.environ["USE_FMOD"] = "1"
|
|
123
|
+
os.environ["FMOD_LIB_PATH"] = "C:/Program Files (x86)/FMOD SoundSystem/FMOD Studio API Windows/api/core/lib/x64"
|
|
124
|
+
import av_play as av
|
|
125
|
+
import time
|
|
126
|
+
|
|
127
|
+
filepath = "test.mp3"
|
|
128
|
+
player = av.AudioPlayer()
|
|
129
|
+
player.init()
|
|
130
|
+
|
|
131
|
+
print("FMOD Player Initialized.")
|
|
132
|
+
|
|
133
|
+
try:
|
|
134
|
+
instance = player.create_file_instance(filepath)
|
|
135
|
+
instance.set_volume(0.8)
|
|
136
|
+
instance.play()
|
|
137
|
+
print(f"Playing '{instance.file_path}'...")
|
|
138
|
+
|
|
139
|
+
while instance.get_playback_state() == av_play.AVPlaybackState.AV_STATE_PLAYING:
|
|
140
|
+
pos = instance.get_position()
|
|
141
|
+
length = instance.get_length()
|
|
142
|
+
print(f"Position: {pos}/{length} seconds", end='\r')
|
|
143
|
+
time.sleep(1)
|
|
144
|
+
|
|
145
|
+
print("\nPlayback finished.")
|
|
146
|
+
|
|
147
|
+
finally:
|
|
148
|
+
print("Releasing resources.")
|
|
149
|
+
player.release()
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
## 4. Core Data Types & Enums
|
|
155
|
+
|
|
156
|
+
These types are used for arguments and return values throughout the library.
|
|
157
|
+
|
|
158
|
+
### `ParameterValue`
|
|
159
|
+
A type alias for values that can be passed to filters.
|
|
160
|
+
```python
|
|
161
|
+
from typing import Union
|
|
162
|
+
ParameterValue = Union[int, float, bool, str]
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### `AVDevice`
|
|
166
|
+
A `dataclass` containing information about an audio output device.
|
|
167
|
+
- `media_backend: AVMediaBackend`: The backend this device belongs to.
|
|
168
|
+
- `name: str`: The human-readable name of the device.
|
|
169
|
+
|
|
170
|
+
### `AVError`
|
|
171
|
+
Exception raised for all library-specific errors.
|
|
172
|
+
- `info: AVErrorInfo`: The category of the error.
|
|
173
|
+
- `message: str`: A detailed error message from the backend.
|
|
174
|
+
|
|
175
|
+
### Enums
|
|
176
|
+
|
|
177
|
+
#### `AVPlaybackState`
|
|
178
|
+
Represents the current playback status of a media instance.
|
|
179
|
+
- `AV_STATE_NOTHING`: No media loaded or playback has finished/failed.
|
|
180
|
+
- `AV_STATE_STOPPED`: Media is loaded but stopped.
|
|
181
|
+
- `AV_STATE_PLAYING`: Media is actively playing.
|
|
182
|
+
- `AV_STATE_PAUSED`: Playback is paused.
|
|
183
|
+
- `AV_STATE_BUFFERING`: Network stream is buffering.
|
|
184
|
+
- `AV_STATE_LOADING`: Initial loading of media.
|
|
185
|
+
|
|
186
|
+
#### `AVPlaylistMode`
|
|
187
|
+
Defines the playback behavior for a playlist.
|
|
188
|
+
- `SEQUENTIAL`: Plays tracks in order, then stops.
|
|
189
|
+
- `REPEAT_ALL`: Plays tracks in order and repeats the playlist.
|
|
190
|
+
- `REPEAT_ONE`: Repeats the current track indefinitely.
|
|
191
|
+
- `SHUFFLE`: Plays tracks in a random order.
|
|
192
|
+
|
|
193
|
+
#### `AVPlaylistState`
|
|
194
|
+
Represents the overall state of the playlist controller.
|
|
195
|
+
- `STOPPED`: Playlist is stopped.
|
|
196
|
+
- `PLAYING`: Playlist is actively playing.
|
|
197
|
+
- `PAUSED`: Playlist is paused.
|
|
198
|
+
- `FINISHED`: Playlist has finished and is not set to repeat.
|
|
199
|
+
|
|
200
|
+
#### `AVMuteState`
|
|
201
|
+
Represents the audio mute status.
|
|
202
|
+
- `AV_AUDIO_MUTED`
|
|
203
|
+
- `AV_AUDIO_UNMUTED`
|
|
204
|
+
|
|
205
|
+
#### `AVMediaType`
|
|
206
|
+
The type of media the backend primarily handles.
|
|
207
|
+
- `AV_TYPE_AUDIO`
|
|
208
|
+
- `AV_TYPE_VIDEO`
|
|
209
|
+
|
|
210
|
+
#### `AVMediaBackend`
|
|
211
|
+
The underlying native library being used.
|
|
212
|
+
- `AV_BACKEND_FMOD`
|
|
213
|
+
- `AV_BACKEND_MPV`
|
|
214
|
+
- `AV_BACKEND_VLC`
|
|
215
|
+
|
|
216
|
+
#### `AVErrorInfo`
|
|
217
|
+
Describes the category of an `AVError` exception.
|
|
218
|
+
- `UNKNOWN_ERROR`, `INITIALIZATION_ERROR`, `FILE_NOTFOUND`, `UNSUPPORTED_FORMAT`, `INVALID_HANDLE`, `HTTP_ERROR`, `INVALID_MEDIA_FILTER`, `INVALID_FILTER_PARAMETER`, `INVALID_FILTER_PARAMETER_TYPE`, `INVALID_FILTER_PARAMETER_VALUE`, `INVALID_FILTER_PARAMETER_RANGE`, `UNINITIALIZED`, `NET_ERROR`.
|
|
219
|
+
|
|
220
|
+
---
|
|
221
|
+
|
|
222
|
+
## 5. Player API
|
|
223
|
+
|
|
224
|
+
The `Player` is the main entry point for creating and managing media.
|
|
225
|
+
|
|
226
|
+
### Common Player Interface (`AVPlayer`)
|
|
227
|
+
|
|
228
|
+
This is the base API available on `AudioPlayer` and `VideoPlayer`.
|
|
229
|
+
|
|
230
|
+
#### Initialization & Lifecycle
|
|
231
|
+
- `init(self, *args, **kw)`
|
|
232
|
+
- Initializes the backend. Must be called before any other method.
|
|
233
|
+
- **Arguments**: Vary by backend (see concrete player classes below).
|
|
234
|
+
|
|
235
|
+
- `release(self)`
|
|
236
|
+
- Shuts down the backend and releases all associated resources.
|
|
237
|
+
|
|
238
|
+
#### Instance Creation
|
|
239
|
+
- `create_file_instance(self, file_path: str) -> AVMediaInstance`
|
|
240
|
+
- Creates a media instance for a local file.
|
|
241
|
+
|
|
242
|
+
- `create_url_instance(self, url: str) -> AVMediaInstance`
|
|
243
|
+
- Creates a media instance for a URL.
|
|
244
|
+
|
|
245
|
+
#### Playlist Management
|
|
246
|
+
- `load_playlist(self, playlist: Playlist, auto_play: bool = False, mode: AVPlaylistMode = AVPlaylistMode.SEQUENTIAL)`
|
|
247
|
+
- Loads a `Playlist` object and controls playback via the `primary_instance`.
|
|
248
|
+
|
|
249
|
+
- `next(self)`
|
|
250
|
+
- Skips to the next track in the playlist.
|
|
251
|
+
|
|
252
|
+
- `previous(self)`
|
|
253
|
+
- Goes to the previous track in the playlist.
|
|
254
|
+
|
|
255
|
+
- `stop_playlist(self)`
|
|
256
|
+
- Stops playlist playback completely.
|
|
257
|
+
|
|
258
|
+
- `pause_playlist(self)`
|
|
259
|
+
- Pauses the currently playing track in the playlist.
|
|
260
|
+
|
|
261
|
+
- `resume_playlist(self)`
|
|
262
|
+
- Resumes the currently paused track in the playlist.
|
|
263
|
+
|
|
264
|
+
- `set_playlist_mode(self, mode: AVPlaylistMode)`
|
|
265
|
+
- Changes the playlist playback mode.
|
|
266
|
+
|
|
267
|
+
- `set_track_end_callback(self, callback: Callable[[int], None] | None)`
|
|
268
|
+
- Sets a function to be called when a playlist track ends. The callback receives the integer index of the track that finished.
|
|
269
|
+
|
|
270
|
+
- `get_playlist_state(self) -> AVPlaylistState`
|
|
271
|
+
- Returns the current state of the playlist.
|
|
272
|
+
|
|
273
|
+
- `get_playlist_mode(self) -> AVPlaylistMode`
|
|
274
|
+
- Returns the current playlist mode.
|
|
275
|
+
|
|
276
|
+
- `get_current_track_index(self) -> int`
|
|
277
|
+
- Returns the index of the currently playing track.
|
|
278
|
+
|
|
279
|
+
#### Device Management
|
|
280
|
+
- `get_devices(self) -> int`
|
|
281
|
+
- Returns the number of available audio output devices.
|
|
282
|
+
|
|
283
|
+
- `get_device_info(self, index: int) -> AVDevice`
|
|
284
|
+
- Gets information about a device at a specific index.
|
|
285
|
+
|
|
286
|
+
- `set_device(self, index: int)`
|
|
287
|
+
- Sets the active audio output device by its index.
|
|
288
|
+
|
|
289
|
+
- `get_current_device(self) -> int`
|
|
290
|
+
- Gets the index of the currently active device.
|
|
291
|
+
|
|
292
|
+
### FMOD Audio Player (`FMODAudioPlayer`)
|
|
293
|
+
Exposed as `AudioPlayer` when `USE_FMOD` is set. Implements the common `AVPlayer` interface.
|
|
294
|
+
|
|
295
|
+
- `init(self, max_channels: int = 64)`
|
|
296
|
+
- Initializes the FMOD system.
|
|
297
|
+
- **`max_channels`**: The maximum number of simultaneous sounds.
|
|
298
|
+
|
|
299
|
+
### MPV Video Player (`MPVVideoPlayer`)
|
|
300
|
+
Exposed as `VideoPlayer` when `USE_MPV` is set. Implements the common `AVPlayer` interface and adds video-specific methods.
|
|
301
|
+
|
|
302
|
+
- `init(self, window: int = None, ytdl_path: str = None, config: dict = {})`
|
|
303
|
+
- Initializes the MPV player.
|
|
304
|
+
- **`window`**: The window ID (WID) to embed the video in.
|
|
305
|
+
- **`ytdl_path`**: Path to a `yt-dlp` executable for URL streaming.
|
|
306
|
+
- **`config`**: A dictionary of MPV options.
|
|
307
|
+
|
|
308
|
+
- `set_window(self, window: int)`
|
|
309
|
+
- Attaches the video output to a GUI window handle.
|
|
310
|
+
|
|
311
|
+
- `forward(self, offset: int)` / `backward(self, offset: int)`
|
|
312
|
+
- Seeks forward or backward by `offset` seconds.
|
|
313
|
+
|
|
314
|
+
- `set_volume_relative(self, direction: str, offset: float)`
|
|
315
|
+
- Adjusts volume. `direction` must be `"up"` or `"down"`.
|
|
316
|
+
|
|
317
|
+
- `set_fullscreen(self, state: bool)` / `get_fullscreen(self) -> bool`
|
|
318
|
+
- Sets or gets the fullscreen state.
|
|
319
|
+
|
|
320
|
+
- `set_playback_speed(self, speed: float)`
|
|
321
|
+
- Sets the playback speed (1.0 is normal).
|
|
322
|
+
|
|
323
|
+
- `set_resolution(self, width: int, height: int)`
|
|
324
|
+
- Applies a video filter to scale the output.
|
|
325
|
+
|
|
326
|
+
### VLC Video Player (`VLCVideoPlayer`)
|
|
327
|
+
Exposed as `VideoPlayer` when `USE_VLC` is set. Implements the common `AVPlayer` interface and adds video-specific methods.
|
|
328
|
+
|
|
329
|
+
- `init(self, vlc_args: List[str] = [])`
|
|
330
|
+
- Initializes the VLC player.
|
|
331
|
+
- **`vlc_args`**: A list of command-line arguments to pass to the VLC instance.
|
|
332
|
+
|
|
333
|
+
- `set_window(self, window: int)`
|
|
334
|
+
- Attaches the video output to a GUI window handle (HWND).
|
|
335
|
+
|
|
336
|
+
- `forward(self, offset: int)` / `backward(self, offset: int)`
|
|
337
|
+
- Seeks forward or backward by `offset` seconds.
|
|
338
|
+
|
|
339
|
+
- `set_volume_relative(self, direction: str, offset: float)`
|
|
340
|
+
- Adjusts volume. `direction` must be `"up"` or `"down"`.
|
|
341
|
+
|
|
342
|
+
- `set_fullscreen(self, state: bool)` / `get_fullscreen(self) -> bool`
|
|
343
|
+
- Sets or gets the fullscreen state.
|
|
344
|
+
|
|
345
|
+
- `set_playback_speed(self, speed: float)`
|
|
346
|
+
- Sets the playback rate (1.0 is normal).
|
|
347
|
+
|
|
348
|
+
- `set_resolution(self, width: int, height: int)`
|
|
349
|
+
- Applies a video filter to scale the output.
|
|
350
|
+
|
|
351
|
+
---
|
|
352
|
+
|
|
353
|
+
## 6. Media Instance API (`AVMediaInstance`)
|
|
354
|
+
|
|
355
|
+
Controls a single media file or stream. Created via a `Player` object.
|
|
356
|
+
|
|
357
|
+
### Properties
|
|
358
|
+
- `media_type: AVMediaType`
|
|
359
|
+
- `media_backend: AVMediaBackend`
|
|
360
|
+
- `media_source: AVMediaSource`
|
|
361
|
+
- `instance_id: int`
|
|
362
|
+
- `file_path: str`
|
|
363
|
+
|
|
364
|
+
### Loading Methods
|
|
365
|
+
- `load_file(self, file_path: str)`
|
|
366
|
+
- Loads media from a local file.
|
|
367
|
+
- `load_url(self, url: str)`
|
|
368
|
+
- Loads media from a URL.
|
|
369
|
+
|
|
370
|
+
### Playback Control
|
|
371
|
+
- `play(self)`, `pause(self)`, `stop(self)`
|
|
372
|
+
- `mute(self)`, `unmute(self)`
|
|
373
|
+
- `set_volume(self, offset: float)`
|
|
374
|
+
- `set_position(self, position: int)`
|
|
375
|
+
- `set_loop(self, loop: bool)`
|
|
376
|
+
|
|
377
|
+
### State & Information
|
|
378
|
+
- `get_playback_state(self) -> AVPlaybackState`
|
|
379
|
+
- `get_mute_state(self) -> AVMuteState`
|
|
380
|
+
- `get_length(self) -> int`
|
|
381
|
+
- `get_position(self) -> int`
|
|
382
|
+
- `get_volume(self) -> float`
|
|
383
|
+
|
|
384
|
+
### Filter Management
|
|
385
|
+
- `apply_filter(self, filter: AVFilter) -> int`
|
|
386
|
+
- Applies a filter and returns its unique ID.
|
|
387
|
+
- `remove_filter(self, filter_id: int)`
|
|
388
|
+
- `remove_filters(self)`
|
|
389
|
+
- `set_parameter(self, filter_id: int, parameter_name: str, parameter_value: ParameterValue)`
|
|
390
|
+
- `get_parameter(self, filter_id: int, parameter_name: str) -> ParameterValue | None`
|
|
391
|
+
|
|
392
|
+
### Cleanup
|
|
393
|
+
- `release(self)`
|
|
394
|
+
- Stops playback, removes filters, and releases the instance from the backend.
|
|
395
|
+
|
|
396
|
+
---
|
|
397
|
+
|
|
398
|
+
## 7. Audio & Video Filters
|
|
399
|
+
|
|
400
|
+
Instantiate a filter class and apply it to a media instance.
|
|
401
|
+
|
|
402
|
+
### FMOD Audio Filters
|
|
403
|
+
(from `av_play.fmod_audio_filter`)
|
|
404
|
+
- `FMODEchoFilter()`: Parameters: `delay_ms`, `feedback_percent`, `dry_level_db`, `wet_level_db`.
|
|
405
|
+
- `FMODReverbFilter()`: Parameters: `decay_time_ms`, `early_delay_ms`, `late_delay_ms`, `hf_reference_hz`, `hf_decay_ratio_percent`, `diffusion_percent`, `density_percent`, `low_shelf_frequency_hz`, `low_shelf_gain_db`, `high_cut_hz`, `early_late_mix_percent`, `wet_level_db`, `dry_level_db`.
|
|
406
|
+
- `FMODLowpassFilter()`: Parameters: `cutoff_frequency_hz`, `q_factor`.
|
|
407
|
+
- `FMODHighpassFilter()`: Parameters: `cutoff_frequency_hz`, `q_factor`.
|
|
408
|
+
- `FMODBandpassFilter()`: Parameters: `center_frequency_hz`, `bandwidth_q`.
|
|
409
|
+
- `FMODChorusFilter()`: Parameters: `mix_percent`, `rate_hz`, `depth_percent`.
|
|
410
|
+
- `FMODCompressorFilter()`: Parameters: `threshold_db`, `ratio`, `attack_ms`, `release_ms`, `makeup_gain_db`, `use_sidechain`, `linked_channels`.
|
|
411
|
+
- `FMODFlangerFilter()`: Parameters: `mix_percent`, `depth_factor`, `rate_hz`.
|
|
412
|
+
- `FMODDistortionFilter()`: Parameters: `level_factor`.
|
|
413
|
+
- `FMODPitchShiftFilter()`: Parameters: `pitch_scale`, `fft_size_samples`.
|
|
414
|
+
|
|
415
|
+
### MPV Audio Filters
|
|
416
|
+
(from `av_play.mpv_audio_filter`)
|
|
417
|
+
- `MPVEchoFilter()`: Parameters: `in_gain`, `out_gain`, `delays`, `decays`.
|
|
418
|
+
- `MPVReverbFilter()`: Parameters: `dry`, `wet`, `length`, `irnorm`, `irgain`.
|
|
419
|
+
- `MPVLowPassFilter()`: Parameters: `frequency`, `poles`, `width`, `mix`.
|
|
420
|
+
- `MPVHighPassFilter()`: Parameters: `frequency`, `poles`, `width`, `mix`.
|
|
421
|
+
- `MPVCompressorFilter()`: Parameters: `level_in`, `threshold`, `ratio`, `attack`, `release`, `makeup`, `knee`, `detection`, `mix`.
|
|
422
|
+
- `MPVFlangerFilter()`: Parameters: `delay`, `depth`, `regen`, `width`, `speed`, `shape`, `phase`, `interp`.
|
|
423
|
+
- `MPVChorusFilter()`: Parameters: `in_gain`, `out_gain`, `delays`, `decays`, `speeds`, `depths`.
|
|
424
|
+
- `MPVPitchShiftFilter()`: Parameters: `pitch-scale`, `engine`.
|
|
425
|
+
- `MPVLimiterFilter()`: Parameters: `level_in`, `level_out`, `limit`, `attack`, `release`, `asc`, `asc_level`, `level`.
|
|
426
|
+
- `MPVBandPassFilter()`: Parameters: `frequency`, `width`, `csg`, `mix`, `width_type`.
|
|
427
|
+
- `MPVGateFilter()`: Parameters: `level_in`, `mode`, `range`, `threshold`, `ratio`, `attack`, `release`, `makeup`, `knee`, `detection`, `link`.
|
|
428
|
+
|
|
429
|
+
### VLC Audio Filters
|
|
430
|
+
(from `av_play.vlc_audio_filter`)
|
|
431
|
+
- `VLCEqualizerFilter()`: Parameters: `preamp`, `band_60`, `band_170`, `band_310`, `band_600`, `band_1000`, `band_3000`, `band_6000`, `band_12000`, `band_14000`, `band_16000`.
|
|
432
|
+
|
|
433
|
+
---
|
|
434
|
+
|
|
435
|
+
## 8. Playlist Management API
|
|
436
|
+
|
|
437
|
+
### `PlaylistEntry`
|
|
438
|
+
A `dataclass` representing one item in a playlist.
|
|
439
|
+
- `location: str` (Required)
|
|
440
|
+
- `title: Optional[str]`
|
|
441
|
+
- `duration: Optional[int]` (in seconds)
|
|
442
|
+
- `artist: Optional[str]`
|
|
443
|
+
- `album: Optional[str]`
|
|
444
|
+
- `metadata: Optional[Dict[str, Any]]`
|
|
445
|
+
|
|
446
|
+
### `Playlist`
|
|
447
|
+
Represents a list of `PlaylistEntry` objects.
|
|
448
|
+
- `__init__(self, title: str = "New Playlist")`
|
|
449
|
+
- `load(self, file_path_or_url: str, format_type: PlaylistFormat = None, encoding: str = 'utf-8') -> 'Playlist'`
|
|
450
|
+
- `save(self, file_path: str, format_type: PlaylistFormat = None, encoding: str = 'utf-8')`
|
|
451
|
+
- `add_entry(self, entry: PlaylistEntry)`
|
|
452
|
+
- `remove_entry(self, index: int) -> PlaylistEntry | None`
|
|
453
|
+
- `move_entry(self, from_index: int, to_index: int) -> bool`
|
|
454
|
+
- `clear(self)`
|
|
455
|
+
- `get_entry(self, index: int) -> PlaylistEntry | None`
|
|
456
|
+
- `sort(self, key: Union[str, Callable], reverse: bool = False)`
|
|
457
|
+
- `filter(self, predicate: Callable) -> 'Playlist'`
|
|
458
|
+
- `remove_duplicates(self, key: str = "location") -> int`
|
|
459
|
+
- `filter_by_extension(self, allowed_extensions: List[str], include: bool = True) -> int`
|
|
460
|
+
- `merge(self, other: 'Playlist') -> 'Playlist'`
|
|
461
|
+
- `entries: List[PlaylistEntry]` (property)
|
|
462
|
+
- Provides standard list-like access: `len(playlist)`, `playlist[i]`, `for entry in playlist:`.
|
|
463
|
+
|
|
464
|
+
### `PlaylistManager`
|
|
465
|
+
A helper class to manage multiple named playlists.
|
|
466
|
+
- `create_playlist(self, name: str, title: str = None) -> Playlist`
|
|
467
|
+
- `get_playlist(self, name: str) -> Playlist | None`
|
|
468
|
+
- `remove_playlist(self, name: str) -> bool`
|
|
469
|
+
- `load_playlist(self, name: str, file_path_or_url: str, ...)`
|
|
470
|
+
- `save_playlist(self, name: str, file_path: str, ...)`
|
|
471
|
+
- `list_playlists(self) -> List[str]`
|
|
472
|
+
- `merge_playlists(self, name: str, source_playlist_names: List[str], ...)`
|
|
473
|
+
- `sort_playlist(self, name: str, key: Union[str, Callable], ...)`
|
|
474
|
+
- `filter_playlist(self, source_name: str, target_name: str, ...)`
|
|
475
|
+
- `remove_duplicates(self, name: str, ...)`
|
|
476
|
+
- `filter_by_extension(self, name: str, ...)`
|
|
477
|
+
|
|
478
|
+
---
|
|
479
|
+
|
|
480
|
+
## 9. Utility Functions
|
|
481
|
+
|
|
482
|
+
- `MediaInfo(path: str) -> music_tag.AudioFile`
|
|
483
|
+
- A convenience alias for `music_tag.load_file`. Reads metadata (ID3 tags, etc.) from a media file.
|
|
484
|
+
- Example: `tags = MediaInfo("song.mp3"); print(tags['artist'])`
|
|
485
|
+
|
|
486
|
+
---
|
|
487
|
+
|
|
488
|
+
## 10. License
|
|
489
|
+
|
|
490
|
+
MIT
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
setup.py
|
|
3
|
+
AVPlay.egg-info/PKG-INFO
|
|
4
|
+
AVPlay.egg-info/SOURCES.txt
|
|
5
|
+
AVPlay.egg-info/dependency_links.txt
|
|
6
|
+
AVPlay.egg-info/requires.txt
|
|
7
|
+
AVPlay.egg-info/top_level.txt
|
|
8
|
+
av_play/__AV_Common.py
|
|
9
|
+
av_play/__AV_Instance.py
|
|
10
|
+
av_play/__AV_Interface.py
|
|
11
|
+
av_play/__AV_Player.py
|
|
12
|
+
av_play/__init__.py
|
|
13
|
+
av_play/__utils.py
|
|
14
|
+
av_play/audio_filter.py
|
|
15
|
+
av_play/fmod_audio_filter.py
|
|
16
|
+
av_play/fmod_audio_player.py
|
|
17
|
+
av_play/media_info.py
|
|
18
|
+
av_play/mpv_audio_filter.py
|
|
19
|
+
av_play/mpv_video_player.py
|
|
20
|
+
av_play/playlist.py
|
|
21
|
+
av_play/video_filter.py
|
|
22
|
+
av_play/vlc_audio_filter.py
|
|
23
|
+
av_play/vlc_video_player.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
av_play
|
avplay-1.0.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Tomasz Gałaj
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|