[vdr] VDR - xine - CoreAVC
Reinhard Nissl
rnissl at gmx.de
Thu Jan 24 20:31:06 CET 2008
Hi,
Morfsta schrieb:
> OK, I have added the following code into src/demuxers/demux_mpeg_pes.c
>
> static int32_t GetVideoSize(const uint8_t *buf, int length, int
> *width, int *height)
> {
> int i = 0; // the minimum length of the video packet header
> //i += buf[i] + 1; // possible additional header bytes
> for (; i < length-6; i++) {
> if (buf[i] == 0 && buf[i + 1] == 0 && buf[i + 2] == 1) {
> if(buf[i + 3] == 0xb3) {
> int d = (buf[i+4] << 16) | (buf[i+5] << 8) | buf[i+6];
> *width = (d >> 12);
> *height = (d & 0xfff);
> return 1;
> }
> }
> }
> return 0;
> }
>
> and then put the following code in parse_video_stream: -
>
> int Width, Height;
> if (GetVideoSize(p, payload_size, &Width, &Height)) {
> printf("Detected video size %dx%d\n", Width, Height);
> }
> else {
> printf("Failed to detect video size\n");
> }
>
> before: /* H.264 broadcasts via DVB-S use standard video PES packets,
>
> This detects the video size for MPEG2 broadcasts (Detected video size 704x576
> ), but not for H264, I'm guessing the payload is in a different
> format. Can anyone point me in the direction of a GetVideoSize type of
> function for H264 (I looked in libavcodec and the code looks a bit
> more complex!), or spot what I am doing wrong here?
In H.264, this information in coded far more complex. Have a look
into VDR's h264parser.c. Look for pic_width_in_mbs_minus1,
pic_height_in_map_units_minus1 and frame_crop_*_offset.
You can get the standard from here for free:
http://www.itu.int/rec/T-REC-H.264-200503-I/en
Bye.
--
Dipl.-Inform. (FH) Reinhard Nissl
mailto:rnissl at gmx.de
More information about the vdr
mailing list