@@ -80,10 +80,17 @@ def __init__(self, file=None, clip=None):
80
80
self .end_image = None
81
81
self .current_frame = 1
82
82
83
- self .clip = clip
83
+ # Create region clip with Reader
84
+ self .clip = openshot .Clip (clip .Reader ())
85
+
84
86
self .clip .Open ()
85
- self .clip_position = self .clip .Position ()
86
- self .clip .Position (0 )
87
+
88
+ # Set region clip start and end
89
+ self .clip .Start (clip .Start ())
90
+ self .clip .End (clip .End ())
91
+ self .clip .Id ( get_app ().project .generate_id () )
92
+
93
+ print ("IDS {} {}" .format (clip .Id (), self .clip .Id ()))
87
94
88
95
# Keep track of file object
89
96
# self.file = file
@@ -100,6 +107,10 @@ def __init__(self, file=None, clip=None):
100
107
self .channel_layout = c_info .channel_layout #int(file.data['channel_layout'])
101
108
self .video_length = int (self .clip .Duration () * self .fps ) + 1 #int(file.data['video_length'])
102
109
110
+ # Apply effects to region frames
111
+ for effect in clip .Effects ():
112
+ self .clip .AddEffect (effect )
113
+
103
114
# Open video file with Reader
104
115
log .info (self .clip .Reader ())
105
116
@@ -233,15 +244,11 @@ def sliderVideo_valueChanged(self, new_frame):
233
244
def accept (self ):
234
245
""" Ok button clicked """
235
246
236
- self .clip .Position (self .clip_position )
237
-
238
247
self .shutdownPlayer ()
239
248
super (SelectRegion , self ).accept ()
240
249
241
250
def shutdownPlayer (self ):
242
251
243
- self .clip .Position (self .clip_position )
244
-
245
252
log .info ('shutdownPlayer' )
246
253
247
254
# Stop playback
@@ -253,15 +260,14 @@ def shutdownPlayer(self):
253
260
self .preview_parent .background .wait (5000 )
254
261
255
262
# Close readers
256
- self .r .RemoveClip (self .clip )
263
+ self .clip .Close ()
264
+ # self.r.RemoveClip(self.clip)
257
265
self .r .Close ()
258
266
# self.clip.Close()
259
267
self .r .ClearAllCache ()
260
268
261
269
def reject (self ):
262
270
263
- self .clip .Position (self .clip_position )
264
-
265
271
# Cancel dialog
266
272
self .shutdownPlayer ()
267
273
super (SelectRegion , self ).reject ()
0 commit comments