Example #1
0
void
scanwma(struct fidinfo *fidinfo, struct statex *statex)
{
	FILE	*fp;

	fp = efopen(statex->path, "r");
	if (asf_check_header(statex, fp))
		read_asf_header(fidinfo, statex, fp);
	else
		fidinfo->scanned = 0;
	fclose(fp);
}
Example #2
0
int ASFInit(Context_t *context, char *filename)
{
#ifdef DEBUG
	printf("%s::%s\n", FILENAME, __FUNCTION__);
#endif
	int i = 0;

	ds = (demux_stream_t *)malloc(sizeof(demux_stream_t));
	memset(ds, 0, sizeof(demux_stream_t));

	ds->demuxer = (demuxer_t *)malloc(sizeof(demuxer_t));
	memset(ds->demuxer, 0, sizeof(demuxer_t));

	ds->demuxer->audio = (demux_stream_t *)malloc(sizeof(demux_stream_t));
	memset(ds->demuxer->audio, 0, sizeof(demux_stream_t));

	ds->demuxer->video = (demux_stream_t *)malloc(sizeof(demux_stream_t));
	memset(ds->demuxer->video, 0, sizeof(demux_stream_t));

	ds->demuxer->stream = (stream_t *)malloc(sizeof(stream_t));
	memset(ds->demuxer->stream, 0, sizeof(stream_t));

	ds->demuxer->stream->fd = context->playback->fd;

	read(ds->demuxer->stream->fd, ds->demuxer->stream->buffer, 2048);


	ds->demuxer->stream->start_pos	= 0;
	ds->demuxer->stream->flags		= 6;
	ds->demuxer->stream->sector_size	= 0;
	ds->demuxer->stream->buf_pos	= 0;
	ds->demuxer->stream->buf_len	= 2048;
	ds->demuxer->stream->pos		= 2048;
	ds->demuxer->stream->start_pos	= 0;
	ds->demuxer->stream->type		= STREAMTYPE_STREAM;
	ds->demuxer->stream->end_pos = 0;
	ds->demuxer->stream->eof		= 0;
	ds->demuxer->stream->cache_pid	= 0;

	ds->demuxer->video->id = -1;
	ds->demuxer->audio->id = -1;

	//printf("%s::%d\n", __FUNCTION__, __LINE__);
	asf_check_header(ds->demuxer);

	demux_open_asf(ds->demuxer);
	//printf("%s::%d\n", __FUNCTION__, __LINE__);


	for (i = 0; i < MAX_V_STREAMS; i++)
	{
		if (ds->demuxer->v_streams[i] == NULL) continue;

		sh_video = (sh_video_t *)ds->demuxer->v_streams[i];

		if (sh_video)
		{
			printf("V: %d\n", sh_video->vid);

			if (i == 0)
			{
				//ds->demuxer->video->sh = sh_video;
				ds->demuxer->video->id = sh_video->vid;
			}

			char *vcodec = (char *)&sh_video->bih->biCompression;

			printf("biCompression: %s\n", vcodec);

			if (!strncmp(vcodec, "wmv3", 4) || !strncmp(vcodec, "WMV3", 4))
			{
				Track_t Video =
				{
					"eng",
					"V_WMV",
					sh_video->vid,
				};
				context->manager->video->Command(context, MANAGER_ADD, &Video);

			}
			else if (!strncmp(vcodec, "wvc1", 4) || !strncmp(vcodec, "WVC1", 4))
			{
				Track_t Video =
				{
					"eng",
					"V_VC1",
					sh_video->vid,
				};
				context->manager->video->Command(context, MANAGER_ADD, &Video);
			}
		}
	}

	for (i = 0; i < MAX_A_STREAMS; i++)
	{
		if (ds->demuxer->a_streams[i] == NULL) continue;

		sh_audio = (sh_audio_t *)ds->demuxer->a_streams[i];

		if (sh_audio)
		{
			printf("A: %d\n", sh_audio->aid);

			if (i == 0)
			{
				ds->demuxer->audio->id = sh_audio->aid;
				//ds->demuxer->audio->sh = sh_audio;
			}

			printf("WF: 0x%08x\n", sh_audio->wf->wFormatTag);

			if (sh_audio->wf->wFormatTag == 0x161) // WMA2
			{
				Track_t Audio =
				{
					"und",
					"A_WMA",
					sh_audio->aid,
				};
				context->manager->audio->Command(context, MANAGER_ADD, &Audio);
			}
			else if (sh_audio->wf->wFormatTag == 0x162) // WMAP
			{
				Track_t Audio =
				{
					"und",
					"A_WMA",
					sh_audio->aid,
				};
				//Currently not supported
				context->manager->audio->Command(context, MANAGER_ADD, &Audio);
			}


		}
	}

	//exit(0);

	return 0;
}