From 22c1f65fa6d03995be96c107a5bd3b9ee7e54cab Mon Sep 17 00:00:00 2001 From: Luca Abeni Date: Mon, 18 Jan 2010 13:44:12 +0000 Subject: Rename the RTP muxer sources so that the packetisation functions are in rtpenc_*.c files. Originally committed as revision 21284 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavformat/Makefile | 8 ++-- libavformat/rtp_aac.c | 85 --------------------------------- libavformat/rtp_amr.c | 66 ------------------------- libavformat/rtp_h263.c | 80 ------------------------------- libavformat/rtp_mpv.c | 119 ---------------------------------------------- libavformat/rtpenc_aac.c | 85 +++++++++++++++++++++++++++++++++ libavformat/rtpenc_amr.c | 66 +++++++++++++++++++++++++ libavformat/rtpenc_h263.c | 80 +++++++++++++++++++++++++++++++ libavformat/rtpenc_mpv.c | 119 ++++++++++++++++++++++++++++++++++++++++++++++ 9 files changed, 354 insertions(+), 354 deletions(-) delete mode 100644 libavformat/rtp_aac.c delete mode 100644 libavformat/rtp_amr.c delete mode 100644 libavformat/rtp_h263.c delete mode 100644 libavformat/rtp_mpv.c create mode 100644 libavformat/rtpenc_aac.c create mode 100644 libavformat/rtpenc_amr.c create mode 100644 libavformat/rtpenc_h263.c create mode 100644 libavformat/rtpenc_mpv.c (limited to 'libavformat') diff --git a/libavformat/Makefile b/libavformat/Makefile index 18c3f2504d..293f9d36d0 100644 --- a/libavformat/Makefile +++ b/libavformat/Makefile @@ -201,10 +201,10 @@ OBJS-$(CONFIG_ROQ_DEMUXER) += idroq.o OBJS-$(CONFIG_ROQ_MUXER) += raw.o OBJS-$(CONFIG_RPL_DEMUXER) += rpl.o OBJS-$(CONFIG_RTP_MUXER) += rtp.o \ - rtp_aac.o \ - rtp_amr.o \ - rtp_h263.o \ - rtp_mpv.o \ + rtpenc_aac.o \ + rtpenc_amr.o \ + rtpenc_h263.o \ + rtpenc_mpv.o \ rtpenc.o \ rtpenc_h264.o \ avc.o diff --git a/libavformat/rtp_aac.c b/libavformat/rtp_aac.c deleted file mode 100644 index e19b28697e..0000000000 --- a/libavformat/rtp_aac.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - * copyright (c) 2007 Luca Abeni - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "avformat.h" -#include "rtpenc.h" - - -void ff_rtp_send_aac(AVFormatContext *s1, const uint8_t *buff, int size) -{ - RTPMuxContext *s = s1->priv_data; - int len, max_packet_size; - uint8_t *p; - const int max_frames_per_packet = s->max_frames_per_packet ? s->max_frames_per_packet : 5; - const int max_au_headers_size = 2 + 2 * max_frames_per_packet; - - /* skip ADTS header, if present */ - if ((s1->streams[0]->codec->extradata_size) == 0) { - size -= 7; - buff += 7; - } - max_packet_size = s->max_payload_size - max_au_headers_size; - - /* test if the packet must be sent */ - len = (s->buf_ptr - s->buf); - if ((s->num_frames == max_frames_per_packet) || (len && (len + size) > s->max_payload_size)) { - int au_size = s->num_frames * 2; - - p = s->buf + max_au_headers_size - au_size - 2; - if (p != s->buf) { - memmove(p + 2, s->buf + 2, au_size); - } - /* Write the AU header size */ - p[0] = ((au_size * 8) & 0xFF) >> 8; - p[1] = (au_size * 8) & 0xFF; - - ff_rtp_send_data(s1, p, s->buf_ptr - p, 1); - - s->num_frames = 0; - } - if (s->num_frames == 0) { - s->buf_ptr = s->buf + max_au_headers_size; - s->timestamp = s->cur_timestamp; - } - - if (size <= max_packet_size) { - p = s->buf + s->num_frames++ * 2 + 2; - *p++ = size >> 5; - *p = (size & 0x1F) << 3; - memcpy(s->buf_ptr, buff, size); - s->buf_ptr += size; - } else { - int au_size = size; - - max_packet_size = s->max_payload_size - 4; - p = s->buf; - p[0] = 0; - p[1] = 16; - while (size > 0) { - len = FFMIN(size, max_packet_size); - p[2] = au_size >> 5; - p[3] = (au_size & 0x1F) << 3; - memcpy(p + 4, buff, len); - ff_rtp_send_data(s1, p, len + 4, len == size); - size -= len; - buff += len; - } - } -} diff --git a/libavformat/rtp_amr.c b/libavformat/rtp_amr.c deleted file mode 100644 index 367789fccd..0000000000 --- a/libavformat/rtp_amr.c +++ /dev/null @@ -1,66 +0,0 @@ -/* - * RTP packetization for AMR audio - * Copyright (c) 2007 Luca Abeni - * Copyright (c) 2009 Martin Storsjo - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "avformat.h" -#include "rtpenc.h" - -/** - * Packetize AMR frames into RTP packets according to RFC 3267, - * in octet-aligned mode. - */ -void ff_rtp_send_amr(AVFormatContext *s1, const uint8_t *buff, int size) -{ - RTPMuxContext *s = s1->priv_data; - int max_header_toc_size = 1 + s->max_frames_per_packet; - uint8_t *p; - int len; - - /* Test if the packet must be sent. */ - len = s->buf_ptr - s->buf; - if (s->num_frames == s->max_frames_per_packet || (len && len + size - 1 > s->max_payload_size)) { - int header_size = s->num_frames + 1; - p = s->buf + max_header_toc_size - header_size; - if (p != s->buf) - memmove(p, s->buf, header_size); - - ff_rtp_send_data(s1, p, s->buf_ptr - p, 1); - - s->num_frames = 0; - } - - if (!s->num_frames) { - s->buf[0] = 0xf0; - s->buf_ptr = s->buf + max_header_toc_size; - s->timestamp = s->cur_timestamp; - } else { - /* Mark the previous TOC entry as having more entries following. */ - s->buf[1 + s->num_frames - 1] |= 0x80; - } - - /* Copy the frame type and quality bits. */ - s->buf[1 + s->num_frames++] = buff[0] & 0x7C; - buff++; - size--; - memcpy(s->buf_ptr, buff, size); - s->buf_ptr += size; -} - diff --git a/libavformat/rtp_h263.c b/libavformat/rtp_h263.c deleted file mode 100644 index 0ea492106b..0000000000 --- a/libavformat/rtp_h263.c +++ /dev/null @@ -1,80 +0,0 @@ -/* - * RTP packetization for H.263 video - * Copyright (c) 2009 Luca Abeni - * Copyright (c) 2009 Martin Storsjo - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "avformat.h" -#include "rtpenc.h" - -static const uint8_t *find_resync_marker_reverse(const uint8_t *restrict start, - const uint8_t *restrict end) -{ - const uint8_t *p = end - 1; - start += 1; /* Make sure we never return the original start. */ - for (; p > start; p -= 2) { - if (!*p) { - if (!p[ 1] && p[2]) return p; - else if (!p[-1] && p[1]) return p - 1; - } - } - return end; -} - -/** - * Packetize H.263 frames into RTP packets according to RFC 4629 - */ -void ff_rtp_send_h263(AVFormatContext *s1, const uint8_t *buf1, int size) -{ - RTPMuxContext *s = s1->priv_data; - int len, max_packet_size; - uint8_t *q; - - max_packet_size = s->max_payload_size; - - while (size > 0) { - q = s->buf; - if ((buf1[0] == 0) && (buf1[1] == 0)) { - *q++ = 0x04; - buf1 += 2; - size -= 2; - } else { - *q++ = 0; - } - *q++ = 0; - - len = FFMIN(max_packet_size - 2, size); - - /* Look for a better place to split the frame into packets. */ - if (len < size) { - const uint8_t *end = find_resync_marker_reverse(buf1, buf1 + len); - len = end - buf1; - } - - memcpy(q, buf1, len); - q += len; - - /* 90 KHz time stamp */ - s->timestamp = s->cur_timestamp; - ff_rtp_send_data(s1, s->buf, q - s->buf, (len == size)); - - buf1 += len; - size -= len; - } -} diff --git a/libavformat/rtp_mpv.c b/libavformat/rtp_mpv.c deleted file mode 100644 index b23c8f86e8..0000000000 --- a/libavformat/rtp_mpv.c +++ /dev/null @@ -1,119 +0,0 @@ -/* - * RTP packetization for MPEG video - * Copyright (c) 2002 Fabrice Bellard - * Copyright (c) 2007 Luca Abeni - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "libavcodec/mpegvideo.h" -#include "avformat.h" -#include "rtpenc.h" - -/* NOTE: a single frame must be passed with sequence header if - needed. XXX: use slices. */ -void ff_rtp_send_mpegvideo(AVFormatContext *s1, const uint8_t *buf1, int size) -{ - RTPMuxContext *s = s1->priv_data; - int len, h, max_packet_size; - uint8_t *q; - const uint8_t *end = buf1 + size; - int begin_of_slice, end_of_slice, frame_type, temporal_reference; - - max_packet_size = s->max_payload_size; - begin_of_slice = 1; - end_of_slice = 0; - frame_type = 0; - temporal_reference = 0; - - while (size > 0) { - int begin_of_sequence; - - begin_of_sequence = 0; - len = max_packet_size - 4; - - if (len >= size) { - len = size; - end_of_slice = 1; - } else { - const uint8_t *r, *r1; - int start_code; - - r1 = buf1; - while (1) { - start_code = -1; - r = ff_find_start_code(r1, end, &start_code); - if((start_code & 0xFFFFFF00) == 0x100) { - /* New start code found */ - if (start_code == 0x100) { - frame_type = (r[1] & 0x38) >> 3; - temporal_reference = (int)r[0] << 2 | r[1] >> 6; - } - if (start_code == 0x1B8) { - begin_of_sequence = 1; - } - - if (r - buf1 - 4 <= len) { - /* The current slice fits in the packet */ - if (begin_of_slice == 0) { - /* no slice at the beginning of the packet... */ - end_of_slice = 1; - len = r - buf1 - 4; - break; - } - r1 = r; - } else { - if ((r1 - buf1 > 4) && (r - r1 < max_packet_size)) { - len = r1 - buf1 - 4; - end_of_slice = 1; - } - break; - } - } else { - break; - } - } - } - - h = 0; - h |= temporal_reference << 16; - h |= begin_of_sequence << 13; - h |= begin_of_slice << 12; - h |= end_of_slice << 11; - h |= frame_type << 8; - - q = s->buf; - *q++ = h >> 24; - *q++ = h >> 16; - *q++ = h >> 8; - *q++ = h; - - memcpy(q, buf1, len); - q += len; - - /* 90kHz time stamp */ - s->timestamp = s->cur_timestamp; - ff_rtp_send_data(s1, s->buf, q - s->buf, (len == size)); - - buf1 += len; - size -= len; - begin_of_slice = end_of_slice; - end_of_slice = 0; - } -} - - diff --git a/libavformat/rtpenc_aac.c b/libavformat/rtpenc_aac.c new file mode 100644 index 0000000000..e19b28697e --- /dev/null +++ b/libavformat/rtpenc_aac.c @@ -0,0 +1,85 @@ +/* + * copyright (c) 2007 Luca Abeni + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "avformat.h" +#include "rtpenc.h" + + +void ff_rtp_send_aac(AVFormatContext *s1, const uint8_t *buff, int size) +{ + RTPMuxContext *s = s1->priv_data; + int len, max_packet_size; + uint8_t *p; + const int max_frames_per_packet = s->max_frames_per_packet ? s->max_frames_per_packet : 5; + const int max_au_headers_size = 2 + 2 * max_frames_per_packet; + + /* skip ADTS header, if present */ + if ((s1->streams[0]->codec->extradata_size) == 0) { + size -= 7; + buff += 7; + } + max_packet_size = s->max_payload_size - max_au_headers_size; + + /* test if the packet must be sent */ + len = (s->buf_ptr - s->buf); + if ((s->num_frames == max_frames_per_packet) || (len && (len + size) > s->max_payload_size)) { + int au_size = s->num_frames * 2; + + p = s->buf + max_au_headers_size - au_size - 2; + if (p != s->buf) { + memmove(p + 2, s->buf + 2, au_size); + } + /* Write the AU header size */ + p[0] = ((au_size * 8) & 0xFF) >> 8; + p[1] = (au_size * 8) & 0xFF; + + ff_rtp_send_data(s1, p, s->buf_ptr - p, 1); + + s->num_frames = 0; + } + if (s->num_frames == 0) { + s->buf_ptr = s->buf + max_au_headers_size; + s->timestamp = s->cur_timestamp; + } + + if (size <= max_packet_size) { + p = s->buf + s->num_frames++ * 2 + 2; + *p++ = size >> 5; + *p = (size & 0x1F) << 3; + memcpy(s->buf_ptr, buff, size); + s->buf_ptr += size; + } else { + int au_size = size; + + max_packet_size = s->max_payload_size - 4; + p = s->buf; + p[0] = 0; + p[1] = 16; + while (size > 0) { + len = FFMIN(size, max_packet_size); + p[2] = au_size >> 5; + p[3] = (au_size & 0x1F) << 3; + memcpy(p + 4, buff, len); + ff_rtp_send_data(s1, p, len + 4, len == size); + size -= len; + buff += len; + } + } +} diff --git a/libavformat/rtpenc_amr.c b/libavformat/rtpenc_amr.c new file mode 100644 index 0000000000..367789fccd --- /dev/null +++ b/libavformat/rtpenc_amr.c @@ -0,0 +1,66 @@ +/* + * RTP packetization for AMR audio + * Copyright (c) 2007 Luca Abeni + * Copyright (c) 2009 Martin Storsjo + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "avformat.h" +#include "rtpenc.h" + +/** + * Packetize AMR frames into RTP packets according to RFC 3267, + * in octet-aligned mode. + */ +void ff_rtp_send_amr(AVFormatContext *s1, const uint8_t *buff, int size) +{ + RTPMuxContext *s = s1->priv_data; + int max_header_toc_size = 1 + s->max_frames_per_packet; + uint8_t *p; + int len; + + /* Test if the packet must be sent. */ + len = s->buf_ptr - s->buf; + if (s->num_frames == s->max_frames_per_packet || (len && len + size - 1 > s->max_payload_size)) { + int header_size = s->num_frames + 1; + p = s->buf + max_header_toc_size - header_size; + if (p != s->buf) + memmove(p, s->buf, header_size); + + ff_rtp_send_data(s1, p, s->buf_ptr - p, 1); + + s->num_frames = 0; + } + + if (!s->num_frames) { + s->buf[0] = 0xf0; + s->buf_ptr = s->buf + max_header_toc_size; + s->timestamp = s->cur_timestamp; + } else { + /* Mark the previous TOC entry as having more entries following. */ + s->buf[1 + s->num_frames - 1] |= 0x80; + } + + /* Copy the frame type and quality bits. */ + s->buf[1 + s->num_frames++] = buff[0] & 0x7C; + buff++; + size--; + memcpy(s->buf_ptr, buff, size); + s->buf_ptr += size; +} + diff --git a/libavformat/rtpenc_h263.c b/libavformat/rtpenc_h263.c new file mode 100644 index 0000000000..0ea492106b --- /dev/null +++ b/libavformat/rtpenc_h263.c @@ -0,0 +1,80 @@ +/* + * RTP packetization for H.263 video + * Copyright (c) 2009 Luca Abeni + * Copyright (c) 2009 Martin Storsjo + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "avformat.h" +#include "rtpenc.h" + +static const uint8_t *find_resync_marker_reverse(const uint8_t *restrict start, + const uint8_t *restrict end) +{ + const uint8_t *p = end - 1; + start += 1; /* Make sure we never return the original start. */ + for (; p > start; p -= 2) { + if (!*p) { + if (!p[ 1] && p[2]) return p; + else if (!p[-1] && p[1]) return p - 1; + } + } + return end; +} + +/** + * Packetize H.263 frames into RTP packets according to RFC 4629 + */ +void ff_rtp_send_h263(AVFormatContext *s1, const uint8_t *buf1, int size) +{ + RTPMuxContext *s = s1->priv_data; + int len, max_packet_size; + uint8_t *q; + + max_packet_size = s->max_payload_size; + + while (size > 0) { + q = s->buf; + if ((buf1[0] == 0) && (buf1[1] == 0)) { + *q++ = 0x04; + buf1 += 2; + size -= 2; + } else { + *q++ = 0; + } + *q++ = 0; + + len = FFMIN(max_packet_size - 2, size); + + /* Look for a better place to split the frame into packets. */ + if (len < size) { + const uint8_t *end = find_resync_marker_reverse(buf1, buf1 + len); + len = end - buf1; + } + + memcpy(q, buf1, len); + q += len; + + /* 90 KHz time stamp */ + s->timestamp = s->cur_timestamp; + ff_rtp_send_data(s1, s->buf, q - s->buf, (len == size)); + + buf1 += len; + size -= len; + } +} diff --git a/libavformat/rtpenc_mpv.c b/libavformat/rtpenc_mpv.c new file mode 100644 index 0000000000..b23c8f86e8 --- /dev/null +++ b/libavformat/rtpenc_mpv.c @@ -0,0 +1,119 @@ +/* + * RTP packetization for MPEG video + * Copyright (c) 2002 Fabrice Bellard + * Copyright (c) 2007 Luca Abeni + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "libavcodec/mpegvideo.h" +#include "avformat.h" +#include "rtpenc.h" + +/* NOTE: a single frame must be passed with sequence header if + needed. XXX: use slices. */ +void ff_rtp_send_mpegvideo(AVFormatContext *s1, const uint8_t *buf1, int size) +{ + RTPMuxContext *s = s1->priv_data; + int len, h, max_packet_size; + uint8_t *q; + const uint8_t *end = buf1 + size; + int begin_of_slice, end_of_slice, frame_type, temporal_reference; + + max_packet_size = s->max_payload_size; + begin_of_slice = 1; + end_of_slice = 0; + frame_type = 0; + temporal_reference = 0; + + while (size > 0) { + int begin_of_sequence; + + begin_of_sequence = 0; + len = max_packet_size - 4; + + if (len >= size) { + len = size; + end_of_slice = 1; + } else { + const uint8_t *r, *r1; + int start_code; + + r1 = buf1; + while (1) { + start_code = -1; + r = ff_find_start_code(r1, end, &start_code); + if((start_code & 0xFFFFFF00) == 0x100) { + /* New start code found */ + if (start_code == 0x100) { + frame_type = (r[1] & 0x38) >> 3; + temporal_reference = (int)r[0] << 2 | r[1] >> 6; + } + if (start_code == 0x1B8) { + begin_of_sequence = 1; + } + + if (r - buf1 - 4 <= len) { + /* The current slice fits in the packet */ + if (begin_of_slice == 0) { + /* no slice at the beginning of the packet... */ + end_of_slice = 1; + len = r - buf1 - 4; + break; + } + r1 = r; + } else { + if ((r1 - buf1 > 4) && (r - r1 < max_packet_size)) { + len = r1 - buf1 - 4; + end_of_slice = 1; + } + break; + } + } else { + break; + } + } + } + + h = 0; + h |= temporal_reference << 16; + h |= begin_of_sequence << 13; + h |= begin_of_slice << 12; + h |= end_of_slice << 11; + h |= frame_type << 8; + + q = s->buf; + *q++ = h >> 24; + *q++ = h >> 16; + *q++ = h >> 8; + *q++ = h; + + memcpy(q, buf1, len); + q += len; + + /* 90kHz time stamp */ + s->timestamp = s->cur_timestamp; + ff_rtp_send_data(s1, s->buf, q - s->buf, (len == size)); + + buf1 += len; + size -= len; + begin_of_slice = end_of_slice; + end_of_slice = 0; + } +} + + -- cgit v1.2.3