annotate rtpdec_mpeg4.c @ 6319:258c03dc3307 libavformat

Deprecate av_parse_video_frame_size() and av_parse_video_frame_rate() in favor of the newly added corresponding functions av_parse_video_size() and av_parse_video_rate() defined in libavcore/parseutils.h. This change also adds a linking-time dependency of libavcodec and of libavfilter on libavcore.
author stefano
date Mon, 26 Jul 2010 23:12:28 +0000
parents 7b8b71ff9a76
children 491eea5c52d6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6176
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
1 /**
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
2 * Common code for the RTP depacketization of MPEG-4 formats.
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
3 * Copyright (c) 2010 Fabrice Bellard
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
4 * Romain Degez
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
5 *
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
6 * This file is part of FFmpeg.
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
7 *
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
8 * FFmpeg is free software; you can redistribute it and/or
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
9 * modify it under the terms of the GNU Lesser General Public
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
10 * License as published by the Free Software Foundation; either
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
11 * version 2.1 of the License, or (at your option) any later version.
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
12 *
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
13 * FFmpeg is distributed in the hope that it will be useful,
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
16 * Lesser General Public License for more details.
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
17 *
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
18 * You should have received a copy of the GNU Lesser General Public
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
19 * License along with FFmpeg; if not, write to the Free Software
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
21 */
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
22
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
23 /**
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
24 * @file
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
25 * @brief MPEG4 / RTP Code
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
26 * @author Fabrice Bellard
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
27 * @author Romain Degez
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
28 */
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
29
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
30 #include "rtpdec_mpeg4.h"
6262
7b8b71ff9a76 Move SPACE_CHARS back to libavformat/internal.h
mstorsjo
parents: 6192
diff changeset
31 #include "internal.h"
6176
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
32 #include "libavutil/avstring.h"
6178
7aca26f37b02 rtpdec: Move AAC depacketization code in rtpdec to a proper payload handler
mstorsjo
parents: 6177
diff changeset
33 #include "libavcodec/get_bits.h"
6177
3a0c63aea9e9 RTSP: Move more SDP/FMTP stuff from rtsp.c to rtpdec_mpeg4.c
mstorsjo
parents: 6176
diff changeset
34 #include <strings.h>
3a0c63aea9e9 RTSP: Move more SDP/FMTP stuff from rtsp.c to rtpdec_mpeg4.c
mstorsjo
parents: 6176
diff changeset
35
6179
736165b749f8 RTSP, rtpdec: Move RTPPayloadData into rtpdec_mpeg4 and remove all references to rtp_payload_data in rtpdec and rtsp
mstorsjo
parents: 6178
diff changeset
36 /** Structure listing useful vars to parse RTP packet payload*/
736165b749f8 RTSP, rtpdec: Move RTPPayloadData into rtpdec_mpeg4 and remove all references to rtp_payload_data in rtpdec and rtsp
mstorsjo
parents: 6178
diff changeset
37 struct PayloadContext
736165b749f8 RTSP, rtpdec: Move RTPPayloadData into rtpdec_mpeg4 and remove all references to rtp_payload_data in rtpdec and rtsp
mstorsjo
parents: 6178
diff changeset
38 {
736165b749f8 RTSP, rtpdec: Move RTPPayloadData into rtpdec_mpeg4 and remove all references to rtp_payload_data in rtpdec and rtsp
mstorsjo
parents: 6178
diff changeset
39 int sizelength;
736165b749f8 RTSP, rtpdec: Move RTPPayloadData into rtpdec_mpeg4 and remove all references to rtp_payload_data in rtpdec and rtsp
mstorsjo
parents: 6178
diff changeset
40 int indexlength;
736165b749f8 RTSP, rtpdec: Move RTPPayloadData into rtpdec_mpeg4 and remove all references to rtp_payload_data in rtpdec and rtsp
mstorsjo
parents: 6178
diff changeset
41 int indexdeltalength;
736165b749f8 RTSP, rtpdec: Move RTPPayloadData into rtpdec_mpeg4 and remove all references to rtp_payload_data in rtpdec and rtsp
mstorsjo
parents: 6178
diff changeset
42 int profile_level_id;
736165b749f8 RTSP, rtpdec: Move RTPPayloadData into rtpdec_mpeg4 and remove all references to rtp_payload_data in rtpdec and rtsp
mstorsjo
parents: 6178
diff changeset
43 int streamtype;
736165b749f8 RTSP, rtpdec: Move RTPPayloadData into rtpdec_mpeg4 and remove all references to rtp_payload_data in rtpdec and rtsp
mstorsjo
parents: 6178
diff changeset
44 int objecttype;
736165b749f8 RTSP, rtpdec: Move RTPPayloadData into rtpdec_mpeg4 and remove all references to rtp_payload_data in rtpdec and rtsp
mstorsjo
parents: 6178
diff changeset
45 char *mode;
736165b749f8 RTSP, rtpdec: Move RTPPayloadData into rtpdec_mpeg4 and remove all references to rtp_payload_data in rtpdec and rtsp
mstorsjo
parents: 6178
diff changeset
46
736165b749f8 RTSP, rtpdec: Move RTPPayloadData into rtpdec_mpeg4 and remove all references to rtp_payload_data in rtpdec and rtsp
mstorsjo
parents: 6178
diff changeset
47 /** mpeg 4 AU headers */
736165b749f8 RTSP, rtpdec: Move RTPPayloadData into rtpdec_mpeg4 and remove all references to rtp_payload_data in rtpdec and rtsp
mstorsjo
parents: 6178
diff changeset
48 struct AUHeaders {
736165b749f8 RTSP, rtpdec: Move RTPPayloadData into rtpdec_mpeg4 and remove all references to rtp_payload_data in rtpdec and rtsp
mstorsjo
parents: 6178
diff changeset
49 int size;
736165b749f8 RTSP, rtpdec: Move RTPPayloadData into rtpdec_mpeg4 and remove all references to rtp_payload_data in rtpdec and rtsp
mstorsjo
parents: 6178
diff changeset
50 int index;
736165b749f8 RTSP, rtpdec: Move RTPPayloadData into rtpdec_mpeg4 and remove all references to rtp_payload_data in rtpdec and rtsp
mstorsjo
parents: 6178
diff changeset
51 int cts_flag;
736165b749f8 RTSP, rtpdec: Move RTPPayloadData into rtpdec_mpeg4 and remove all references to rtp_payload_data in rtpdec and rtsp
mstorsjo
parents: 6178
diff changeset
52 int cts;
736165b749f8 RTSP, rtpdec: Move RTPPayloadData into rtpdec_mpeg4 and remove all references to rtp_payload_data in rtpdec and rtsp
mstorsjo
parents: 6178
diff changeset
53 int dts_flag;
736165b749f8 RTSP, rtpdec: Move RTPPayloadData into rtpdec_mpeg4 and remove all references to rtp_payload_data in rtpdec and rtsp
mstorsjo
parents: 6178
diff changeset
54 int dts;
736165b749f8 RTSP, rtpdec: Move RTPPayloadData into rtpdec_mpeg4 and remove all references to rtp_payload_data in rtpdec and rtsp
mstorsjo
parents: 6178
diff changeset
55 int rap_flag;
736165b749f8 RTSP, rtpdec: Move RTPPayloadData into rtpdec_mpeg4 and remove all references to rtp_payload_data in rtpdec and rtsp
mstorsjo
parents: 6178
diff changeset
56 int streamstate;
736165b749f8 RTSP, rtpdec: Move RTPPayloadData into rtpdec_mpeg4 and remove all references to rtp_payload_data in rtpdec and rtsp
mstorsjo
parents: 6178
diff changeset
57 } *au_headers;
736165b749f8 RTSP, rtpdec: Move RTPPayloadData into rtpdec_mpeg4 and remove all references to rtp_payload_data in rtpdec and rtsp
mstorsjo
parents: 6178
diff changeset
58 int au_headers_allocated;
736165b749f8 RTSP, rtpdec: Move RTPPayloadData into rtpdec_mpeg4 and remove all references to rtp_payload_data in rtpdec and rtsp
mstorsjo
parents: 6178
diff changeset
59 int nb_au_headers;
736165b749f8 RTSP, rtpdec: Move RTPPayloadData into rtpdec_mpeg4 and remove all references to rtp_payload_data in rtpdec and rtsp
mstorsjo
parents: 6178
diff changeset
60 int au_headers_length_bytes;
736165b749f8 RTSP, rtpdec: Move RTPPayloadData into rtpdec_mpeg4 and remove all references to rtp_payload_data in rtpdec and rtsp
mstorsjo
parents: 6178
diff changeset
61 int cur_au_index;
736165b749f8 RTSP, rtpdec: Move RTPPayloadData into rtpdec_mpeg4 and remove all references to rtp_payload_data in rtpdec and rtsp
mstorsjo
parents: 6178
diff changeset
62 };
6176
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
63
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
64 /* return the length and optionally the data */
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
65 static int hex_to_data(uint8_t *data, const char *p)
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
66 {
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
67 int c, len, v;
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
68
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
69 len = 0;
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
70 v = 1;
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
71 for (;;) {
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
72 p += strspn(p, SPACE_CHARS);
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
73 if (*p == '\0')
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
74 break;
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
75 c = toupper((unsigned char) *p++);
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
76 if (c >= '0' && c <= '9')
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
77 c = c - '0';
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
78 else if (c >= 'A' && c <= 'F')
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
79 c = c - 'A' + 10;
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
80 else
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
81 break;
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
82 v = (v << 4) | c;
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
83 if (v & 0x100) {
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
84 if (data)
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
85 data[len] = v;
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
86 len++;
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
87 v = 1;
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
88 }
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
89 }
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
90 return len;
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
91 }
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
92
6177
3a0c63aea9e9 RTSP: Move more SDP/FMTP stuff from rtsp.c to rtpdec_mpeg4.c
mstorsjo
parents: 6176
diff changeset
93 typedef struct {
3a0c63aea9e9 RTSP: Move more SDP/FMTP stuff from rtsp.c to rtpdec_mpeg4.c
mstorsjo
parents: 6176
diff changeset
94 const char *str;
3a0c63aea9e9 RTSP: Move more SDP/FMTP stuff from rtsp.c to rtpdec_mpeg4.c
mstorsjo
parents: 6176
diff changeset
95 uint16_t type;
3a0c63aea9e9 RTSP: Move more SDP/FMTP stuff from rtsp.c to rtpdec_mpeg4.c
mstorsjo
parents: 6176
diff changeset
96 uint32_t offset;
3a0c63aea9e9 RTSP: Move more SDP/FMTP stuff from rtsp.c to rtpdec_mpeg4.c
mstorsjo
parents: 6176
diff changeset
97 } AttrNameMap;
3a0c63aea9e9 RTSP: Move more SDP/FMTP stuff from rtsp.c to rtpdec_mpeg4.c
mstorsjo
parents: 6176
diff changeset
98
3a0c63aea9e9 RTSP: Move more SDP/FMTP stuff from rtsp.c to rtpdec_mpeg4.c
mstorsjo
parents: 6176
diff changeset
99 /* All known fmtp parameters and the corresponding RTPAttrTypeEnum */
3a0c63aea9e9 RTSP: Move more SDP/FMTP stuff from rtsp.c to rtpdec_mpeg4.c
mstorsjo
parents: 6176
diff changeset
100 #define ATTR_NAME_TYPE_INT 0
3a0c63aea9e9 RTSP: Move more SDP/FMTP stuff from rtsp.c to rtpdec_mpeg4.c
mstorsjo
parents: 6176
diff changeset
101 #define ATTR_NAME_TYPE_STR 1
3a0c63aea9e9 RTSP: Move more SDP/FMTP stuff from rtsp.c to rtpdec_mpeg4.c
mstorsjo
parents: 6176
diff changeset
102 static const AttrNameMap attr_names[]=
3a0c63aea9e9 RTSP: Move more SDP/FMTP stuff from rtsp.c to rtpdec_mpeg4.c
mstorsjo
parents: 6176
diff changeset
103 {
3a0c63aea9e9 RTSP: Move more SDP/FMTP stuff from rtsp.c to rtpdec_mpeg4.c
mstorsjo
parents: 6176
diff changeset
104 { "SizeLength", ATTR_NAME_TYPE_INT,
6179
736165b749f8 RTSP, rtpdec: Move RTPPayloadData into rtpdec_mpeg4 and remove all references to rtp_payload_data in rtpdec and rtsp
mstorsjo
parents: 6178
diff changeset
105 offsetof(PayloadContext, sizelength) },
6177
3a0c63aea9e9 RTSP: Move more SDP/FMTP stuff from rtsp.c to rtpdec_mpeg4.c
mstorsjo
parents: 6176
diff changeset
106 { "IndexLength", ATTR_NAME_TYPE_INT,
6179
736165b749f8 RTSP, rtpdec: Move RTPPayloadData into rtpdec_mpeg4 and remove all references to rtp_payload_data in rtpdec and rtsp
mstorsjo
parents: 6178
diff changeset
107 offsetof(PayloadContext, indexlength) },
6177
3a0c63aea9e9 RTSP: Move more SDP/FMTP stuff from rtsp.c to rtpdec_mpeg4.c
mstorsjo
parents: 6176
diff changeset
108 { "IndexDeltaLength", ATTR_NAME_TYPE_INT,
6179
736165b749f8 RTSP, rtpdec: Move RTPPayloadData into rtpdec_mpeg4 and remove all references to rtp_payload_data in rtpdec and rtsp
mstorsjo
parents: 6178
diff changeset
109 offsetof(PayloadContext, indexdeltalength) },
6177
3a0c63aea9e9 RTSP: Move more SDP/FMTP stuff from rtsp.c to rtpdec_mpeg4.c
mstorsjo
parents: 6176
diff changeset
110 { "profile-level-id", ATTR_NAME_TYPE_INT,
6179
736165b749f8 RTSP, rtpdec: Move RTPPayloadData into rtpdec_mpeg4 and remove all references to rtp_payload_data in rtpdec and rtsp
mstorsjo
parents: 6178
diff changeset
111 offsetof(PayloadContext, profile_level_id) },
6177
3a0c63aea9e9 RTSP: Move more SDP/FMTP stuff from rtsp.c to rtpdec_mpeg4.c
mstorsjo
parents: 6176
diff changeset
112 { "StreamType", ATTR_NAME_TYPE_INT,
6179
736165b749f8 RTSP, rtpdec: Move RTPPayloadData into rtpdec_mpeg4 and remove all references to rtp_payload_data in rtpdec and rtsp
mstorsjo
parents: 6178
diff changeset
113 offsetof(PayloadContext, streamtype) },
6177
3a0c63aea9e9 RTSP: Move more SDP/FMTP stuff from rtsp.c to rtpdec_mpeg4.c
mstorsjo
parents: 6176
diff changeset
114 { "mode", ATTR_NAME_TYPE_STR,
6179
736165b749f8 RTSP, rtpdec: Move RTPPayloadData into rtpdec_mpeg4 and remove all references to rtp_payload_data in rtpdec and rtsp
mstorsjo
parents: 6178
diff changeset
115 offsetof(PayloadContext, mode) },
6177
3a0c63aea9e9 RTSP: Move more SDP/FMTP stuff from rtsp.c to rtpdec_mpeg4.c
mstorsjo
parents: 6176
diff changeset
116 { NULL, -1, -1 },
3a0c63aea9e9 RTSP: Move more SDP/FMTP stuff from rtsp.c to rtpdec_mpeg4.c
mstorsjo
parents: 6176
diff changeset
117 };
3a0c63aea9e9 RTSP: Move more SDP/FMTP stuff from rtsp.c to rtpdec_mpeg4.c
mstorsjo
parents: 6176
diff changeset
118
6179
736165b749f8 RTSP, rtpdec: Move RTPPayloadData into rtpdec_mpeg4 and remove all references to rtp_payload_data in rtpdec and rtsp
mstorsjo
parents: 6178
diff changeset
119 static PayloadContext *new_context(void)
736165b749f8 RTSP, rtpdec: Move RTPPayloadData into rtpdec_mpeg4 and remove all references to rtp_payload_data in rtpdec and rtsp
mstorsjo
parents: 6178
diff changeset
120 {
736165b749f8 RTSP, rtpdec: Move RTPPayloadData into rtpdec_mpeg4 and remove all references to rtp_payload_data in rtpdec and rtsp
mstorsjo
parents: 6178
diff changeset
121 return av_mallocz(sizeof(PayloadContext));
736165b749f8 RTSP, rtpdec: Move RTPPayloadData into rtpdec_mpeg4 and remove all references to rtp_payload_data in rtpdec and rtsp
mstorsjo
parents: 6178
diff changeset
122 }
736165b749f8 RTSP, rtpdec: Move RTPPayloadData into rtpdec_mpeg4 and remove all references to rtp_payload_data in rtpdec and rtsp
mstorsjo
parents: 6178
diff changeset
123
736165b749f8 RTSP, rtpdec: Move RTPPayloadData into rtpdec_mpeg4 and remove all references to rtp_payload_data in rtpdec and rtsp
mstorsjo
parents: 6178
diff changeset
124 static void free_context(PayloadContext * data)
736165b749f8 RTSP, rtpdec: Move RTPPayloadData into rtpdec_mpeg4 and remove all references to rtp_payload_data in rtpdec and rtsp
mstorsjo
parents: 6178
diff changeset
125 {
736165b749f8 RTSP, rtpdec: Move RTPPayloadData into rtpdec_mpeg4 and remove all references to rtp_payload_data in rtpdec and rtsp
mstorsjo
parents: 6178
diff changeset
126 int i;
736165b749f8 RTSP, rtpdec: Move RTPPayloadData into rtpdec_mpeg4 and remove all references to rtp_payload_data in rtpdec and rtsp
mstorsjo
parents: 6178
diff changeset
127 for (i = 0; i < data->nb_au_headers; i++) {
736165b749f8 RTSP, rtpdec: Move RTPPayloadData into rtpdec_mpeg4 and remove all references to rtp_payload_data in rtpdec and rtsp
mstorsjo
parents: 6178
diff changeset
128 /* according to rtp_parse_mp4_au, we treat multiple
736165b749f8 RTSP, rtpdec: Move RTPPayloadData into rtpdec_mpeg4 and remove all references to rtp_payload_data in rtpdec and rtsp
mstorsjo
parents: 6178
diff changeset
129 * au headers as one, so nb_au_headers is always 1.
736165b749f8 RTSP, rtpdec: Move RTPPayloadData into rtpdec_mpeg4 and remove all references to rtp_payload_data in rtpdec and rtsp
mstorsjo
parents: 6178
diff changeset
130 * loop anyway in case this changes.
736165b749f8 RTSP, rtpdec: Move RTPPayloadData into rtpdec_mpeg4 and remove all references to rtp_payload_data in rtpdec and rtsp
mstorsjo
parents: 6178
diff changeset
131 * (note: changes done carelessly might lead to a double free)
736165b749f8 RTSP, rtpdec: Move RTPPayloadData into rtpdec_mpeg4 and remove all references to rtp_payload_data in rtpdec and rtsp
mstorsjo
parents: 6178
diff changeset
132 */
736165b749f8 RTSP, rtpdec: Move RTPPayloadData into rtpdec_mpeg4 and remove all references to rtp_payload_data in rtpdec and rtsp
mstorsjo
parents: 6178
diff changeset
133 av_free(&data->au_headers[i]);
736165b749f8 RTSP, rtpdec: Move RTPPayloadData into rtpdec_mpeg4 and remove all references to rtp_payload_data in rtpdec and rtsp
mstorsjo
parents: 6178
diff changeset
134 }
736165b749f8 RTSP, rtpdec: Move RTPPayloadData into rtpdec_mpeg4 and remove all references to rtp_payload_data in rtpdec and rtsp
mstorsjo
parents: 6178
diff changeset
135 av_free(data->mode);
736165b749f8 RTSP, rtpdec: Move RTPPayloadData into rtpdec_mpeg4 and remove all references to rtp_payload_data in rtpdec and rtsp
mstorsjo
parents: 6178
diff changeset
136 av_free(data);
736165b749f8 RTSP, rtpdec: Move RTPPayloadData into rtpdec_mpeg4 and remove all references to rtp_payload_data in rtpdec and rtsp
mstorsjo
parents: 6178
diff changeset
137 }
736165b749f8 RTSP, rtpdec: Move RTPPayloadData into rtpdec_mpeg4 and remove all references to rtp_payload_data in rtpdec and rtsp
mstorsjo
parents: 6178
diff changeset
138
6176
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
139 static int parse_fmtp_config(AVCodecContext * codec, char *value)
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
140 {
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
141 /* decode the hexa encoded parameter */
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
142 int len = hex_to_data(NULL, value);
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
143 if (codec->extradata)
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
144 av_free(codec->extradata);
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
145 codec->extradata = av_mallocz(len + FF_INPUT_BUFFER_PADDING_SIZE);
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
146 if (!codec->extradata)
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
147 return AVERROR(ENOMEM);
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
148 codec->extradata_size = len;
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
149 hex_to_data(codec->extradata, value);
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
150 return 0;
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
151 }
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
152
6180
5c977bb6aea7 rtpdec_mpeg4: Rename PayloadContext to be consistently 'data'
mstorsjo
parents: 6179
diff changeset
153 static int rtp_parse_mp4_au(PayloadContext *data, const uint8_t *buf)
6178
7aca26f37b02 rtpdec: Move AAC depacketization code in rtpdec to a proper payload handler
mstorsjo
parents: 6177
diff changeset
154 {
7aca26f37b02 rtpdec: Move AAC depacketization code in rtpdec to a proper payload handler
mstorsjo
parents: 6177
diff changeset
155 int au_headers_length, au_header_size, i;
7aca26f37b02 rtpdec: Move AAC depacketization code in rtpdec to a proper payload handler
mstorsjo
parents: 6177
diff changeset
156 GetBitContext getbitcontext;
7aca26f37b02 rtpdec: Move AAC depacketization code in rtpdec to a proper payload handler
mstorsjo
parents: 6177
diff changeset
157
7aca26f37b02 rtpdec: Move AAC depacketization code in rtpdec to a proper payload handler
mstorsjo
parents: 6177
diff changeset
158 /* decode the first 2 bytes where the AUHeader sections are stored
7aca26f37b02 rtpdec: Move AAC depacketization code in rtpdec to a proper payload handler
mstorsjo
parents: 6177
diff changeset
159 length in bits */
7aca26f37b02 rtpdec: Move AAC depacketization code in rtpdec to a proper payload handler
mstorsjo
parents: 6177
diff changeset
160 au_headers_length = AV_RB16(buf);
7aca26f37b02 rtpdec: Move AAC depacketization code in rtpdec to a proper payload handler
mstorsjo
parents: 6177
diff changeset
161
7aca26f37b02 rtpdec: Move AAC depacketization code in rtpdec to a proper payload handler
mstorsjo
parents: 6177
diff changeset
162 if (au_headers_length > RTP_MAX_PACKET_LENGTH)
7aca26f37b02 rtpdec: Move AAC depacketization code in rtpdec to a proper payload handler
mstorsjo
parents: 6177
diff changeset
163 return -1;
7aca26f37b02 rtpdec: Move AAC depacketization code in rtpdec to a proper payload handler
mstorsjo
parents: 6177
diff changeset
164
6180
5c977bb6aea7 rtpdec_mpeg4: Rename PayloadContext to be consistently 'data'
mstorsjo
parents: 6179
diff changeset
165 data->au_headers_length_bytes = (au_headers_length + 7) / 8;
6178
7aca26f37b02 rtpdec: Move AAC depacketization code in rtpdec to a proper payload handler
mstorsjo
parents: 6177
diff changeset
166
7aca26f37b02 rtpdec: Move AAC depacketization code in rtpdec to a proper payload handler
mstorsjo
parents: 6177
diff changeset
167 /* skip AU headers length section (2 bytes) */
7aca26f37b02 rtpdec: Move AAC depacketization code in rtpdec to a proper payload handler
mstorsjo
parents: 6177
diff changeset
168 buf += 2;
7aca26f37b02 rtpdec: Move AAC depacketization code in rtpdec to a proper payload handler
mstorsjo
parents: 6177
diff changeset
169
6180
5c977bb6aea7 rtpdec_mpeg4: Rename PayloadContext to be consistently 'data'
mstorsjo
parents: 6179
diff changeset
170 init_get_bits(&getbitcontext, buf, data->au_headers_length_bytes * 8);
6178
7aca26f37b02 rtpdec: Move AAC depacketization code in rtpdec to a proper payload handler
mstorsjo
parents: 6177
diff changeset
171
7aca26f37b02 rtpdec: Move AAC depacketization code in rtpdec to a proper payload handler
mstorsjo
parents: 6177
diff changeset
172 /* XXX: Wrong if optionnal additional sections are present (cts, dts etc...) */
6180
5c977bb6aea7 rtpdec_mpeg4: Rename PayloadContext to be consistently 'data'
mstorsjo
parents: 6179
diff changeset
173 au_header_size = data->sizelength + data->indexlength;
6178
7aca26f37b02 rtpdec: Move AAC depacketization code in rtpdec to a proper payload handler
mstorsjo
parents: 6177
diff changeset
174 if (au_header_size <= 0 || (au_headers_length % au_header_size != 0))
7aca26f37b02 rtpdec: Move AAC depacketization code in rtpdec to a proper payload handler
mstorsjo
parents: 6177
diff changeset
175 return -1;
7aca26f37b02 rtpdec: Move AAC depacketization code in rtpdec to a proper payload handler
mstorsjo
parents: 6177
diff changeset
176
6180
5c977bb6aea7 rtpdec_mpeg4: Rename PayloadContext to be consistently 'data'
mstorsjo
parents: 6179
diff changeset
177 data->nb_au_headers = au_headers_length / au_header_size;
5c977bb6aea7 rtpdec_mpeg4: Rename PayloadContext to be consistently 'data'
mstorsjo
parents: 6179
diff changeset
178 if (!data->au_headers || data->au_headers_allocated < data->nb_au_headers) {
5c977bb6aea7 rtpdec_mpeg4: Rename PayloadContext to be consistently 'data'
mstorsjo
parents: 6179
diff changeset
179 av_free(data->au_headers);
5c977bb6aea7 rtpdec_mpeg4: Rename PayloadContext to be consistently 'data'
mstorsjo
parents: 6179
diff changeset
180 data->au_headers = av_malloc(sizeof(struct AUHeaders) * data->nb_au_headers);
5c977bb6aea7 rtpdec_mpeg4: Rename PayloadContext to be consistently 'data'
mstorsjo
parents: 6179
diff changeset
181 data->au_headers_allocated = data->nb_au_headers;
6178
7aca26f37b02 rtpdec: Move AAC depacketization code in rtpdec to a proper payload handler
mstorsjo
parents: 6177
diff changeset
182 }
7aca26f37b02 rtpdec: Move AAC depacketization code in rtpdec to a proper payload handler
mstorsjo
parents: 6177
diff changeset
183
7aca26f37b02 rtpdec: Move AAC depacketization code in rtpdec to a proper payload handler
mstorsjo
parents: 6177
diff changeset
184 /* XXX: We handle multiple AU Section as only one (need to fix this for interleaving)
7aca26f37b02 rtpdec: Move AAC depacketization code in rtpdec to a proper payload handler
mstorsjo
parents: 6177
diff changeset
185 In my test, the FAAD decoder does not behave correctly when sending each AU one by one
7aca26f37b02 rtpdec: Move AAC depacketization code in rtpdec to a proper payload handler
mstorsjo
parents: 6177
diff changeset
186 but does when sending the whole as one big packet... */
6180
5c977bb6aea7 rtpdec_mpeg4: Rename PayloadContext to be consistently 'data'
mstorsjo
parents: 6179
diff changeset
187 data->au_headers[0].size = 0;
5c977bb6aea7 rtpdec_mpeg4: Rename PayloadContext to be consistently 'data'
mstorsjo
parents: 6179
diff changeset
188 data->au_headers[0].index = 0;
5c977bb6aea7 rtpdec_mpeg4: Rename PayloadContext to be consistently 'data'
mstorsjo
parents: 6179
diff changeset
189 for (i = 0; i < data->nb_au_headers; ++i) {
5c977bb6aea7 rtpdec_mpeg4: Rename PayloadContext to be consistently 'data'
mstorsjo
parents: 6179
diff changeset
190 data->au_headers[0].size += get_bits_long(&getbitcontext, data->sizelength);
5c977bb6aea7 rtpdec_mpeg4: Rename PayloadContext to be consistently 'data'
mstorsjo
parents: 6179
diff changeset
191 data->au_headers[0].index = get_bits_long(&getbitcontext, data->indexlength);
6178
7aca26f37b02 rtpdec: Move AAC depacketization code in rtpdec to a proper payload handler
mstorsjo
parents: 6177
diff changeset
192 }
7aca26f37b02 rtpdec: Move AAC depacketization code in rtpdec to a proper payload handler
mstorsjo
parents: 6177
diff changeset
193
6180
5c977bb6aea7 rtpdec_mpeg4: Rename PayloadContext to be consistently 'data'
mstorsjo
parents: 6179
diff changeset
194 data->nb_au_headers = 1;
6178
7aca26f37b02 rtpdec: Move AAC depacketization code in rtpdec to a proper payload handler
mstorsjo
parents: 6177
diff changeset
195
7aca26f37b02 rtpdec: Move AAC depacketization code in rtpdec to a proper payload handler
mstorsjo
parents: 6177
diff changeset
196 return 0;
7aca26f37b02 rtpdec: Move AAC depacketization code in rtpdec to a proper payload handler
mstorsjo
parents: 6177
diff changeset
197 }
7aca26f37b02 rtpdec: Move AAC depacketization code in rtpdec to a proper payload handler
mstorsjo
parents: 6177
diff changeset
198
7aca26f37b02 rtpdec: Move AAC depacketization code in rtpdec to a proper payload handler
mstorsjo
parents: 6177
diff changeset
199
7aca26f37b02 rtpdec: Move AAC depacketization code in rtpdec to a proper payload handler
mstorsjo
parents: 6177
diff changeset
200 /* Follows RFC 3640 */
7aca26f37b02 rtpdec: Move AAC depacketization code in rtpdec to a proper payload handler
mstorsjo
parents: 6177
diff changeset
201 static int aac_parse_packet(AVFormatContext *ctx,
6180
5c977bb6aea7 rtpdec_mpeg4: Rename PayloadContext to be consistently 'data'
mstorsjo
parents: 6179
diff changeset
202 PayloadContext *data,
6178
7aca26f37b02 rtpdec: Move AAC depacketization code in rtpdec to a proper payload handler
mstorsjo
parents: 6177
diff changeset
203 AVStream *st,
7aca26f37b02 rtpdec: Move AAC depacketization code in rtpdec to a proper payload handler
mstorsjo
parents: 6177
diff changeset
204 AVPacket *pkt,
7aca26f37b02 rtpdec: Move AAC depacketization code in rtpdec to a proper payload handler
mstorsjo
parents: 6177
diff changeset
205 uint32_t *timestamp,
7aca26f37b02 rtpdec: Move AAC depacketization code in rtpdec to a proper payload handler
mstorsjo
parents: 6177
diff changeset
206 const uint8_t *buf, int len, int flags)
7aca26f37b02 rtpdec: Move AAC depacketization code in rtpdec to a proper payload handler
mstorsjo
parents: 6177
diff changeset
207 {
6180
5c977bb6aea7 rtpdec_mpeg4: Rename PayloadContext to be consistently 'data'
mstorsjo
parents: 6179
diff changeset
208 if (rtp_parse_mp4_au(data, buf))
6178
7aca26f37b02 rtpdec: Move AAC depacketization code in rtpdec to a proper payload handler
mstorsjo
parents: 6177
diff changeset
209 return -1;
7aca26f37b02 rtpdec: Move AAC depacketization code in rtpdec to a proper payload handler
mstorsjo
parents: 6177
diff changeset
210
6180
5c977bb6aea7 rtpdec_mpeg4: Rename PayloadContext to be consistently 'data'
mstorsjo
parents: 6179
diff changeset
211 buf += data->au_headers_length_bytes + 2;
5c977bb6aea7 rtpdec_mpeg4: Rename PayloadContext to be consistently 'data'
mstorsjo
parents: 6179
diff changeset
212 len -= data->au_headers_length_bytes + 2;
6178
7aca26f37b02 rtpdec: Move AAC depacketization code in rtpdec to a proper payload handler
mstorsjo
parents: 6177
diff changeset
213
7aca26f37b02 rtpdec: Move AAC depacketization code in rtpdec to a proper payload handler
mstorsjo
parents: 6177
diff changeset
214 /* XXX: Fixme we only handle the case where rtp_parse_mp4_au define
7aca26f37b02 rtpdec: Move AAC depacketization code in rtpdec to a proper payload handler
mstorsjo
parents: 6177
diff changeset
215 one au_header */
6180
5c977bb6aea7 rtpdec_mpeg4: Rename PayloadContext to be consistently 'data'
mstorsjo
parents: 6179
diff changeset
216 av_new_packet(pkt, data->au_headers[0].size);
5c977bb6aea7 rtpdec_mpeg4: Rename PayloadContext to be consistently 'data'
mstorsjo
parents: 6179
diff changeset
217 memcpy(pkt->data, buf, data->au_headers[0].size);
6178
7aca26f37b02 rtpdec: Move AAC depacketization code in rtpdec to a proper payload handler
mstorsjo
parents: 6177
diff changeset
218
7aca26f37b02 rtpdec: Move AAC depacketization code in rtpdec to a proper payload handler
mstorsjo
parents: 6177
diff changeset
219 pkt->stream_index = st->index;
7aca26f37b02 rtpdec: Move AAC depacketization code in rtpdec to a proper payload handler
mstorsjo
parents: 6177
diff changeset
220 return 0;
7aca26f37b02 rtpdec: Move AAC depacketization code in rtpdec to a proper payload handler
mstorsjo
parents: 6177
diff changeset
221 }
7aca26f37b02 rtpdec: Move AAC depacketization code in rtpdec to a proper payload handler
mstorsjo
parents: 6177
diff changeset
222
6191
7884ec350d88 rtpdec: Clean up FMTP parsing code in MPEG-4/AAC RTP depacketizer
mstorsjo
parents: 6186
diff changeset
223 static int parse_fmtp(AVStream *stream, PayloadContext *data,
7884ec350d88 rtpdec: Clean up FMTP parsing code in MPEG-4/AAC RTP depacketizer
mstorsjo
parents: 6186
diff changeset
224 char *attr, char *value)
6176
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
225 {
6191
7884ec350d88 rtpdec: Clean up FMTP parsing code in MPEG-4/AAC RTP depacketizer
mstorsjo
parents: 6186
diff changeset
226 AVCodecContext *codec = stream->codec;
7884ec350d88 rtpdec: Clean up FMTP parsing code in MPEG-4/AAC RTP depacketizer
mstorsjo
parents: 6186
diff changeset
227 int res, i;
6176
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
228
6192
b93d7a25cd6b Reindent
mstorsjo
parents: 6191
diff changeset
229 if (!strcmp(attr, "config")) {
b93d7a25cd6b Reindent
mstorsjo
parents: 6191
diff changeset
230 res = parse_fmtp_config(codec, value);
6176
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
231
6192
b93d7a25cd6b Reindent
mstorsjo
parents: 6191
diff changeset
232 if (res < 0)
b93d7a25cd6b Reindent
mstorsjo
parents: 6191
diff changeset
233 return res;
b93d7a25cd6b Reindent
mstorsjo
parents: 6191
diff changeset
234 }
6177
3a0c63aea9e9 RTSP: Move more SDP/FMTP stuff from rtsp.c to rtpdec_mpeg4.c
mstorsjo
parents: 6176
diff changeset
235
6192
b93d7a25cd6b Reindent
mstorsjo
parents: 6191
diff changeset
236 if (codec->codec_id == CODEC_ID_AAC) {
b93d7a25cd6b Reindent
mstorsjo
parents: 6191
diff changeset
237 /* Looking for a known attribute */
b93d7a25cd6b Reindent
mstorsjo
parents: 6191
diff changeset
238 for (i = 0; attr_names[i].str; ++i) {
b93d7a25cd6b Reindent
mstorsjo
parents: 6191
diff changeset
239 if (!strcasecmp(attr, attr_names[i].str)) {
b93d7a25cd6b Reindent
mstorsjo
parents: 6191
diff changeset
240 if (attr_names[i].type == ATTR_NAME_TYPE_INT) {
b93d7a25cd6b Reindent
mstorsjo
parents: 6191
diff changeset
241 *(int *)((char *)data+
b93d7a25cd6b Reindent
mstorsjo
parents: 6191
diff changeset
242 attr_names[i].offset) = atoi(value);
b93d7a25cd6b Reindent
mstorsjo
parents: 6191
diff changeset
243 } else if (attr_names[i].type == ATTR_NAME_TYPE_STR)
b93d7a25cd6b Reindent
mstorsjo
parents: 6191
diff changeset
244 *(char **)((char *)data+
b93d7a25cd6b Reindent
mstorsjo
parents: 6191
diff changeset
245 attr_names[i].offset) = av_strdup(value);
6177
3a0c63aea9e9 RTSP: Move more SDP/FMTP stuff from rtsp.c to rtpdec_mpeg4.c
mstorsjo
parents: 6176
diff changeset
246 }
6192
b93d7a25cd6b Reindent
mstorsjo
parents: 6191
diff changeset
247 }
b93d7a25cd6b Reindent
mstorsjo
parents: 6191
diff changeset
248 }
6191
7884ec350d88 rtpdec: Clean up FMTP parsing code in MPEG-4/AAC RTP depacketizer
mstorsjo
parents: 6186
diff changeset
249 return 0;
6192
b93d7a25cd6b Reindent
mstorsjo
parents: 6191
diff changeset
250 }
6191
7884ec350d88 rtpdec: Clean up FMTP parsing code in MPEG-4/AAC RTP depacketizer
mstorsjo
parents: 6186
diff changeset
251
7884ec350d88 rtpdec: Clean up FMTP parsing code in MPEG-4/AAC RTP depacketizer
mstorsjo
parents: 6186
diff changeset
252 static int parse_sdp_line(AVFormatContext *s, int st_index,
7884ec350d88 rtpdec: Clean up FMTP parsing code in MPEG-4/AAC RTP depacketizer
mstorsjo
parents: 6186
diff changeset
253 PayloadContext *data, const char *line)
7884ec350d88 rtpdec: Clean up FMTP parsing code in MPEG-4/AAC RTP depacketizer
mstorsjo
parents: 6186
diff changeset
254 {
7884ec350d88 rtpdec: Clean up FMTP parsing code in MPEG-4/AAC RTP depacketizer
mstorsjo
parents: 6186
diff changeset
255 const char *p;
7884ec350d88 rtpdec: Clean up FMTP parsing code in MPEG-4/AAC RTP depacketizer
mstorsjo
parents: 6186
diff changeset
256
7884ec350d88 rtpdec: Clean up FMTP parsing code in MPEG-4/AAC RTP depacketizer
mstorsjo
parents: 6186
diff changeset
257 if (av_strstart(line, "fmtp:", &p))
7884ec350d88 rtpdec: Clean up FMTP parsing code in MPEG-4/AAC RTP depacketizer
mstorsjo
parents: 6186
diff changeset
258 return ff_parse_fmtp(s->streams[st_index], data, p, parse_fmtp);
6176
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
259
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
260 return 0;
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
261 }
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
262
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
263 RTPDynamicProtocolHandler ff_mp4v_es_dynamic_handler = {
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
264 .enc_name = "MP4V-ES",
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
265 .codec_type = AVMEDIA_TYPE_VIDEO,
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
266 .codec_id = CODEC_ID_MPEG4,
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
267 .parse_sdp_a_line = parse_sdp_line,
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
268 .open = NULL,
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
269 .close = NULL,
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
270 .parse_packet = NULL
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
271 };
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
272
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
273 RTPDynamicProtocolHandler ff_mpeg4_generic_dynamic_handler = {
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
274 .enc_name = "mpeg4-generic",
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
275 .codec_type = AVMEDIA_TYPE_AUDIO,
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
276 .codec_id = CODEC_ID_AAC,
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
277 .parse_sdp_a_line = parse_sdp_line,
6179
736165b749f8 RTSP, rtpdec: Move RTPPayloadData into rtpdec_mpeg4 and remove all references to rtp_payload_data in rtpdec and rtsp
mstorsjo
parents: 6178
diff changeset
278 .open = new_context,
736165b749f8 RTSP, rtpdec: Move RTPPayloadData into rtpdec_mpeg4 and remove all references to rtp_payload_data in rtpdec and rtsp
mstorsjo
parents: 6178
diff changeset
279 .close = free_context,
6178
7aca26f37b02 rtpdec: Move AAC depacketization code in rtpdec to a proper payload handler
mstorsjo
parents: 6177
diff changeset
280 .parse_packet = aac_parse_packet
6176
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
281 };