Example #1
0
		BeginEnumDescriptors(gb, nType, nLength) {			// ES_info_length
			switch (nType) {
				case DT_ISO_639_LANGUAGE :
					gb.ReadBuffer(DescBuffer, nLength);
					strLanguage = ConvertString (DescBuffer, 3);
					break;
				case DT_AC3_AUDIO :
					pes_stream_type = AUDIO_STREAM_AC3;
					SkipDescriptor (gb, nType, nLength);
					break;
				case DT_EXTENDED_AC3_AUDIO :
					pes_stream_type = AUDIO_STREAM_AC3_PLUS;
					SkipDescriptor (gb, nType, nLength);
					break;
				case DT_SUBTITLING : {
					gb.ReadBuffer(DescBuffer, nLength);
					strLanguage = ConvertString (DescBuffer, 3);
					pes_stream_type = SUBTITLE_STREAM;
				}
				break;
				default :
					SkipDescriptor (gb, nType, nLength);
					break;
			}
		}
Example #2
0
HRESULT CMpeg2DataParser::ParsePMT(CDVBChannel& Channel)
{
    HRESULT hr;
    CComPtr<ISectionList> pSectionList;
    DWORD dwLength;
    PSECTION data;
    WORD wTSID;
    WORD wSectionLength;

    Channel.SetVideoFps(DVB_FPS_NONE);
    Channel.SetVideoChroma(DVB_Chroma_NONE);

    CheckNoLog(m_pData->GetSection((PID)Channel.GetPMT(), SI_PMT, &m_Filter, 15000, &pSectionList));
    CheckNoLog(pSectionList->GetSectionData(0, &dwLength, &data));

    CGolombBuffer gb((BYTE*)data, dwLength);

    // TS_program_map_section()
    CheckNoLog(ParseSIHeader(gb, SI_PMT, wSectionLength, wTSID));

    gb.BitRead(3);                                              // reserved
    Channel.SetPCR((ULONG)gb.BitRead(13));                      // PCR_PID
    gb.BitRead(4);                                              // reserved
    BeginEnumDescriptors(gb, nType, nLength) {                  // for (i=0;i<N;i++) {
        SkipDescriptor(gb, nType, nLength);                     // descriptor()
    }
Example #3
0
HRESULT CMpeg2DataParser::ParseSDT(ULONG ulFreq)
{
	HRESULT					hr;
	CComPtr<ISectionList>	pSectionList;
	DWORD					dwLength;
	PSECTION				data;
	WORD					wTSID;
	WORD					wONID;
	WORD					wSectionLength;

	CheckNoLog (m_pData->GetSection (PID_SDT, SI_SDT, &m_Filter, 5000, &pSectionList));
	CheckNoLog (pSectionList->GetSectionData (0, &dwLength, &data));

	CGolombBuffer	gb ((BYTE*)data, dwLength);

	// service_description_section()
	CheckNoLog (ParseSIHeader (gb, SI_SDT, wSectionLength, wTSID));

	wONID = gb.BitRead(16);												// original_network_id
	gb.BitRead(8);														// reserved_future_use

	while (gb.GetSize() - gb.GetPos() > 4) {
		CDVBChannel			Channel;
		Channel.SetFrequency (ulFreq);
		Channel.SetTSID (wTSID);
		Channel.SetONID (wONID);
		Channel.SetSID  (gb.BitRead(16));								// service_id   uimsbf
		gb.BitRead(6);													// reserved_future_use   bslbf
		gb.BitRead(1);													// EIT_schedule_flag   bslbf
		Channel.SetNowNextFlag(!!gb.BitRead(1));						// EIT_present_following_flag   bslbf
		gb.BitRead(3);													// running_status   uimsbf
		Channel.SetEncrypted (!!gb.BitRead(1));							// free_CA_mode   bslbf

		// Descriptors:
		BeginEnumDescriptors(gb, nType, nLength) {
			switch (nType) {
				case DT_SERVICE :
					gb.BitRead(8);											// service_type
					nLength = gb.BitRead(8);								// service_provider_name_length
					gb.ReadBuffer (DescBuffer, nLength);					// service_provider_name

					nLength = gb.BitRead(8);								// service_name_length
					gb.ReadBuffer (DescBuffer, nLength);					// service_name
					DescBuffer[nLength] = 0;
					Channel.SetName (ConvertString (DescBuffer, nLength));
					TRACE ("%15S %d\n", Channel.GetName(), Channel.GetSID());
					break;
				default :
					SkipDescriptor (gb, nType, nLength);					// descriptor()
					break;
			}
		}
		EndEnumDescriptors


		if (!Channels.Lookup(Channel.GetSID())) {
			Channels [Channel.GetSID()] = Channel;
		}
	}

	return S_OK;
}