mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 21:31:04 +00:00
Bug 1355933: P6. Hook up ADTS sniffer. r=kamidphish
MozReview-Commit-ID: 3aYmCRRbRzg --HG-- extra : rebase_source : bec12e1f81e90a4bc1ddbb46c57f81c2a968a9ca
This commit is contained in:
parent
73db8daa39
commit
fca0f47212
@ -88,6 +88,7 @@
|
|||||||
#define AUDIO_3GPP2 "audio/3gpp2"
|
#define AUDIO_3GPP2 "audio/3gpp2"
|
||||||
#define AUDIO_MIDI "audio/x-midi"
|
#define AUDIO_MIDI "audio/x-midi"
|
||||||
#define AUDIO_MATROSKA "audio/x-matroska"
|
#define AUDIO_MATROSKA "audio/x-matroska"
|
||||||
|
#define AUDIO_AAC "audio/aac"
|
||||||
|
|
||||||
#define BINARY_OCTET_STREAM "binary/octet-stream"
|
#define BINARY_OCTET_STREAM "binary/octet-stream"
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
#include "ADTSDemuxer.h"
|
||||||
#include "FlacDemuxer.h"
|
#include "FlacDemuxer.h"
|
||||||
#include "mozilla/ArrayUtils.h"
|
#include "mozilla/ArrayUtils.h"
|
||||||
#include "mozilla/ModuleUtils.h"
|
#include "mozilla/ModuleUtils.h"
|
||||||
@ -130,6 +131,11 @@ static bool MatchesFLAC(const uint8_t* aData, const uint32_t aLength)
|
|||||||
return mozilla::FlacDemuxer::FlacSniffer(aData, aLength);
|
return mozilla::FlacDemuxer::FlacSniffer(aData, aLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool MatchesADTS(const uint8_t* aData, const uint32_t aLength)
|
||||||
|
{
|
||||||
|
return mozilla::ADTSDemuxer::ADTSSniffer(aData, aLength);
|
||||||
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsMediaSniffer::GetMIMETypeFromContent(nsIRequest* aRequest,
|
nsMediaSniffer::GetMIMETypeFromContent(nsIRequest* aRequest,
|
||||||
const uint8_t* aData,
|
const uint8_t* aData,
|
||||||
@ -197,6 +203,11 @@ nsMediaSniffer::GetMIMETypeFromContent(nsIRequest* aRequest,
|
|||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (MatchesADTS(aData, clampedLength)) {
|
||||||
|
aSniffedType.AssignLiteral(AUDIO_AAC);
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
// Could not sniff the media type, we are required to set it to
|
// Could not sniff the media type, we are required to set it to
|
||||||
// application/octet-stream.
|
// application/octet-stream.
|
||||||
aSniffedType.AssignLiteral(APPLICATION_OCTET_STREAM);
|
aSniffedType.AssignLiteral(APPLICATION_OCTET_STREAM);
|
||||||
|
Loading…
Reference in New Issue
Block a user