mirror of
				https://github.com/rofafor/vdr-plugin-femon.git
				synced 2023-10-10 11:36:53 +00:00 
			
		
		
		
	Compare commits
	
		
			10 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|  | 4e87693de6 | ||
|  | 8ea980a60f | ||
|  | 5635c2dc52 | ||
|  | 7551788969 | ||
|  | 6b6169d5f3 | ||
|  | 22644e6ae4 | ||
|  | 3fc73af3d5 | ||
|  | c07abc7ed5 | ||
|  | e57b36a151 | ||
|  | 453ca7a2a5 | 
							
								
								
									
										6
									
								
								HISTORY
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								HISTORY
									
									
									
									
									
								
							| @@ -370,3 +370,9 @@ VDR Plugin 'femon' Revision History | ||||
| - Removed OSD offset and height options. | ||||
| - Added PES assembler. | ||||
| - Added bitstream parsers for all codecs. | ||||
|  | ||||
| 2009-09-04: Version 1.7.4 | ||||
|  | ||||
| - Fixed H.264 bitstream parser. | ||||
| - Added a mutex to receiver class. | ||||
| - Added 1080/720/576/480 format symbols into status window. | ||||
|   | ||||
							
								
								
									
										2
									
								
								femon.c
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								femon.c
									
									
									
									
									
								
							| @@ -18,7 +18,7 @@ | ||||
