comparison gui/ui/actions.c @ 35483:8ac7761bcb7c

Clear information associated with a file when setting a new one. This fixes showing wrong information when jumping through the playlist tracks in stop mode.
author ib
date Mon, 03 Dec 2012 14:04:43 +0000
parents e671bb33230f
children 4d2ebecd1605
comparison
equal deleted inserted replaced
35482:0477dcdcd6d6 35483:8ac7761bcb7c
263 * @brief Set the file to be played. 263 * @brief Set the file to be played.
264 * 264 *
265 * @param dir directory (optional, else NULL) 265 * @param dir directory (optional, else NULL)
266 * @param name filename 266 * @param name filename
267 * @param type stream type of the file 267 * @param type stream type of the file
268 *
269 * @note All #guiInfo members associated with the file will be cleared.
268 */ 270 */
269 void uiSetFile(char *dir, char *name, int type) 271 void uiSetFile(char *dir, char *name, int type)
270 { 272 {
271 if (!dir) 273 if (!dir)
272 setdup(&guiInfo.Filename, name); 274 setdup(&guiInfo.Filename, name);
273 else 275 else
274 setddup(&guiInfo.Filename, dir, name); 276 setddup(&guiInfo.Filename, dir, name);
275 277
276 filename = guiInfo.Filename; 278 filename = guiInfo.Filename;
277 279
278 if (type != SAME_STREAMTYPE) 280 if (type != SAME_STREAMTYPE) {
279 guiInfo.StreamType = type; 281 guiInfo.StreamType = type;
280 282
281 nfree(guiInfo.AudioFilename); 283 guiInfo.VideoWidth = 0;
282 nfree(guiInfo.SubtitleFilename); 284 guiInfo.VideoHeight = 0;
285 guiInfo.AudioChannels = 0;
286 guiInfo.RunningTime = 0;
287 guiInfo.Track = 0;
288 guiInfo.Chapter = 0;
289 guiInfo.Angle = 0;
290
291 nfree(guiInfo.CodecName);
292 nfree(guiInfo.AudioFilename);
293 nfree(guiInfo.SubtitleFilename);
294 }
283 } 295 }
284 296
285 /** 297 /**
286 * @brief Unset the file being played. 298 * @brief Unset the file being played.
287 *
288 * @note Additionally, clear all #guiInfo members associated with the file.
289 */ 299 */
290 void uiUnsetFile(void) 300 void uiUnsetFile(void)
291 { 301 {
292 uiSetFile(NULL, NULL, STREAMTYPE_DUMMY); 302 uiSetFile(NULL, NULL, STREAMTYPE_DUMMY);
293
294 nfree(guiInfo.CodecName);
295
296 guiInfo.Track = 0;
297 guiInfo.Chapter = 0;
298 guiInfo.Angle = 0;
299 guiInfo.RunningTime = 0;
300 guiInfo.AudioChannels = 0;
301 guiInfo.VideoWidth = 0;
302 guiInfo.VideoHeight = 0;
303 } 303 }
304 304
305 /** 305 /**
306 * @brief Set file to be played to current playlist entry. 306 * @brief Set file to be played to current playlist entry.
307 */ 307 */