Ticket #2197 (closed feature: obsolete)
media-hud-looped - Set up looped from the HUD
Reported by: | deyan | Owned by: | stefan |
---|---|---|---|
Priority: | critical | Milestone: | X3 |
Component: | uncategorized | Version: | 2.0 |
Keywords: | Cc: | stefan, todor | |
Category: | unknown | Effort: | |
Importance: | 85 | Ticket_group: | |
Estimated Number of Hours: | 0 | Add Hours to Ticket: | 0 |
Billable?: | yes | Total Hours: | 0 |
Analysis_owners: | todor | Design_owners: | stefan |
Imp._owners: | stefan | Test_owners: | |
Analysis_reviewers: | meddle | Changelog: | |
Design_reviewers: | meddle | Imp._reviewers: | todor. pap |
Test_reviewers: | Analysis_score: | 3 | |
Design_score: | 4 | Imp._score: | 3 |
Test_score: | 0 |
Description (last modified by todor) (diff)
- In the appearance HUD of the media frames there must be a checkbox allowing the user to loop its media frames.
- The checkbox must be labeled "Loop"
- When the checkbox is empty the media will play only once and then stops.
- When the checkbox is full the media will be looped.
- By default the media is looped.
Change History
comment:1 Changed 15 years ago by todor
- Category set to unknown
- Status changed from new to s1a_analysis_started
- Analysis_score set to 0
- Test_score set to 0
- Design_score set to 0
- Owner set to todor
- Imp._score set to 0
comment:2 Changed 15 years ago by todor
- Status changed from s1a_analysis_started to s1b_analysis_finished
comment:4 Changed 15 years ago by deyan
- Priority changed from major to critical
- Summary changed from media-hud-looped – Set up looped from the HUD to media-hud-looped – Set up looped from the HUD
Batch update from file 0911261.csv
comment:5 Changed 15 years ago by todor
- Summary changed from media-hud-looped – Set up looped from the HUD to media-hud-looped - Set up looped from the HUD
comment:6 Changed 15 years ago by todor
- Status changed from new to s1a_analysis_started
- Description modified (diff)
comment:7 Changed 15 years ago by todor
- Status changed from s1a_analysis_started to s1b_analysis_finished
comment:8 Changed 15 years ago by stefan
- Status changed from s1b_analysis_finished to s1c_analysis_ok
comment:9 Changed 15 years ago by stefan
- Owner changed from todor to stefan
- Status changed from s1c_analysis_ok to s2a_design_started
comment:10 Changed 15 years ago by stefan
- Status changed from s2a_design_started to s2b_design_finished
Design
First and foremost, it is important to note that this ticket is closely related to few other tickets:
- #2180 - media-hud-controls - Toggle show of media controls. (this ticket is not implemented yet)
- #2198 - media-hud-clip - Set up clipping from the HUD (this ticket is implemented in the same branch as the current ticket's design.
In order to provide looping feature for the media files we made following changes:
- added KEY_LOOP key in the MediaFrameR4 class in order to provide persistence for the feature.
- a utility method for transforming seconds to milliseconds is added in MediaUtil class (in our case its not simple as multiplying by 1000, because there is condition that milliseconds must be divisible by 10). This method is also used in the #2198 ticket. The code is:
public static long getMillis(double seconds) { long millis = (long) (seconds * 1000 / AudioChunk.MILLIS_LEN) - 1; return millis * AudioChunk.MILLIS_LEN; }
- important method is added in the MediaFrameView class, which calculates/transforms the requested time (which, most of the time, is the time passed since creating/opening of the book) in time of the media file, in respect, of course, of looping and clipping. The code is as follows (it is clear and simple enough to provide needed explanation by itself):
protected long calculatePosition(TimePos time) { MediaState state = model().get().getMediaState(time); long pos = state.getPosition(); long duration = MediaUtil.getMillis(handler().get().getInfo().getDuration()); long precede = 0; if (model().get().isClipped()) { MediaClip clip = model().get().getMediaClip(); if (clip.getEndSecond() >= 0) { duration = MediaUtil.getMillis(clip.getEndSecond()); } precede = MediaUtil.getMillis(clip.getStartSecond()); duration -= precede; } if (model().get().isLooped()) { pos %= duration; } if (pos > duration) { return -1; } return precede + pos; }
comment:11 Changed 15 years ago by meddle
- Design_owners set to stefan
- Status changed from s2b_design_finished to s2c_design_ok
- Analysis_reviewers set to meddle
- Analysis_score changed from 0 to 3
- Cc stefan, todor added
- Design_score changed from 0 to 4
- Design_reviewers set to meddle
- Analysis_owners set to todor
Think it works, by the way why do you write sentences with a small letter??
I like that you add code to the design, but could you add and the JavaDoc?
And there is one thing, the ticket is some bug, so when you write design and put some methods in it write the use-cases in which they will be used, because it is hard to understand the reason you write them otherwise...
@todor : The analysis works I think, Stefan should have reviewed it...
WRITE YOUR NAMES IN THE FIELDS!!!
4p
comment:12 Changed 15 years ago by stefan
- Status changed from s2c_design_ok to s3a_implementation_started
- Imp._owners set to stefan
It was mistake that I used small letters when listing the changes. Regarding the use-cases of the methods:
- calculatePosition(TimePos time) - as the name implies, it is used for calculating needed position in the media file in milliseconds(i.e. at which millisecond of the length of the media the given time is). If we are before or after the end of the file, and it is not looped, then we return -1, which means that there is not corresponding frame for the given time.
- getMillis(double seconds) - it is mainly used for transforming seconds to milliseconds of the duration of media files (it is kept in seconds), because in our application we use milliseconds for requesting frames from the media bridge/native.
Implementation code: [8291]
comment:13 Changed 15 years ago by stefan
- Status changed from s3a_implementation_started to s3b_implementation_finished
comment:14 Changed 15 years ago by stefan
I'm sorry, I've forgotten the JavaDoc. It is as follows:
/** * Calculate position in milliseconds, while it considers clipping and * looping of the media; * * @param time * TimePos that is needed actual time for. * * @return * Referential time in milliseconds in media. */ protected long calculatePosition(TimePos time) { ... }
and
/** * Provides transforming from double to long with sligther different * accuracy. * * @param seconds * actual time in double. * * @return same time in long (milliseconds); */ public static long getMillis(double seconds) { ... }
comment:15 Changed 15 years ago by stefan
Minor fix [8322]
comment:16 Changed 15 years ago by pap
- Status changed from s3b_implementation_finished to s3c_implementation_ok
- Imp._score changed from 0 to 3
- Imp._reviewers set to todor. pap
- Very bad JavaDoc for the class MediaClip itself.
- This class and its persister don't belong to base.media module - I moved them to main.func.media.
- Don't write ValueRefs that way. Override getInitial only if it is really necessary. Otherwise - see the JavaDoc of ValueRef.
- It seems that there is some sort of problems with media link actions and looping/clipping.
- Navigation with media slider doesn't work correct.
- In MediaLogic ON_PALY_PAUSE when calculating endTime you should use TimelineOptions.advance in order to have correct calculation of the phase.
- There were some places (timelines palette) and slider navigation that didn't consider clipping. That made me extract media length calculation in a method in MediaView.
comment:17 Changed 15 years ago by pap
comment:18 Changed 13 years ago by meddle
- Status changed from s3c_implementation_ok to closed
- Resolution set to obsolete
Closing all the tickets before M Y1