-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pzhlkj6612 new slider and better player #49
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
It seems that the responding speed of the audio playing has been improved.
It seems that `read_header()` in av_format.h is the source of the noise.
branch name: remove_useless_initialization_of_SDL_subsystem
The "PlayThread's logic" are the functions `audio_decode_frame()` and `packet_queue_get()`. 1. `audio_clock` will store the position in millisecond and `qint64` type. 2. the 1e8 times attempts is NOT ok. 3. `packet_queue_get()` should return `-1` if something goes wrong.
This makes the BUG more visible.
1. New `BesSlider` 1.1. Click is on the handle 1.1.1. The relative position between the mouse and the center of handle (`click_pos_offset`) is calculated and stored when the handle is dragged. So the handle will move relative to the mouse and keep a certain offset (`click_pos_offset`) instead of placing its center under the mouse. This is a Netease Music style. 1.2. Click is NOT on the handle 1.2.1. Use `BesSliderStyle` to change the positioning method from 'stepping' to 'directness'. 1.2.2. The new positioning method makes the click-and-drag operation can be performed correctly, because `QSlider::sliderPressed`, `QSlider::sliderMoved` and `QSlider::sliderReleased` signals will be emitted correctly when the click is not on the handle. 1.3. "Where is my mouse ?" 1.3.1. Use `subControlRect` to determine the range of handle and whether the mouse is over the handle. 1.3.2. Remove old logic related to the above, including `enterEvent(QEvent*)` and `leaveEvent(QEvent*)` functions. 1.3.3. Set `setMouseTracking(true)`. As long as `enableMouseEvt` is equal to `true`, whether or not the mouse is pressed, when the mouse hovers over the handle, its cursor style will be `Qt::PointingHandCursor`, otherwise it will be `Qt::ArrowCursor` (set by `unsetCursor()`). 2. `BottomWidget` and `MusicPlayer` 2.1. About the refined logic 2.1.1. Even if only the handle of `sliderSong` is clicked, the seeking operation will be performed. `audioOriginalPos` is dead. This is a Netease Music style. 2.1.2. Existing logic restricts clicks to be performed on `sliderSong` only when `enableMouseEvt` is equal to `true`, so the redundant judgments have been removed. 2.2. The position of the audio is playing 2.2.1. `AdjustingPos` will be set `true` when `sliderSong` is pushed down. 2.2.2. `MusicPlayer` will tell `BottomWidget` and `AdjustingPos` will be set `false` when the seeking operation is finished (`PlayThread::seekFinished()` and `MusicPlayer::seekFinished()`). 2.2.3. So, It's guaranteed that the current position will only be refreshed by `MusicPlayer` if no mouse action is applied to `sliderSong`.
1. `BottomWidget` will reset `AdjustingPos` to `false` and ready for next seeking operation. 2. End the player by setting `AGSStatus` to `AGS_FINISH`.
1. Any interval of the timer is unreasonable. Higher values send too many indentical positions, while lower values make the positions inaccurate. 2. Now when the `PlayThread::audio_decode_frame()` function is called, `PlayThread` will notify `MusicPlayer` to send the position. 3. `PlayThread::positionChanged()` signal does not contain the value of the current position. 4. When `MusicPlayer` receives the signal `PlayThread::positionChanged()`, the `MusicPlayer::sendPosChangedSignal()` function will be called. 5. The `MusicPlayer::positionChanged(qint64)` signal contains the position which obtained from `playThread->getCurrentTime()`. 6. The pause-and-play operation of the timer in function `MusicPlayer::seek(quint64)` is useless and misleading.
1. If the player is paused, this call is useless.
1. Implement the keeping pause after seeking. 2. When the player is paused, the new position should be sent on time after a seeking which is performed by the program.
1. The function `av_seek_frame()` will get error with `AVSEEK_FLAG_ANY` method, especially when somebody wants to seek to the end of the audio. 2. So, the player will try seeking again with `AVSEEK_FLAG_BACKWARD` method.
Related PR: #47 |
Closed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.