[FFmpeg-cvslog] r18061 - in trunk/libavformat: rtp_asf.c rtp_asf.h rtpdec.c
rbultje
subversion
Fri Mar 20 02:11:08 CET 2009
Author: rbultje
Date: Fri Mar 20 02:11:08 2009
New Revision: 18061
Log:
Assign the x-pf-asf payload string to be decoded by rtp_asf.c, and add a
SDP line handler that parses the streamID in the SDP so that ASF stream
data can be matched to their respective streams in the RTSP demuxer. See
"[PATCH] RTSP-MS 12/15: ASF payload support" thread on mailinglist.
Modified:
trunk/libavformat/rtp_asf.c
trunk/libavformat/rtp_asf.h
trunk/libavformat/rtpdec.c
Modified: trunk/libavformat/rtp_asf.c
==============================================================================
--- trunk/libavformat/rtp_asf.c Fri Mar 20 02:07:22 2009 (r18060)
+++ trunk/libavformat/rtp_asf.c Fri Mar 20 02:11:08 2009 (r18061)
@@ -27,6 +27,7 @@
#include <libavutil/base64.h>
#include <libavutil/avstring.h>
+#include "rtp.h"
#include "rtp_asf.h"
#include "rtsp.h"
#include "asf.h"
@@ -50,3 +51,41 @@ void ff_wms_parse_sdp_a_line(AVFormatCon
rt->asf_ctx->pb = NULL;
}
}
+
+static int
+asfrtp_parse_sdp_line (AVFormatContext *s, int stream_index,
+ PayloadContext *asf, const char *line)
+{
+ if (av_strstart(line, "stream:", &line)) {
+ RTSPState *rt = s->priv_data;
+
+ s->streams[stream_index]->id = strtol(line, NULL, 10);
+
+ if (rt->asf_ctx) {
+ int i;
+
+ for (i = 0; i < rt->asf_ctx->nb_streams; i++) {
+ if (s->streams[stream_index]->id == rt->asf_ctx->streams[i]->id) {
+ *s->streams[stream_index]->codec =
+ *rt->asf_ctx->streams[i]->codec;
+ rt->asf_ctx->streams[i]->codec->extradata_size = 0;
+ rt->asf_ctx->streams[i]->codec->extradata = NULL;
+ av_set_pts_info(s->streams[stream_index], 32, 1, 1000);
+ }
+ }
+ }
+ }
+
+ return 0;
+}
+
+#define RTP_ASF_HANDLER(n, s, t) \
+RTPDynamicProtocolHandler ff_ms_rtp_ ## n ## _handler = { \
+ s, \
+ t, \
+ CODEC_ID_NONE, \
+ asfrtp_parse_sdp_line, \
+};
+
+RTP_ASF_HANDLER(asf_pfv, "x-asf-pf", CODEC_TYPE_VIDEO);
+RTP_ASF_HANDLER(asf_pfa, "x-asf-pf", CODEC_TYPE_AUDIO);
Modified: trunk/libavformat/rtp_asf.h
==============================================================================
--- trunk/libavformat/rtp_asf.h Fri Mar 20 02:07:22 2009 (r18060)
+++ trunk/libavformat/rtp_asf.h Fri Mar 20 02:11:08 2009 (r18061)
@@ -23,6 +23,7 @@
#define AVFORMAT_RTP_ASF_H
#include "avformat.h"
+#include "rtpdec.h"
/**
* Parse a Windows Media Server-specific SDP line
@@ -32,4 +33,11 @@
*/
void ff_wms_parse_sdp_a_line(AVFormatContext *s, const char *p);
+/**
+ * Handlers for the x-asf-pf payloads (the payload ID for RTP/ASF).
+ * Defined and implemented in rtp_asf.c, registered in rtpdec.c.
+ */
+extern RTPDynamicProtocolHandler ff_ms_rtp_asf_pfv_handler,
+ ff_ms_rtp_asf_pfa_handler;
+
#endif /* AVFORMAT_RTP_ASF_H */
Modified: trunk/libavformat/rtpdec.c
==============================================================================
--- trunk/libavformat/rtpdec.c Fri Mar 20 02:07:22 2009 (r18060)
+++ trunk/libavformat/rtpdec.c Fri Mar 20 02:11:08 2009 (r18061)
@@ -30,6 +30,7 @@
#include "network.h"
#include "rtpdec.h"
+#include "rtp_asf.h"
#include "rtp_h264.h"
//#define DEBUG
@@ -60,6 +61,9 @@ void av_register_rtp_dynamic_payload_han
ff_register_dynamic_payload_handler(&mp4v_es_handler);
ff_register_dynamic_payload_handler(&mpeg4_generic_handler);
ff_register_dynamic_payload_handler(&ff_h264_dynamic_handler);
+
+ ff_register_dynamic_payload_handler(&ff_ms_rtp_asf_pfv_handler);
+ ff_register_dynamic_payload_handler(&ff_ms_rtp_asf_pfa_handler);
}
static int rtcp_parse_packet(RTPDemuxContext *s, const unsigned char *buf, int len)
More information about the ffmpeg-cvslog
mailing list