comparison rtp_mpv.c @ 2411:9134c5f663bd libavformat

Backport fix for mpegvideo rtp, fixes Issue119, original fix from Dario Gallucci <dariodotgallucciatpolito.it> in feng
author lu_zero
date Tue, 28 Aug 2007 13:43:39 +0000
parents 18e94e5989d8
children a19cdec5d552
comparison
equal deleted inserted replaced
2410:9b58a031620e 2411:9134c5f663bd
26 void ff_rtp_send_mpegvideo(AVFormatContext *s1, const uint8_t *buf1, int size) 26 void ff_rtp_send_mpegvideo(AVFormatContext *s1, const uint8_t *buf1, int size)
27 { 27 {
28 RTPDemuxContext *s = s1->priv_data; 28 RTPDemuxContext *s = s1->priv_data;
29 AVStream *st = s1->streams[0]; 29 AVStream *st = s1->streams[0];
30 int len, h, max_packet_size; 30 int len, h, max_packet_size;
31 int b=1, e=0;
31 uint8_t *q; 32 uint8_t *q;
32 33
33 max_packet_size = s->max_payload_size; 34 max_packet_size = s->max_payload_size;
34 35
35 while (size > 0) { 36 while (size > 0) {
36 /* XXX: more correct headers */ 37 len = max_packet_size - 4;
38
39 if (len >= size) {
40 len = size;
41 e = 1;
42 }
43
37 h = 0; 44 h = 0;
38 if (st->codec->sub_id == 2) 45 h |= b << 12;
39 h |= 1 << 26; /* mpeg 2 indicator */ 46 h |= e << 11;
47
48 // if (st->codec->sub_id == 2)
49 // h |= 1 << 26; /* mpeg 2 indicator */
50
40 q = s->buf; 51 q = s->buf;
41 *q++ = h >> 24; 52 *q++ = h >> 24;
42 *q++ = h >> 16; 53 *q++ = h >> 16;
43 *q++ = h >> 8; 54 *q++ = h >> 8;
44 *q++ = h; 55 *q++ = h;
45 56
46 if (st->codec->sub_id == 2) { 57 /* if (st->codec->sub_id == 2) {
47 h = 0; 58 h = 0;
48 *q++ = h >> 24; 59 *q++ = h >> 24;
49 *q++ = h >> 16; 60 *q++ = h >> 16;
50 *q++ = h >> 8; 61 *q++ = h >> 8;
51 *q++ = h; 62 *q++ = h;
52 } 63 } */
53
54 len = max_packet_size - (q - s->buf);
55 if (len > size)
56 len = size;
57 64
58 memcpy(q, buf1, len); 65 memcpy(q, buf1, len);
59 q += len; 66 q += len;
60 67
61 /* 90 KHz time stamp */ 68 /* 90 KHz time stamp */