CN106557555A - media playing method and device - Google Patents

media playing method and device Download PDF

Info

Publication number
CN106557555A
CN106557555A CN201610979163.8A CN201610979163A CN106557555A CN 106557555 A CN106557555 A CN 106557555A CN 201610979163 A CN201610979163 A CN 201610979163A CN 106557555 A CN106557555 A CN 106557555A
Authority
CN
China
Prior art keywords
media
file
folder
database
media file
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201610979163.8A
Other languages
Chinese (zh)
Inventor
马子平
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Nubia Technology Co Ltd
Original Assignee
Nubia Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Nubia Technology Co Ltd filed Critical Nubia Technology Co Ltd
Priority to CN201610979163.8A priority Critical patent/CN106557555A/en
Publication of CN106557555A publication Critical patent/CN106557555A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/40Information retrieval; Database structures therefor; File system structures therefor of multimedia data, e.g. slideshows comprising image and additional audio data
    • G06F16/48Retrieval characterised by using metadata, e.g. metadata not derived from the content or metadata generated manually
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/40Information retrieval; Database structures therefor; File system structures therefor of multimedia data, e.g. slideshows comprising image and additional audio data
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/40Information retrieval; Database structures therefor; File system structures therefor of multimedia data, e.g. slideshows comprising image and additional audio data
    • G06F16/43Querying
    • G06F16/438Presentation of query results
    • G06F16/4387Presentation of query results by the use of playlists
    • GPHYSICS
    • G11INFORMATION STORAGE
    • G11BINFORMATION STORAGE BASED ON RELATIVE MOVEMENT BETWEEN RECORD CARRIER AND TRANSDUCER
    • G11B27/00Editing; Indexing; Addressing; Timing or synchronising; Monitoring; Measuring tape travel
    • G11B27/02Editing, e.g. varying the order of information signals recorded on, or reproduced from, record carriers
    • G11B27/031Electronic editing of digitised analogue information signals, e.g. audio or video signals
    • G11B27/034Electronic editing of digitised analogue information signals, e.g. audio or video signals on discs

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Multimedia (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Library & Information Science (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses a kind of media playing apparatus and method, its method includes:When the triggering of the media file condition of scanning is detected, the media database of media file and media application in scanning medium file obtains the second media file information in the first media file information and the media database in media folder;First media file information is compared with the second media file information, in judging the media folder, whether has media file to change;If there is media file to change in media folder, the media database and media play list for updating media application is corresponded to then, the present invention can be with real-time synchronization media play list and media database, already present image is shown only, ensure the integrity of media information, and in media play list image effectiveness, improve Consumer's Experience.

Description

Media playing method and device
Technical Field
The present invention relates to the field of media playing technologies, and in particular, to a media playing method and apparatus.
Background
In the era of mobile internet, with the popularization of intelligent terminals, people continuously pursue high-quality audio-visual experience, high code rate, high resolution, multiple channels and lossless video and audio sources gradually become standard configurations, and users have higher and higher requirements for the picture quality of multimedia media.
Currently, the mainstream media player completely depends on the multimedia database of the system, and when a media file is renamed and modified by a third-party application or a user moves an SD card out of or into the media player, the media database of the system is not updated in time, which results in that effective records, a play list and media files under a media folder in the media database of the media player cannot be synchronized in real time. After the media database is updated, the played time length, remarks, TAG and other information of the media file are deleted, and the played time cannot be recorded when the user plays the media again next time, so that the user experience is poor.
Disclosure of Invention
The invention mainly aims to provide a media playing method and a media playing device, and aims to realize the real-time updating of a media database and a play list of a media player after a media file is changed, and further avoid the problem that the played time, remarks, TAG and other information of the media file can be deleted after the media database is updated.
In order to achieve the above object, a media playing method provided by the present invention is applied to a terminal, a media application is installed on the terminal, a system of the terminal is configured with a media folder, a media database and a media playing list based on the media application, and the method includes:
when the triggering of a media file scanning condition is detected, scanning a media file in the media folder and a media database of a media application to obtain first media file information in the media folder and second media file information in the media database;
comparing and analyzing the first media file information and the second media file information, and judging whether a media file is changed in the media folder, wherein the change of the media file at least comprises the addition, deletion or modification of the media file;
if the media files in the media folder are changed, correspondingly updating a media database and a media play list of the media application, wherein: and when no media file exists in the media database through the recorded storage path query, the operation of deleting the corresponding record is not executed.
Optionally, if there is a change in the media file in the media folder, the step of correspondingly updating the media database of the media application includes:
if the media file folder is newly added with the media file, inserting a storage path of the newly added media file and a record related to file duration into the media database;
and/or the presence of a gas in the gas,
if the media file is deleted in the media folder, updating a corresponding record in the media database, and setting the record to be in an inactivated state, wherein the updated record at least comprises the played time length, remarks and TAG TAG information of the deleted media file;
and/or the presence of a gas in the gas,
if the media file is modified in the media folder, updating the corresponding record in the media database, and updating the last modification time of the file in the record to the modification time of the modified media file.
Optionally, if there is a change in the media file in the media folder, the step of correspondingly updating the media database of the media application further includes:
if the newly added media files in the media folder are the media files reappeared due to the SD card being moved in, updating the corresponding records of the media database, and setting the records to be in an activated state;
and/or the presence of a gas in the gas,
if the deleted media files in the media folder are lost due to the removal of the SD card, updating corresponding records in the media database, and setting the records to be in an inactivated state;
and/or the presence of a gas in the gas,
if the modified media file in the media folder is the renamed media file and the storage path of the media file is changed, updating the corresponding record in the media database, and changing the storage path of the matched record into the storage path of the current media file; or, if the modified media file in the media folder is the media file with the preserved file name and the original file replaced, inserting the related information of the media file into the media database as a new record.
Optionally, the media file scanning condition is:
when the media application is launched;
or,
entering a media playlist interface after starting a media application;
or,
when detecting that the SD card is inserted into/removed from the terminal;
or,
when the broadcast of the media folder content change is monitored.
Optionally, the first media file information and the second media information include: the file name, storage path, file duration, played duration, file size, last file modification time and/or whether the file is activated;
the step of comparing and analyzing the first media file information and the second media file information and judging whether media files in the media folder are changed comprises the following steps:
if the file name, the storage path and the file duration of the media file in the media folder are matched with the corresponding records in the media database, and the matched records cannot be found in the media database, the media file is judged to be newly added in the media folder;
if the file name, the storage path and the file duration of the media file in the media folder are matched with the corresponding records in the media database, the records exist in the media database, and the corresponding media file information does not exist in the media folder, the media file is judged to be deleted in the media folder;
if the file name, the storage path, the file duration and the last modification time of the media file in the media folder are matched with the corresponding records in the media database, the file name, the storage path and the file duration are not changed, and the last modification time is changed, the media file is modified in the media folder;
and if the file name, the storage path, the file duration and the last modification time of the media file in the media folder are matched with the corresponding records in the media database, and the file duration is not changed but the file name and the storage path are changed, determining that the media file is renamed in the media folder.
Optionally, the step of correspondingly updating the media database and the media playlist of the media application further includes:
updating a media playlist of the media application according to the updated media database, hiding the non-existent media files, wherein: when the media file does not exist in the media database through the recorded storage path query, the played time length of the media file is recorded so as to continue playing from the previously played position when the media file is played next time.
Optionally, the step of correspondingly updating the media database and the media playlist of the media application further includes:
and clearing the mark information of the media files cached in the media database by a preset rule at preset time intervals.
The embodiment of the present invention further provides a media playing device, which is applied to a terminal, wherein a media application is installed on the terminal, a system of the terminal is configured with a media folder, a media database and a media playing list based on the media application, and the device includes:
the file scanning module is used for scanning the media files in the media folder and a media database of a media application when detecting that a media file scanning condition is triggered to obtain first media file information in the media folder and second media file information in the media database;
the comparison analysis module is used for comparing and analyzing the first media file information and the second media file information and judging whether a media file in the media folder is changed or not, wherein the change of the media file at least comprises the addition, deletion or modification of the media file;
an updating module, configured to update the media database and the media playlist of the media application correspondingly if the media file in the media folder is changed, where: and when no media file exists in the media database through the recorded storage path query, the operation of deleting the corresponding record is not executed.
Optionally, the updating module is further configured to insert a storage path of the newly added media file and a record related to a file duration into the media database if the newly added media file exists in the media folder;
and/or the presence of a gas in the gas,
if the media file is deleted in the media folder, updating a corresponding record in the media database, and setting the record to be in an inactivated state, wherein the updated record at least comprises the played time length, remarks and TAG TAG information of the deleted media file;
and/or the presence of a gas in the gas,
if the media file is modified in the media folder, updating the corresponding record in the media database, and updating the last modification time of the file in the record to the modification time of the modified media file.
Optionally, the updating module is further configured to update a corresponding record of the media database and set the record as an activated state if the newly added media file in the media folder is a media file that reappears due to the SD card being moved in;
and/or the presence of a gas in the gas,
if the deleted media files in the media folder are lost due to the removal of the SD card, updating corresponding records in the media database, and setting the records to be in an inactivated state;
and/or the presence of a gas in the gas,
if the modified media file in the media folder is the renamed media file and the storage path of the media file is changed, updating the corresponding record in the media database, and changing the storage path of the matched record into the storage path of the current media file; or, if the modified media file in the media folder is the media file with the preserved file name and the original file replaced, inserting the related information of the media file into the media database as a new record.
Optionally, the media file scanning condition is:
when the media application is launched;
or,
entering a media playlist interface after starting a media application;
or,
when detecting that the SD card is inserted into/removed from the terminal;
or,
when the broadcast of the media folder content change is monitored.
Optionally, the first media file information and the second media information include: the file name, storage path, file duration, played duration, file size, last file modification time and/or whether the file is activated;
the comparison analysis module is also used for judging that the media folder has a new addition of the media files if the file names, the storage paths and the file durations of the media files in the media folder are matched with corresponding records in a media database and the matched records cannot be found in the media database;
if the file name, the storage path and the file duration of the media file in the media folder are matched with the corresponding records in the media database, the records exist in the media database, and the corresponding media file information does not exist in the media folder, the media file is judged to be deleted in the media folder;
if the file name, the storage path, the file duration and the last modification time of the media file in the media folder are matched with the corresponding records in the media database, the file name, the storage path and the file duration are not changed, and the last modification time is changed, the media file is modified in the media folder;
and if the file name, the storage path, the file duration and the last modification time of the media file in the media folder are matched with the corresponding records in the media database, and the file duration is not changed but the file name and the storage path are changed, determining that the media file is renamed in the media folder.
Optionally, the updating module is further configured to update a media playlist of the media application according to the updated media database, and hide a non-existent media file, where: when the media file does not exist in the media database through the recorded storage path query, the played time length of the media file is recorded so as to continue playing from the previously played position when the media file is played next time.
Optionally, the updating module is further configured to clear the tag information of the media file cached in the media database at preset time intervals according to a preset rule.
The invention provides a media playing method and a device, when a media file scanning condition is detected to trigger, scanning a media file in a media folder and a media database of a media application to obtain first media file information in the media folder and second media file information in the media database; comparing and analyzing the first media file information and the second media file information, and judging whether a media file is changed in the media folder, wherein the change of the media file at least comprises the addition, deletion or modification of the media file; if the media files in the media folder are changed, correspondingly updating a media database and a media play list of the media application, wherein: when the media file does not exist in the media database through the recorded storage path query, the operation of deleting the corresponding record is not executed, for example, the record can be set to be in an inactivated state, the play list is updated at the same time, the nonexistent media file is hidden, the played time length, the remark and the TAG information are synchronized to the media database in real time, and the played time length of the media is recorded so as to be played continuously from the played position when the media is played again.
Therefore, according to the scheme, when the media files in the media folder are modified, such as the third-party application renames, deletes and modifies the media files, the SD card is moved out and the like, the media playlist and the media database are synchronized in real time, and only the existing images are displayed, so that the integrity of media information is ensured, the effectiveness of the images in the media playlist is ensured, and the user experience is improved.
Drawings
FIG. 1 is a diagram of an alternative mobile terminal hardware architecture for implementing various embodiments of the present invention;
FIG. 2 is a schematic diagram of a wireless communication system for the mobile terminal shown in FIG. 1;
FIG. 3 is a block diagram of a media player according to a first embodiment of the present invention;
FIG. 4 is a schematic diagram of a media file scanning process according to an embodiment of the invention;
FIG. 5 is a schematic overall flow chart of media data processing according to an embodiment of the present invention;
FIG. 6 is a diagram illustrating a media database cache flush procedure according to an embodiment of the invention;
FIG. 7 is a flowchart illustrating a first embodiment of a media playing method according to the present invention;
fig. 8 is a flowchart illustrating a media playing method according to a second embodiment of the present invention.
The implementation, functional features and advantages of the objects of the present invention will be further explained with reference to the accompanying drawings.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
The embodiment of the invention relates to media playing in terminal media application, wherein the related terminal can be a fixed terminal such as a PC (personal computer) and the like, and can also be referred to as a mobile terminal.
A mobile terminal implementing various embodiments of the present invention will now be described with reference to the accompanying drawings. In the following description, suffixes such as "module", "component", or "unit" used to denote elements are used only for facilitating the explanation of the present invention, and have no specific meaning in themselves. Thus, "module" and "component" may be used in a mixture.
The mobile terminal may be implemented in various forms. For example, the terminal described in the present invention may include a mobile terminal such as a mobile phone, a smart phone, a notebook computer, a digital broadcast receiver, a PDA (personal digital assistant), a PAD (tablet computer), a PMP (portable multimedia player), a navigation device, and the like, and a stationary terminal such as a digital TV, a desktop computer, and the like. In the following, it is assumed that the terminal is a mobile terminal. However, it will be understood by those skilled in the art that the configuration according to the embodiment of the present invention can be applied to a fixed type terminal in addition to elements particularly used for moving purposes.
Fig. 1 is a schematic diagram of a hardware structure of an alternative mobile terminal for implementing various embodiments of the present invention.
The mobile terminal 100 may include a wireless communication unit 110, a user input unit 130, an output unit 150, a memory 160, an interface unit 170, a controller 180, and a power supply unit 190, etc. Fig. 1 illustrates a mobile terminal having various components, but it is to be understood that not all illustrated components are required to be implemented. More or fewer components may alternatively be implemented. Elements of the mobile terminal will be described in detail below.
The wireless communication unit 110 typically includes one or more components that allow radio communication between the mobile terminal 100 and a wireless communication system or network. For example, the wireless communication unit may include at least one of a broadcast receiving module 111, a wireless internet module 113.
The broadcast receiving module 111 receives a broadcast signal and/or broadcast associated information from an external broadcast management server via a broadcast channel. The broadcast channel may include a satellite channel and/or a terrestrial channel. The broadcast management server may be a server that generates and transmits a broadcast signal and/or broadcast associated information or a server that receives a previously generated broadcast signal and/or broadcast associated information and transmits it to a terminal. The broadcast signal may include a TV broadcast signal, a radio broadcast signal, a data broadcast signal, and the like. Also, the broadcast signal may further include a broadcast signal combined with a TV or radio broadcast signal. The broadcast associated information may also be provided via a mobile communication network, and in this case, the broadcast associated information may be received by the mobile communication module 112. The broadcasting signal may exist in various forms, for example, it may be in an Electronic Program Guide (EPG) of Digital Multimedia Broadcasting (DMB), a numberA digital video broadcasting-handheld (DVB-H) Electronic Service Guide (ESG) or the like. The broadcast receiving module 111 may receive a signal broadcast by using various types of broadcasting systems. In particular, the broadcast receiving module 111 may receive a broadcast signal by using a signal such as multimedia broadcasting-terrestrial (DMB-T), digital multimedia broadcasting-satellite (DMB-S), digital video broadcasting-handheld (DVB-H), forward link media (MediaFLO)@) A digital broadcasting system of a terrestrial digital broadcasting integrated service (ISDB-T), etc. receives digital broadcasting. The broadcast receiving module 111 may be constructed to be suitable for various broadcasting systems that provide broadcast signals as well as the above-mentioned digital broadcasting systems. The broadcast signal and/or broadcast associated information received via the broadcast receiving module 111 may be stored in the memory 160 (or other type of storage medium).
The wireless internet module 113 supports wireless internet access of the mobile terminal. The module may be internally or externally coupled to the terminal. The wireless internet access technology to which the module relates may include WLAN (wireless LAN) (Wi-Fi), Wibro (wireless broadband), Wimax (worldwide interoperability for microwave access), HSDPA (high speed downlink packet access), and the like.
The user input unit 130 may generate key input data according to a command input by a user to control various operations of the mobile terminal. The user input unit 130 allows a user to input various types of information, and may include a keyboard, dome sheet, touch pad (e.g., a touch-sensitive member that detects changes in resistance, pressure, capacitance, and the like due to being touched), scroll wheel, joystick, and the like. In particular, when the touch pad is superimposed on the display unit 151 in the form of a layer, a touch screen may be formed.
The interface unit 170 serves as an interface through which at least one external device is connected to the mobile terminal 100. For example, the external device may include a wired or wireless headset port, an external power supply (or battery charger) port, a wired or wireless data port, a memory card port, a port for connecting a device having an identification module, an audio input/output (I/O) port, a video I/O port, an earphone port, and the like. The identification module may store various information for authenticating a user using the mobile terminal 100 and may include a User Identity Module (UIM), a Subscriber Identity Module (SIM), a Universal Subscriber Identity Module (USIM), and the like. In addition, a device having an identification module (hereinafter, referred to as an "identification device") may take the form of a smart card, and thus, the identification device may be connected with the mobile terminal 100 via a port or other connection means. The interface unit 170 may be used to receive input (e.g., data information, power, etc.) from an external device and transmit the received input to one or more elements within the mobile terminal 100 or may be used to transmit data between the mobile terminal and the external device.
In addition, when the mobile terminal 100 is connected with an external cradle, the interface unit 170 may serve as a path through which power is supplied from the cradle to the mobile terminal 100 or may serve as a path through which various command signals input from the cradle are transmitted to the mobile terminal. Various command signals or power input from the cradle may be used as signals for recognizing whether the mobile terminal is accurately mounted on the cradle.
The output unit 150 is configured to provide output signals (e.g., audio signals, video signals, alarm signals, vibration signals, etc.) in a visual, audio, and/or tactile manner. The output unit 150 may include a display unit 151, an audio output module 152, and the like.
The display unit 151 may display information processed in the mobile terminal 100. For example, when the mobile terminal 100 is in a phone call mode, the display unit 151 may display a User Interface (UI) or a Graphical User Interface (GUI) related to a call or other communication (e.g., text messaging, multimedia file downloading, etc.). When the mobile terminal 100 is in a video call mode or an image capturing mode, the display unit 151 may display a captured image and/or a received image, a UI or GUI showing a video or an image and related functions, and the like.
Meanwhile, when the display unit 151 and the touch pad are overlapped with each other in the form of a layer to form a touch screen, the display unit 151 may serve as an input device and an output device. The display unit 151 may include at least one of a Liquid Crystal Display (LCD), a thin film transistor LCD (TFT-LCD), an Organic Light Emitting Diode (OLED) display, a flexible display, a three-dimensional (3D) display, and the like. Some of these displays may be configured to be transparent to allow a user to view from the outside, which may be referred to as transparent displays, and a typical transparent display may be, for example, a TOLED (transparent organic light emitting diode) display or the like. Depending on the particular desired implementation, the mobile terminal 100 may include two or more display units (or other display devices), for example, the mobile terminal may include an external display unit (not shown) and an internal display unit (not shown). The touch screen may be used to detect a touch input pressure as well as a touch input position and a touch input area.
The audio output module 152 may convert audio data received by the wireless communication unit 110 or stored in the memory 160 into an audio signal and output as sound when the mobile terminal is in a call signal reception mode, a call mode, a recording mode, a voice recognition mode, a broadcast reception mode, or the like. Also, the audio output module 152 may provide audio output related to a specific function performed by the mobile terminal 100 (e.g., a call signal reception sound, a message reception sound, etc.). The audio output module 152 may include a speaker, a buzzer, and the like.
The memory 160 may store software programs and the like for processing and controlling operations performed by the controller 180, or may temporarily store data (e.g., a phonebook, messages, still images, videos, and the like) that has been or will be output. Also, the memory 160 may store data regarding various ways of vibration and audio signals output when a touch is applied to the touch screen.
The memory 160 may include at least one type of storage medium including a flash memory, a hard disk, a multimedia card, a card-type memory (e.g., SD or DX memory, etc.), a Random Access Memory (RAM), a Static Random Access Memory (SRAM), a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), a programmable read-only memory (PROM), a magnetic memory, a magnetic disk, an optical disk, and the like. Also, the mobile terminal 100 may cooperate with a network storage device that performs a storage function of the memory 160 through a network connection.
The controller 180 generally controls the overall operation of the mobile terminal. For example, the controller 180 performs control and processing related to voice calls, data communications, video calls, and the like. In addition, the controller 180 may include a multimedia module 1810 for reproducing (or playing back) multimedia data, and the multimedia module 1810 may be constructed within the controller 180 or may be constructed separately from the controller 180. The controller 180 may perform a pattern recognition process to recognize a handwriting input or a picture drawing input performed on the touch screen as a character or an image.
Specifically, the controller 180 may further include:
the file scanning module 201 is configured to scan a media file in the media folder and a media database of a media application when a media file scanning condition trigger is detected, so as to obtain first media file information in the media folder and second media file information in the media database;
a comparison analysis module 202, configured to compare and analyze the first media file information and the second media file information, and determine whether a media file in the media folder is changed, where the change of the media file at least includes addition, deletion, or modification of the media file;
an updating module 203, configured to update the media database and the media playlist of the media application correspondingly if the media file in the media folder is changed, where: and when no media file exists in the media database through the recorded storage path query, the operation of deleting the corresponding record is not executed.
The power supply unit 190 receives external power or internal power and provides appropriate power required to operate various elements and components under the control of the controller 180.
The various embodiments described herein may be implemented in a computer-readable medium using, for example, computer software, hardware, or any combination thereof. For a hardware implementation, the embodiments described herein may be implemented using at least one of an Application Specific Integrated Circuit (ASIC), a Digital Signal Processor (DSP), a Digital Signal Processing Device (DSPD), a Programmable Logic Device (PLD), a Field Programmable Gate Array (FPGA), a processor, a controller, a microcontroller, a microprocessor, an electronic unit designed to perform the functions described herein, and in some cases, such embodiments may be implemented in the controller 180. For a software implementation, the implementation such as a process or a function may be implemented with a separate software module that allows performing at least one function or operation. The software codes may be implemented by software applications (or programs) written in any suitable programming language, which may be stored in the memory 160 and executed by the controller 180.
The mobile terminal 100 as shown in fig. 1 may be configured to operate with communication systems such as wired and wireless communication systems and satellite-based communication systems that transmit data via frames or packets.
A communication system in which a mobile terminal according to the present invention is operable will now be described with reference to fig. 2.
Such communication systems may use different air interfaces and/or physical layers. For example, the air interface used by the communication system includes, for example, Frequency Division Multiple Access (FDMA), Time Division Multiple Access (TDMA), Code Division Multiple Access (CDMA), and Universal Mobile Telecommunications System (UMTS) (in particular, Long Term Evolution (LTE)), global system for mobile communications (GSM), and the like. By way of non-limiting example, the following description relates to a CDMA communication system, but such teachings are equally applicable to other types of systems.
Referring to fig. 2, the CDMA wireless communication system may include a plurality of mobile terminals 100, a plurality of Base Stations (BSs) 270, Base Station Controllers (BSCs) 275, and a Mobile Switching Center (MSC) 280. The MSC 280 is configured to interface with a Public Switched Telephone Network (PSTN) 290. The MSC 280 is also configured to interface with BSCs 275, which may be coupled to base stations via a backhaul. The backhaul may be constructed according to any of several known interfaces including, for example, E1/T1, ATM, IP, PPP, frame Relay, HDSL, ADSL, or xDSL. It will be understood that a system as shown in fig. 2 may include multiple BSCs 275.
Each BS 270 may serve one or more sectors (or regions), each sector covered by a multi-directional antenna or an antenna pointing in a particular direction being radially distant from the BS 270. Alternatively, each partition may be covered by two or more antennas for diversity reception. Each BS 270 may be configured to support multiple frequency allocations, with each frequency allocation having a particular frequency spectrum (e.g., 1.25MHz, 5MHz, etc.).
The intersection of partitions with frequency allocations may be referred to as a CDMA channel. The BS 270 may also be referred to as a Base Transceiver Subsystem (BTS) or other equivalent terminology. In such a case, the term "base station" may be used to generically refer to a single BSC275 and at least one BS 270. The base stations may also be referred to as "cells". Alternatively, each partition of a particular BS 270 may be referred to as a plurality of cell sites.
As shown in fig. 2, a Broadcast Transmitter (BT)295 transmits a broadcast signal to the mobile terminal 100 operating within the system. A broadcast receiving module 111 as shown in fig. 1 is provided at the mobile terminal 100 to receive a broadcast signal transmitted by the BT 295. In fig. 2, several Global Positioning System (GPS) satellites 300 are shown. The satellite 300 assists in locating at least one of the plurality of mobile terminals 100.
In fig. 2, a plurality of satellites 300 are depicted, but it is understood that useful positioning information may be obtained with any number of satellites. As a typical operation of the wireless communication system, the BS 270 receives reverse link signals from various mobile terminals 100. The mobile terminal 100 is generally engaged in conversations, messaging, and other types of communications. Each reverse link signal received by a particular base station is processed within a particular BS 270. The obtained data is forwarded to the associated BSC 275. The BSC provides call resource allocation and mobility management functions including coordination of soft handoff procedures between BSs 270. The BSCs 275 also route the received data to the MSC 280, which provides additional routing services for interfacing with the PSTN 290. Similarly, the PSTN 290 interfaces with the MSC 280, the MSC interfaces with the BSCs 275, and the BSCs 275 accordingly control the BS 270 to transmit forward link signals to the mobile terminal 100.
Based on the above mobile terminal hardware structure and communication system, various embodiments of the present invention are proposed.
In the prior art, media applications such as a media player depend on a multimedia database of a system, when a media file in a media folder is modified by a third-party application, records in the media database, a media play list and files in each media folder of the system cannot be synchronized in real time, after the media database is updated, information such as the played time length, remarks and TAG TAGs of the media file is deleted, and when a user plays the media again next time, the played time cannot be recorded, so that the user experience is poor.
Therefore, the invention provides a solution, which depends on a database of a media application, when a media file in a media folder changes (such as a third-party application renames, deletes and modifies the media file, and removes an SD card, etc.), a deletion operation is not executed for a file which does not exist in the media database, but the record in the database is updated to an unactivated state, a playlist is updated, the nonexistent media file is hidden, and the playing time length, remark and TAG TAG information are updated to the media database in real time, so that the integrity of media information is ensured, the effectiveness of an image in the media playlist is ensured, and the user experience is improved.
Specifically, as shown in fig. 3, a first embodiment of the present invention provides a media playing device, including: a file scanning module 201, a comparison analysis module 202 and an update module 203, wherein:
a file scanning module 201, configured to scan a media file in the media folder and a media database of a media application when a media file scanning condition is triggered is detected, to obtain first media file information in the media folder and second media file information in the media database;
a comparison analysis module 202, configured to compare and analyze the first media file information and the second media file information, and determine whether a media file in the media folder is changed, where the change of the media file at least includes addition, deletion, or modification of the media file;
an updating module 203, configured to update the media database and the media playlist of the media application correspondingly if the media file in the media folder is changed, where: and when no media file exists in the media database through the recorded storage path query, the operation of deleting the corresponding record is not executed.
Further, the matching update module 202 is further configured to insert a storage path of the newly added media file and a record related to a file duration into the media database if the media file is newly added to the media folder;
and/or the presence of a gas in the gas,
if the media file is deleted in the media folder, updating a corresponding record in the media database, and setting the record to be in an inactivated state, wherein the updated record at least comprises the played time length, remarks and TAG TAG information of the deleted media file;
and/or the presence of a gas in the gas,
if the media file is modified in the media folder, updating the corresponding record in the media database, and updating the last modification time of the file in the record to the modification time of the modified media file.
Further, the matching update module 202 is further configured to update a corresponding record of the media database and set the record as an activated state if the newly added media file in the media folder is a media file that reappears due to the SD card being moved in;
and/or if the deleted media file in the media folder is lost due to the removal of the SD card, updating a corresponding record in the media database, and setting the record in an inactivated state;
and/or if the modified media file in the media folder is the renamed media file and the storage path of the media file is changed, updating the corresponding record in the media database, and changing the storage path of the matched record into the storage path of the current media file; or, if the modified media file in the media folder is the media file with the preserved file name and the original file replaced, inserting the related information of the media file into the media database as a new record.
Specifically, the media playing device of the present embodiment may be applied to a mobile terminal such as a mobile phone, a tablet computer, a PDA or a notebook computer, and may also be applied to a fixed terminal such as a digital TV or a desktop computer, which is not limited in this embodiment. This embodiment is exemplified by a mobile phone.
In this embodiment, media playing application software, such as a media player, is installed on a terminal, such as a mobile phone, and a played media file may be an audio file, a video file, or an audio-video file.
The media player typically relies on a multimedia database (hereinafter media database) in the terminal system.
The multimedia database is mainly recorded with storage paths, file names, file sizes, file durations, file types and the like of all media files in the media folder, and additionally maintains parameter information such as media playing durations, remarks, TAGs (TAGs) and the like for the media files.
When a user starts the media application software to play the audio and video files, the media application software firstly calls the media file information recorded in the media database, and then calls the corresponding media files in the media folder through the media file information recorded in the media database, so that corresponding images are displayed, and media playing is realized.
Because the existing media application software depends on the media database of the system, when the media files in the media folders are modified by a third-party application other than the media application (for example, the third-party application performs operations such as renaming and modifying on the media files, or a Secure Digital Memory Card (SD Card) is moved out/in), the records and the media playlists in the media database cannot be synchronized with the files in each media folder of the system in real time. At this time, during playing, there are some records in the media database, and the corresponding media file cannot be found through the storage path, resulting in poor user experience. In addition, since the media player additionally maintains information such as the time length of the played media, the remark, the TAG, etc. for the media file, the user does not want the information to be deleted.
In order to avoid the foregoing situation, in this embodiment, a corresponding trigger condition is set to scan the media file, and the media file information in the media folder of the terminal system and the media file information in the media database are obtained through scanning, so that the records and the media playlist in the media database are synchronized with the files in each media folder of the system in real time, the consistency and integrity of the media file information are ensured, and the user experience is improved. When scanning, the record of the media file does not exist in the media database, the database is updated without executing deletion operation, the record is set to be in an inactivated state, the play list is updated, and the nonexistent media file is hidden.
In this embodiment, the media file information may include: the file name, storage path, file duration, file size, last modification time of the file and/or whether the file is activated, the time duration for which the file has been played, notes, TAG, etc. of the media file.
Specifically, the present embodiment sets the following media file scanning triggering mechanism:
1. when entering the media application or returning to the main interface of the media play list after starting the media application, the media files need to be scanned, and the media play list and the media database of the media application need to be updated;
2. when the SD card is inserted/removed, the media file needs to be scanned, and a media playing list and a media database of the media application are updated;
3. and monitoring the broadcast of the folder content change, and starting file scanning when receiving the broadcast so as to provide extension for the function of actively requesting scanning.
When the triggering of a media file scanning condition is detected, scanning a media file in a media folder of a terminal system and a media database of a media application, and acquiring media file information in the media folder of the terminal system and media file information in the media database.
As a media file scanning method, the following media file filtering mechanism may be adopted:
as shown in fig. 4, taking a video file as an example, the specific flow is as follows:
s11, scanning the file;
s12, if the file is judged to be a file, the operation goes to S13; otherwise, returning to S11;
s13, judging whether the file is a video format file; if not, go to S14;
s14, analyzing the file header information;
s15, judging whether the mimetype comprises a 'video' field and the like; if so, judging the file to be a video file, otherwise, judging the file not to be the video file.
Specifically, after initiating a file scan, the media folders on the internal/external memory of the terminal are scanned in a step-by-step traversal, filtering the media file format, e.g., whether the file suffix is.mp 4/. wmv, etc. If the format is not the format, the file header information is analyzed, and whether the mimetype of the file header information comprises a 'video/' field and the like is judged. After the media file is scanned, the file is analyzed, decoded and previewed, so that the scanning efficiency of the media file can be improved.
For the scanning of the media database of the media application, key information of the media files recorded in the multimedia database is mainly scanned, such as: storage path, file name, file size, file duration, TAG, remark, played duration information, file type, file activation state and other information.
After the media file information in the media folder and the media file information in the media database are obtained, the media file information in the media folder and the media file information in the media database are compared to judge whether the media file information in the media folder changes or not, if yes, the media file information recorded in the media database is correspondingly updated, and meanwhile, a media playlist is updated.
The method comprises the steps of judging whether media file information in a media folder is changed or not, and mainly judging whether media files are newly added, deleted, modified and the like in the media folder or not.
When the media files in the media folder are changed (such as the third-party application file manager renames, deletes, modifies the content of the media files, and removes the SD card), the multimedia data updating mechanism of the media application is triggered.
The present embodiment takes into account: when the third-party application performs operations such as renaming and modifying on the media file or performs operations of moving out/in the SD card, but the media database of the gallery is not updated in time, the problem exists: and if some records in the database cannot find the corresponding media file through the storage path of the records, judging that the file does not exist. In addition, since the gallery additionally maintains parameter information such as category TAG, favorites, privacy, etc. for the media files, the user does not want to delete such information.
Thus, when scanning is performed, for a record that does not exist, a delete operation is not performed, but the database is updated, the record is set to an inactive state, and the media playlist is updated, without displaying the media file that does not exist.
When scanning is started, a scanning thread is started, and all recorded information in the gallery multimedia database is inquired and cached: the storage path, the file duration, the last file modification time, whether the file is activated or not and the like are used for comparing with each piece of media file information in the media folder.
Specifically, the obtained media file information in the media folder is compared with the media file information in the media database, and whether a new addition, deletion, or modification (in this embodiment, renaming is used as one of the modifications) operation of the media file exists in the media folder is determined.
Wherein, the following method can be adopted to judge whether the media file is added, deleted and modified in the media folder:
if the file name, the storage path and the file duration of the media file in the media folder are matched with the corresponding records in the media database, and the matched records cannot be found in the media database, the media file is judged to be newly added in the media folder;
if the file name, the storage path and the file duration of the media file in the media folder are matched with the corresponding records in the media database, the records exist in the media database, and the corresponding media file information does not exist in the media folder, the media file is judged to be deleted in the media folder;
if the file name, the storage path, the file duration and the last modification time of the media file in the media folder are matched with the corresponding records in the media database, the file name, the storage path and the file duration are not changed, and the last modification time is changed, the media file is modified in the media folder;
and if the file name, the storage path, the file duration and the last modification time of the media file in the media folder are matched with the corresponding records in the media database, and the file duration is not changed but the file name and the storage path are changed, determining that the media file is renamed in the media folder.
The media data synchronous update under the application scene of adding, deleting and renaming the media files is elaborated in the following steps:
1. for the application scenario of the newly added media file:
the method comprises two situations of adding a media file and moving an SD card, wherein:
for the newly added media file: and a third party is applied to add a new media file under the media folder, under the condition, after the media file information in the media folder and the media file information in the media database are obtained through scanning, the file name, the storage path and the file duration of the media file in the media folder are matched with the corresponding records in the media database, if the matched records cannot be found in the media database, the media file is judged to be newly added in the media folder, and the storage path and the related records of the file duration of the newly added media file are inserted into the media database.
For SD card move in: because the corresponding record in the database is not deleted, the matched record can still be found during scanning, so that the media file which reappears due to the SD card moving in can be detected in the media folder through comparison, at the moment, the corresponding record of the media database is updated, and the record is set to be in an activated state.
2. For an application scenario where a media file is deleted:
the method comprises two conditions of deleting the media file and removing the SD card, wherein:
for deleting a media file: after a certain media file is deleted through a third-party application (such as a file manager), because the file does not exist, when all files under a media folder are traversed, the record does not exist, and for the situation, the corresponding record in the media database is updated, and the record is set to be in an inactivated state; the updated record at least comprises the played time length, the remark and the TAG TAG information of the deleted media file, so that the situation that the played time length, the remark, the TAG TAG and other information of the media file are deleted after the media database is updated and the played time cannot be recorded when the user plays the media again next time, and the user experience is poor is avoided.
For SD card removal: and detecting that the media file in the media folder is lost due to the removal of the SD card through comparison, and if the media file is not present, updating the corresponding record in the media database and setting the record in an inactivated state, similar to deletion.
3. For an application scenario where a media file is modified:
the third party application modifies a certain media file, for example, edits the file, so that the modification time of the file is changed, but the storage path (path) and the file duration are not changed: in this case, if it is detected through comparison that a modified media file exists in the media folder, the corresponding record in the media database is updated, and the last modification time of the file in the record is updated to the modification time of the modified media file, and other information is maintained unchanged.
4. For an application scenario of renaming a media file:
the following two cases are included:
a. media files are renamed to other file names:
the media file still exists, but the storage path changes and cannot match the existing record in the database. Matching the duration of the file with all records in the database to find a record with the same duration, updating the media database at the moment, changing the path information of the matched record into the path information of the existing file, and keeping other information unchanged. (for the extreme case, if a plurality of records with matched duration are found, the file information can be inserted into the database as a new record because whether the records are the original file or not can not be judged).
b. After deleting a certain file in the media folder, copying a new file named as the original media file name: at this time, the path information of the file is matched with the original record, the time length information is further compared, generally, the time length of the new file is not equal to the time length recorded in the media database, and the related information of the file is used as a new record and is inserted into the database. If the database has records of the same path information, the records are deleted first. (for extreme cases, when the path and duration information of the newly copied file are matched with the original records in the database, the modification time for directly updating the corresponding records in the database is the modification time of the current file).
That is, if it is detected through comparison that a renamed media file exists in the media folder and the storage path of the media file is changed, the corresponding record in the media database is updated, and the storage path of the matched record is changed into the storage path of the current media file; or, if the media file with the reserved file name but replacing the original file exists in the media folder, the related information of the media file is inserted into the media database as a new record.
And after the updating of the media database is completed, updating a media play list of the media application in real time without displaying the nonexistent media files so as to ensure the effectiveness of the media play list, synchronizing the played time length, remarks and TAG TAG information to the media database in real time, recording the played time length of the media, and continuously playing from the played position when the media is played again.
Therefore, according to the scheme, when the media files in the media folder are modified, such as the third-party application renames, deletes and modifies the media files, the SD card is moved out and the like, the media playlist and the media database are synchronized in real time, and only the existing images are displayed, so that the integrity of media information is ensured, the effectiveness of the images in the media playlist is ensured, and the user experience is improved. The overall flow chart of this embodiment can be described with reference to fig. 5 (taking a video file as an example).
Further, the updating module 203 is further configured to clear the tag information of the media file cached in the media database at preset time intervals according to preset rules.
Specifically, as shown in fig. 6, at regular intervals (e.g., 6 months), the frequency of the unused time and the used time may be determined according to whether: and clearing the mark information of the media file cached in the media database by taking the played time length, the remark and the TAG TAG information as rules.
The frequencies used are: the number of times the media file was used/the total number of times all sound recording files were used (use means that the media file was played, modified, moved, etc.).
According to the scheme, the mark information of the media files cached in the media database is regularly cleaned according to the using habits of the user, the availability of the storage space of the media database can be improved, and convenience is brought to the user to use the files through cleaning of the data.
The media playing device in the embodiment of the present invention is described above, and the media playing method in the embodiment of the present invention is described below.
As shown in fig. 7, a first embodiment of the present invention provides a media playing method, which is applied to a terminal, where a media application is installed on the terminal, and a system of the terminal is configured with a media folder, a media database, and a media playlist based on the media application, where the method includes:
step S101, when detecting the triggering of a media file scanning condition, scanning a media file in the media folder and a media database of a media application to obtain first media file information in the media folder and second media file information in the media database;
in a specific implementation, the execution main body of the method of this embodiment may be a mobile terminal such as a mobile phone, a tablet computer, a PDA, or a notebook computer, or may also be a fixed terminal such as a digital TV, a desktop computer, and the embodiment is not limited thereto. This embodiment is exemplified by a mobile phone.
In this embodiment, media playing application software, such as a media player, is installed on a terminal, such as a mobile phone, and a played media file may be an audio file, a video file, or an audio-video file.
The media player typically relies on a multimedia database (hereinafter media database) in the terminal system.
The multimedia database is mainly recorded with storage paths, file names, file sizes, file durations, file types and the like of all media files in the media folder, and additionally maintains parameter information such as media playing durations, remarks, TAGs (TAGs) and the like for the media files.
When a user starts the media application software to play the audio and video files, the media application software firstly calls the media file information recorded in the media database, and then calls the corresponding media files in the media folder through the media file information recorded in the media database, so that corresponding images are displayed, and media playing is realized.
Because the existing media application software depends on the media database of the system, when the media files in the media folders are modified by a third-party application other than the media application (for example, the third-party application performs operations such as renaming and modifying on the media files, or a Secure Digital Memory Card (SD Card) is moved out/in), the records and the media playlists in the media database cannot be synchronized with the files in each media folder of the system in real time. At this time, during playing, there are some records in the media database, and the corresponding media file cannot be found through the storage path, resulting in poor user experience. In addition, since the media player additionally maintains information such as the length of time the media has been played, notes, TAGs (TAGs), etc. for the media file, the user does not want the information to be deleted.
In order to avoid the foregoing situation, in this embodiment, a corresponding trigger condition is set to scan the media file, and the media file information in the media folder of the terminal system and the media file information in the media database are obtained through scanning, so that the records and the media playlist in the media database are synchronized with the files in each media folder of the system in real time, the consistency and integrity of the media file information are ensured, and the user experience is improved. When scanning, the record of the media file does not exist in the media database, the database is updated without executing deletion operation, the record is set to be in an inactivated state, the play list is updated, and the nonexistent media file is hidden.
In this embodiment, the media file information may include: the file name, storage path, file duration, file size, last modification time of the file and/or whether the file is activated, the time duration for which the file has been played, notes, TAG, etc. of the media file.
Specifically, the present embodiment sets the following media file scanning triggering mechanism:
1. when entering the media application or returning to the main interface of the media play list after starting the media application, the media files need to be scanned, and the media play list and the media database of the media application need to be updated;
2. when the SD card is inserted/removed, the media file needs to be scanned, and a media playing list and a media database of the media application are updated;
3. and monitoring the broadcast of the folder content change, and starting file scanning when receiving the broadcast so as to provide extension for the function of actively requesting scanning.
When the triggering of a media file scanning condition is detected, scanning a media file in a media folder of a terminal system and a media database of a media application, and acquiring media file information in the media folder of the terminal system and media file information in the media database.
As a media file scanning method, the following media file filtering mechanism may be adopted:
as shown in fig. 4, taking a video file as an example, the specific flow is as follows:
s11, scanning the file;
s12, if the file is judged to be a file, the operation goes to S13; otherwise, returning to S11;
s13, judging whether the file is a video format file; if not, go to S14;
s14, analyzing the file header information;
s15, judging whether the mimetype comprises a 'video' field and the like; if so, judging the file to be a video file, otherwise, judging the file not to be the video file.
Specifically, after initiating a media file scan, the media folders on the internal/external memory of the terminal are scanned in a step-by-step scan, filtering the media file format, e.g., whether the file suffix is.mp 4/. wmv, etc. audio-video format. If the format is not the format, the file header information is analyzed, and whether the mimetype of the file header information comprises a 'video/' field and the like is judged. After the media file is scanned, the file is analyzed, decoded and previewed, so that the scanning efficiency of the media file can be improved.
For the scanning of the media database of the media application, key information of the media files recorded in the multimedia database is mainly scanned, such as: storage path, file name, file size, file duration, TAG, remark, played duration information, file type, file activation state and other information.
Step S102, comparing and analyzing the first media file information and the second media file information, and judging whether a media file in the media folder is changed, wherein the change of the media file at least comprises the addition, deletion or modification of the media file;
step S103, if the media file in the media folder is changed, correspondingly updating the media database and the media playlist of the media application, where: and when no media file exists in the media database through the recorded storage path query, the operation of deleting the corresponding record is not executed.
After the media file information in the media folder and the media file information in the media database are obtained, the media file information in the media folder and the media file information in the media database are compared to judge whether the media file information in the media folder changes or not, if yes, the media file information recorded in the media database is correspondingly updated, and meanwhile, a media playlist is updated.
The method comprises the steps of judging whether media file information in a media folder is changed or not, and mainly judging whether media files are newly added, deleted, modified and the like in the media folder or not.
When the media files in the media folder are changed (such as the third-party application file manager renames, deletes, modifies the content of the media files, and removes the SD card), the multimedia data updating mechanism of the media application is triggered.
The present embodiment takes into account: when the third-party application performs operations such as renaming, content modification and the like on the media file or moves out/in the SD card, but the media database of the gallery is not updated in time, the problem exists at this time: and if some records in the database cannot find the corresponding media file through the storage path of the records, judging that the file does not exist. In addition, since the gallery additionally maintains parameter information such as category TAG, favorites, privacy, etc. for the media files, the user does not want to delete such information.
Thus, when scanning is performed, for a record that does not exist, a delete operation is not performed, but the database is updated, the record is set to an inactive state, and the media playlist is updated, without displaying the media file that does not exist.
When scanning is started, a scanning thread is started, and all recorded information in the gallery multimedia database is inquired and cached: the storage path, the file duration, the last file modification time, whether the file is activated or not and the like are used for comparing with each piece of media file information in the media folder.
Specifically, the obtained media file information in the media folder is compared with the media file information in the media database, and whether a new addition, deletion, or modification (in this embodiment, renaming is used as one of the modifications) operation of the media file exists in the media folder is determined.
Wherein, the following method can be adopted to judge whether the media file is added, deleted and modified in the media folder:
if the file name, the storage path and the file duration of the media file in the media folder are matched with the corresponding records in the media database, and the matched records cannot be found in the media database, the media file is judged to be newly added in the media folder;
if the file name, the storage path and the file duration of the media file in the media folder are matched with the corresponding records in the media database, the records exist in the media database, and the corresponding media file information does not exist in the media folder, the media file is judged to be deleted in the media folder;
if the file name, the storage path, the file duration and the last modification time of the media file in the media folder are matched with the corresponding records in the media database, the file name, the storage path and the file duration are not changed, and the last modification time is changed, the media file is modified in the media folder;
and if the file name, the storage path, the file duration and the last modification time of the media file in the media folder are matched with the corresponding records in the media database, and the file duration is not changed but the file name and the storage path are changed, determining that the media file is renamed in the media folder.
The media data synchronous update under the application scene of adding, deleting and renaming the media files is elaborated in the following steps:
1. for the application scenario of the newly added media file:
the method comprises two situations of adding a media file and moving an SD card, wherein:
for the newly added media file: and a third party is applied to add a new media file under the media folder, under the condition, after the media file information in the media folder and the media file information in the media database are obtained through scanning, the file name, the storage path and the file duration of the media file in the media folder are matched with the corresponding records in the media database, if the matched records cannot be found in the media database, the media file is judged to be newly added in the media folder, and the storage path and the related records of the file duration of the newly added media file are inserted into the media database.
For SD card move in: because the corresponding record in the database is not deleted, the matched record can still be found during scanning, so that the media file which reappears due to the SD card moving in can be detected in the media folder through comparison, at the moment, the corresponding record of the media database is updated, and the record is set to be in an activated state.
2. For an application scenario where a media file is deleted:
the method comprises two conditions of deleting the media file and removing the SD card, wherein:
for deleting a media file: after a certain media file is deleted through a third-party application (such as a file manager), because the file does not exist, when all files under a media folder are traversed, the record does not exist, and for the situation, the corresponding record in the media database is updated, and the record is set to be in an inactivated state; the updated record at least comprises the played time length, the remark and the TAG TAG information of the deleted media file, so that the situation that the played time length, the remark, the TAG TAG and other information of the media file are deleted after the media database is updated and the played time cannot be recorded when the user plays the media again next time, and the user experience is poor is avoided.
For SD card removal: and detecting that the media file in the media folder is lost due to the removal of the SD card through comparison, and if the media file is not present, updating the corresponding record in the media database and setting the record in an inactivated state, similar to deletion.
3. For an application scenario where a media file is modified:
the third party application modifies a certain media file, for example, edits the file, so that the modification time of the file is changed, but the storage path (path) and the file duration are not changed: in this case, if it is detected through comparison that a modified media file exists in the media folder, the corresponding record in the media database is updated, and the last modification time of the file in the record is updated to the modification time of the modified media file, and other information is maintained unchanged.
4. For an application scenario of renaming a media file:
the following two cases are included:
a. media files are renamed to other file names:
the media file still exists, but the storage path changes and cannot match the existing record in the database. Matching the duration of the file with all records in the database to find a record with the same duration, updating the media database at the moment, changing the path information of the matched record into the path information of the existing file, and keeping other information unchanged. (for the extreme case, if a plurality of records with matched duration are found, the file information can be inserted into the database as a new record because whether the records are the original file or not can not be judged).
b. After deleting a certain file in the media folder, copying a new file named as the original media file name: at this time, the path information of the file is matched with the original record, the time length information is further compared, generally, the time length of the new file is not equal to the time length recorded in the media database, and the related information of the file is used as a new record and is inserted into the database. If the database has records of the same path information, the records are deleted first. (for extreme cases, when the path and duration information of the newly copied file are matched with the original records in the database, the modification time for directly updating the corresponding records in the database is the modification time of the current file).
That is, if it is detected through comparison that a renamed media file exists in the media folder and the storage path of the media file is changed, the corresponding record in the media database is updated, and the storage path of the matched record is changed into the storage path of the current media file; or, if the media file with the reserved file name but replacing the original file exists in the media folder, the related information of the media file is inserted into the media database as a new record.
And after the updating of the media database is completed, updating a media play list of the media application in real time without displaying the nonexistent media files so as to ensure the effectiveness of the media play list, synchronizing the played time length, remarks and TAG TAG information to the media database in real time, recording the played time length of the media, and continuously playing from the played position when the media is played again.
Therefore, according to the scheme, when the media files in the media folder are modified, such as the third-party application renames, deletes and modifies the media files, the SD card is moved out and the like, the media playlist and the media database are synchronized in real time, and only the existing images are displayed, so that the integrity of media information is ensured, the effectiveness of the images in the media playlist is ensured, and the user experience is improved. The overall flow chart of this embodiment can be described with reference to fig. 5 (taking a video file as an example).
As shown in fig. 8, a second embodiment of the present invention provides a media playing method, which is based on the embodiment shown in fig. 7, and is different from the embodiment in that the present embodiment further includes a scheme for clearing the mark information of the media file cached in the media database according to the habit of the user.
In this embodiment, the method further includes:
and step S104, clearing the mark information of the media files cached in the media database by a preset rule at preset time intervals.
Specifically, as shown in fig. 6, at regular intervals (e.g., 6 months), the frequency of the unused time and the used time may be determined according to whether: and clearing the mark information of the media file cached in the media database by taking the played time length, the remark and the TAG TAG information as rules.
The frequencies used are: the number of times the media file was used/the total number of times all sound recording files were used (use means that the media file was played, modified, moved, etc.).
According to the scheme, the mark information of the media files cached in the media database is regularly cleaned according to the using habits of the user, the availability of the storage space of the media database can be improved, and convenience is brought to the user to use the files through cleaning of the data.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which is stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal device (such as a mobile phone, a computer, a server, an air conditioner, or a network device) to execute the method according to the embodiments of the present invention.
The above description is only a preferred embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes, which are made by using the contents of the present specification and the accompanying drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.

