The content of the invention
To solve in existing embedded multimedia playing system, it can not realize that the file of polymorphic type plays simultaneously, play
Ability is single, the problem of stability excessively dependent on network, there is provided a kind of multi-medium play method and system.
According to an aspect of the present invention, there is provided a kind of multi-medium play method, including:
S1, streaming media playing is carried out, detect transmission of flow media data quality;
S2, threshold value is less than according to the transmission of flow media data quality of detecting, judgement is known according to local multi-medium data
Content and the default playing sequence for playing the frequency, obtaining local multi-medium data;
S3, according to the playing sequence of the local multi-medium data, play local multi-medium data.
Wherein, the type of the local multi-medium data includes local video information, GIF animations and picture.
Wherein, after step S3, when threshold value is higher than according to the transmission of flow media data quality of detecting, then this is terminated
The broadcasting of ground multi-medium data, carry out the broadcasting of stream medium data.
Wherein, also include before the step S1:Pre-set playing sequence and the broadcasting of the local multi-medium data
The frequency.
The GIF animations and picture are played out by tool graphical user interface Qt;The stream medium data and local
Video information is played out based on GStreamer-imx playing frames.
According to the second aspect of the invention, there is provided a kind of multimedia play system, including:
Streaming media module, for carrying out streaming media playing, detect transmission of flow media data quality;
Main control module, for being less than threshold value according to the transmission of flow media data quality of detecting, judgement is known according to local more
The content of media data and the default playing sequence for playing the frequency, obtaining local multi-medium data;
Local multimedia playing module, for the playing sequence according to the local multi-medium data, play local more matchmakers
Volume data.
Wherein, the local multimedia playing module includes local video information broadcasting submodule and local GIF animations figure
Piece plays submodule.
Wherein, the main control module is additionally operable to, when threshold value is higher than according to the transmission of flow media data quality of detecting,
The broadcasting of local multi-medium data is then terminated, carries out the broadcasting of stream medium data.
Wherein, also bag playlist module, for pre-setting playing sequence and the broadcasting of the local multi-medium data
The frequency.
Wherein, the local GIF motion pictures play submodule and realize broadcasting by tool graphical user interface Qt;
Streaming media module and the local video information is played submodule and broadcast based on GStreamer-imx playing frames
Put.
Method proposed by the present invention, the monitoring of the streaming media quality of data is realized, while realize streaming media playing and this
Ground plays seamless switching, and the fluency of video playback is improved in the built-in multimedia player in some special screnes,
Enhance and play the rich of type, improve Consumer's Experience.
Embodiment
With reference to the accompanying drawings and examples, the embodiment of the present invention is described in further detail.Implement below
Example is used to illustrate the present invention, but is not limited to the scope of the present invention.
With reference to figure 1, a kind of flow chart for multi-medium play method that Fig. 1 provides for one embodiment of the invention, methods described
Including:
S1, streaming media playing is carried out, detect transmission of flow media data quality;
S2, threshold value is less than according to the transmission of flow media data quality of detecting, judgement is known according to local multi-medium data
Content and the default playing sequence for playing the frequency, obtaining local multi-medium data;
S3, according to the playing sequence of the local multi-medium data, play local multi-medium data.
Specifically, when player starts, by connecting the network ip address pre-set so that can receive to come from net
The stream media information of network, in playing process, the transmission quality of stream medium data will be detected always, when detecting transmission quality mistake
It is low so as to play error or interrupt, then according to broadcasting frequency requirement set in advance and broadcast locally-stored multimedia messages
Sequence requirement is put, is added to and plays in queue, then carries out local video broadcasting.
For example, in the multimedia player installed in certain subway, by receiving stream media information, streaming media video is carried out
Broadcasting, during playing stream media video, will always detect stream medium data transmission speed, here set one biography
The threshold value of defeated speed is 100kb/s, when detecting transmission speed and being less than this threshold value, then can be determined that current network
Connect unstable, be unable to maintain that the smooth broadcasting of streaming media video, therefore, local video playback will be switched to, played with ensureing
Quality.
In local multimedia memory storehouse, each content of multimedia is all preset with playing sequence and plays the frequency;Such as
First multimedia file playing sequence is 1, plays the frequency and is once, then when local play is carried out, more than described first
Media file is placed on first of broadcasting queue;And for example the second multimedia file playing sequence is arranged to 2, and broadcasting frequency is set
Played for interval, then in queue is played, the second multimedia file is placed on the second of multimedia play list, four, six,
By that analogy, so as to realize according to default playing sequence and play the frequency, local multimedia file is played out.
By the method, the monitoring of the streaming media quality of data is realized, while realizes streaming media playing and local broadcasting
Seamless switching, the fluency of video playback is improved in the built-in multimedia player in some special screnes, is improved
Consumer's Experience.
On the basis of above-described embodiment, the type of the local multi-medium data includes local video information, GIF animations
And picture.Wherein, the GIF animations and picture are played out by tool graphical user interface Qt;The stream medium data and
Local video information is played out based on GStreamer-imx playing frames.
Specifically, when local play is carried out, will be different according to the content for playing multimedia file in queue, selection
Broadcasting type, wherein playing type includes that local video plays, local GIF animations play and local more Picture card cartoons play,
It is as follows to implement code:
Wherein, the type of local multi-medium data includes local video information, GIF animations and picture.Wherein, the GIF
Animation and picture are realized by tool graphical user interface Qt to be played;Stream medium data and the local video information is based on
GStreamer-imx playing frames play out.
Streaming media module and local video module all realized using independent thread, for convenience with main control thread it
Between communication, all realized with the SubClassings of Qt QThread classes.In streaming media module thread, create a Streaming Media and broadcast
Device is put, and continues to play.The crux of streaming media playing module is realised in that:
Similar, in local video module thread, also need to create a local audio/video player, for playing.This
The Key Implementation of ground video player is:Create first and play the video needed and audio components, it is as follows:
Source=gst_element_factory_make (" filesrc ", " source ");//
Qtdemux=gst_element_factory_make (" qtdemux ", " demuxer ");
Vq=gst_element_factory_make (" queue ", " videoq ");
Hparser=gst_element_factory_make (" h264parse ", " h264parser ");
Vpudec=gst_element_factory_make (" imxvpudec ", " imxvpudecr ");
Videosink=gst_element_factory_make (" imxipuvideosink ",
"imxipuvideosinker");
Aq=gst_element_factory_make (" queue ", " audioq ");
Faad=gst_element_factory_make (" faad ", " faader ");
Ac=gst_element_factory_make (" audioconvert ", " audioconverter ");
Vol=gst_element_factory_make (" volume ", " volumeadj ");
Alsa=gst_element_factory_make (" alsasink ", " alsasinker ");
Secondly, these elements are put into Gstreamer pipeline, these element associateds got up in an appropriate manner.
It is as follows:
/*put together a pipeline*/
gst_bin_add_many(GST_BIN(pipeLine),source,qtdemux,vq,hparser,vpudec,
videosink,\
aq,faad,ac,vol,alsa,NULL);
gst_element_link_pads(source,"src",qtdemux,"sink");
/*listen for newly created pads*/
g_signal_connect(qtdemux,"pad-added",
G_CALLBACK(cb_new_pad),NULL);
gst_element_link_many(vq,hparser,vpudec,videosink,NULL);
gst_element_link_many(aq,faad,ac,vol,alsa,NULL);
Local GIF and more Picture card cartoon modules are realized with an independent animation control.Key Implementation is:
void UsrAnimationControls::SetAnimationType (QString type) // setting animation
Type
void UsrAnimationControls::Start () // start different according to different animation types, selection
Broadcast mode
By the method, streaming media video, local video, GIF animations and picture polytype media file are realized
Self-service broadcasting, enhance and play the rich of type, improve broadcasting compatibility and the flexibility of built-in player.
On the basis of the various embodiments described above, methods described also includes, after step S3, when the Streaming Media number according to detecting
When being higher than threshold value according to transmission quality, then the broadcasting of local multi-medium data is terminated, carry out the broadcasting of stream medium data.
Specifically, no matter stream medium data play or in local playing process, all can streaming media data biography
Transmission quality is detected, and when detecting that transmission quality is higher than threshold value, then can carry out the broadcasting of streaming media video.By pre-
The broadcasting priority first set, the priority of streaming media playing is arranged to highest, when the transmission for detecting stream medium data
When quality is more than threshold value, then can know current streaming media playing will not interim card delay, streaming media video will be carried out and broadcast
Put.If currently playing type plays to be local, streaming media playing is switched to again.
By the method, the seamless switching that streaming media video is played and locally played is realized, it is special at some to improve
Such as the video playback smoothness degree in track traffic or highway communication under scene, Consumer's Experience is improved.
On the basis of the various embodiments described above, in addition to pre-set the playing sequence of the local multi-medium data and broadcast
Put frequency step.
Specifically, set by the playing sequence to the multimedia file in locally-stored storehouse in advance and the broadcasting frequency
Put, then can be sequentially and each according to the local multimedia set in advance when needing to carry out local multimedia
The broadcasting frequency of individual multimedia file, carries out local multimedia.
With reference to figure 2, Fig. 2 be another embodiment of the present invention provide a kind of multimedia play system structure chart, the system
Including:Streaming media module 21, main control module 22 and local multimedia playing module 23.
Wherein, streaming media playing module 21 is used to carry out streaming media playing, detects transmission of flow media data quality.
Wherein, main control module 22 is used to be less than threshold value according to the transmission of flow media data quality of detecting, and basis is known in judgement
The content of local multi-medium data and the default playing sequence for playing the frequency, obtaining local multi-medium data.
Wherein, local multimedia playing module 23 is used for the playing sequence according to the local multi-medium data, plays this
Ground multi-medium data.
Specifically, when player starts, streaming media module is by connecting the network ip address pre-set so that can be with
Receiving carrys out the stream media information of automatic network, and during system carries out video playback, streaming media module will detect stream matchmaker always
The transmission quality of volume data, it is too low when detecting transmission quality so as to play error or interrupt, main control module then sends control and referred to
Make to local multimedia playing module, locally-stored multimedia messages according to broadcasting frequency requirement set in advance and are played
Sequence requirement, it is added to and plays in queue, then carries out local video broadcasting.
For example, in the multimedia player installed in certain subway, streaming media module is carried out by receiving stream media information
The broadcasting of streaming media video, during playing stream media video, the transmission speed of stream medium data will be detected always, here
The threshold value for setting a transmission speed is 100kb/s, when detecting transmission speed and being less than this threshold value, then be can be determined that
Current network connection is unstable, is unable to maintain that the smooth broadcasting of streaming media video, and therefore, play system will switch to local regard
Frequency plays, to ensure play quality.
In local multimedia memory storehouse, each content of multimedia is all preset with playing sequence and plays the frequency;Such as
First multimedia file playing sequence is 1, plays the frequency and is once, then when local play is carried out, more than described first
Media file is placed on first of broadcasting queue;And for example the second multimedia file playing sequence is arranged to 2, and broadcasting frequency is set
Played for interval, then in queue is played, the second multimedia file is placed on the second of multimedia play list, four, six,
By that analogy, so as to realize according to default playing sequence and play the frequency, local multimedia file is played out.
By this system, the monitoring of the streaming media quality of data is realized, while realizes streaming media playing and local broadcasting
Seamless switching.The fluency of video playback is improved in built-in multimedia player in some special screnes, is improved
Consumer's Experience.
On the basis of above-described embodiment, the local multimedia playing module includes local video information and plays submodule
Submodule is played with local GIF motion pictures.The local GIF motion pictures play submodule and pass through tool graphical user interface
Qt, which is realized, to be played;Streaming media module and the local video information is played submodule and entered based on GStreamer-imx playing frames
Row plays.
Specifically, when local play is carried out, will be different according to the content for playing multimedia file in queue, selection
Broadcasting type, wherein playing type includes that local video plays, local GIF animations play and local more Picture card cartoons play.
During video playback, local video plays submodule and streaming media playing module uses GStreamer-
Imx realizes and played that GStreamer-imx is a kind of multimedia frame run on the hardware platforms of I.MX 6 as playing frame
Frame.In embedded environment, a series of multimedia playing module can be built using GStreamer-imx, including locally regard
Frequency plays, streaming media playing.On the other hand, it is real by tool graphical user interface Qt to play submodule for local GIF motion pictures
Now play.Qt is cross-platform graphic user interface (Graphical UserInterface, abbreviation GUI) instrument, can be utilized
Qt realizes GIF and more Picture card cartoons broadcasting.
By this system, realize streaming media video, local video and GIF motion picture polytype media files from
Broadcasting is helped, improves broadcasting compatibility and the flexibility of built-in player.
On the basis of the various embodiments described above, the main control module is additionally operable to, when the transmission of flow media data according to detecting
When quality is higher than threshold value, then the broadcasting of local multi-medium data is terminated, carry out the broadcasting of stream medium data.
Specifically, no matter stream medium data play or in local playing process, all can streaming media data biography
Transmission quality is detected, and when detecting that transmission quality is higher than threshold value, then can carry out the broadcasting of streaming media video.By pre-
The broadcasting priority first set, the priority of streaming media playing is arranged to highest, when the transmission for detecting stream medium data
When quality is more than threshold value, then it can know that current streaming media playing will not cause interim card to postpone, streaming media video will be carried out
Broadcasting.If currently playing type plays to be local, streaming media playing is switched to again.
By this system, the seamless switching that streaming media video is played and locally played is realized, it is special at some to improve
Such as the video playback smoothness degree in track traffic or highway communication under scene, Consumer's Experience is improved.
On the basis of the various embodiments described above, also bag playlist module, for pre-setting the local multimedia number
According to playing sequence and play the frequency.
Specifically, set by the playing sequence to the multimedia file in locally-stored storehouse in advance and the broadcasting frequency
Put, then can be sequentially and each according to the local multimedia set in advance when needing to carry out local multimedia
The broadcasting frequency of individual multimedia file, carries out local multimedia.
Finally, the present processes are only preferable embodiment, are not intended to limit the scope of the present invention.It is all
Within the spirit and principles in the present invention, any modification, equivalent substitution and improvements made etc., the protection of the present invention should be included in
Within the scope of.