A kind of management method and system of time-based media file
Technical field
The present invention relates to the administrative skill field of media file more particularly to a kind of management of time-based media file
Method and system.
Background technique
Smart phone is popularized so that the generation of the media files such as picture, audio and video is very easy to, how to these
File organize just at a difficult problem, traditional organization and administration mode is located respectively by different file types
Reason, it is not convenient intuitive enough, it cannot achieve the temporal serialization processing of any media file, such as random playback, dynamic additions and deletions
Deng.
Summary of the invention
It is an object of the invention to propose the management method and system of a kind of time-based media file, by media file
Time offset and the file information linear memory in index file at the same time, by the time index file to media text
Part progress is time-based to be uniformly managed, easy to operate intuitive.
To achieve this purpose, the present invention adopts the following technical scheme:
On the one hand, the present invention proposes a kind of management method of time-based media file, comprising:
Media file is received, the media file is stored in the file of the media file respective file type;
The information of the media file is obtained, the information includes filename, time span, the file of the media file
Type;
It determines the position being stored in the data cell indexed file TIDX of the index file TIDX of the information, calculates institute
State the time offset of data cell, the time offset be the data cell before all data cells in store when
Between the sum of length, the information and the time offset are stored in the data cell;
The media file is managed according to the index file TIDX.
Wherein it is determined that the position being stored in the data cell indexed file TIDX of the index file TIDX of the information it
Afterwards, further includes: judge whether the position in other data cell indexed files TIDX of index file TIDX changes, if
It is the time offset for calculating changed data cell, the time offset of changed data cell is to become
The sum of the time span stored in all data cells before the data cell changed is stored in the time offset and occurs
The data cell of variation.
Wherein, the position in the data cell indexed file TIDX of the determining index file TIDX for being stored in the information
It sets, calculates the time offset of the data cell, comprising:
Determine the front position being stored in the data cell indexed file TIDX of the index file TIDX of the information, institute
The time offset for stating data cell is 0;
The position for the data of other data cells in index file TIDX being moved back a data cell, changes
The time offset of data cell increase the time span being stored in front position data cell;Or
Confirmation is stored in the terminal position in the data cell indexed file TIDX of the index file TIDX of the information, institute
The time offset for stating data cell be terminal position before all data cells in the sum of the time span that stores.
Wherein it is determined that be stored in the data cell indexed file TIDX of the index file TIDX of the information position it
Afterwards, further includes:
The location information of the data cell where information described in the filename and index file TIDX in the information
It is stored in the data cell of mapped file FMAT;
The media file is managed according to the mapped file FMAT.
Wherein, the data format of the data cell of the index file TIDX are as follows: TIDX=[d1,d2,d3,d4,d5],
In, d1For the time offset of media file, d2For the filename of media file, d3For the time span of media file, d4For matchmaker
The file type of body file, d5For user-defined feature value, the user-defined feature value includes file color value;
The data format of the data cell of time index file FMAT are as follows: FMAT=[F1,F2], wherein F1For media file
Filename, F2For the location information of the data cell where the information of media file described in index file TIDX.
Wherein, the management includes being deleted the media file, play positioning and being played process adjusting;
When the management is deletes media file, comprising:
By the time offset makeup time axis of the data cell of the index file TIDX;
It obtains and deletes media file at the time point of the time shaft, corresponding time offset is found according to the point,
Corresponding data cell is found according to the offset;
The filename and file type for reading the media file of the data cell storage, find according to the file type
Corresponding file deletes the media file according to the filename;
The data for deleting the data cell, the data of other data cells after the data cell of deletion to
The position for the data cell that moves forward, the time offset of changed data cell subtracts deposits in the data cell of deletion
The time span entered;
When the management is plays out positioning to media file, comprising:
By the time offset makeup time axis of the data cell of the index file TIDX;
It obtains and plays media file at the time point of the time shaft, corresponding time offset is found according to time point,
Corresponding data cell is found according to time offset;
The filename and file type for reading the media file of the data cell storage, find correspondence according to file type
File, read the media file and play out;
When the management is adjusted to play out process to media file, comprising:
By the time offset makeup time axis of the data cell of the index file TIDX;
It obtains and plays media file in the time point of the time shaft, mobile classification and need mobile time span;
If the mobile classification is to advance, when the time point is obtained target plus the time span for needing movement
Between point;If the mobile classification is to retreat, the time point is subtracted into the time span for needing movement and obtains the object time
Point finds corresponding time offset according to the object time point, finds corresponding data sheet according to the time offset
Member;
The filename and file type for reading the media file of the data cell storage, find correspondence according to file type
File, read the media file and play out;
Wherein, the management includes deleting the media file, specifically:
Obtain the filename for deleting media file;
The data cell that the mapped file FMAT where the filename is found according to filename, reads the data cell
In location information, find the data cell of index file TIDX according to the positional information;
The filename and file type for reading the media file of the data cell storage, find according to the file type
Corresponding file deletes the media file according to the filename;
The data for deleting the data cell of the mapped file FMAT and the data cell of the index file TIDX, deleting
The data of other data cells after the data cell removed to Forward one data cell position, changed number
The time span being stored in the data cell of deletion is subtracted according to the time offset of unit.
On the other hand, the present invention also proposes a kind of management system of time-based media file, which is characterized in that packet
It includes:
File reception unit, for receiving media file;
File storage unit, for the media file being stored in the file of the media file respective file type;
Acquiring unit, for obtaining the information of the media file, the information include the media file filename,
Time span, file type;
Storage location determination unit, for determining the data cell for being stored in the index file TIDX of the information in index text
Position in part TIDX;
Computing unit, for calculating the time offset of the data cell, the time offset is the data cell
The sum of the time span stored in all data cells before;
Index datastore unit, for the information and the time offset to be stored in the data cell;
Administrative unit, for being managed according to the index file TIDX to the media file.
Wherein, further includes:
Position judging unit, the position in other data cell indexed files TIDX for judging index file TIDX
Whether change;If so, the time offset of changed data cell is calculated, the time of changed data cell
Offset be the changed data cell before all data cells in the sum of the time span that stores, the time
Offset is stored in the changed data cell;
Mapping relations storage unit, for where information described in the filename and index file TIDX in the information
Data cell location information deposit mapped file FMAT data cell;
TIDX data format setting unit, for the data format of index file TIDX data cell to be arranged;
FMAT data format setting unit, for the data format of mapped file FMAT data cell to be arranged.
Wherein, the administrative unit is also used to be managed the media file according to the mapped file FMAT, institute
Stating administrative unit includes:
Unit is deleted, for deleting media file;
Positioning unit, the play position for located media file;
Process adjusts unit, for adjusting the play position of media file.
Technical solution bring provided by the invention the utility model has the advantages that
The management method and system of media file of the present invention receive media file, the media file are stored in the media
The file of file respective file type, obtains the information of the media file, and the information includes the text of the media file
Part name, time span, file type determine the data cell indexed file TIDX for being stored in the index file TIDX of the information
In position, calculate the time offset of the data cell, the time offset be the data cell before all numbers
According to the sum of the time span stored in unit, the information and the time offset are stored in the data cell, according to institute
Index file TIDX is stated to be managed the media file;By the time offset of media file and the file information linear memory
In index file at the same time, uniformly it is managed by the time index file is time-based to media file progress,
It is easy to operate intuitive.
Detailed description of the invention
Fig. 1 is the method flow diagram of media file management method one embodiment provided by the invention.
Fig. 2 is the method flow diagram of second embodiment of media file management method provided by the invention.
Fig. 3 is the system construction drawing of media file management system one embodiment provided by the invention.
Fig. 4 is the system construction drawing of second embodiment of media file management system provided by the invention.
Specific embodiment
To further illustrate the technical scheme of the present invention below with reference to the accompanying drawings and specific embodiments.
Embodiment one
It is the method flow diagram of media file management method one embodiment provided by the invention referring to Fig. 1, Fig. 1.
In the first embodiment, the method for the media file management includes:
S101 receives media file, the media file is stored in the file of the media file respective file type;
Three catalogue files are pre-established, storage audio file, video file and picture file is respectively used to, establishes simultaneously
Time index file simultaneously initializes.Time index file is used to store the time index of the media file under these three catalogue files
Data, the time index data include time offset, filename, time span, file type and the file color of media file
Value, the time index data of each media file are stored in the data cell of time index file TIDX in the form of array.
S102, obtains the information of the media file, the information include the filename of the media file, time it is long
Degree, file type;
If the file type is video type or audio types, the time span is play time length;If described
File type is picture, and the time span is 5 seconds.
S103 determines the position being stored in the data cell indexed file TIDX of the index file TIDX of the information,
Calculate the time offset of the data cell, the time offset be the data cell before all data cells in deposit
The information and the time offset are stored in the data cell by the sum of time span of storage;
The specified file of the media file deposit that will acquire extracts the information of media file after unique name, including
Its filename, time span, file type select a data cell as the storage list of the information in time index file
Member, the time offset of the data cell are the time offset of the media file, and the time span of the data cell is the matchmaker
The time span of body file, the time offset be the data cell before all data cells in the time span that stores
The sum of, the information of the time offset and media file is stored in the data cell.
Preferably, determine that the mode of the position of the storage unit has following two:
Mode one determines the front end being stored in the data cell indexed file TIDX of the index file TIDX of the information
Position, the time offset of the data cell are 0;
The position for the data of other data cells in index file TIDX being moved back a data cell, changes
The time offset of data cell increase the time span being stored in front position data cell;
Mode two, confirmation are stored in the end in the data cell indexed file TIDX of the index file TIDX of the information
Position, the time offset of the data cell be terminal position before all data cells in the time span that stores it
With.
S104 is managed the media file according to the index file TIDX.
After the media file of each deposit catalogue file is uniquely named, its time index data, including media are obtained
Time offset, filename, file size and the file type of file, and the number of unified linear access time index file TIDX
According in unit, the time index data and media file of each data cell are corresponded, settling time index file TIDX with
Linking relationship between media file entity, can be by the time index file TIDX to media text all under catalogue file
Part is managed collectively.
The management includes being deleted the media file, play positioning and being played process adjusting.
To sum up, the management method of media file of the embodiment of the present invention receives media file and will store after its unique name
Under specified catalogue file, obtains the time index data of media file and be linearly stored in time index file;It establishes
Linking relationship between time index file and media file entity, due to the time rope of each data cell of time index file
Argument is corresponded according to media file, when can be based on to the media file under catalogue file by time index file
Between unified management, eliminate the inconvenience of classification processing.
Embodiment two
Referring to fig. 2, Fig. 2 is the method flow diagram of second embodiment of media file management method provided by the invention.
In a second embodiment, the method for the media file management includes:
S201 receives media file, the media file is stored in the file of the media file respective file type;
S202, obtains the information of the media file, the information include the filename of the media file, time it is long
Degree, file type;
S203 determines the position being stored in the data cell indexed file TIDX of the index file TIDX of the information;
The data format of the data cell of index file are as follows: TIDX=[d1, d2, d3, d4, d5], wherein TIDX is array
Title, d1 are the time offset of the media file, and d2 is the filename of the media file, and d3 is the media file
Time span, d4 are the file type of the media file, and d5 is user-defined feature value, and the user-defined feature value includes file
Color value.
S204, calculates the time offset of the data cell, and the time offset is the institute before the data cell
There is the sum of the time span stored in data cell, the information and the time offset are stored in the data cell;
S205, the position of the data cell where information described in the filename and index file TIDX in the information
The data cell of information deposit mapped file FMAT;
Mapped file is established, which is stored between the filename of media file and above-mentioned time index file
Mapping relations, the data format of data cell are as follows: FMAT=[F1, F2], wherein F1 is media file name, and F2 is index text
The location information of data cell where the information of media file described in part TIDX, if obtaining the filename of media file,
The data cell where the information of the media file can be found, to find the time index data of the media file.
S206, by the time offset makeup time axis of the data cell of the index file TIDX;
The time offset of each data cell storage, makeup time axis, first data in extraction time index file
The time offset of unit storage is 0, constitutes the starting point of time shaft, and the time offset of each data cell is the data sheet
The sum of the time span stored in all data cells before member, constitutes the node of the time shaft;
The period that each media file occupies on the time shaft is the time span of the media file, the period
Starting point is the time offset of media file, i.e. the time of data cell where the time index data of the media file is inclined
Shifting amount.
S207 identifies operational order corresponding with the management, if the operational order is to delete media file,
Enter step S208;If the operational order is to play out positioning to media file, S215 is entered step;If the operation refers to
It enables to play out process to media file and adjusting, enters step S217;
Identify to the management category of media file, i.e. operational order, including media file deleted, play positioning and
Broadcasting process is adjusted.
If deleting media file, there are two types of approach:
S208 judges deletion mode, if the deletion mode to the media file is the deletion based on time shaft, into step
Rapid S209;If the deletion mode to the media file is the deletion based on filename, S211 is entered step;
Mode one, the deletion mode to the media file is the deletion based on time index:
S209 is obtained and is deleted media file at the time point of the time shaft;
S210 finds corresponding time offset according to the time point, is found according to the time offset corresponding
Data cell
If user needs the media file to some time point or some period to delete, select the time point or
Period, the time point and period correspond to the time offset of media file, are found according to the time offset corresponding
Data cell in time index file deletes the matchmaker according to the linking relationship between the data cell and the media file entity
Body file.
Mode two, the deletion mode to the media file is the deletion based on filename:
S211 obtains the filename for deleting media file, the mapped file where the filename is found according to filename
The data cell of FMAT;
S212 reads the location information of the data cell of index file TIDX in the data cell, according to the position
Information finds corresponding data cell;
The filename for obtaining needing the media file deleted, finds data sheet corresponding with file name by mapped file
The location information of member, further finds the data cell, reads media file corresponding with file name in the data cell
Time index data are deleted according to the linking relationship where the time index data between data cell and the media file entity
The media file.
S213 reads the filename and file type of the media file of the data cell storage, is looked for according to file type
To corresponding file, the media file is deleted;
S214 deletes the data of the data cell, other data cells after the data cell of deletion
Data subtract the data sheet of deletion to the position of one data cell of Forward, the time offset of changed data cell
The time span being stored in member;
After the media file is deleted, while the time index data of the media file are deleted, vacates a data sheet
Member, the time index data after the data cell are moved along a data cell, while mobile time index data
Time offset subtract it is described delete file time span, form new time offset;If being carried out to media file
When deletion based on filename, the content of the data cell in mapped file where file name need to be removed simultaneously.
Positioning is played out to media file, i.e., the play position of selected media file, steps are as follows:
S215 obtains and plays media file at the time point of the time shaft, it is inclined to find the corresponding time according to time point
Shifting amount finds corresponding data cell according to time offset;
S216 reads the filename and file type of the media file of the data cell storage, is looked for according to file type
To corresponding file, reads the media file and play out;
During playback of media files, user can select fixed point to play according to their own needs, according to user's
The time point for needing to position when playback of media files on operation acquisition time axis, the time which corresponds to media file are inclined
Shifting amount finds the data cell where corresponding time index data according to the time offset, according in the data cell
Content finds the catalogue of the media file, and the content for reading the media file plays out;
Since the time index data of all media files under catalogue file are stored in the same mapped file middle line
Property storage, the time offset of each media file name and the media file correspond, corresponding with time index file
The consecutive order that audio file, video file and picture file may be implemented on time shaft plays.
For example, if there are three media files under catalogue file, successively are as follows: filename is audio1.mp3 audio file, when
Between length be 60 seconds, the entitled pic1.jpg picture file of file, time span is fixed as 5 seconds and file entitled video1.mp4 view
Frequency file, time span are 180 seconds, the data cell in time index file where the time index data of these three files
Content successively are as follows: [0, audio.mp3,60,1, FF0000], [60, pic1.jpg, 5,3,00FF00] and [65,
Video.mp4,240,2,0000FF], if the time point for playing positioning is selected as leading zero's, three files are playd in order, point
It is not that audio file plays 60 seconds, then picture file plays 5 seconds, and last playing video file simultaneously continues to terminate for 180 seconds.
It is played out in addition it is also possible to be navigated on time shaft by the filename of media file, specifically:
The position of the data cell where the information of media file is found in mapped file according to the filename of media file
Confidence breath;
Above-mentioned data cell is found according to the location information, reads the time offset in the data cell, the time is inclined
Shifting amount is the time offset of media file on a timeline;
The file type for reading media file in the data cell finds the matchmaker according to this document type and above-mentioned filename
Body file reads the media file and plays out.
It plays out process to media file to adjust, i.e. fast forward or rewind, steps are as follows:
S217 is obtained and is played media file in the time point of the time shaft, mobile classification and need the mobile time long
Degree
S218 judges that broadcasting process adjusts classification and enters step S219 if the broadcasting process is adjusted to advance;If institute
It states broadcasting process to be adjusted to retreat, enters step S220;
The time point is needed mobile time span to obtain object time point by S219 plus described
The time point is subtracted the time span for needing movement and obtains object time point by S220
S221 finds corresponding time offset according to the object time point, is found pair according to the time offset
The data cell of the index file TIDX answered;
Continue above-mentioned routine, if playback of media files was to 30 seconds, user selected F.F. to skip to 35 seconds after as newly
Broadcast point, obtain and play 30 seconds locating time points at present and need traveling time length 35 seconds, by conduct in 30+35=65 seconds
Object time point, the object time point correspond to the time offset that target plays media file, are looked for according to the time offset
Into time index file, corresponding data cell [65, video.mp4,240,2,0000FF], read the data cell
In filename video.mp4 and file type 2, find the catalogue of media file video.mp4, read the media file
The content of video.mp4, playing video file video1.mp4.
To sum up, media file is uniquely named and is stored corresponding by the management method of the media file of the embodiment of the present invention
Catalogue under after, extract its characteristic information, determine its time offset in time index file, by the time offset
Data cell with characteristic information as the linear access time index file of time index data of the media file, and establishing should
Mapping relations between the filename of media file and the data cell, the time of data cell is inclined in extraction time index file
Shifting amount, settling time axis are managed media file according to the filename of the time shaft and media file;Due to the time shaft
On time offset corresponding time point and media file correspond, can be to the matchmaker under catalogue file by the time shaft
Body file carries out time-based unified management, while can also be based on by filename and mapping relations to media file
The delete operation of filename eliminates the inconvenience of classification processing, brings better experience to user.
Embodiment three
It is the system construction drawing of media file management system one embodiment provided by the invention referring to Fig. 3, Fig. 3.
In the third embodiment, the system of the media file management includes:
File reception unit 01, for receiving media file.
File storage unit 02, for the media file being stored in the file of the media file respective file type.
It receives media file and stores, catalogue identical with this document type is arrived in storage after received file is uniquely named
Under file, catalogue file includes audio file, picture file and video file.
Acquiring unit 03, for obtaining the information of the media file, the information includes the file of the media file
Name, time span, file type.
Storage location determination unit 04, for determining that the data cell for being stored in the index file TIDX of the information is indexing
Position in file TIDX;
Computing unit 05, for calculating the time offset of the data cell, the time offset is the data sheet
The sum of the time span stored in all data cells before member.
Determine that the information of media file will calculate the number after the position of data cell in access time index file
According to the time offset of unit, the time offset of the data cell is the time stored in all data cells before it
The sum of length, using the time offset as the time offset of the media file in time index file.
Preferably, the position being stored in the data cell indexed file TIDX of the index file TIDX of the information is determined
There are two types of modes: by the front position of time index file, i.e. first data cell or terminal position, i.e. first free time
Information memory cell of the data cell as the media file.
Index datastore unit 06, for the information and the time offset to be stored in the data cell.
Using the information of the time migration for the media file being calculated and media file as the time rope of the media file
The argument data cell selected according to deposit.
Administrative unit 07, for being managed according to the index file TIDX to the media file.
The administrative unit packet 07 includes:
Unit 071 is deleted, for deleting media file;
Positioning unit 072, the play position for located media file;
Process adjusts unit 073, for adjusting the play position of media file.
After the time index data access time index file of media file, each media file corresponds one group
Time index data, these time index data unify linear memory in time index file, can pass through the time index
Linking relationship between file and media file entity deletes the media file, plays positioning and plays process adjusting.
To sum up, the management system of media file of the embodiment of the present invention receives media file and will store after its unique name
Under specified catalogue file, obtains the time index data of media file and be linearly stored in time index file;It establishes
Linking relationship between time index file and media file entity, due in time index file time index data and matchmaker
Body file correspond, by the time index data in the time index file can to the media file under catalogue file into
The time-based unified management of row, eliminates the inconvenience of classification processing.
Example IV
Referring to fig. 4, Fig. 4 is the system construction drawing of second embodiment of media file management system provided by the invention.
On the basis of 3rd embodiment, the system of the media file management further include:
TIDX data format setting unit 08, for the data format of index file TIDX data cell to be arranged;
FMAT data format setting unit 09, for the data format of mapped file FMAT data cell to be arranged.
The format of the format of the data cell of time index file and the data cell of mapped file is set.
Position judging unit 10, the position in other data cell indexed files TIDX for judging index file TIDX
It sets and whether changes;If so, calculate the time offset of changed data cell, changed data cell when
Between offset be the changed data cell before all data cells in the sum of the time span that stores, it is described when
Between offset be stored in the changed data cell.
It, need to will be after the data cell before by the selected data cell of the time index data of media file deposit
Non vacuum data unit moves backward the position of a data cell, it is mobile after the time offset of data cell be its it
The sum of the time span of preceding all data cells storage, if selected data cell is the terminal position of time index file,
That is first idle data cell does not need to move the time index that other non vacuum data units are directly stored in the media file
Data.
Mapping relations storage unit 11, for information institute described in the filename and index file TIDX in the information
Data cell location information deposit mapped file FMAT data cell;
Time shaft establishes unit 12, for by the time offset makeup time of the data cell of the index file TIDX
Axis.
The time offset of each data cell storage, makeup time axis, first data in extraction time index file
The time offset of unit storage is 0, constitutes the starting point of time shaft, and the time offset of each data cell is the data sheet
The sum of the time span stored in all data cells before member, constitutes the node of the time shaft;Each media file is at this
The period occupied on time shaft is the time span of the media file, and the starting point of the period is that the time of media file is inclined
Shifting amount, end point are the time offset of next media file.
It, can be by the time shaft to media since on the time shaft, each time point corresponds to a media file
File carries out time-based management.
Administrative unit 07 is also used to be managed the media file according to the mapped file FMAT.
The mapping relations between the filename of media file and time index file are established, the filename in the information
With the data cell of the location information deposit mapped file FMAT of the data cell where information described in index file TIDX, purport
Corresponding data cell in time index file can be being found by filename, is reading the time index number of the media file
According to according to the linking relationship between the time index file and media file entity, to be managed to media file, specifically
To carry out the delete operation based on filename to media file.
To sum up, media file is uniquely named and is stored corresponding by the management system of the media file of the embodiment of the present invention
Catalogue under after, extract its characteristic information, determine its time offset in time index file, by the time offset
Data cell with characteristic information as the linear access time index file of time index data of the media file, and establishing should
Mapping relations between the filename of media file and the data cell, the time of data cell is inclined in extraction time index file
Shifting amount, settling time axis are managed media file according to the filename of the time shaft and media file;Due to the time shaft
On time offset corresponding time point and media file correspond, can be to the matchmaker under catalogue file by the time shaft
Body file carries out time-based unified management, while can also be based on by filename and mapping relations to media file
The delete operation of filename eliminates the inconvenience of classification processing, brings better experience to user.
The technical principle of the invention is described above in combination with a specific embodiment.These descriptions are intended merely to explain of the invention
Principle, and shall not be construed in any way as a limitation of the scope of protection of the invention.Based on the explanation herein, the technology of this field
Personnel can associate with other specific embodiments of the invention without creative labor, these modes are fallen within
Within protection scope of the present invention.