Claims (14)

1. A media playing method is applied to a terminal, a media application is installed on the terminal, a system of the terminal is configured with a media folder, a media database and a media playing list based on the media application, and the method comprises the following steps:
when the triggering of a media file scanning condition is detected, scanning a media file in the media folder and a media database of a media application to obtain first media file information in the media folder and second media file information in the media database;
comparing and analyzing the first media file information and the second media file information, and judging whether a media file is changed in the media folder, wherein the change of the media file at least comprises the addition, deletion or modification of the media file;
if the media files in the media folder are changed, correspondingly updating a media database and a media play list of the media application, wherein: and when no media file exists in the media database through the recorded storage path query, the operation of deleting the corresponding record is not executed.
2. The method of claim 1, wherein if there is a change in the media file in the media folder, the step of updating the media database of the media application correspondingly comprises:
if the media file folder is newly added with the media file, inserting a storage path of the newly added media file and a record related to file duration into the media database;
and/or the presence of a gas in the gas,
if the media file is deleted in the media folder, updating a corresponding record in the media database, and setting the record to be in an inactivated state, wherein the updated record at least comprises the played time length, remarks and TAG TAG information of the deleted media file;
and/or the presence of a gas in the gas,
if the media file is modified in the media folder, updating the corresponding record in the media database, and updating the last modification time of the file in the record to the modification time of the modified media file.
3. The method according to claim 2, wherein if there is a change in the media file in the media folder, the step of updating the media database of the media application further comprises:
if the newly added media files in the media folder are the media files reappeared due to the SD card being moved in, updating the corresponding records of the media database, and setting the records to be in an activated state;
and/or the presence of a gas in the gas,
if the deleted media files in the media folder are lost due to the removal of the SD card, updating corresponding records in the media database, and setting the records to be in an inactivated state;
and/or the presence of a gas in the gas,
if the modified media file in the media folder is the renamed media file and the storage path of the media file is changed, updating the corresponding record in the media database, and changing the storage path of the matched record into the storage path of the current media file; or, if the modified media file in the media folder is the media file with the preserved file name and the original file replaced, inserting the related information of the media file into the media database as a new record.
4. A method according to claim 1, 2 or 3, wherein the media file scanning conditions are:
when the media application is launched;
or,
entering a media playlist interface after starting a media application;
or,
when detecting that the SD card is inserted into/removed from the terminal;
or,
when the broadcast of the media folder content change is monitored.
5. The method of claim 1, 2 or 3, wherein the first media file information and the second media information comprise: the file name, storage path, file duration, played duration, file size, last file modification time and/or whether the file is activated;
the step of comparing and analyzing the first media file information and the second media file information and judging whether media files in the media folder are changed comprises the following steps:
if the file name, the storage path and the file duration of the media file in the media folder are matched with the corresponding records in the media database, and the matched records cannot be found in the media database, the media file is judged to be newly added in the media folder;
if the file name, the storage path and the file duration of the media file in the media folder are matched with the corresponding records in the media database, the records exist in the media database, and the corresponding media file information does not exist in the media folder, the media file is judged to be deleted in the media folder;
if the file name, the storage path, the file duration and the last modification time of the media file in the media folder are matched with the corresponding records in the media database, the file name, the storage path and the file duration are not changed, and the last modification time is changed, the media file is modified in the media folder;
and if the file name, the storage path, the file duration and the last modification time of the media file in the media folder are matched with the corresponding records in the media database, and the file duration is not changed but the file name and the storage path are changed, determining that the media file is renamed in the media folder.
6. The method of claim 1, 2 or 3, wherein the step of correspondingly updating the media database and the media playlist of the media application further comprises:
updating a media playlist of the media application according to the updated media database, hiding the non-existent media files, wherein: when the media file does not exist in the media database through the recorded storage path query, the played time length of the media file is recorded so as to continue playing from the previously played position when the media file is played next time.
7. The method of claim 1, 2 or 3, wherein the step of correspondingly updating the media database and the media playlist of the media application further comprises:
and clearing the mark information of the media files cached in the media database by a preset rule at preset time intervals.
8. A media playing apparatus, applied to a terminal, where a media application is installed on the terminal, and a system of the terminal is configured with a media folder, a media database, and a media playlist based on the media application, the apparatus comprising:
the file scanning module is used for scanning the media files in the media folder and a media database of a media application when detecting that a media file scanning condition is triggered to obtain first media file information in the media folder and second media file information in the media database;
the comparison analysis module is used for comparing and analyzing the first media file information and the second media file information and judging whether a media file in the media folder is changed or not, wherein the change of the media file at least comprises the addition, deletion or modification of the media file;
an updating module, configured to update the media database and the media playlist of the media application correspondingly if the media file in the media folder is changed, where: and when no media file exists in the media database through the recorded storage path query, the operation of deleting the corresponding record is not executed.
9. The apparatus of claim 8,
the updating module is further used for inserting a storage path of the newly added media file and a related record of file duration into the media database if the media file is newly added in the media folder;
and/or the presence of a gas in the gas,
if the media file is deleted in the media folder, updating a corresponding record in the media database, and setting the record to be in an inactivated state, wherein the updated record at least comprises the played time length, remarks and TAG TAG information of the deleted media file;
and/or the presence of a gas in the gas,
if the media file is modified in the media folder, updating the corresponding record in the media database, and updating the last modification time of the file in the record to the modification time of the modified media file.
10. The apparatus of claim 9,
the updating module is further configured to update a corresponding record of the media database and set the record to an activated state if the newly added media file in the media folder is a media file that reappears due to the SD card being moved in;
and/or the presence of a gas in the gas,
if the deleted media files in the media folder are lost due to the removal of the SD card, updating corresponding records in the media database, and setting the records to be in an inactivated state;
and/or the presence of a gas in the gas,
if the modified media file in the media folder is the renamed media file and the storage path of the media file is changed, updating the corresponding record in the media database, and changing the storage path of the matched record into the storage path of the current media file; or, if the modified media file in the media folder is the media file with the preserved file name and the original file replaced, inserting the related information of the media file into the media database as a new record.
11. The apparatus of claim 8, 9 or 10, wherein the media file scanning condition is:
when the media application is launched;
or,
entering a media playlist interface after starting a media application;
or,
when detecting that the SD card is inserted into/removed from the terminal;
or,
when the broadcast of the media folder content change is monitored.
12. The apparatus of claim 8, 9 or 10, wherein the first media file information and the second media information comprise: the file name, storage path, file duration, played duration, file size, last file modification time and/or whether the file is activated;
the comparison analysis module is also used for judging that the media folder has a new addition of the media files if the file names, the storage paths and the file durations of the media files in the media folder are matched with corresponding records in a media database and the matched records cannot be found in the media database;
if the file name, the storage path and the file duration of the media file in the media folder are matched with the corresponding records in the media database, the records exist in the media database, and the corresponding media file information does not exist in the media folder, the media file is judged to be deleted in the media folder;
if the file name, the storage path, the file duration and the last modification time of the media file in the media folder are matched with the corresponding records in the media database, the file name, the storage path and the file duration are not changed, and the last modification time is changed, the media file is modified in the media folder;
and if the file name, the storage path, the file duration and the last modification time of the media file in the media folder are matched with the corresponding records in the media database, and the file duration is not changed but the file name and the storage path are changed, determining that the media file is renamed in the media folder.
13. The apparatus of claim 8, 9 or 10,
the updating module is further configured to update a media playlist of the media application according to the updated media database, and hide a non-existent media file, where: when the media file does not exist in the media database through the recorded storage path query, the played time length of the media file is recorded so as to continue playing from the previously played position when the media file is played next time.
14. The apparatus of claim 8, 9 or 10,
the updating module is further configured to clear the tag information of the media file cached in the media database at preset time intervals according to preset rules.
CN201610979163.8A 2016-10-31 2016-10-31 media playing method and device Pending CN106557555A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610979163.8A CN106557555A (en) 2016-10-31 2016-10-31 media playing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610979163.8A CN106557555A (en) 2016-10-31 2016-10-31 media playing method and device

