channels/tsmf: integrate pull request #2012

This commit is contained in:
Marc-André Moreau 2014-11-10 14:18:23 -05:00
parent 129582e67f
commit a8ceed9dda
4 changed files with 61 additions and 15 deletions

View File

@ -22,13 +22,11 @@
#include "config.h"
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <winpr/crt.h>
#include <winpr/stream.h>
#include <winpr/print.h>
#include "tsmf_decoder.h"
#include "tsmf_constants.h"
#include "tsmf_types.h"
@ -176,40 +174,64 @@ static const TSMFMediaTypeMap tsmf_sub_type_map[] =
},
/* E436EB81-524F-11CE-9F53-0020AF0BA770 */
/*
{
{ 0x81, 0xEB, 0x36, 0xE4, 0x4F, 0x52, 0xCE, 0x11, 0x9F, 0x53, 0x00, 0x20, 0xAF, 0x0B, 0xA7, 0x70 },
"MEDIASUBTYPE_MP1V",
TSMF_SUB_TYPE_MP1V
},
*/
/* 00000050-0000-0010-8000-00AA00389B71 */
/*
{
{ 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71 },
"MEDIASUBTYPE_MP1A",
TSMF_SUB_TYPE_MP1A
},
*/
/* E06D802C-DB46-11CF-B4D1-00805F6CBBEA */
/*
{
{ 0x2C, 0x80, 0x6D, 0xE0, 0x46, 0xDB, 0xCF, 0x11, 0xB4, 0xD1, 0x00, 0x80, 0x5F, 0x6C, 0xBB, 0xEA },
"MEDIASUBTYPE_DOLBY_AC3",
TSMF_SUB_TYPE_AC3
},
*/
/* 32595559-0000-0010-8000-00AA00389B71 */
/*
{
{ 0x59, 0x55, 0x59, 0x32, 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71 },
"MEDIASUBTYPE_YUY2",
TSMF_SUB_TYPE_YUY2
},
*/
/* Opencodec IDS */
{
{0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71},
"MEDIASUBTYPE_FLAC",
TSMF_SUB_TYPE_FLAC
},
{
{0x61, 0x34, 0x70, 0x6D, 0x7A, 0x76, 0x4D, 0x49, 0xB4, 0x78, 0xF2, 0x9D, 0x25, 0xDC, 0x90, 0x37},
"MEDIASUBTYPE_OGG",
TSMF_SUB_TYPE_OGG
},
{
{0x4D, 0x34, 0x53, 0x32, 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71},
"MEDIASUBTYPE_H263",
TSMF_SUB_TYPE_H263
},
/* WebMMF codec IDS */
{
{0x56, 0x50, 0x38, 0x30, 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71},
"MEDIASUBTYPE_VP8",
TSMF_SUB_TYPE_VP8
},
{
{0x0B, 0xD1, 0x2F, 0x8D, 0x41, 0x58, 0x6B, 0x4A, 0x89, 0x05, 0x58, 0x8F, 0xEC, 0x1A, 0xDE, 0xD9},
"MEDIASUBTYPE_OGG",
TSMF_SUB_TYPE_OGG
},
{
{ 0 },
@ -525,13 +547,30 @@ BOOL tsmf_codec_parse_media_type(TS_AM_MEDIA_TYPE* mediatype, wStream* s)
return ret;
}
BOOL tsmf_codec_check_media_type(wStream* s)
BOOL tsmf_codec_check_media_type(const char* decoder_name, wStream* s)
{
BYTE* m;
BOOL ret;
TS_AM_MEDIA_TYPE mediatype;
Stream_GetPointer(s, m);
ret = tsmf_codec_parse_media_type(&mediatype, s);
Stream_SetPointer(s, m);
if (ret)
{
ITSMFDecoder* decoder = tsmf_load_decoder(decoder_name, &mediatype);
if (!decoder)
{
WLog_WARN(TAG, "Format not supported by decoder %s", decoder_name);
ret = FALSE;
}
else
{
decoder->Free(decoder);
}
}
return ret;
}

View File

@ -23,7 +23,7 @@
#include "tsmf_types.h"
BOOL tsmf_codec_parse_media_type(TS_AM_MEDIA_TYPE* mediatype, wStream* s);
BOOL tsmf_codec_check_media_type(wStream* s);
BOOL tsmf_codec_check_media_type(const char* decoder_name, wStream* s);
#endif

View File

@ -118,6 +118,13 @@
#define TSMF_SUB_TYPE_MP43 17
#define TSMF_SUB_TYPE_MP4S 18
#define TSMF_SUB_TYPE_MP42 19
#define TSMF_SUB_TYPE_OGG 20
#define TSMF_SUB_TYPE_SPEEX 21
#define TSMF_SUB_TYPE_THEORA 22
#define TSMF_SUB_TYPE_FLAC 23
#define TSMF_SUB_TYPE_VP8 24
#define TSMF_SUB_TYPE_VP9 25
#define TSMF_SUB_TYPE_H263 26
/* FormatType */
#define TSMF_FORMAT_TYPE_UNKNOWN 0

View File

@ -110,7 +110,7 @@ int tsmf_ifman_check_format_support_request(TSMF_IFMAN* ifman)
DEBUG_TSMF("PlatformCookie %d numMediaType %d", PlatformCookie, numMediaType);
if (!tsmf_codec_check_media_type(ifman->input))
if (!tsmf_codec_check_media_type(ifman->decoder_name, ifman->input))
FormatSupported = 0;
if (FormatSupported)