mirror of
				https://projects.vdr-developer.org/git/vdr-plugin-softhddevice.git
				synced 2023-10-10 17:16:51 +00:00 
			
		
		
		
	Fix bug: mpeg stills not displayed.
This commit is contained in:
		| @@ -1,6 +1,7 @@ | |||||||
| User johns | User johns | ||||||
| Date: | Date: | ||||||
|  |  | ||||||
|  |     Fix bug: mpeg stills not displayed. | ||||||
|     Detect audio stream type only after stream switch. |     Detect audio stream type only after stream switch. | ||||||
|     Detect more h264 streams with leading zeros. |     Detect more h264 streams with leading zeros. | ||||||
|     VDPAU: support for studio levels added. |     VDPAU: support for studio levels added. | ||||||
|   | |||||||
							
								
								
									
										30
									
								
								softhddev.c
									
									
									
									
									
								
							
							
						
						
									
										30
									
								
								softhddev.c
									
									
									
									
									
								
							| @@ -485,6 +485,7 @@ static void VideoEnqueue(int64_t pts, const void *data, int size) | |||||||
| 	// new + grow reserves FF_INPUT_BUFFER_PADDING_SIZE | 	// new + grow reserves FF_INPUT_BUFFER_PADDING_SIZE | ||||||
| 	av_grow_packet(avpkt, ((size + VIDEO_BUFFER_SIZE / 2) | 	av_grow_packet(avpkt, ((size + VIDEO_BUFFER_SIZE / 2) | ||||||
| 		/ (VIDEO_BUFFER_SIZE / 2)) * (VIDEO_BUFFER_SIZE / 2)); | 		/ (VIDEO_BUFFER_SIZE / 2)) * (VIDEO_BUFFER_SIZE / 2)); | ||||||
|  | 	// FIXME: out of memory! | ||||||
| #ifdef DEBUG | #ifdef DEBUG | ||||||
| 	if (avpkt->size <= avpkt->stream_index + size) { | 	if (avpkt->size <= avpkt->stream_index + size) { | ||||||
| 	    fprintf(stderr, "%d %d %d\n", avpkt->size, avpkt->stream_index, | 	    fprintf(stderr, "%d %d %d\n", avpkt->size, avpkt->stream_index, | ||||||
| @@ -1166,6 +1167,9 @@ void Freeze(void) | |||||||
|  |  | ||||||
| /** | /** | ||||||
| **	Display the given I-frame as a still picture. | **	Display the given I-frame as a still picture. | ||||||
|  | ** | ||||||
|  | **	@param data	pes frame data | ||||||
|  | **	@param size	number of bytes in frame | ||||||
| */ | */ | ||||||
| void StillPicture(const uint8_t * data, int size) | void StillPicture(const uint8_t * data, int size) | ||||||
| { | { | ||||||
| @@ -1178,10 +1182,10 @@ void StillPicture(const uint8_t * data, int size) | |||||||
| 	Error(_("[softhddev] invalid still video packet\n")); | 	Error(_("[softhddev] invalid still video packet\n")); | ||||||
| 	return; | 	return; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     if (VideoCodecID == CODEC_ID_NONE) { |     if (VideoCodecID == CODEC_ID_NONE) { | ||||||
| 	// FIXME: should detect codec, see PlayVideo | 	// FIXME: should detect codec, see PlayVideo | ||||||
| 	Error(_("[softhddev] no codec known for still picture\n")); | 	Error(_("[softhddev] no codec known for still picture\n")); | ||||||
| 	return; |  | ||||||
|     } |     } | ||||||
|     //Clear();				// flush video buffers |     //Clear();				// flush video buffers | ||||||
|  |  | ||||||
| @@ -1191,14 +1195,16 @@ void StillPicture(const uint8_t * data, int size) | |||||||
| 	const uint8_t *split; | 	const uint8_t *split; | ||||||
| 	int n; | 	int n; | ||||||
|  |  | ||||||
| 	// split the I-frame into single pes packets | 	if ((data[3] & 0xF0) == 0xE0) {	// PES packet | ||||||
| 	    split = data; | 	    split = data; | ||||||
| 	    n = size; | 	    n = size; | ||||||
|  | 	    // split the I-frame into single pes packets | ||||||
| 	    do { | 	    do { | ||||||
| 		int len; | 		int len; | ||||||
|  |  | ||||||
| 		len = (split[4] << 8) + split[5]; | 		len = (split[4] << 8) + split[5]; | ||||||
| 	    if (len > n) { | 		if (!len || len + 6 > n) { | ||||||
|  | 		    PlayVideo(split, n);	// feed remaining bytes | ||||||
| 		    break; | 		    break; | ||||||
| 		} | 		} | ||||||
| 		PlayVideo(split, len + 6);	// feed it | 		PlayVideo(split, len + 6);	// feed it | ||||||
| @@ -1208,11 +1214,23 @@ void StillPicture(const uint8_t * data, int size) | |||||||
| 	    VideoNextPacket(VideoCodecID);	// terminate last packet | 	    VideoNextPacket(VideoCodecID);	// terminate last packet | ||||||
|  |  | ||||||
| 	    if (VideoCodecID == CODEC_ID_H264) { | 	    if (VideoCodecID == CODEC_ID_H264) { | ||||||
| 	    VideoEnqueue(AV_NOPTS_VALUE, seq_end_h264, sizeof(seq_end_h264)); | 		VideoEnqueue(AV_NOPTS_VALUE, seq_end_h264, | ||||||
|  | 		    sizeof(seq_end_h264)); | ||||||
| 	    } else { | 	    } else { | ||||||
| 	    VideoEnqueue(AV_NOPTS_VALUE, seq_end_mpeg, sizeof(seq_end_mpeg)); | 		VideoEnqueue(AV_NOPTS_VALUE, seq_end_mpeg, | ||||||
|  | 		    sizeof(seq_end_mpeg)); | ||||||
| 	    } | 	    } | ||||||
| 	    VideoNextPacket(VideoCodecID);	// terminate last packet | 	    VideoNextPacket(VideoCodecID);	// terminate last packet | ||||||
|  | 	} else {			// ES packet | ||||||
|  |  | ||||||
|  | 	    if (VideoCodecID != CODEC_ID_MPEG2VIDEO) { | ||||||
|  | 		VideoNextPacket(CODEC_ID_NONE);	// close last stream | ||||||
|  | 		VideoCodecID = CODEC_ID_MPEG2VIDEO; | ||||||
|  | 	    } | ||||||
|  | 	    VideoEnqueue(AV_NOPTS_VALUE, data, size); | ||||||
|  | 	    VideoEnqueue(AV_NOPTS_VALUE, seq_end_mpeg, sizeof(seq_end_mpeg)); | ||||||
|  | 	    VideoNextPacket(VideoCodecID);	// terminate last packet | ||||||
|  | 	} | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -1497,7 +1515,7 @@ void SoftHdDeviceExit(void) | |||||||
|     StopVideo(); |     StopVideo(); | ||||||
|  |  | ||||||
|     CodecExit(); |     CodecExit(); | ||||||
|     VideoPacketExit(); |     //VideoPacketExit(); | ||||||
|  |  | ||||||
|     if (ConfigStartX11Server) { |     if (ConfigStartX11Server) { | ||||||
| 	Debug(3, "x-setup: Stop x11 server\n"); | 	Debug(3, "x-setup: Stop x11 server\n"); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user