Publications (1)

Publication Number Publication Date
CN106557555A true CN106557555A (en) 2017-04-05

Family

ID=58444189

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610979163.8A Pending CN106557555A (en) 2016-10-31 2016-10-31 media playing method and device

Country Status (1)

Country Link
CN (1) CN106557555A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111914105A (en) * 2019-05-08 2020-11-10 青岛海信移动通信技术股份有限公司 File query method and device and electronic equipment
CN113469438A (en) * 2021-06-30 2021-10-01 北京达佳互联信息技术有限公司 Data processing method, device, equipment and storage medium
CN115002537A (en) * 2021-12-23 2022-09-02 荣耀终端有限公司 Video sharing method, electronic device, storage medium, and program product

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102104623A (en) * 2010-12-20 2011-06-22 广州市动景计算机科技有限公司 Method and system for performing break-point continuous playing of media file through mobile terminal
CN103092988A (en) * 2013-02-07 2013-05-08 广州市久邦数码科技有限公司 Realizing method of directly managing mobile phone media resources on desktop
CN105426386A (en) * 2015-10-23 2016-03-23 小米科技有限责任公司 File synchronization method and apparatus, and terminal device
US20160292049A1 (en) * 2015-03-31 2016-10-06 Oracle International Corporation Data recovery for a relational database management system instance in a heterogeneous database system
CN106055611A (en) * 2016-05-25 2016-10-26 努比亚技术有限公司 Display device for scanning processes, mobile terminal and method

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102104623A (en) * 2010-12-20 2011-06-22 广州市动景计算机科技有限公司 Method and system for performing break-point continuous playing of media file through mobile terminal
CN103092988A (en) * 2013-02-07 2013-05-08 广州市久邦数码科技有限公司 Realizing method of directly managing mobile phone media resources on desktop
US20160292049A1 (en) * 2015-03-31 2016-10-06 Oracle International Corporation Data recovery for a relational database management system instance in a heterogeneous database system
CN105426386A (en) * 2015-10-23 2016-03-23 小米科技有限责任公司 File synchronization method and apparatus, and terminal device
CN106055611A (en) * 2016-05-25 2016-10-26 努比亚技术有限公司 Display device for scanning processes, mobile terminal and method

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
WSM6960228 等: "台电MP4的电子书为什么删除之后再下还是会提示上次阅读的位置", 《百度知道HTTP://1T.CLICK/RNB》 *

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111914105A (en) * 2019-05-08 2020-11-10 青岛海信移动通信技术股份有限公司 File query method and device and electronic equipment
CN113469438A (en) * 2021-06-30 2021-10-01 北京达佳互联信息技术有限公司 Data processing method, device, equipment and storage medium
CN113469438B (en) * 2021-06-30 2024-01-05 北京达佳互联信息技术有限公司 Data processing method, device, equipment and storage medium
CN115002537A (en) * 2021-12-23 2022-09-02 荣耀终端有限公司 Video sharing method, electronic device, storage medium, and program product

