[Audio] Use MP3 format instead of OGG when using IE browsers

This commit is contained in:
emeric
2015-01-10 18:56:13 +01:00
parent e89b08fc39
commit fe5b010b84
8 changed files with 33 additions and 16 deletions
+1 -3
View File
@@ -27,7 +27,6 @@
[UI]
- handle internationalization
[Settings]
- increase the menu's width / add margins
- logout users that are being changed (loss of admin admin rights), or make sure they are still admin when they make changes
- "signal not exposed" problem if a user logout and login again. bad resource destruction?
[user/transcoding]
@@ -43,8 +42,7 @@
- MediaPlayer: move slider using js (http://redmine.webtoolkit.eu/boards/2/topics/7924?r=8478)
- TrackView : handle duration > 1 hour
- TrackView : Reselect the current selected item when displaying the updated search results
- Add Year column in the release filter. Add covers too?
- Save/Load playlists
- Add covers in the release filter?
[Video]
- implement a decent mediaplayer
-2
View File
@@ -154,8 +154,6 @@ InputFormatContext::getPictures(std::vector<Picture>& pictures) const
else
picture.mimeType = "application/octet-stream";
LMS_LOG(MOD_AV, SEV_DEBUG) << "MIME set to '" << picture.mimeType << "'" << std::endl;
AVPacket pkt = native()->streams[i]->attached_pic;
std::copy(pkt.data, pkt.data + pkt.size, std::back_inserter(picture.data));
+1 -1
View File
@@ -30,7 +30,7 @@ const std::vector<Format> Format::_supportedFormats
{
{Format::OGA, Format::Audio, "audio/ogg", "Ogg"},
{Format::OGV, Format::Video, "video/ogg", "Ogg"},
{Format::MP3, Format::Audio, "audio/mp3", "MP3"},
{Format::MP3, Format::Audio, "audio/mpeg", "MP3"},
{Format::WEBMA, Format::Audio, "audio/webm", "WebM"},
{Format::WEBMV, Format::Video, "video/webm", "WebM"},
{Format::FLV, Format::Video, "video/x-flv", "Flash Video"},
-7
View File
@@ -27,13 +27,6 @@
namespace Transcode
{
std::string
getMimeType(Format format)
{
//TODO
return "";
}
Parameters::Parameters(const InputMediaFile& inputMediaFile,
const Format& outputFormat)
:
+12 -1
View File
@@ -502,7 +502,18 @@ Audio::playTrack(boost::filesystem::path p)
Transcode::InputMediaFile inputFile(p);
Transcode::Parameters parameters(inputFile, Transcode::Format::get(Transcode::Format::OGA));
// Determine the output format using the encoding of the player
Transcode::Format::Encoding encoding;
switch(AudioMediaPlayer::getEncoding())
{
case Wt::WMediaPlayer::MP3: encoding = Transcode::Format::MP3; break;
case Wt::WMediaPlayer::M4A: encoding = Transcode::Format::M4A; break;
case Wt::WMediaPlayer::OGA: encoding = Transcode::Format::OGA; break;
default:
encoding = Transcode::Format::MP3;
}
Transcode::Parameters parameters(inputFile, Transcode::Format::get(encoding));
parameters.setBitrate(Transcode::Stream::Audio, bitrate);
+15 -2
View File
@@ -23,11 +23,24 @@
#include <Wt/WTemplate>
#include <Wt/WHBoxLayout>
#include <Wt/WVBoxLayout>
#include <Wt/WApplication>
#include <Wt/WEnvironment>
#include "AudioMediaPlayer.hpp"
namespace UserInterface {
Wt::WMediaPlayer::Encoding
AudioMediaPlayer::getEncoding()
{
const Wt::WEnvironment& env = Wt::WApplication::instance()->environment();
if (env.agentIsIE())
return Wt::WMediaPlayer::MP3;
else
return Wt::WMediaPlayer::OGA;
}
AudioMediaPlayer::AudioMediaPlayer( Wt::WContainerWidget *parent)
: Wt::WContainerWidget(parent),
_mediaResource(nullptr)
@@ -98,7 +111,7 @@ AudioMediaPlayer::AudioMediaPlayer( Wt::WContainerWidget *parent)
controlsLayout->addWidget(shuffle);
_mediaPlayer = new Wt::WMediaPlayer( Wt::WMediaPlayer::Audio, btnContainer );
_mediaPlayer->addSource( Wt::WMediaPlayer::OGA, "" );
_mediaPlayer->addSource( getEncoding(), "" );
_mediaPlayer->ended().connect(this, &AudioMediaPlayer::handleTrackEnded);
_mediaPlayer->setControlsWidget( 0 );
@@ -142,7 +155,7 @@ AudioMediaPlayer::loadPlayer(void)
_mediaResource = new AvConvTranscodeStreamResource( *_currentParameters, this );
_mediaInternalLink.setResource( _mediaResource );
_mediaPlayer->addSource( Wt::WMediaPlayer::OGA, _mediaInternalLink );
_mediaPlayer->addSource( getEncoding(), _mediaInternalLink );
}
void
+3
View File
@@ -38,6 +38,9 @@ class AudioMediaPlayer : public Wt::WContainerWidget
{
public:
// Encoding is set based on environment
static Wt::WMediaPlayer::Encoding getEncoding();
AudioMediaPlayer( Wt::WContainerWidget *parent = 0);
void load(const Transcode::Parameters& parameters);
@@ -58,6 +58,7 @@ AvConvTranscodeStreamResource::handleRequest(const Wt::Http::Request& request,
LMS_LOG(MOD_UI, SEV_DEBUG) << "Launching transcoder";
transcoder = std::make_shared<Transcode::AvConvTranscoder>( _parameters);
LMS_LOG(MOD_UI, SEV_DEBUG) << "Mime type set to '" << _parameters.getOutputFormat().getMimeType() << "'";
response.setMimeType(_parameters.getOutputFormat().getMimeType());
}