Community
cancel
Showing results for 
Search instead for 
Did you mean: 
dewildt
Beginner
72 Views

Timeshift: Problems with file access and file size

Hello,
I'm experimenting with timeshifting. (Reading and writing from/to the same file.)
I have two problems

1) Writing and reading at the same time with the default FIOReader and FileWriter is not possible, because the read/write-permissions in vm_file_fopen is set to zero (mds[1] = 0). Is it possible to set these permissions default to mds[1] = FILE_SHARE_READ|FILE_SHARE_WRITE?
It would also be nice if it is possible to create the file, when reading from it and it doesn't exist
(Set in the case 'r'-case the value of mds[2] to OPEN_ALWAYS.)

2) Jumping to a specific position is not possible, because it's based on the file size, which is only initialized at the begining, but the size increases over the time.
=> In FIOReader only set the size at the initialization. I think updating this value in GetSize() or when m_stPos is updated whould be more usefull.
=> In StreamParser is the size also set at the initialization. An up-to-date value of m_uiSourceSize whould be necessary for SetPosition() and GetSize().
=> In Demuxer is the size also only set at the initialization. Also the value of m_uiSourceSize should be updated in SetTimePosition(), GetExactDuration() and GetDuration().

With these modifications a timeshift is possible.
Is it possible to update the UMC in a future release?

Regards,
0 Kudos
2 Replies
Vladimir_Dudnik
Employee
72 Views

Hello,

there is comments from our expert:

1. [AM] Simalteneous reading and writing is possible for files opened by vm_file_open function. In your case it is not possible because you try to open for write file already opened by FIOReader to read only access. VM library uses standard approach to vm_file primitives, so you can achive you requirements with ra access specifier, no changes in VM required. OPEN_ALWAYS for pure read access r is terrible image you try open non-existent file and receive status open OK !???

2. Time shift is not that simple. You need to know relationship between playback time and number of bytes in stream.

Regards,
Vladimir

dewildt
Beginner
72 Views

Thanks for the quick response smiley [:-)]

vdudnik:
1. [AM] Simalteneous reading and writing is possible for files opened by vm_file_open function. In your case it is not possible because you try to open for write file already opened by FIOReader to read only access. VM library uses standard approach to vm_file primitives, so you can achive you requirements with ra access specifier, no changes in VM required.

I think the "a"-settings will (only) overwrite the "r"-settings. But I will try it.

OPEN_ALWAYS for pure read access r is terrible image you try open non-existent file and receive status open OK !???

Sorry, my attention was to add an additional mode-character like '+', but maybe the "a"-solution will also work, because it set mds[2] to OPEN_ALWAYS

2. Time shift is not that simple. You need to know relationship between playback time and number of bytes in stream.

But doesn't I have this relationship, if I frequently update the actual stream/file-size and when I have the actual byte-position inside the stream? (Assuming that I have a constant bitrate)


Reply