Exemplo n.º 1
0
static int output_ffmpeg_init(void)
{

	Log_error("ffmpeg", "output_ffmpeg_init----- ");

	SongMetaData_init(&song_meta_);
	register_mime_type("audio/*");
	register_mime_type("audio/x-mpeg");
	register_mime_type("audio/mpeg");
    av_register_all();
    avformat_network_init();

	//:(s_pFormatCtx = avformat_alloc_context();
    s_au_convert_ctx = swr_alloc();
    s_out_buffer = (uint8_t *)av_malloc(MAX_AUDIO_FRAME_SIZE * 2);
    s_pFrame = av_frame_alloc();

    mp_msg_init();
    char ** ao_list= malloc(sizeof(char*)*2);
    const int c_number_count = 10;
    *ao_list = malloc(sizeof(char) * c_number_count);
    ao_list[1] = malloc(sizeof(char) *c_number_count);
    strcpy(ao_list[0],"alsa");
    memset(ao_list[1],0, c_number_count);
    s_audio_device = init_best_audio_out(ao_list, 0, 44100, 2,AF_FORMAT_S16_LE,0);
    assert(s_audio_device != NULL);
    free(ao_list[0]);
    free(ao_list[1]);
    free(ao_list);
	
    mixer_Init_control_point(&s_mixer, s_audio_device);
	pthread_mutex_init(&s_mutex, NULL);
    pthread_cond_init(&s_cond, NULL);
	return 0;
}
Exemplo n.º 2
0
CMIMEMessage::CMIMEMessage()
{
	m_sMIMEContentType = _T( "multipart/mixed" );
	m_sPartBoundary = _T( "WC_MAIL_PaRt_BoUnDaRy_05151998" );
	m_sNoMIMEText = _T( "This is a multi-part message in MIME format." );

	// Register the MIME types handled by this class
	//
	CMIMEContentAgent* pType;
	// These objects are deleted by CMIMTypeManager's destructor
	pType = new CTextPlain( TEXT_PLAIN, GetCharsPerLine() );
	register_mime_type( pType );
	pType = new CAppOctetStream( APPLICATION_OCTETSTREAM );
	register_mime_type( pType );
}
void register_mime_type(const char *mime_type) {
	register_mime_type_internal(mime_type);
	if (strcmp("audio/mpeg", mime_type) == 0) {
		register_mime_type_internal("audio/x-mpeg");

		// BubbleUPnP does not seem to match generic "audio/*" types,
		// but only matches mime-types _exactly_, so we add some here.
		// TODO(hzeller): we already add the "audio/*" mime-type
		// output_gstream.c:scan_caps() which should just work once
		// BubbleUPnP allows for  matching "audio/*". Remove the code
		// here.

		// BubbleUPnP uses audio/x-scpl as an indicator to know if the
		// renderer can handle it (otherwise it will proxy).
		// Simple claim: if we can handle mpeg, then we can handle
		// shoutcast.
		// (For more accurate answer: we'd to check if all of
		// mpeg, aac, aacp, ogg are supported).
		register_mime_type_internal("audio/x-scpls");

		// This is apparently something sent by the spotifyd
		// https://gitorious.org/spotifyd
		register_mime_type("audio/L16;rate=44100;channels=2");
	}

	// Some workaround: some controllers seem to match the version without
	// x-, some with; though the mime-type is correct with x-, these formats
	// seem to be common enough to sometimes be used without.
	// If this works, we should probably collect all of these
	// in a set emit always both, foo/bar and foo/x-bar, as it is a similar
	// work-around as seen above with mpeg -> x-mpeg.
	if (strcmp("audio/x-alac", mime_type) == 0) {
	  register_mime_type_internal("audio/alac");
	}
	if (strcmp("audio/x-aiff", mime_type) == 0) {
	  register_mime_type_internal("audio/aiff");
	}
	if (strcmp("audio/x-m4a", mime_type) == 0) {
	  register_mime_type_internal("audio/m4a");
	  register_mime_type_internal("audio/mp4");
	}
}