Electronic device and method for seeking file position
First Claim
Patent Images
1. A method for seeking a file position of a file, the method comprising:
- (s1) obtaining a file size “
L,”
a time length “
D”
of the file, a packet size “
P,” and
a specified time point “
S”
in the file;
(s2) determining an identifier (ID) of a main bit stream of the file;
(s3) calculating an estimated file position “
A”
corresponding to the specified time point according to a formula of A=L*(S/D), and rounding A up to a multiple of P;
(s4) seeking a packetized elementary stream (PES) of the main bit stream from the estimated file position “
A”
according to an inverse order, and obtaining a presentation time stamp (PTS) “
T”
of the found PES, the found PES of the main bit stream being the first stream nearest to the estimated file position “
A”
;
(s5) determining if an absolute value |S−
T| is greater than a preset value, and executing steps (s6)-(s7) if the absolute value |S−
T| is greater than the preset value, or executing step (s8) if the absolute value |S−
T| is less than or equal to the preset value;
(s6) re-calculating the estimated file position “
A”
according to a preset estimation formula, and rounding A up to the next multiple of P;
(s7) returning to step (s4) if S is greater than or equal to T, or seeks again a PES of the main bit stream from the estimated file position “
A”
according to a sequential order if S is less than T, obtains a PTS “
T”
of the found PES, and returning to step (s5); and
(s8) seeking a first I-frame from the estimated file position “
A”
according to the inverse order if the main bit stream is a video stream, and determining the PES of the first I-frame is an accurate file position of the specified time point “
S,”
or determining the PES last found in step (s4) or (s7) is the accurate file position of the specified time point “
S”
if the main bit stream is not the video stream.
1 Assignment
0 Petitions
Accused Products
Abstract
A method for seeking a file position of a file first seeks an estimated file position corresponding to a specified time point in the file, and adjusts the estimated file position according to a preset estimation formula. The method further determines the estimated file position is an accurate file position of the specified time point in the file until a difference between the estimated file position and the specified time point is less than a preset value.
-
Citations
15 Claims
-
1. A method for seeking a file position of a file, the method comprising:
-
(s1) obtaining a file size “
L,”
a time length “
D”
of the file, a packet size “
P,” and
a specified time point “
S”
in the file;(s2) determining an identifier (ID) of a main bit stream of the file; (s3) calculating an estimated file position “
A”
corresponding to the specified time point according to a formula of A=L*(S/D), and rounding A up to a multiple of P;(s4) seeking a packetized elementary stream (PES) of the main bit stream from the estimated file position “
A”
according to an inverse order, and obtaining a presentation time stamp (PTS) “
T”
of the found PES, the found PES of the main bit stream being the first stream nearest to the estimated file position “
A”
;(s5) determining if an absolute value |S−
T| is greater than a preset value, and executing steps (s6)-(s7) if the absolute value |S−
T| is greater than the preset value, or executing step (s8) if the absolute value |S−
T| is less than or equal to the preset value;(s6) re-calculating the estimated file position “
A”
according to a preset estimation formula, and rounding A up to the next multiple of P;(s7) returning to step (s4) if S is greater than or equal to T, or seeks again a PES of the main bit stream from the estimated file position “
A”
according to a sequential order if S is less than T, obtains a PTS “
T”
of the found PES, and returning to step (s5); and(s8) seeking a first I-frame from the estimated file position “
A”
according to the inverse order if the main bit stream is a video stream, and determining the PES of the first I-frame is an accurate file position of the specified time point “
S,”
or determining the PES last found in step (s4) or (s7) is the accurate file position of the specified time point “
S”
if the main bit stream is not the video stream. - View Dependent Claims (2, 3, 4, 5)
-
-
6. An electronic device, the electronic device comprising:
-
a display screen; a storage device; one or more processors; and one or more modules stored in the storage device and configured for execution by the one or more processors, the one or more modules including instructions to execute the following steps; (s1) obtaining a file size “
L,”
a time length “
D”
of the file, a packet size “
P,” and
a specified time point “
S”
in the file;(s2) determining an identifier (ID) of a main bit stream of the file; (s3) calculating an estimated file position “
A”
corresponding to the specified time point according to a formula of A=L*(S/D), and rounding A up to a multiple of P;(s4) seeking a packetized elementary stream (PES) of the main bit stream from the estimated file position “
A”
according to an inverse order, and obtaining a presentation time stamp (PTS) “
T”
of the found PES, the found PES of the main bit stream being the first stream nearest to the estimated file position “
A”
;(s5) determining if an absolute value |S−
T| is greater than a preset value, and executing steps (s6)-(s7) if the absolute value |S−
T| is greater than the preset value, or executing step (s8) if the absolute value |S−
T| is less than or equal to the preset value;(s6) re-calculating the estimated file position “
A”
according to a preset estimation formula, and rounding A up to the next multiple of P;(s7) returning to step (s4) if S is greater than or equal to T, or seeks again a PES of the main bit stream from the estimated file position “
A”
according to a sequential order if S is less than T, obtains a PTS “
T”
of the found PES, and returning to step (s5); and(s8) seeking a first I-frame from the estimated file position “
A”
according to the inverse order if the main bit stream is a video stream, and determining the PES of the first I-frame is an accurate file position of the specified time point “
S,”
or determining the last PES found in step (s4) or (s7) is the accurate file position of the specified time point “
S”
if the main bit stream is not the video stream. - View Dependent Claims (7, 8, 9, 10)
-
-
11. A non-transitory storage medium having stored thereon instructions that, when executed by a processor of an electronic device, causes the processor to perform a method for seeking a file position of a file, the method comprising:
-
(s1) obtaining a file size “
L,”
a time length “
D”
of the file, a packet size “
P,” and
a specified time point “
S”
in the file;(s2) determining an identifier (ID) of a main bit stream of the file; (s3) calculating an estimated file position “
A”
corresponding to the specified time point according to a formula of A=L*(S/D), and rounding A up to a multiple of P;(s4) seeking a packetized elementary stream (PES) of the main bit stream from the estimated file position “
A”
according to an inversed order, and obtaining a presentation time stamp (PTS) “
T”
of the found PES, the found PES of the main bit stream being the first stream nearest to the estimated file position “
A”
;(s5) determining if an absolute value |S−
T| is greater than a preset value, and executing steps (s6)-(s7) if the absolute value |S−
T| is greater than the preset value, or executing step (s8) if the absolute value |S−
T| is less than or equal to the preset value;(s6) re-calculating the estimated file position “
A”
according to a preset estimation formula, and rounding A up to the next multiple of P;(s7) returning to step (s4) if S is greater than or equal to T, or seeks again a PES of the main bit stream from the estimated file position “
A”
according to a sequential order if S is less than T, obtains a PTS “
T”
of the found PES, and returning to step (s5); and(s8) seeking a first I-frame from the estimated file position “
A”
according to the inverse order if the main bit stream is a video stream, and determining the PES of the first I-frame is an accurate file position of the specified time point “
S,”
or determining the last PES found in step (s4) or (s7) is the accurate file position of the specified time point “
S”
if the main bit stream is not the video stream. - View Dependent Claims (12, 13, 14, 15)
-
Specification