Skip to content

Commit

Permalink
audioes: fix the mime type / suffix audio-detection
Browse files Browse the repository at this point in the history
  • Loading branch information
perexg committed Oct 15, 2016
1 parent 398cf2c commit 37ef4b8
Showing 1 changed file with 33 additions and 25 deletions.
58 changes: 33 additions & 25 deletions src/muxer/muxer_audioes.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,26 +67,49 @@ audioes_muxer_type(streaming_component_type_t type)
}


/**
*
*/
static const streaming_start_component_t *
audioes_get_component(muxer_t *m, const struct streaming_start *ss)
{
const streaming_start_component_t *ssc;
muxer_container_type_t mc = MC_UNKNOWN;
int i, count;

for (i = count = 0; i < ss->ss_num_components;i++) {
ssc = &ss->ss_components[i];

if ((!ssc->ssc_disabled) && (SCT_ISAUDIO(ssc->ssc_type))) {
if (m->m_config.m_force_type != MC_UNKNOWN) {
mc = audioes_muxer_type(ssc->ssc_type);
if (m->m_config.m_force_type != mc)
continue;
}
if (m->m_config.m_index == count)
return ssc;
count++;
}
}
return NULL;
}


/**
* Figure out the mimetype
*/
static const char *
audioes_muxer_mime(muxer_t *m, const struct streaming_start *ss)
{
int i;
muxer_container_type_t mc = MC_UNKNOWN;
const streaming_start_component_t *ssc;

if (m->m_config.m_force_type != MC_UNKNOWN)
return muxer_container_type2mime(m->m_config.m_force_type, 0);

for (i = 0; i < ss->ss_num_components; i++) {
ssc = &ss->ss_components[i];
if (ssc->ssc_disabled)
continue;
ssc = audioes_get_component(m, ss);
if (ssc)
mc = audioes_muxer_type(ssc->ssc_type);
break;
}

return muxer_container_type2mime(mc, 0);
}
Expand All @@ -100,27 +123,12 @@ audioes_muxer_reconfigure(muxer_t *m, const struct streaming_start *ss)
{
audioes_muxer_t *am = (audioes_muxer_t*)m;
const streaming_start_component_t *ssc;
muxer_container_type_t mc;
int i, count = 0;

am->am_index = -1;

for (i = 0; i < ss->ss_num_components;i++) {
ssc = &ss->ss_components[i];

if ((!ssc->ssc_disabled) && (SCT_ISAUDIO(ssc->ssc_type))) {
if (m->m_config.m_force_type != MC_UNKNOWN) {
mc = audioes_muxer_type(ssc->ssc_type);
if (m->m_config.m_force_type != mc)
continue;
}
if (m->m_config.m_index == count) {
am->am_index = ssc->ssc_index;
break;
}
count++;
}
}
ssc = audioes_get_component(m, ss);
if (ssc)
am->am_index = ssc->ssc_index;

return 0;
}
Expand Down

0 comments on commit 37ef4b8

Please sign in to comment.