} audioes_muxer_t;
+/**
+ *
+ */
+static int
+audioes_muxer_type(streaming_component_type_t type)
+{
+ muxer_container_type_t mc = MC_UNKNOWN;
+ switch (type) {
+ case SCT_MPEG2AUDIO: mc = MC_MPEG2AUDIO; break;
+ case SCT_AC3: mc = MC_AC3; break;
+ case SCT_EAC3: mc = MC_AC3; break;
+ case SCT_AAC: mc = MC_AAC; break;
+ case SCT_MP4A: mc = MC_MP4A; break;
+ case SCT_VORBIS: mc = MC_VORBIS; break;
+ default: break;
+ }
+ return mc;
+}
+
+
/**
* Figure out the mimetype
*/
static const char *
-audioes_muxer_mime(muxer_t* m, const struct streaming_start *ss)
+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;
- switch (ssc->ssc_type) {
- case SCT_MPEG2AUDIO: mc = MC_MPEG2AUDIO; break;
- case SCT_AC3: mc = MC_AC3; break;
- case SCT_EAC3: mc = MC_AC3; break;
- case SCT_AAC: mc = MC_AAC; break;
- case SCT_MP4A: mc = MC_MP4A; break;
- case SCT_VORBIS: mc = MC_VORBIS; break;
- default: break;
- }
+ mc = audioes_muxer_type(ssc->ssc_type);
break;
}
* Reconfigure the muxer
*/
static int
-audioes_muxer_reconfigure(muxer_t* m, const struct streaming_start *ss)
+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;
- int i;
+ muxer_container_type_t mc;
+ int i, count = 0;
am->am_index = -1;
ssc = &ss->ss_components[i];
if ((!ssc->ssc_disabled) && (SCT_ISAUDIO(ssc->ssc_type))) {
- am->am_index = ssc->ssc_index;
- break;
+ 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++;
}
}
*/
typedef struct profile_audio {
profile_t;
+ int pro_mc;
+ int pro_index;
} profile_audio_t;
+static htsmsg_t *
+profile_class_mc_audio_list ( void *o, const char *lang )
+{
+ static const struct strtab tab[] = {
+ { N_("Any"), MC_UNKNOWN },
+ { N_("MPEG-2 audio"), MC_MPEG2AUDIO, },
+ { N_("AC3 audio"), MC_AC3, },
+ { N_("AAC audio"), MC_AAC },
+ { N_("MP4 audio"), MC_MP4A },
+ { N_("Vorbis audio"), MC_VORBIS },
+ };
+ return strtab2htsmsg(tab, 1, lang);
+}
+
const idclass_t profile_audio_class =
{
.ic_super = &profile_class,
.ic_class = "profile-audio",
.ic_caption = N_("Audio stream"),
.ic_properties = (const property_t[]){
+ {
+ .type = PT_INT,
+ .id = "type",
+ .name = N_("Audio type"),
+ .desc = N_("Pick the stream with given audio type only."),
+ .off = offsetof(profile_audio_t, pro_mc),
+ .list = profile_class_mc_audio_list,
+ .group = 1
+ },
+ {
+ .type = PT_INT,
+ .id = "index",
+ .name = N_("Stream index"),
+ .desc = N_("Stream index (starts with zero)."),
+ .off = offsetof(profile_audio_t, pro_index),
+ .group = 1
+ },
{ }
}
};
muxer_config_t *m_cfg, int flags)
{
muxer_config_t c;
+ profile_audio_t *pro = (profile_audio_t *)prch->prch_pro;
if (m_cfg)
c = *m_cfg; /* do not alter the original parameter */
else
memset(&c, 0, sizeof(c));
- c.m_type = MC_MPEG2AUDIO;
+ c.m_type = pro->pro_mc != MC_UNKNOWN ? pro->pro_mc : MC_MPEG2AUDIO;
+ c.m_force_type = pro->pro_mc;
+ c.m_index = pro->pro_index;
assert(!prch->prch_muxer);
prch->prch_muxer = muxer_create(&c);
static muxer_container_type_t
profile_audio_get_mc(profile_t *_pro)
{
- return MC_MPEG2AUDIO; /* may be incorrect */
+ profile_audio_t *pro = (profile_audio_t *)_pro;
+ if (pro->pro_mc == MC_UNKNOWN)
+ return MC_MPEG2AUDIO;
+ return pro->pro_mc;
}
static profile_t *
}
-
-
-
-
#if ENABLE_LIBAV
/*