* Improve WMA DLNA profile parsing.
This commit is contained in:
parent
595eaf5168
commit
5782be8ab2
@ -39,6 +39,29 @@ _asf_read_file_properties(FILE *fp, asf_file_properties_t *p, __u32 size)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_pick_dlna_profile(struct song_metadata *psong, uint16_t format)
|
||||||
|
{
|
||||||
|
/* DLNA Profile Name */
|
||||||
|
switch( le16_to_cpu(format) )
|
||||||
|
{
|
||||||
|
case WMA:
|
||||||
|
if( psong->max_bitrate < 193000 )
|
||||||
|
asprintf(&(psong->dlna_pn), "WMABASE");
|
||||||
|
else if( psong->max_bitrate < 385000 )
|
||||||
|
asprintf(&(psong->dlna_pn), "WMAFULL");
|
||||||
|
break;
|
||||||
|
case WMAPRO:
|
||||||
|
asprintf(&(psong->dlna_pn), "WMAPRO");
|
||||||
|
break;
|
||||||
|
case WMALSL:
|
||||||
|
asprintf(&(psong->dlna_pn), "WMALSL%s",
|
||||||
|
psong->channels > 2 ? "_MULT5" : "");
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
_asf_read_audio_stream(FILE *fp, struct song_metadata *psong, int size)
|
_asf_read_audio_stream(FILE *fp, struct song_metadata *psong, int size)
|
||||||
{
|
{
|
||||||
@ -55,24 +78,9 @@ _asf_read_audio_stream(FILE *fp, struct song_metadata *psong, int size)
|
|||||||
psong->channels = le16_to_cpu(s.wfx.nChannels);
|
psong->channels = le16_to_cpu(s.wfx.nChannels);
|
||||||
psong->bitrate = le32_to_cpu(s.wfx.nAvgBytesPerSec) * 8;
|
psong->bitrate = le32_to_cpu(s.wfx.nAvgBytesPerSec) * 8;
|
||||||
psong->samplerate = le32_to_cpu(s.wfx.nSamplesPerSec);
|
psong->samplerate = le32_to_cpu(s.wfx.nSamplesPerSec);
|
||||||
/* DLNA Profile Name */
|
if (!psong->max_bitrate)
|
||||||
switch( le16_to_cpu(s.wfx.wFormatTag) )
|
psong->max_bitrate = psong->bitrate;
|
||||||
{
|
_pick_dlna_profile(psong, s.wfx.wFormatTag);
|
||||||
case WMAV1:
|
|
||||||
case WMAV2:
|
|
||||||
if( (psong->bitrate/1000+1) >= 385 || psong->samplerate > 48000 )
|
|
||||||
asprintf(&(psong->dlna_pn), "WMAPRO");
|
|
||||||
else if( ((psong->bitrate+1) / 1000) <= 192 )
|
|
||||||
asprintf(&(psong->dlna_pn), "WMABASE");
|
|
||||||
else
|
|
||||||
asprintf(&(psong->dlna_pn), "WMAFULL");
|
|
||||||
break;
|
|
||||||
case WMAPRO:
|
|
||||||
asprintf(&(psong->dlna_pn), "WMAPRO");
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -101,25 +109,11 @@ _asf_read_media_stream(FILE *fp, struct song_metadata *psong, __u32 size)
|
|||||||
psong->channels = le16_to_cpu(wfx.nChannels);
|
psong->channels = le16_to_cpu(wfx.nChannels);
|
||||||
psong->bitrate = le32_to_cpu(wfx.nAvgBytesPerSec) * 8;
|
psong->bitrate = le32_to_cpu(wfx.nAvgBytesPerSec) * 8;
|
||||||
psong->samplerate = le32_to_cpu(wfx.nSamplesPerSec);
|
psong->samplerate = le32_to_cpu(wfx.nSamplesPerSec);
|
||||||
/* DLNA Profile Name */
|
if (!psong->max_bitrate)
|
||||||
switch( le16_to_cpu(wfx.wFormatTag) )
|
psong->max_bitrate = psong->bitrate;
|
||||||
{
|
_pick_dlna_profile(psong, wfx.wFormatTag);
|
||||||
case WMAV1:
|
|
||||||
case WMAV2:
|
|
||||||
if( (psong->bitrate/1000+1) >= 385 || psong->samplerate > 48000 )
|
|
||||||
asprintf(&(psong->dlna_pn), "WMAPRO");
|
|
||||||
else if( (psong->bitrate / 1000)+1 < 192 )
|
|
||||||
asprintf(&(psong->dlna_pn), "WMABASE");
|
|
||||||
else
|
|
||||||
asprintf(&(psong->dlna_pn), "WMAFULL");
|
|
||||||
break;
|
|
||||||
case WMAPRO:
|
|
||||||
asprintf(&(psong->dlna_pn), "WMAPRO");
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -448,6 +442,7 @@ _get_asffileinfo(char *file, struct song_metadata *psong)
|
|||||||
_asf_read_file_properties(fp, &FileProperties, tmp.Size);
|
_asf_read_file_properties(fp, &FileProperties, tmp.Size);
|
||||||
psong->song_length = le64_to_cpu(FileProperties.PlayDuration) / 10000;
|
psong->song_length = le64_to_cpu(FileProperties.PlayDuration) / 10000;
|
||||||
psong->bitrate = le64_to_cpu(FileProperties.MaxBitrate);
|
psong->bitrate = le64_to_cpu(FileProperties.MaxBitrate);
|
||||||
|
psong->max_bitrate = psong->bitrate;
|
||||||
}
|
}
|
||||||
else if(IsEqualGUID(&tmp.ID, &ASF_ContentDescription))
|
else if(IsEqualGUID(&tmp.ID, &ASF_ContentDescription))
|
||||||
{
|
{
|
||||||
|
@ -75,6 +75,7 @@ struct song_metadata {
|
|||||||
char compilation; // YTCP
|
char compilation; // YTCP
|
||||||
|
|
||||||
int bitrate;
|
int bitrate;
|
||||||
|
int max_bitrate;
|
||||||
int samplerate;
|
int samplerate;
|
||||||
int samplesize;
|
int samplesize;
|
||||||
int channels;
|
int channels;
|
||||||
@ -105,9 +106,9 @@ struct song_metadata {
|
|||||||
int plist_id;
|
int plist_id;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define WMAV1 0x161
|
#define WMA 0x161
|
||||||
#define WMAV2 0x162
|
#define WMAPRO 0x162
|
||||||
#define WMAPRO 0x163
|
#define WMALSL 0x163
|
||||||
|
|
||||||
extern int scan_init(char *path);
|
extern int scan_init(char *path);
|
||||||
extern void make_composite_tags(struct song_metadata *psong);
|
extern void make_composite_tags(struct song_metadata *psong);
|
||||||
|
@ -78,10 +78,6 @@
|
|||||||
#define PNPX 0
|
#define PNPX 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 0 // Add these once the newer ffmpeg libs that can detect WMAPRO are more widely used
|
|
||||||
"http-get:*:video/x-ms-wmv:DLNA.ORG_PN=WMVHIGH_PRO;DLNA.ORG_OP=01;DLNA.ORG_CI=0,"
|
|
||||||
"http-get:*:video/x-ms-wmv:DLNA.ORG_PN=WMVMED_PRO;DLNA.ORG_OP=01;DLNA.ORG_CI=0,"
|
|
||||||
#endif
|
|
||||||
#define RESOURCE_PROTOCOL_INFO_VALUES \
|
#define RESOURCE_PROTOCOL_INFO_VALUES \
|
||||||
"http-get:*:image/jpeg:DLNA.ORG_PN=JPEG_TN," \
|
"http-get:*:image/jpeg:DLNA.ORG_PN=JPEG_TN," \
|
||||||
"http-get:*:image/jpeg:DLNA.ORG_PN=JPEG_SM;DLNA.ORG_OP=01;DLNA.ORG_CI=0," \
|
"http-get:*:image/jpeg:DLNA.ORG_PN=JPEG_SM;DLNA.ORG_OP=01;DLNA.ORG_CI=0," \
|
||||||
@ -145,6 +141,8 @@
|
|||||||
"http-get:*:audio/x-ms-wma:DLNA.ORG_PN=WMABASE;DLNA.ORG_OP=01;DLNA.ORG_CI=0," \
|
"http-get:*:audio/x-ms-wma:DLNA.ORG_PN=WMABASE;DLNA.ORG_OP=01;DLNA.ORG_CI=0," \
|
||||||
"http-get:*:audio/x-ms-wma:DLNA.ORG_PN=WMAFULL;DLNA.ORG_OP=01;DLNA.ORG_CI=0," \
|
"http-get:*:audio/x-ms-wma:DLNA.ORG_PN=WMAFULL;DLNA.ORG_OP=01;DLNA.ORG_CI=0," \
|
||||||
"http-get:*:audio/x-ms-wma:DLNA.ORG_PN=WMAPRO;DLNA.ORG_OP=01;DLNA.ORG_CI=0," \
|
"http-get:*:audio/x-ms-wma:DLNA.ORG_PN=WMAPRO;DLNA.ORG_OP=01;DLNA.ORG_CI=0," \
|
||||||
|
"http-get:*:audio/x-ms-wma:DLNA.ORG_PN=WMALSL;DLNA.ORG_OP=01;DLNA.ORG_CI=0," \
|
||||||
|
"http-get:*:audio/x-ms-wma:DLNA.ORG_PN=WMALSL_MULT5;DLNA.ORG_OP=01;DLNA.ORG_CI=0," \
|
||||||
"http-get:*:audio/mp4:DLNA.ORG_PN=AAC_ISO_320;DLNA.ORG_OP=01;DLNA.ORG_CI=0," \
|
"http-get:*:audio/mp4:DLNA.ORG_PN=AAC_ISO_320;DLNA.ORG_OP=01;DLNA.ORG_CI=0," \
|
||||||
"http-get:*:audio/3gpp:DLNA.ORG_PN=AAC_ISO_320;DLNA.ORG_OP=01;DLNA.ORG_CI=0," \
|
"http-get:*:audio/3gpp:DLNA.ORG_PN=AAC_ISO_320;DLNA.ORG_OP=01;DLNA.ORG_CI=0," \
|
||||||
"http-get:*:audio/mp4:DLNA.ORG_PN=AAC_ISO;DLNA.ORG_OP=01;DLNA.ORG_CI=0," \
|
"http-get:*:audio/mp4:DLNA.ORG_PN=AAC_ISO;DLNA.ORG_OP=01;DLNA.ORG_CI=0," \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user