| #error "VDR-1.7.0 API version or greater is required!" | ||||
| #endif | ||||
|  | ||||
| static const char VERSION[]       = "1.7.3"; | ||||
| static const char VERSION[]       = "1.7.4"; | ||||
| static const char DESCRIPTION[]   = trNOOP("DVB Signal Information Monitor (OSD)"); | ||||
| static const char MAINMENUENTRY[] = trNOOP("Signal Information"); | ||||
|  | ||||
|   | ||||
| @@ -89,7 +89,7 @@ enum eAudioCodingMode { | ||||
|  | ||||
| typedef struct audio_info { | ||||
|   eAudioCodec codec;             // enum | ||||
|   double      bitrate;           // kbit/s or eAudioBitrate | ||||
|   double      bitrate;           // bit/s or eAudioBitrate | ||||
|   int         samplingFrequency; // Hz or eAudioSamplingFrequency | ||||
|   int         channelMode;       // eAudioChannelMode | ||||
| } audio_info_t; | ||||
|   | ||||
							
								
								
									
										453
									
								
								femonh264.c
									
									
									
									
									
								
							
							
						
						
									
										453
									
								
								femonh264.c
									
									
									
									
									
								
							| @@ -3,8 +3,6 @@ | ||||
|  * | ||||
|  * See the README file for copyright information and how to reach the author. | ||||
|  * | ||||
|  * The original NAL SPS parsing and bitstream functions are taken from | ||||
|  * vdr-xineliboutput plugin by Petri Hintukainen. | ||||
|  */ | ||||
|  | ||||
| #include "femontools.h" | ||||
| @@ -58,8 +56,11 @@ cFemonH264::cFemonH264(cFemonVideoIf *videohandler) | ||||
|   m_Scan(VIDEO_SCAN_INVALID), | ||||
|   m_CpbDpbDelaysPresentFlag(false), | ||||
|   m_PicStructPresentFlag(false), | ||||
|   m_FrameMbsOnlyFlag(false), | ||||
|   m_MbAdaptiveFrameFieldFlag(false), | ||||
|   m_TimeOffsetLength(0) | ||||
| { | ||||
|   reset(); | ||||
| } | ||||
|  | ||||
| cFemonH264::~cFemonH264() | ||||
| @@ -69,7 +70,7 @@ cFemonH264::~cFemonH264() | ||||
| bool cFemonH264::processVideo(const uint8_t *buf, int len) | ||||
| { | ||||
|   uint8_t nal_data[len]; | ||||
|   bool aud_found = false, sps_found = false, sei_found = false; | ||||
|   bool aud_found = false, sps_found = false, sei_found = true; // SEI temporarily disabled! | ||||
|   const uint8_t *start = buf; | ||||
|   const uint8_t *end = start + len; | ||||
|  | ||||
| @@ -82,6 +83,8 @@ bool cFemonH264::processVideo(const uint8_t *buf, int len) | ||||
|   buf += PesPayloadOffset(buf); | ||||
|   start = buf; | ||||
|  | ||||
|   reset(); | ||||
|  | ||||
|   for (;;) { | ||||
|       int consumed = 0; | ||||
|  | ||||
| @@ -114,7 +117,7 @@ bool cFemonH264::processVideo(const uint8_t *buf, int len) | ||||
|                   sps_found = true; | ||||
|              } | ||||
|              break; | ||||
| #if 0 | ||||
|  | ||||
|         case NAL_SEI: | ||||
|              if (!sei_found) { | ||||
|                //Dprintf("H.264: Found NAL SEI at offset %d/%d", buf - start, len); | ||||
| @@ -124,7 +127,7 @@ bool cFemonH264::processVideo(const uint8_t *buf, int len) | ||||
|                   sei_found = true; | ||||
|              } | ||||
|              break; | ||||
| #endif | ||||
|  | ||||
|         default: | ||||
|              break; | ||||
|         } | ||||
| @@ -138,15 +141,15 @@ bool cFemonH264::processVideo(const uint8_t *buf, int len) | ||||
|   if (aud_found) { | ||||
|      m_VideoHandler->SetVideoCodec(VIDEO_CODEC_H264); | ||||
|      if (sps_found) { | ||||
|         //Dprintf("H.264 SPS: -> video size %dx%d, aspect %d format %d", m_Width, m_Height, m_AspectRatio, m_Format); | ||||
|         //Dprintf("H.264 SPS: size %dx%d, aspect %d format %d framerate %.2f bitrate %.0f", m_Width, m_Height, m_AspectRatio, m_Format, m_FrameRate, m_BitRate); | ||||
|         m_VideoHandler->SetVideoFormat(m_Format); | ||||
|         m_VideoHandler->SetVideoSize(m_Width, m_Height); | ||||
|         m_VideoHandler->SetVideoAspectRatio(m_AspectRatio); | ||||
|         } | ||||
|      if (sei_found) { | ||||
|         //Dprintf("H.264 SEI: -> stream bitrate %.1f, frame rate %.1f scan %d", m_BitRate, m_FrameRate, m_Scan); | ||||
|         m_VideoHandler->SetVideoFramerate(m_FrameRate); | ||||
|         m_VideoHandler->SetVideoBitrate(m_BitRate); | ||||
|         } | ||||
|      if (sei_found) { | ||||
|         //Dprintf("H.264 SEI: scan %d", m_Scan); | ||||
|         m_VideoHandler->SetVideoScan(m_Scan); | ||||
|         } | ||||
|   } | ||||
| @@ -154,6 +157,15 @@ bool cFemonH264::processVideo(const uint8_t *buf, int len) | ||||
|   return aud_found; | ||||
| } | ||||
|  | ||||
| void cFemonH264::reset() | ||||
| { | ||||
|   m_CpbDpbDelaysPresentFlag = false; | ||||
|   m_PicStructPresentFlag = false; | ||||
|   m_FrameMbsOnlyFlag = false; | ||||
|   m_MbAdaptiveFrameFieldFlag = false; | ||||
|   m_TimeOffsetLength = 0; | ||||
| } | ||||
|  | ||||
| const uint8_t *cFemonH264::nextStartCode(const uint8_t *start, const uint8_t *end) | ||||
| { | ||||
|   for (end -= 3; start < end; ++start) { | ||||
| @@ -187,34 +199,252 @@ int cFemonH264::nalUnescape(uint8_t *dst, const uint8_t *src, int len) | ||||
|  | ||||
| int cFemonH264::parseSPS(const uint8_t *buf, int len) | ||||
| { | ||||
|   int profile_idc, pic_order_cnt_type, frame_mbs_only, i, j; | ||||
|   int profile_idc, level_idc, constraint_set3_flag, pic_order_cnt_type, i, j; | ||||
|   cBitStream bs(buf, len); | ||||
|  | ||||
|   unsigned int width = m_Width; | ||||
|   unsigned int height = m_Height; | ||||
|   uint32_t width = m_Width; | ||||
|   uint32_t height = m_Height; | ||||
|   eVideoAspectRatio aspect_ratio = m_AspectRatio; | ||||
|   eVideoFormat format = m_Format; | ||||
|   double frame_rate = m_FrameRate; | ||||
|   double bit_rate = m_BitRate; | ||||
|   bool cpb_dpb_delays_present_flag = m_CpbDpbDelaysPresentFlag; | ||||
|   bool pic_struct_present_flag = m_PicStructPresentFlag; | ||||
|   unsigned int time_offset_length = m_TimeOffsetLength; | ||||
|   bool frame_mbs_only_flag = m_FrameMbsOnlyFlag; | ||||
|   bool mb_adaptive_frame_field_flag = m_MbAdaptiveFrameFieldFlag; | ||||
|   uint32_t time_offset_length = m_TimeOffsetLength; | ||||
|  | ||||
|   profile_idc = bs.getU8(); | ||||
|  | ||||
|   //Dprintf("H.264 SPS: profile_idc %d", profile_idc); | ||||
|  | ||||
|   bs.skipBits(16); | ||||
|   profile_idc = bs.getU8();                 // profile_idc | ||||
|   bs.skipBit();                             // constraint_set0_flag | ||||
|   bs.skipBit();                             // constraint_set1_flag | ||||
|   bs.skipBit();                             // constraint_set2_flag | ||||
|   constraint_set3_flag = bs.getBit();       // constraint_set3_flag | ||||
|   bs.skipBits(4);                           // reserved_zero_4bits | ||||
|   level_idc = bs.getU8();                   // level_idc | ||||
|   bs.skipUeGolomb();                        // seq_parameter_set_id | ||||
|   if (profile_idc >= 100) { | ||||
|   //Dprintf("H.264 SPS: profile_idc %d level_idc %d", profile_idc, level_idc); | ||||
|   switch (profile_idc) { | ||||
|     case 66:                                // baseline profile | ||||
|     case 77:                                // main profile | ||||
|     case 88:                                // extended profile | ||||
|          switch (level_idc) { | ||||
|            case 10:                         // level 1.0 | ||||
|                 bit_rate = 64000; | ||||
|                 break; | ||||
|            case 11:                         // level 1b / 1.1 | ||||
|                 bit_rate = constraint_set3_flag ? 128000 : 192000; | ||||
|                 break; | ||||
|            case 12:                         // level 1.2 | ||||
|                 bit_rate = 384000; | ||||
|                 break; | ||||
|            case 13:                         // level 1.3 | ||||
|                 bit_rate = 768000; | ||||
|                 break; | ||||
|            case 20:                         // level 2.0 | ||||
|                 bit_rate = 2000000; | ||||
|                 break; | ||||
|            case 21:                         // level 2.1 | ||||
|                 bit_rate = 4000000; | ||||
|                 break; | ||||
|            case 22:                         // level 2.2 | ||||
|                 bit_rate = 4000000; | ||||
|                 break; | ||||
|            case 30:                         // level 3.0 | ||||
|                 bit_rate = 10000000; | ||||
|                 break; | ||||
|            case 31:                         // level 3.1 | ||||
|                 bit_rate = 14000000; | ||||
|                 break; | ||||
|            case 32:                         // level 3.2 | ||||
|                 bit_rate = 20000000; | ||||
|                 break; | ||||
|            case 40:                         // level 4.0 | ||||
|                 bit_rate = 20000000; | ||||
|                 break; | ||||
|            case 41:                         // level 4.1 | ||||
|                 bit_rate = 50000000; | ||||
|                 break; | ||||
|            case 42:                         // level 4.2 | ||||
|                 bit_rate = 50000000; | ||||
|                 break; | ||||
|            case 50:                         // level 5.0 | ||||
|                 bit_rate = 135000000; | ||||
|                 break; | ||||
|            case 51:                         // level 5.1 | ||||
|                 bit_rate = 240000000; | ||||
|                 break; | ||||
|            default: | ||||
|                 break; | ||||
|          } | ||||
|          break; | ||||
|     case 100:                               // high profile | ||||
|          switch (level_idc) { | ||||
|            case 10:                         // level 1.0 | ||||
|                 bit_rate = 80000; | ||||
|                 break; | ||||
|            case 11:                         // level 1b / 1.1 | ||||
|                 bit_rate = constraint_set3_flag ? 160000 : 240000; | ||||
|                 break; | ||||
|            case 12:                         // level 1.2 | ||||
|                 bit_rate = 480000; | ||||
|                 break; | ||||
|            case 13:                         // level 1.3 | ||||
|                 bit_rate = 960000; | ||||
|                 break; | ||||
|            case 20:                         // level 2.0 | ||||
|                 bit_rate = 2500000; | ||||
|                 break; | ||||
|            case 21:                         // level 2.1 | ||||
|                 bit_rate = 5000000; | ||||
|                 break; | ||||
|            case 22:                         // level 2.2 | ||||
|                 bit_rate = 5000000; | ||||
|                 break; | ||||
|            case 30:                         // level 3.0 | ||||
|                 bit_rate = 12500000; | ||||
|                 break; | ||||
|            case 31:                         // level 3.1 | ||||
|                 bit_rate = 17500000; | ||||
|                 break; | ||||
|            case 32:                         // level 3.2 | ||||
|                 bit_rate = 25000000; | ||||
|                 break; | ||||
|            case 40:                         // level 4.0 | ||||
|                 bit_rate = 25000000; | ||||
|                 break; | ||||
|            case 41:                         // level 4.1 | ||||
|                 bit_rate = 62500000; | ||||
|                 break; | ||||
|            case 42:                         // level 4.2 | ||||
|                 bit_rate = 62500000; | ||||
|                 break; | ||||
|            case 50:                         // level 5.0 | ||||
|                 bit_rate = 168750000; | ||||
|                 break; | ||||
|            case 51:                         // level 5.1 | ||||
|                 bit_rate = 300000000; | ||||
|                 break; | ||||
|            default: | ||||
|                 break; | ||||
|          } | ||||
|          break; | ||||
|     case 110:                               // high 10 profile | ||||
|          switch (level_idc) { | ||||
|            case 10:                         // level 1.0 | ||||
|                 bit_rate = 192000; | ||||
|                 break; | ||||
|            case 11:                         // level 1b / 1.1 | ||||
|                 bit_rate = constraint_set3_flag ? 384000 : 576000; | ||||
|                 break; | ||||
|            case 12:                         // level 1.2 | ||||
|                 bit_rate = 115200; | ||||
|                 break; | ||||
|            case 13:                         // level 1.3 | ||||
|                 bit_rate = 2304000; | ||||
|                 break; | ||||
|            case 20:                         // level 2.0 | ||||
|                 bit_rate = 6000000; | ||||
|                 break; | ||||
|            case 21:                         // level 2.1 | ||||
|                 bit_rate = 12000000; | ||||
|                 break; | ||||
|            case 22:                         // level 2.2 | ||||
|                 bit_rate = 12000000; | ||||
|                 break; | ||||
|            case 30:                         // level 3.0 | ||||
|                 bit_rate = 30000000; | ||||
|                 break; | ||||
|            case 31:                         // level 3.1 | ||||
|                 bit_rate = 42000000; | ||||
|                 break; | ||||
|            case 32:                         // level 3.2 | ||||
|                 bit_rate = 60000000; | ||||
|                 break; | ||||
|            case 40:                         // level 4.0 | ||||
|                 bit_rate = 60000000; | ||||
|                 break; | ||||
|            case 41:                         // level 4.1 | ||||
|                 bit_rate = 150000000; | ||||
|                 break; | ||||
|            case 42:                         // level 4.2 | ||||
|                 bit_rate = 150000000; | ||||
|                 break; | ||||
|            case 50:                         // level 5.0 | ||||
|                 bit_rate = 405000000; | ||||
|                 break; | ||||
|            case 51:                         // level 5.1 | ||||
|                 bit_rate = 720000000; | ||||
|                 break; | ||||
|            default: | ||||
|                 break; | ||||
|          } | ||||
|          break; | ||||
|     case 122:                               // high 4:2:2 profile | ||||
|     case 144:                               // high 4:4:4 profile | ||||
|          switch (level_idc) { | ||||
|            case 10:                         // level 1.0 | ||||
|                 bit_rate = 256000; | ||||
|                 break; | ||||
|            case 11:                         // level 1b / 1.1 | ||||
|                 bit_rate = constraint_set3_flag ? 512000 : 768000; | ||||
|                 break; | ||||
|            case 12:                         // level 1.2 | ||||
|                 bit_rate = 1536000; | ||||
|                 break; | ||||
|            case 13:                         // level 1.3 | ||||
|                 bit_rate = 3072000; | ||||
|                 break; | ||||
|            case 20:                         // level 2.0 | ||||
|                 bit_rate = 8000000; | ||||
|                 break; | ||||
|            case 21:                         // level 2.1 | ||||
|                 bit_rate = 16000000; | ||||
|                 break; | ||||
|            case 22:                         // level 2.2 | ||||
|                 bit_rate = 16000000; | ||||
|                 break; | ||||
|            case 30:                         // level 3.0 | ||||
|                 bit_rate = 40000000; | ||||
|                 break; | ||||
|            case 31:                         // level 3.1 | ||||
|                 bit_rate = 56000000; | ||||
|                 break; | ||||
|            case 32:                         // level 3.2 | ||||
|                 bit_rate = 80000000; | ||||
|                 break; | ||||
|            case 40:                         // level 4.0 | ||||
|                 bit_rate = 80000000; | ||||
|                 break; | ||||
|            case 41:                         // level 4.1 | ||||
|                 bit_rate = 200000000; | ||||
|                 break; | ||||
|            case 42:                         // level 4.2 | ||||
|                 bit_rate = 200000000; | ||||
|                 break; | ||||
|            case 50:                         // level 5.0 | ||||
|                 bit_rate = 540000000; | ||||
|                 break; | ||||
|            case 51:                         // level 5.1 | ||||
|                 bit_rate = 960000000; | ||||
|                 break; | ||||
|            default: | ||||
|                 break; | ||||
|          } | ||||
|          break; | ||||
|     default: | ||||
|          break; | ||||
|   } | ||||
|   if ((profile_idc == 100) || (profile_idc == 110) || (profile_idc == 122) || (profile_idc == 144)) { | ||||
|      if (bs.getUeGolomb() == 3)             // chroma_format_idc | ||||
|         bs.skipBit();                       // residual_colour_transform_flag | ||||
|      bs.skipUeGolomb();                     // bit_depth_luma - 8 | ||||
|      bs.skipUeGolomb();                     // bit_depth_chroma - 8 | ||||
|      bs.skipBit();                          // transform_bypass | ||||
|      if (bs.getBit()) {                     // seq_scaling_matrix_present | ||||
|         for (i = 0; i < 8; i++) { | ||||
|             if (bs.getBit()) {              // seq_scaling_list_present | ||||
|      bs.skipUeGolomb();                     // bit_depth_luma_minus8 | ||||
|      bs.skipUeGolomb();                     // bit_depth_chroma_minus8 | ||||
|      bs.skipBit();                          // qpprime_y_zero_transform_bypass_flag | ||||
|      if (bs.getBit()) {                     // seq_scaling_matrix_present_flag | ||||
|         for (i = 0; i < 8; ++i) { | ||||
|             if (bs.getBit()) {              // seq_scaling_list_present_flag[i] | ||||
|                int last = 8, next = 8, size = (i < 6) ? 16 : 64; | ||||
|                for (j = 0; j < size; j++) { | ||||
|                for (j = 0; j < size; ++j) { | ||||
|                    if (next) | ||||
|                       next = (last + bs.getSeGolomb()) & 0xff; | ||||
|                    last = next ?: last; | ||||
| @@ -223,67 +453,59 @@ int cFemonH264::parseSPS(const uint8_t *buf, int len) | ||||
|             } | ||||
|         } | ||||
|      } | ||||
|  | ||||
|   bs.skipUeGolomb();                        // log2_max_frame_num - 4 | ||||
|   pic_order_cnt_type = bs.getUeGolomb(); | ||||
|   bs.skipUeGolomb();                        // log2_max_frame_num_minus4 | ||||
|   pic_order_cnt_type = bs.getUeGolomb();    // pic_order_cnt_type | ||||
|   if (pic_order_cnt_type == 0) | ||||
|      bs.skipUeGolomb();                     // log2_max_poc_lsb - 4 | ||||
|      bs.skipUeGolomb();                     // log2_max_pic_order_cnt_lsb_minus4 | ||||
|   else if (pic_order_cnt_type == 1) { | ||||
|      bs.skipBit();                          // delta_pic_order_always_zero | ||||
|      bs.skipSeGolomb();                     // offset_for_non_ref_pic | ||||
|      bs.skipSeGolomb();                     // offset_for_top_to_bottom_field | ||||
|      j = bs.getUeGolomb();                  // num_ref_frames_in_pic_order_cnt_cycle | ||||
|      for (i = 0; i < j; i++) | ||||
|      for (i = 0; i < j; ++i) | ||||
|          bs.skipSeGolomb();                 // offset_for_ref_frame[i] | ||||
|      } | ||||
|   bs.skipUeGolomb();                        // ref_frames | ||||
|   bs.skipBit();                             // gaps_in_frame_num_allowed | ||||
|   width          = bs.getUeGolomb() + 1;    // mbs | ||||
|   height         = bs.getUeGolomb() + 1;    // mbs | ||||
|   frame_mbs_only = bs.getBit(); | ||||
|  | ||||
|   bs.skipUeGolomb();                        // num_ref_frames | ||||
|   bs.skipBit();                             // gaps_in_frame_num_value_allowed_flag | ||||
|   width  = bs.getUeGolomb() + 1;            // pic_width_in_mbs_minus1 | ||||
|   height = bs.getUeGolomb() + 1;            // pic_height_in_mbs_minus1 | ||||
|   frame_mbs_only_flag = bs.getBit();        // frame_mbs_only_flag | ||||
|   //Dprintf("H.264 SPS: pic_width:  %u mbs", width); | ||||
|   //Dprintf("H.264 SPS: pic_height: %u mbs", height); | ||||
|   //Dprintf("H.264 SPS: frame only flag: %d", frame_mbs_only); | ||||
|  | ||||
|   //Dprintf("H.264 SPS: frame only flag: %d", frame_mbs_only_flag); | ||||
|   width  *= 16; | ||||
|   height *= 16 * (2 - frame_mbs_only); | ||||
|  | ||||
|   if (!frame_mbs_only) { | ||||
|     if (bs.getBit()) {                      // mb_adaptive_frame_field_flag | ||||
|        //Dprintf("H.264 SPS: MBAFF"); | ||||
|        } | ||||
|     } | ||||
|  | ||||
|   height *= 16 * (frame_mbs_only_flag ? 1 : 2); | ||||
|   if (!frame_mbs_only_flag) | ||||
|      mb_adaptive_frame_field_flag = bs.getBit(); // mb_adaptive_frame_field_flag | ||||
|   bs.skipBit();                             // direct_8x8_inference_flag | ||||
|   if (bs.getBit()) {                        // frame_cropping_flag | ||||
|     uint32_t crop_left   = bs.getUeGolomb(); | ||||
|     uint32_t crop_right  = bs.getUeGolomb(); | ||||
|     uint32_t crop_top    = bs.getUeGolomb(); | ||||
|     uint32_t crop_bottom = bs.getUeGolomb(); | ||||
|     //Dprintf("H.264 SPS: cropping %d %d %d %d", crop_left, crop_top, crop_right, crop_bottom); | ||||
|  | ||||
|     width -= 2 * (crop_left + crop_right); | ||||
|     if (frame_mbs_only) | ||||
|        height -= 2 * (crop_top + crop_bottom); | ||||
|     else | ||||
|        height -= 4 * (crop_top + crop_bottom); | ||||
|     } | ||||
|  | ||||
|      uint32_t crop_left, crop_right, crop_top, crop_bottom; | ||||
|      crop_left   = bs.getUeGolomb();        // frame_crop_left_offset | ||||
|      crop_right  = bs.getUeGolomb();        // frame_crop_rigth_offset | ||||
|      crop_top    = bs.getUeGolomb();        // frame_crop_top_offset | ||||
|      crop_bottom = bs.getUeGolomb();        // frame_crop_bottom_offset | ||||
|      //Dprintf("H.264 SPS: cropping %d %d %d %d", crop_left, crop_top, crop_right, crop_bottom); | ||||
|      width -= 2 * (crop_left + crop_right); | ||||
|      if (frame_mbs_only_flag) | ||||
|         height -= 2 * (crop_top + crop_bottom); | ||||
|      else | ||||
|         height -= 4 * (crop_top + crop_bottom); | ||||
|      } | ||||
|   // VUI parameters | ||||
|   if (bs.getBit()) {                        // vui_parameters_present_flag | ||||
|      if (bs.getBit()) {                     // aspect_ratio_info_present | ||||
|         uint32_t aspect_ratio_idc = bs.getU8(); | ||||
|         uint32_t aspect_ratio_idc; | ||||
|         aspect_ratio_idc = bs.getU8();      // aspect_ratio_idc | ||||
|         //Dprintf("H.264 SPS: aspect_ratio_idc %d", aspect_ratio_idc); | ||||
|         if (aspect_ratio_idc == 255) {      // extended sar | ||||
|            bs.skipBit();                    // sar_width | ||||
|            bs.skipBit();                    // sar_height | ||||
|            bs.skipBits(16);                 // sar_width | ||||
|            bs.skipBits(16);                 // sar_height | ||||
|            aspect_ratio = VIDEO_ASPECT_RATIO_EXTENDED; | ||||
|            //Dprintf("H.264 SPS: aspect ratio extended"); | ||||
|            } | ||||
|         else if (aspect_ratio_idc < sizeof(s_AspectRatios) / sizeof(s_AspectRatios[0])) { | ||||
|            aspect_ratio = s_AspectRatios[aspect_ratio_idc]; | ||||
|            //Dprintf("H.264 SPS: -> aspect ratio %d", aspect_ratio); | ||||
|            //Dprintf("H.264 SPS: aspect ratio %d", aspect_ratio); | ||||
|            } | ||||
|         } | ||||
|      if (bs.getBit())                       // overscan_info_present_flag | ||||
| @@ -293,10 +515,9 @@ int cFemonH264::parseSPS(const uint8_t *buf, int len) | ||||
|         video_format = bs.getBits(3);       // video_format | ||||
|         if (video_format < sizeof(s_VideoFormats) / sizeof(s_VideoFormats[0])) { | ||||
|            format = s_VideoFormats[video_format]; | ||||
|            //Dprintf("H.264 SPS: -> video format %d", format); | ||||
|            //Dprintf("H.264 SPS: video format %d", format); | ||||
|            } | ||||
|         bs.skipBit();                       // video_full_range_flag | ||||
|         bs.skipBit();                       // video_full_range_flag | ||||
|         if (bs.getBit()) {                  // colour_description_present_flag | ||||
|            bs.skipBits(8);                  // colour_primaries | ||||
|            bs.skipBits(8);                  // transfer_characteristics | ||||
| @@ -308,8 +529,11 @@ int cFemonH264::parseSPS(const uint8_t *buf, int len) | ||||
|         bs.skipUeGolomb();                  // chroma_sample_loc_type_bottom_field | ||||
|         } | ||||
|      if (bs.getBit()) {                     // timing_info_present_flag | ||||
|         bs.skipBits(32);                    // num_units_in_tick | ||||
|         bs.skipBits(32);                    // time_scale | ||||
|         uint32_t num_units_in_tick, time_scale; | ||||
|         num_units_in_tick = bs.getU32();    // num_units_in_tick | ||||
|         time_scale        = bs.getU32();    // time_scale | ||||
|         if (num_units_in_tick > 0) | ||||
|            frame_rate = time_scale / num_units_in_tick; | ||||
|         bs.skipBit();                       // fixed_frame_rate_flag | ||||
|         } | ||||
|      int nal_hrd_parameters_present_flag = bs.getBit(); // nal_hrd_parameters_present_flag | ||||
| @@ -331,18 +555,18 @@ int cFemonH264::parseSPS(const uint8_t *buf, int len) | ||||
|      int vlc_hrd_parameters_present_flag = bs.getBit(); // vlc_hrd_parameters_present_flag | ||||
|      if (vlc_hrd_parameters_present_flag) { | ||||
|          int cpb_cnt_minus1; | ||||
|          cpb_cnt_minus1 = bs.getUeGolomb();  // cpb_cnt_minus1 | ||||
|          bs.skipBits(4);                     // bit_rate_scale | ||||
|          bs.skipBits(4);                     // cpb_size_scale | ||||
|          cpb_cnt_minus1 = bs.getUeGolomb(); // cpb_cnt_minus1 | ||||
|          bs.skipBits(4);                    // bit_rate_scale | ||||
|          bs.skipBits(4);                    // cpb_size_scale | ||||
|          for (int i = 0; i < cpb_cnt_minus1; ++i) { | ||||
|              bs.skipUeGolomb();              // bit_rate_value_minus1[i] | ||||
|              bs.skipUeGolomb();              // cpb_size_value_minus1[i] | ||||
|              bs.skipBit();                   // cbr_flag[i] | ||||
|              bs.skipUeGolomb();             // bit_rate_value_minus1[i] | ||||
|              bs.skipUeGolomb();             // cpb_size_value_minus1[i] | ||||
|              bs.skipBit();                  // cbr_flag[i] | ||||
|              } | ||||
|          bs.skipBits(5);                     // initial_cpb_removal_delay_length_minus1 | ||||
|          bs.skipBits(5);                     // cpb_removal_delay_length_minus1 | ||||
|          bs.skipBits(5);                     // dpb_output_delay_length_minus1 | ||||
|          time_offset_length = bs.getBits(5); // time_offset_length | ||||
|          bs.skipBits(5);                    // initial_cpb_removal_delay_length_minus1 | ||||
|          bs.skipBits(5);                    // cpb_removal_delay_length_minus1 | ||||
|          bs.skipBits(5);                    // dpb_output_delay_length_minus1 | ||||
|          time_offset_length = bs.getBits(5);// time_offset_length | ||||
|         } | ||||
|      cpb_dpb_delays_present_flag = (nal_hrd_parameters_present_flag | vlc_hrd_parameters_present_flag); | ||||
|      if (cpb_dpb_delays_present_flag) | ||||
| @@ -363,8 +587,12 @@ int cFemonH264::parseSPS(const uint8_t *buf, int len) | ||||
|   m_Height = height; | ||||
|   m_AspectRatio = aspect_ratio; | ||||
|   m_Format = format; | ||||
|   m_FrameRate = frame_rate; | ||||
|   m_BitRate = bit_rate; | ||||
|   m_CpbDpbDelaysPresentFlag = cpb_dpb_delays_present_flag; | ||||
|   m_PicStructPresentFlag = pic_struct_present_flag; | ||||
|   m_FrameMbsOnlyFlag = frame_mbs_only_flag; | ||||
|   m_MbAdaptiveFrameFieldFlag = mb_adaptive_frame_field_flag; | ||||
|   m_TimeOffsetLength = time_offset_length; | ||||
|  | ||||
|   return (bs.getIndex() / 8); | ||||
| @@ -375,24 +603,20 @@ int cFemonH264::parseSEI(const uint8_t *buf, int len) | ||||
|   int num_referenced_subseqs, i; | ||||
|   cBitStream bs(buf, len); | ||||
|  | ||||
|   double frame_rate = m_FrameRate; | ||||
|   double bit_rate = m_BitRate; | ||||
|   eVideoScan scan = m_Scan; | ||||
|  | ||||
|   while ((bs.getIndex() * 8 + 16) < len) {               // sei_message | ||||
|     int lastByte, payloadSize = 0, payloadType = 0; | ||||
|  | ||||
|     // last_payload_type_byte | ||||
|     do { | ||||
|        lastByte = bs.getU8() & 0xFF; | ||||
|        payloadType += lastByte; | ||||
|     } while (lastByte == 0xFF); | ||||
|     } while (lastByte == 0xFF);                          // last_payload_type_byte | ||||
|  | ||||
|     // last_payload_size_byte | ||||
|     do { | ||||
|        lastByte = bs.getU8() & 0xFF; | ||||
|        payloadSize += lastByte; | ||||
|     } while (lastByte == 0xFF); | ||||
|     } while (lastByte == 0xFF);                          // last_payload_size_byte | ||||
|  | ||||
|     switch (payloadType) {                               // sei_payload | ||||
|       case 1:                                            // pic_timing | ||||
| @@ -400,10 +624,34 @@ int cFemonH264::parseSEI(const uint8_t *buf, int len) | ||||
|               bs.skipUeGolomb();                         // cpb_removal_delay | ||||
|               bs.skipUeGolomb();                         // dpb_output_delay | ||||
|               } | ||||
|            if (m_PicStructPresentFlag) {                // pic_struct_present_flag | ||||
|               unsigned int pic_struct = bs.getBits(4);  // pic_struct | ||||
|               if (pic_struct >= (sizeof(s_SeiNumClockTsTable) ) / sizeof(s_SeiNumClockTsTable[0])) | ||||
|            if (m_PicStructPresentFlag) {                 // pic_struct_present_flag | ||||
|               uint32_t pic_struct; | ||||
|               pic_struct = bs.getBits(4);                // pic_struct | ||||
|               if (pic_struct >= (sizeof(s_SeiNumClockTsTable)) / sizeof(s_SeiNumClockTsTable[0])) | ||||
|                  return 0; | ||||
|               if (m_FrameMbsOnlyFlag && !m_MbAdaptiveFrameFieldFlag) | ||||
|                  scan = VIDEO_SCAN_PROGRESSIVE; | ||||
|               else { | ||||
|                  switch (pic_struct) { | ||||
|                    case 0:                               // frame | ||||
|                    case 7:                               // frame doubling | ||||
|                    case 8:                               // frame tripling | ||||
|                         scan = VIDEO_SCAN_PROGRESSIVE; | ||||
|                         break; | ||||
|                    case 1:                               // top | ||||
|                    case 2:                               // bottom | ||||
|                    case 3:                               // top bottom | ||||
|                    case 4:                               // bottom top | ||||
|                    case 5:                               // top bottom top | ||||
|                    case 6:                               // bottom top bottom | ||||
|                         scan = VIDEO_SCAN_INTERLACED; | ||||
|                         break; | ||||
|                    default: | ||||
|                         scan = VIDEO_SCAN_RESERVED; | ||||
|                         break; | ||||
|                    } | ||||
|                 } | ||||
|               //Dprintf("H.264 SEI: pic struct %d scan type %d", pic_struct, scan); | ||||
|               for (int i = 0; i < s_SeiNumClockTsTable[pic_struct]; ++i) { | ||||
|                   if (bs.getBit()) {                     // clock_timestamp_flag[i] | ||||
|                      int full_timestamp_flag; | ||||
| @@ -421,7 +669,7 @@ int cFemonH264::parseSEI(const uint8_t *buf, int len) | ||||
|                             scan = VIDEO_SCAN_RESERVED; | ||||
|                             break; | ||||
|                        } | ||||
|                      //Dprintf("\nH.264 SEI: -> scan type %d", bit_rate, scan); | ||||
|                      //Dprintf("H.264 SEI: scan type %d", scan); | ||||
|                      bs.skipBit();                       // nuit_field_based_flag | ||||
|                      bs.skipBits(5);                     // counting_type | ||||
|                      full_timestamp_flag = bs.getBit();  // full_timestamp_flag | ||||
| @@ -450,22 +698,21 @@ int cFemonH264::parseSEI(const uint8_t *buf, int len) | ||||
|               } | ||||
|            break; | ||||
|  | ||||
|       case 12:                                          // sub_seq_characteristics | ||||
|            bs.skipUeGolomb();                           // sub_seq_layer_num | ||||
|            bs.skipUeGolomb();                           // sub_seq_id | ||||
|            if (bs.getBit())                             // duration_flag | ||||
|               bs.skipBits(32);                          // sub_seq_duration | ||||
|            if (bs.getBit()) {                           // average_rate_flag | ||||
|               bs.skipBit();                             // accurate_statistics_flag | ||||
|               bit_rate   = bs.getU16() / 1048.51;       // average_bit_rate (1000 bit/s -> Mbit/s) | ||||
|               frame_rate = bs.getU16() / 256.0;         // average_frame_rate (frames/256s) | ||||
|               //Dprintf("\nH.264 SEI: -> stream bitrate %.1f, frame rate %.1f", bit_rate, frame_rate); | ||||
|       case 12:                                           // sub_seq_characteristics | ||||
|            bs.skipUeGolomb();                            // sub_seq_layer_num | ||||
|            bs.skipUeGolomb();                            // sub_seq_id | ||||
|            if (bs.getBit())                              // duration_flag | ||||
|               bs.skipBits(32);                           // sub_seq_duration | ||||
|            if (bs.getBit()) {                            // average_rate_flag | ||||
|               bs.skipBit();                              // accurate_statistics_flag | ||||
|               bs.skipBits(16);                           // average_bit_rate (1000 bit/s) | ||||
|               bs.skipBits(16);                           // average_frame_rate (frames per 256s) | ||||
|               } | ||||
|            num_referenced_subseqs = bs.getUeGolomb();   // num_referenced_subseqs | ||||
|            num_referenced_subseqs = bs.getUeGolomb();    // num_referenced_subseqs | ||||
|            for (i = 0; i < num_referenced_subseqs; ++i) { | ||||
|                bs.skipUeGolomb();                       // ref_sub_seq_layer_num | ||||
|                bs.skipUeGolomb();                       // ref_sub_seq_id | ||||
|                bs.getBit();                             // ref_sub_seq_direction | ||||
|                bs.skipUeGolomb();                        // ref_sub_seq_layer_num | ||||
|                bs.skipUeGolomb();                        // ref_sub_seq_id | ||||
|                bs.getBit();                              // ref_sub_seq_direction | ||||
|                } | ||||
|            break; | ||||
|  | ||||
| @@ -478,8 +725,6 @@ int cFemonH264::parseSEI(const uint8_t *buf, int len) | ||||
|     bs.byteAlign(); | ||||
|     } | ||||
|  | ||||
|   m_FrameRate = frame_rate; | ||||
|   m_BitRate = bit_rate; | ||||
|   m_Scan = scan; | ||||
|  | ||||
|   return (bs.getIndex() / 8); | ||||
|   | ||||
							
								
								
									
										33
									
								
								femonh264.h
									
									
									
									
									
								
							
							
						
						
									
										33
									
								
								femonh264.h
									
									
									
									
									
								
							| @@ -19,26 +19,29 @@ private: | ||||
|     NAL_END_SEQ = 0x0A  // End of Sequence | ||||
|   }; | ||||
|  | ||||
|   cFemonVideoIf *m_VideoHandler; | ||||
|   unsigned int m_Width; | ||||
|   unsigned int m_Height; | ||||
|   cFemonVideoIf    *m_VideoHandler; | ||||
|   uint32_t          m_Width; | ||||
|   uint32_t          m_Height; | ||||
|   eVideoAspectRatio m_AspectRatio; | ||||
|   eVideoFormat m_Format; | ||||
|   double m_FrameRate; | ||||
|   double m_BitRate; | ||||
|   eVideoScan m_Scan; | ||||
|   bool m_CpbDpbDelaysPresentFlag; | ||||
|   bool m_PicStructPresentFlag; | ||||
|   unsigned int m_TimeOffsetLength; | ||||
|   eVideoFormat      m_Format; | ||||
|   double            m_FrameRate; | ||||
|   double            m_BitRate; | ||||
|   eVideoScan        m_Scan; | ||||
|   bool              m_CpbDpbDelaysPresentFlag; | ||||
|   bool              m_PicStructPresentFlag; | ||||
|   bool              m_FrameMbsOnlyFlag; | ||||
|   bool              m_MbAdaptiveFrameFieldFlag; | ||||
|   uint32_t          m_TimeOffsetLength; | ||||
|  | ||||
|   void           reset(); | ||||
|   const uint8_t *nextStartCode(const uint8_t *start, const uint8_t *end); | ||||
|   int nalUnescape(uint8_t *dst, const uint8_t *src, int len); | ||||
|   int parseSPS(const uint8_t *buf, int len); | ||||
|   int parseSEI(const uint8_t *buf, int len); | ||||
|   int            nalUnescape(uint8_t *dst, const uint8_t *src, int len); | ||||
|   int            parseSPS(const uint8_t *buf, int len); | ||||
|   int            parseSEI(const uint8_t *buf, int len); | ||||
|  | ||||
|   static const eVideoAspectRatio s_AspectRatios[]; | ||||
|   static const eVideoFormat s_VideoFormats[]; | ||||
|   static const uint8_t s_SeiNumClockTsTable[9]; | ||||
|   static const eVideoFormat      s_VideoFormats[]; | ||||
|   static const uint8_t           s_SeiNumClockTsTable[9]; | ||||
|  | ||||
| public: | ||||
|   cFemonH264(cFemonVideoIf *videohandler); | ||||
|   | ||||
							
								
								
									
										13
									
								
								femonosd.c
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								femonosd.c
									
									
									
									
									
								
							| @@ -247,6 +247,7 @@ void cFemonOsd::DrawStatusWindow(void) | ||||
|        case 5:  bm = &bmSymbol[SYMBOL_FIVE];  break; | ||||
|        case 6:  bm = &bmSymbol[SYMBOL_SIX];   break; | ||||
|        case 7:  bm = &bmSymbol[SYMBOL_SEVEN]; break; | ||||
|        case 8:  bm = &bmSymbol[SYMBOL_EIGHT]; break; | ||||
|        default: bm = &bmSymbol[SYMBOL_ZERO];  break; | ||||
|        } | ||||
|      OSDDRAWSTATUSBM(OSDSPACING); | ||||
| @@ -261,6 +262,7 @@ void cFemonOsd::DrawStatusWindow(void) | ||||
|            case 5:  bm = &bmSymbol[SYMBOL_FIVE];  break; | ||||
|            case 6:  bm = &bmSymbol[SYMBOL_SIX];   break; | ||||
|            case 7:  bm = &bmSymbol[SYMBOL_SEVEN]; break; | ||||
|            case 8:  bm = &bmSymbol[SYMBOL_EIGHT]; break; | ||||
|            default: bm = &bmSymbol[SYMBOL_ZERO];  break; | ||||
|            } | ||||
|         OSDDRAWSTATUSBM(OSDSPACING); | ||||
| @@ -278,6 +280,17 @@ void cFemonOsd::DrawStatusWindow(void) | ||||
|         OSDDRAWSTATUSBM(OSDSPACING); | ||||
|         } | ||||
|      if (m_Receiver) { | ||||
|         if (abs(m_Receiver->VideoVerticalSize() - 1080) < 20) | ||||
|            bm = &bmSymbol[SYMBOL_FORMAT_1080]; | ||||
|         else if (abs(m_Receiver->VideoVerticalSize() - 720) < 20) | ||||
|            bm = &bmSymbol[SYMBOL_FORMAT_720]; | ||||
|         else if (abs(m_Receiver->VideoVerticalSize() - 576) < 20) | ||||
|            bm = &bmSymbol[SYMBOL_FORMAT_576]; | ||||
|         else if (abs(m_Receiver->VideoVerticalSize() - 480) < 20) | ||||
|            bm = &bmSymbol[SYMBOL_FORMAT_480]; | ||||
|         else | ||||
|            bm = NULL; | ||||
|         OSDDRAWSTATUSBM(OSDSPACING); | ||||
|         switch (m_Receiver->VideoCodec()) { | ||||
|            case VIDEO_CODEC_MPEG2: bm = &bmSymbol[SYMBOL_MPEG2]; break; | ||||
|            case VIDEO_CODEC_H264:  bm = &bmSymbol[SYMBOL_H264];  break; | ||||
|   | ||||
| @@ -13,6 +13,7 @@ | ||||
| cFemonReceiver::cFemonReceiver(tChannelID ChannelID, int Ca, int Vtype, int Vpid, int Apid[], int Dpid[]) | ||||
| : cReceiver(ChannelID, -1, Vpid, Apid, Dpid, NULL), | ||||
|   cThread("femon receiver"), | ||||
|   m_Mutex(), | ||||
|   m_Sleep(), | ||||
|   m_Active(false), | ||||
|   m_DetectH264(this), | ||||
|   | ||||
							
								
								
									
										150
									
								
								femonreceiver.h
									
									
									
									
									
								
							
							
						
						
									
										150
									
								
								femonreceiver.h
									
									
									
									
									
								
							| @@ -21,6 +21,7 @@ | ||||
|  | ||||
| class cFemonReceiver : public cReceiver, public cThread, public cFemonVideoIf, public cFemonAudioIf, public cFemonAC3If { | ||||
| private: | ||||
|   cMutex        m_Mutex; | ||||
|   cCondWait     m_Sleep; | ||||
|   bool          m_Active; | ||||
|  | ||||
| @@ -57,66 +58,115 @@ protected: | ||||
|   virtual void Action(void); | ||||
|  | ||||
| public: | ||||
|   virtual void SetVideoCodec(eVideoCodec codec)                   { m_VideoInfo.codec       = codec; } | ||||
|   virtual void SetVideoFormat(eVideoFormat format)                { m_VideoInfo.format      = format; } | ||||
|   virtual void SetVideoScan(eVideoScan scan)                      { m_VideoInfo.scan        = scan; } | ||||
|   virtual void SetVideoAspectRatio(eVideoAspectRatio aspectratio) { m_VideoInfo.aspectRatio = aspectratio; } | ||||
|   virtual void SetVideoSize(int width, int height)                { m_VideoInfo.width       = width; | ||||
|                                                                     m_VideoInfo.height      = height; } | ||||
|   virtual void SetVideoFramerate(double framerate)                { m_VideoInfo.frameRate   = framerate; } | ||||
|   virtual void SetVideoBitrate(double bitrate)                    { m_VideoInfo.bitrate     = bitrate; } | ||||
|   virtual void SetVideoCodec(eVideoCodec codec)                   { cMutexLock MutexLock(&m_Mutex); | ||||
|                                                                     m_VideoInfo.codec = codec; } | ||||
|   virtual void SetVideoFormat(eVideoFormat format)                { cMutexLock MutexLock(&m_Mutex); | ||||
|                                                                     m_VideoInfo.format = format; } | ||||
|   virtual void SetVideoScan(eVideoScan scan)                      { cMutexLock MutexLock(&m_Mutex); | ||||
|                                                                     m_VideoInfo.scan = scan; } | ||||
|   virtual void SetVideoAspectRatio(eVideoAspectRatio aspectratio) { cMutexLock MutexLock(&m_Mutex); | ||||
|                                                                     m_VideoInfo.aspectRatio = aspectratio; } | ||||
|   virtual void SetVideoSize(int width, int height)                { cMutexLock MutexLock(&m_Mutex); | ||||
|                                                                     m_VideoInfo.width  = width; | ||||
|                                                                     m_VideoInfo.height = height; } | ||||
|   virtual void SetVideoFramerate(double framerate)                { cMutexLock MutexLock(&m_Mutex); | ||||
|                                                                     m_VideoInfo.frameRate = framerate; } | ||||
|   virtual void SetVideoBitrate(double bitrate)                    { cMutexLock MutexLock(&m_Mutex); | ||||
|                                                                     m_VideoInfo.bitrate = bitrate; } | ||||
|  | ||||
|   virtual void SetAudioCodec(eAudioCodec codec)        { m_AudioInfo.codec = codec; } | ||||
|   virtual void SetAudioBitrate(double bitrate)         { m_AudioInfo.bitrate = bitrate; } | ||||
|   virtual void SetAudioSamplingFrequency(int sampling) { m_AudioInfo.samplingFrequency = sampling; } | ||||
|   virtual void SetAudioChannel(eAudioChannelMode mode) { m_AudioInfo.channelMode = mode; } | ||||
|   virtual void SetAudioCodec(eAudioCodec codec)        { cMutexLock MutexLock(&m_Mutex); | ||||
|                                                          m_AudioInfo.codec = codec; } | ||||
|   virtual void SetAudioBitrate(double bitrate)         { cMutexLock MutexLock(&m_Mutex); | ||||
|                                                          m_AudioInfo.bitrate = bitrate; } | ||||
|   virtual void SetAudioSamplingFrequency(int sampling) { cMutexLock MutexLock(&m_Mutex); | ||||
|                                                          m_AudioInfo.samplingFrequency = sampling; } | ||||
|   virtual void SetAudioChannel(eAudioChannelMode mode) { cMutexLock MutexLock(&m_Mutex); | ||||
|                                                          m_AudioInfo.channelMode = mode; } | ||||
|  | ||||
|   virtual void SetAC3Bitrate(int bitrate)            { m_AC3Info.bitrate = bitrate; } | ||||
|   virtual void SetAC3SamplingFrequency(int sampling) { m_AC3Info.samplingFrequency = sampling; } | ||||
|   virtual void SetAC3Bitstream(int mode)             { m_AC3Info.bitstreamMode = mode; } | ||||
|   virtual void SetAC3AudioCoding(int mode)           { m_AC3Info.audioCodingMode = mode; } | ||||
|   virtual void SetAC3DolbySurround(int mode)         { m_AC3Info.dolbySurroundMode = mode; } | ||||
|   virtual void SetAC3CenterMix(int level)            { m_AC3Info.centerMixLevel = level; } | ||||
|   virtual void SetAC3SurroundMix(int level)          { m_AC3Info.surroundMixLevel = level; } | ||||
|   virtual void SetAC3Dialog(int level)               { m_AC3Info.dialogLevel = level; } | ||||
|   virtual void SetAC3LFE(bool onoff)                 { m_AC3Info.lfe = onoff; } | ||||
|   virtual void SetAC3Bitrate(int bitrate)            { cMutexLock MutexLock(&m_Mutex); | ||||
|                                                        m_AC3Info.bitrate = bitrate; } | ||||
|   virtual void SetAC3SamplingFrequency(int sampling) { cMutexLock MutexLock(&m_Mutex); | ||||
|                                                        m_AC3Info.samplingFrequency = sampling; } | ||||
|   virtual void SetAC3Bitstream(int mode)             { cMutexLock MutexLock(&m_Mutex); | ||||
|                                                        m_AC3Info.bitstreamMode = mode; } | ||||
|   virtual void SetAC3AudioCoding(int mode)           { cMutexLock MutexLock(&m_Mutex); | ||||
|                                                        m_AC3Info.audioCodingMode = mode; } | ||||
|   virtual void SetAC3DolbySurround(int mode)         { cMutexLock MutexLock(&m_Mutex); | ||||
|                                                        m_AC3Info.dolbySurroundMode = mode; } | ||||
|   virtual void SetAC3CenterMix(int level)            { cMutexLock MutexLock(&m_Mutex); | ||||
|                                                        m_AC3Info.centerMixLevel = level; } | ||||
|   virtual void SetAC3SurroundMix(int level)          { cMutexLock MutexLock(&m_Mutex); | ||||
|                                                        m_AC3Info.surroundMixLevel = level; } | ||||
|   virtual void SetAC3Dialog(int level)               { cMutexLock MutexLock(&m_Mutex); | ||||
|                                                        m_AC3Info.dialogLevel = level; } | ||||
|   virtual void SetAC3LFE(bool onoff)                 { cMutexLock MutexLock(&m_Mutex); | ||||
|                                                        m_AC3Info.lfe = onoff; } | ||||
|  | ||||
| public: | ||||
|   cFemonReceiver(tChannelID ChannelID, int Ca, int Vtype, int Vpid, int Apid[], int Dpid[]); | ||||
|   virtual ~cFemonReceiver(); | ||||
|   void Deactivate(void); | ||||
|  | ||||
|   bool   VideoValid(void)           { return m_VideoValid; };                  // boolean | ||||
|   double VideoBitrate(void)         { return m_VideoBitrate; };                // bit/s | ||||
|   int    VideoCodec(void)           { return m_VideoInfo.codec; };             // eVideoCodec | ||||
|   int    VideoFormat(void)          { return m_VideoInfo.format; };            // eVideoFormat | ||||
|   int    VideoScan(void)            { return m_VideoInfo.scan; };              // eVideoScan | ||||
|   int    VideoAspectRatio(void)     { return m_VideoInfo.aspectRatio; };       // eVideoAspectRatio | ||||
|   int    VideoHorizontalSize(void)  { return m_VideoInfo.width; };             // pixels | ||||
|   int    VideoVerticalSize(void)    { return m_VideoInfo.height; };            // pixels | ||||
|   double VideoFrameRate(void)       { return m_VideoInfo.frameRate; };         // Hz | ||||
|   double VideoStreamBitrate(void)   { return m_VideoInfo.bitrate; };           // bit/s | ||||
|   bool   VideoValid(void)           { cMutexLock MutexLock(&m_Mutex); | ||||
|                                       return m_VideoValid; };                  // boolean | ||||
|   double VideoBitrate(void)         { cMutexLock MutexLock(&m_Mutex); | ||||
|                                       return m_VideoBitrate; };                // bit/s | ||||
|   int    VideoCodec(void)           { cMutexLock MutexLock(&m_Mutex); | ||||
|                                       return m_VideoInfo.codec; };             // eVideoCodec | ||||
|   int    VideoFormat(void)          { cMutexLock MutexLock(&m_Mutex); | ||||
|                                       return m_VideoInfo.format; };            // eVideoFormat | ||||
|   int    VideoScan(void)            { cMutexLock MutexLock(&m_Mutex); | ||||
|                                       return m_VideoInfo.scan; };              // eVideoScan | ||||
|   int    VideoAspectRatio(void)     { cMutexLock MutexLock(&m_Mutex); | ||||
|                                       return m_VideoInfo.aspectRatio; };       // eVideoAspectRatio | ||||
|   int    VideoHorizontalSize(void)  { cMutexLock MutexLock(&m_Mutex); | ||||
|                                       return m_VideoInfo.width; };             // pixels | ||||
|   int    VideoVerticalSize(void)    { cMutexLock MutexLock(&m_Mutex); | ||||
|                                       return m_VideoInfo.height; };            // pixels | ||||
|   double VideoFrameRate(void)       { cMutexLock MutexLock(&m_Mutex); | ||||
|                                       return m_VideoInfo.frameRate; };         // Hz | ||||
|   double VideoStreamBitrate(void)   { cMutexLock MutexLock(&m_Mutex); | ||||
|                                       return m_VideoInfo.bitrate; };           // bit/s | ||||
|  | ||||
|   bool   AudioValid(void)           { return m_AudioValid; };                  // boolean | ||||
|   double AudioBitrate(void)         { return m_AudioBitrate; };                // bit/s | ||||
|   int    AudioCodec(void)           { return m_AudioInfo.codec; };             // eAudioCodec | ||||
|   int    AudioChannelMode(void)     { return m_AudioInfo.channelMode; };       // eAudioChannelMode | ||||
|   double AudioStreamBitrate(void)   { return m_AudioInfo.bitrate; };           // bit/s or eAudioBitrate | ||||
|   int    AudioSamplingFreq(void)    { return m_AudioInfo.samplingFrequency; }; // Hz or eAudioSamplingFrequency | ||||
|   bool   AudioValid(void)           { cMutexLock MutexLock(&m_Mutex); | ||||
|                                       return m_AudioValid; };                  // boolean | ||||
|   double AudioBitrate(void)         { cMutexLock MutexLock(&m_Mutex); | ||||
|                                       return m_AudioBitrate; };                // bit/s | ||||
|   int    AudioCodec(void)           { cMutexLock MutexLock(&m_Mutex); | ||||
|                                       return m_AudioInfo.codec; };             // eAudioCodec | ||||
|   int    AudioChannelMode(void)     { cMutexLock MutexLock(&m_Mutex); | ||||
|                                       return m_AudioInfo.channelMode; };       // eAudioChannelMode | ||||
|   double AudioStreamBitrate(void)   { cMutexLock MutexLock(&m_Mutex); | ||||
|                                       return m_AudioInfo.bitrate; };           // bit/s or eAudioBitrate | ||||
|   int    AudioSamplingFreq(void)    { cMutexLock MutexLock(&m_Mutex); | ||||
|                                       return m_AudioInfo.samplingFrequency; }; // Hz or eAudioSamplingFrequency | ||||
|  | ||||
|   bool   AC3Valid(void)             { return m_AC3Valid; };                    // boolean | ||||
|   double AC3Bitrate(void)           { return m_AC3Bitrate; };                  // bit/s | ||||
|   double AC3StreamBitrate(void)     { return m_AC3Info.bitrate; };             // bit/s or eAudioBitrate | ||||
|   int    AC3SamplingFreq(void)      { return m_AC3Info.samplingFrequency; };   // Hz or eAudioSamplingFrequency | ||||
|   int    AC3BitStreamMode(void)     { return m_AC3Info.bitstreamMode; };       // 0..7 or eAudioBitstreamMode | ||||
|   int    AC3AudioCodingMode(void)   { return m_AC3Info.audioCodingMode; };     // 0..7 or eAudioCodingMode | ||||
|   bool   AC3_2_0(void)              { return (m_AC3Info.audioCodingMode == AUDIO_CODING_MODE_2_0); }; // boolean | ||||
|   bool   AC3_5_1(void)	            { return (m_AC3Info.audioCodingMode == AUDIO_CODING_MODE_3_2); }; // boolean | ||||
|   int    AC3DolbySurroundMode(void) { return m_AC3Info.dolbySurroundMode; };   // eAudioDolbySurroundMode | ||||
|   int    AC3CenterMixLevel(void)    { return m_AC3Info.centerMixLevel; };      // eAudioCenterMixLevel | ||||
|   int    AC3SurroundMixLevel(void)  { return m_AC3Info.surroundMixLevel; };    // eAudioSurroundMixLevel | ||||
|   int    AC3DialogLevel(void)       { return m_AC3Info.dialogLevel; };         // -dB | ||||
|   bool   AC3Lfe(void)               { return m_AC3Info.lfe; };                 // boolean | ||||
|   bool   AC3Valid(void)             { cMutexLock MutexLock(&m_Mutex); | ||||
|                                       return m_AC3Valid; };                    // boolean | ||||
|   double AC3Bitrate(void)           { cMutexLock MutexLock(&m_Mutex); | ||||
|                                       return m_AC3Bitrate; };                  // bit/s | ||||
|   double AC3StreamBitrate(void)     { cMutexLock MutexLock(&m_Mutex); | ||||
|                                       return m_AC3Info.bitrate; };             // bit/s or eAudioBitrate | ||||
|   int    AC3SamplingFreq(void)      { cMutexLock MutexLock(&m_Mutex); | ||||
|                                       return m_AC3Info.samplingFrequency; };   // Hz or eAudioSamplingFrequency | ||||
|   int    AC3BitStreamMode(void)     { cMutexLock MutexLock(&m_Mutex); | ||||
|                                       return m_AC3Info.bitstreamMode; };       // 0..7 or eAudioBitstreamMode | ||||
|   int    AC3AudioCodingMode(void)   { cMutexLock MutexLock(&m_Mutex); | ||||
|                                       return m_AC3Info.audioCodingMode; };     // 0..7 or eAudioCodingMode | ||||
|   bool   AC3_2_0(void)              { cMutexLock MutexLock(&m_Mutex); | ||||
|                                       return (m_AC3Info.audioCodingMode == AUDIO_CODING_MODE_2_0); }; // boolean | ||||
|   bool   AC3_5_1(void)	            { cMutexLock MutexLock(&m_Mutex); | ||||
|                                       return (m_AC3Info.audioCodingMode == AUDIO_CODING_MODE_3_2); }; // boolean | ||||
|   int    AC3DolbySurroundMode(void) { cMutexLock MutexLock(&m_Mutex); | ||||
|                                       return m_AC3Info.dolbySurroundMode; };   // eAudioDolbySurroundMode | ||||
|   int    AC3CenterMixLevel(void)    { cMutexLock MutexLock(&m_Mutex); | ||||
|                                       return m_AC3Info.centerMixLevel; };      // eAudioCenterMixLevel | ||||
|   int    AC3SurroundMixLevel(void)  { cMutexLock MutexLock(&m_Mutex); | ||||
|                                       return m_AC3Info.surroundMixLevel; };    // eAudioSurroundMixLevel | ||||
|   int    AC3DialogLevel(void)       { cMutexLock MutexLock(&m_Mutex); | ||||
|                                       return m_AC3Info.dialogLevel; };         // -dB | ||||
|   bool   AC3Lfe(void)               { cMutexLock MutexLock(&m_Mutex); | ||||
|                                       return m_AC3Info.lfe; };                 // boolean | ||||
|   }; | ||||
|  | ||||
| #endif //__FEMONRECEIVER_H | ||||
|   | ||||
| @@ -37,6 +37,11 @@ | ||||
| #include "symbols/five.xpm" | ||||
| #include "symbols/six.xpm" | ||||
| #include "symbols/seven.xpm" | ||||
| #include "symbols/eight.xpm" | ||||
| #include "symbols/format1080.xpm" | ||||
| #include "symbols/format720.xpm" | ||||
| #include "symbols/format576.xpm" | ||||
| #include "symbols/format480.xpm" | ||||
|  | ||||
| cBitmap bmSymbol[SYMBOL_MAX_COUNT] = | ||||
| { | ||||
| @@ -69,5 +74,10 @@ cBitmap bmSymbol[SYMBOL_MAX_COUNT] = | ||||
|   cBitmap(four_xpm),           // SYMBOL_FOUR | ||||
|   cBitmap(five_xpm),           // SYMBOL_FIVE | ||||
|   cBitmap(six_xpm),            // SYMBOL_SIX | ||||
|   cBitmap(seven_xpm)           // SYMBOL_SEVEN | ||||
|   cBitmap(seven_xpm),          // SYMBOL_SEVEN | ||||
|   cBitmap(eight_xpm),          // SYMBOL_EIGHT | ||||
|   cBitmap(format1080_xpm),     // SYMBOL_FORMAT_1080 | ||||
|   cBitmap(format720_xpm),      // SYMBOL_FORMAT_720 | ||||
|   cBitmap(format576_xpm),      // SYMBOL_FORMAT_576 | ||||
|   cBitmap(format480_xpm)       // SYMBOL_FORMAT_480 | ||||
| }; | ||||
|   | ||||
| @@ -41,6 +41,11 @@ enum eSymbols { | ||||
|   SYMBOL_FIVE, | ||||
|   SYMBOL_SIX, | ||||
|   SYMBOL_SEVEN, | ||||
|   SYMBOL_EIGHT, | ||||
|   SYMBOL_FORMAT_1080, | ||||
|   SYMBOL_FORMAT_720, | ||||
|   SYMBOL_FORMAT_576, | ||||
|   SYMBOL_FORMAT_480, | ||||
|   SYMBOL_MAX_COUNT | ||||
|   }; | ||||
|  | ||||
|   | ||||
| @@ -66,7 +66,7 @@ typedef struct video_info { | ||||
|   int               width;       // pixels | ||||
|   int               height;      // pixels | ||||
|   double            frameRate;   // Hz | ||||
|   double            bitrate;     // Mbit/s | ||||
|   double            bitrate;     // bit/s | ||||
| } video_info_t; | ||||
|  | ||||
| class cFemonVideoIf { | ||||
|   | ||||
							
								
								
									
										23
									
								
								symbols/eight.xpm
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								symbols/eight.xpm
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,23 @@ | ||||
| /* XPM */ | ||||
| static const char *const eight_xpm[] = { | ||||
| "15 18 2 1", | ||||
| ".	c #FFFFFF", | ||||
| "+	c #000000", | ||||
| "+++++++++++++++", | ||||
| "..............+", | ||||
| ".....++++.....+", | ||||
| "....++++++....+", | ||||
| "....++..++....+", | ||||
| "...++....++...+", | ||||
| "...++....++...+", | ||||
| "....++..++....+", | ||||
| ".....++++.....+", | ||||
| ".....++++.....+", | ||||
| "....++..++....+", | ||||
| "...++....++...+", | ||||
| "...++....++...+", | ||||
| "....++..++....+", | ||||
| "....++++++....+", | ||||
| ".....++++.....+", | ||||
| "..............+", | ||||
| "+++++++++++++++"}; | ||||
							
								
								
									
										23
									
								
								symbols/format1080.xpm
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								symbols/format1080.xpm
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,23 @@ | ||||
| /* XPM */ | ||||
| static const char *const format1080_xpm[] = { | ||||
| "40 18 2 1", | ||||
| ".	c #FFFFFF", | ||||
| "+	c #000000", | ||||
| "++++++++++++++++++++++++++++++++++++++++", | ||||
| "+......................................+", | ||||
| "+......++...++++.....++++.....++++.....+", | ||||
| "+...+++++..++++++...++++++...++++++....+", | ||||
| "+...+++++..++..++...++..++...++..++....+", | ||||
| "+......++.++....++.++....++.++....++...+", | ||||
| "+......++.++....++.++....++.++....++...+", | ||||
| "+......++.++....++..++..++..++....++...+", | ||||
| "+......++.++....++...++++...++....++...+", | ||||
| "+......++.++....++...++++...++....++...+", | ||||
| "+......++.++....++..++..++..++....++...+", | ||||
| "+......++.++....++.++....++.++....++...+", | ||||
| "+......++.++....++.++....++.++....++...+", | ||||
| "+......++..++..++...++..++...++..++....+", | ||||
| "+......++..++++++...++++++...++++++....+", | ||||
| "+......++...++++.....++++.....++++.....+", | ||||
| "+......................................+", | ||||
| "++++++++++++++++++++++++++++++++++++++++"}; | ||||
							
								
								
									
										23
									
								
								symbols/format480.xpm
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								symbols/format480.xpm
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,23 @@ | ||||
| /* XPM */ | ||||
| static const char *const format480_xpm[] = { | ||||
| "35 18 2 1", | ||||
| ".	c #FFFFFF", | ||||
| "+	c #000000", | ||||
| "+++++++++++++++++++++++++++++++++++", | ||||
| "+.................................+", | ||||
| "+.........++....++++.....++++.....+", | ||||
| "+........+++...++++++...++++++....+", | ||||
| "+.......++++...++..++...++..++....+", | ||||
| "+......++.++..++....++.++....++...+", | ||||
| "+.....++..++..++....++.++....++...+", | ||||
| "+.....++..++...++..++..++....++...+", | ||||
| "+....++...++....++++...++....++...+", | ||||
| "+...++....++....++++...++....++...+", | ||||
| "+...+++++++++..++..++..++....++...+", | ||||
| "+...+++++++++.++....++.++....++...+", | ||||
| "+.........++..++....++.++....++...+", | ||||
| "+.........++...++..++...++..++....+", | ||||
| "+.........++...++++++...++++++....+", | ||||
| "+.........++....++++.....++++.....+", | ||||
| "+.................................+", | ||||
| "+++++++++++++++++++++++++++++++++++"}; | ||||
							
								
								
									
										23
									
								
								symbols/format576.xpm
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								symbols/format576.xpm
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,23 @@ | ||||
| /* XPM */ | ||||
| static const char *const format576_xpm[] = { | ||||
| "33 18 2 1", | ||||
| ".	c #FFFFFF", | ||||
| "+	c #000000", | ||||
| "+++++++++++++++++++++++++++++++++", | ||||
| "+...............................+", | ||||
| "+...+++++++.++++++++..++++++....+", | ||||
| "+...+++++++.++++++++.++++++++...+", | ||||
| "+...++......++....++.+++...++...+", | ||||
| "+...++............++.++.........+", | ||||
| "+...++...........+++.++.........+", | ||||
| "+...++++++.......++..++.+++.....+", | ||||
| "+...+++++++......++..+++++++....+", | ||||
| "+...++...+++....+++..+++..+++...+", | ||||
| "+.........++....++...++....++...+", | ||||
| "+.........++....++...++....++...+", | ||||
| "+...++....++...+++...++....++...+", | ||||
| "+...++...+++...++....+++..+++...+", | ||||
| "+...+++++++....++....+++++++....+", | ||||
| "+....+++++.....++.....+++++.....+", | ||||
| "+...............................+", | ||||
| "+++++++++++++++++++++++++++++++++"}; | ||||
							
								
								
									
										23
									
								
								symbols/format720.xpm
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								symbols/format720.xpm
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,23 @@ | ||||
| /* XPM */ | ||||
| static const char *const format720_xpm[] = { | ||||
| "34 18 2 1", | ||||
| ".	c #FFFFFF", | ||||
| "+	c #000000", | ||||
| "++++++++++++++++++++++++++++++++++", | ||||
| "+................................+", | ||||
| "+...++++++++...++++.....++++.....+", | ||||
| "+...++++++++.+++++++...++++++....+", | ||||
| "+...++....++.++....++..++..++....+", | ||||
| "+.........++.......++.++....++...+", | ||||
| "+.........++.......++.++....++...+", | ||||
| "+.........++.......++.++....++...+", | ||||
| "+........++......+++..++....++...+", | ||||
| "+.......+++.....+++...++....++...+", | ||||
| "+.......++.....+++....++....++...+", | ||||
| "+.......++....+++.....++....++...+", | ||||
| "+......+++...+++......++....++...+", | ||||
| "+......++....++........++..++....+", | ||||
| "+......++....++++++++..++++++....+", | ||||
| "+......++....++++++++...++++.....+", | ||||
| "+................................+", | ||||
| "++++++++++++++++++++++++++++++++++"}; | ||||
		Reference in New Issue
	
	Block a user