[FFmpeg-devel] RTP/SVQ3 payload parser
Benoit Fouet
benoit.fouet
Wed Jul 29 09:13:18 CEST 2009
Hi,
On 2009-07-29 00:21, Ronald S. Bultje wrote:
> Hi,
>
> I don't think anyone but gstreamer has this, and the gstreamer one is
> one big hack. I think my code does the right thing.
>
> Oh, so there's some qt-related code in the rtpdec.c part of the patch
> (not part of the added code, but part of the surrounding code), so it
> will not apply cleanly, but I'll fix that when I am allowed to apply,
> it's from another patch in my tree.
>
> Ronald
>
>
Index: ffmpeg-svn/libavformat/rtp_svq3.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ ffmpeg-svn/libavformat/rtp_svq3.c 2009-07-28 18:17:30.000000000 -0400
@@ -0,0 +1,146 @@
[...]
> +/**< return 0 on packet, no more left, 1 on packet, 1 on partial
packet... */
>
no '<'
> +static int
> +sv3v_parse_packet (AVFormatContext *s, PayloadContext *sv, AVStream *st,
> + AVPacket *pkt, uint32_t *timestamp,
> + const uint8_t *buf, int len, int flags)
> +{
> + int res, config_packet, start_packet, end_packet;
> +
res could be moved closer to where it's used
> + if (len < 2)
> + return -1;
you could save some operations if you decremented len by 2 here and
incremented buf by 2 too (not sure how this would affect readability though)
> + config = get_bits(&gb, 3);
> + switch (config) {
> + case 0: st->codec->width = 160; st->codec->height = 128
> /* FIXME: Wiki says 120? */; break;
I'd say 120 too (QQVGA), what did you see that made you think it was 128 ?
> + if (start_packet) {
> + if (sv->pktbuf) {
> + uint8_t *buf;
try to find another name than the already existing buf here.
> Index: ffmpeg-svn/libavformat/rtpdec.c
> ===================================================================
> --- ffmpeg-svn.orig/libavformat/rtpdec.c 2009-07-28
> 15:38:49.000000000 -0400
> +++ ffmpeg-svn/libavformat/rtpdec.c 2009-07-28 15:39:48.000000000
> -0400
(this file is not what I have in my tree, do you have pending things ?)
> @@ -61,6 +61,7 @@
> ff_qt_rtp_aud_handler,
> ff_quicktime_rtp_vid_handler,
> ff_quicktime_rtp_aud_handler;
> +extern RTPDynamicProtocolHandler ff_rtp_sv3v_vid_handler;
>
shouldn't that be in a header file instead ?
> void av_register_rtp_dynamic_payload_handlers(void)
> {
> @@ -76,6 +77,8 @@
> ff_register_dynamic_payload_handler(&ff_qt_rtp_aud_handler);
>
> ff_register_dynamic_payload_handler(&ff_quicktime_rtp_vid_handler);
>
> ff_register_dynamic_payload_handler(&ff_quicktime_rtp_aud_handler);
> +
> + ff_register_dynamic_payload_handler(&ff_rtp_sv3v_vid_handler);
> }
>
> static int rtcp_parse_packet(RTPDemuxContext *s, const unsigned char
> *buf, int len)
Ben
More information about the ffmpeg-devel
mailing list