Similar Documents

Publication Publication Date Title
CN106559563B (en) Image data processing method and device
CN105426403B (en) Bookmark synchronization method and device
CN106227867B (en) A kind of method and device of file management
CN106775391B (en) Interface switching device and method
CN106453939B (en) Streaming media access method and device
CN105677325A (en) Mobile terminal and image processing method
CN106610770A (en) Picture viewing method and device
CN106250268B (en) Content of text recovery device and method
CN106528576B (en) Page search method, terminal, system and storage medium
CN106227744A (en) Terminal document managing device, terminal and terminal document management method
CN106547439B (en) Method and device for processing message
CN106095464B (en) A kind of method and device of the seamless operation of application program
CN107066604B (en) Junk file cleaning method and terminal
CN106055660A (en) Mobile terminal page access method, mobile terminal page access device and mobile terminal
CN106557555A (en) media playing method and device
CN107027113B (en) SIM card activation method and mobile terminal
CN106485163A (en) Control method and control device that mobile terminal data storehouse accesses
CN106357929A (en) Previewing method based on audio file and mobile terminal
CN107194243B (en) Mobile terminal and method for installing application program
CN106559577B (en) Mobile terminal and control method thereof
CN105787030B (en) A kind of mobile terminal and its method for handling data
CN106385494B (en) Method and device for acquiring dynamic home page of mobile terminal application
CN106293330B (en) Prompting method and device for upgrading application program icon
CN105898034B (en) A kind of mobile terminal and its method for handling picture
CN105868654A (en) A mobile terminal and a screen capture method thereof

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20170405