Exemplo n.º 1
0
static gboolean gst_devsound_src_setcaps(GstBaseSrc *bsrc, GstCaps *caps)
    {
    GstDevsoundSrc *devsoundsrc;
    GstStructure *structure;
    const gchar *mimetype;
    int rate;
    int channel;

    devsoundsrc = GST_DEVSOUND_SRC (bsrc);
    //gst_debug_log(devsound_debug, GST_LEVEL_LOG, "", "", 0, (GObject *) devsoundsrc, "gst_devsound_src_setcaps ENTER ",NULL);
    structure = gst_caps_get_structure(caps, 0);
    mimetype = gst_structure_get_name(structure);

    gst_structure_get_int(structure, "rate", &rate);
    gst_structure_get_int(structure, "channels", &channel);

    devsoundsrc->rate = gst_devsound_src_get_rate(rate);
    devsoundsrc->channels = channel;

    set_channels(devsoundsrc->handle, devsoundsrc->channels);

    set_rate(devsoundsrc->handle, devsoundsrc->rate);

    if (!strncmp(mimetype, "audio/x-raw-int", 15))
        {
        devsoundsrc->fourcc = 0x36315020; //KMMFFourCCCodePCM16
        }
    else if (!strncmp(mimetype, "audio/amr", 9))
        {
        devsoundsrc->fourcc = 0x524d4120; //KMMFFourCCCodeAMR
        }
    else if (!strncmp(mimetype, "audio/x-mulaw", 13)||
             !strncmp(mimetype,"audio/x-alaw", 12))
        {
        devsoundsrc->fourcc = 0x31313747; //KMccFourCCIdG711
        }
    else if (!strncmp(mimetype, "audio/ilbc", 10))
        {
        devsoundsrc->fourcc = 0x43424c49; //KMccFourCCIdILBC
        }
    else if (!strncmp(mimetype, "audio/g729", 10))
        {
        devsoundsrc->fourcc = 0x39323747; //KMccFourCCIdG729
        }
    else
        {
        devsoundsrc->fourcc = 0x36315020; //KMMFFourCCCodePCM16
        }

    set_fourcc(devsoundsrc->handle, devsoundsrc->fourcc);
    //gst_debug_log(devsound_debug, GST_LEVEL_LOG, "", "", 0, (GObject *) devsoundsrc, "Before Signal DevSound from STOP",NULL);
    pthread_mutex_lock(&(create_mutex1));
    pthread_cond_signal(&(create_condition1));
    pthread_mutex_unlock(&(create_mutex1));
    //gst_debug_log(devsound_debug, GST_LEVEL_LOG, "", "", 0, (GObject *) devsoundsrc, "After Signal DevSound from STOP ",NULL);
    //gst_debug_log(devsound_debug, GST_LEVEL_LOG, "", "", 0, (GObject *) devsoundsrc, "gst_devsound_src_setcaps EXIT ",NULL);
    return TRUE;
    }
Exemplo n.º 2
0
static int 
_set_video_stream(FileInfo *finfo, MPLS_STREAM *ss)
{
	int nRet = 0;
	BITMAP_INFO_HEADER *bih;

	bih = &finfo->bih;
	finfo->VideoType = _lookup_int(codec_map, ss->coding_type);

	if (finfo->VideoType != 0)
	{
		set_fourcc((char *)&bih->biCompression, (es_stream_type_t)finfo->VideoType);
		switch (ss->coding_type) {
			case 0x01:
			case 0x02:
			case 0xea:
			case 0x1b:
				bih->biHeight = _lookup_int(video_format_map, ss->format);
				finfo->FPS = _lookup_float(video_rate_map, ss->rate);
				nRet = 1;
				break;

			default:
				fprintf(stderr, "unrecognized coding type %02x\n", ss->coding_type);
				break;
		};

		switch (bih->biHeight)
		{
			case 480:
				bih->biWidth = 800;
				break;
			case 576:
				bih->biWidth = 768;
				break;
			case 720:
				bih->biWidth = 1280;
				break;
			case 1080:
				bih->biWidth = 1920;
				break;
			default: 
				nRet = 0;
				break;
		}
	}
	return nRet;
}