annotate rtpdec_mpeg4.c @ 6179:736165b749f8 libavformat

RTSP, rtpdec: Move RTPPayloadData into rtpdec_mpeg4 and remove all references to rtp_payload_data in rtpdec and rtsp Patch by Josh Allmann, joshua dot allmann at gmail
author mstorsjo
date Fri, 25 Jun 2010 08:02:50 +0000
parents 7aca26f37b02
children 5c977bb6aea7
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"
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
31 #include "internal.h"
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
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
153 static int rtp_parse_mp4_au(PayloadContext *infos, 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
7aca26f37b02 rtpdec: Move AAC depacketization code in rtpdec to a proper payload handler
mstorsjo
parents: 6177
diff changeset
165 infos->au_headers_length_bytes = (au_headers_length + 7) / 8;
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
7aca26f37b02 rtpdec: Move AAC depacketization code in rtpdec to a proper payload handler
mstorsjo
parents: 6177
diff changeset
170 init_get_bits(&getbitcontext, buf, infos->au_headers_length_bytes * 8);
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...) */
7aca26f37b02 rtpdec: Move AAC depacketization code in rtpdec to a proper payload handler
mstorsjo
parents: 6177
diff changeset
173 au_header_size = infos->sizelength + infos->indexlength;
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
7aca26f37b02 rtpdec: Move AAC depacketization code in rtpdec to a proper payload handler
mstorsjo
parents: 6177
diff changeset
177 infos->nb_au_headers = au_headers_length / au_header_size;
7aca26f37b02 rtpdec: Move AAC depacketization code in rtpdec to a proper payload handler
mstorsjo
parents: 6177
diff changeset
178 if (!infos->au_headers || infos->au_headers_allocated < infos->nb_au_headers) {
7aca26f37b02 rtpdec: Move AAC depacketization code in rtpdec to a proper payload handler
mstorsjo
parents: 6177
diff changeset
179 av_free(infos->au_headers);
7aca26f37b02 rtpdec: Move AAC depacketization code in rtpdec to a proper payload handler
mstorsjo
parents: 6177
diff changeset
180 infos->au_headers = av_malloc(sizeof(struct AUHeaders) * infos->nb_au_headers);
7aca26f37b02 rtpdec: Move AAC depacketization code in rtpdec to a proper payload handler
mstorsjo
parents: 6177
diff changeset
181 infos->au_headers_allocated = infos->nb_au_headers;
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... */
7aca26f37b02 rtpdec: Move AAC depacketization code in rtpdec to a proper payload handler
mstorsjo
parents: 6177
diff changeset
187 infos->au_headers[0].size = 0;
7aca26f37b02 rtpdec: Move AAC depacketization code in rtpdec to a proper payload handler
mstorsjo
parents: 6177
diff changeset
188 infos->au_headers[0].index = 0;
7aca26f37b02 rtpdec: Move AAC depacketization code in rtpdec to a proper payload handler
mstorsjo
parents: 6177
diff changeset
189 for (i = 0; i < infos->nb_au_headers; ++i) {
7aca26f37b02 rtpdec: Move AAC depacketization code in rtpdec to a proper payload handler
mstorsjo
parents: 6177
diff changeset
190 infos->au_headers[0].size += get_bits_long(&getbitcontext, infos->sizelength);
7aca26f37b02 rtpdec: Move AAC depacketization code in rtpdec to a proper payload handler
mstorsjo
parents: 6177
diff changeset
191 infos->au_headers[0].index = get_bits_long(&getbitcontext, infos->indexlength);
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
7aca26f37b02 rtpdec: Move AAC depacketization code in rtpdec to a proper payload handler
mstorsjo
parents: 6177
diff changeset
194 infos->nb_au_headers = 1;
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,
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
202 PayloadContext *infos,
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 {
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
208 if (rtp_parse_mp4_au(infos, 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
7aca26f37b02 rtpdec: Move AAC depacketization code in rtpdec to a proper payload handler
mstorsjo
parents: 6177
diff changeset
211 buf += infos->au_headers_length_bytes + 2;
7aca26f37b02 rtpdec: Move AAC depacketization code in rtpdec to a proper payload handler
mstorsjo
parents: 6177
diff changeset
212 len -= infos->au_headers_length_bytes + 2;
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 */
7aca26f37b02 rtpdec: Move AAC depacketization code in rtpdec to a proper payload handler
mstorsjo
parents: 6177
diff changeset
216 av_new_packet(pkt, infos->au_headers[0].size);
7aca26f37b02 rtpdec: Move AAC depacketization code in rtpdec to a proper payload handler
mstorsjo
parents: 6177
diff changeset
217 memcpy(pkt->data, buf, infos->au_headers[0].size);
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
6176
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
223 static int parse_sdp_line(AVFormatContext *s, int st_index,
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
224 PayloadContext *rtp_payload_data, const char *line)
6176
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
225 {
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
226 const char *p;
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
227 char value[4096], attr[25];
6177
3a0c63aea9e9 RTSP: Move more SDP/FMTP stuff from rtsp.c to rtpdec_mpeg4.c
mstorsjo
parents: 6176
diff changeset
228 int res = 0, i;
3a0c63aea9e9 RTSP: Move more SDP/FMTP stuff from rtsp.c to rtpdec_mpeg4.c
mstorsjo
parents: 6176
diff changeset
229 AVStream *st = s->streams[st_index];
3a0c63aea9e9 RTSP: Move more SDP/FMTP stuff from rtsp.c to rtpdec_mpeg4.c
mstorsjo
parents: 6176
diff changeset
230 AVCodecContext* codec = st->codec;
6176
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
231
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
232 if (av_strstart(line, "fmtp:", &p)) {
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
233 // remove protocol identifier
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
234 while (*p && *p == ' ') p++; // strip spaces
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
235 while (*p && *p != ' ') p++; // eat protocol identifier
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
236 while (*p && *p == ' ') p++; // strip trailing spaces
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
237
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
238 while (ff_rtsp_next_attr_and_value(&p,
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
239 attr, sizeof(attr),
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
240 value, sizeof(value))) {
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
241 if (!strcmp(attr, "config")) {
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
242 res = parse_fmtp_config(codec, value);
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
243
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
244 if (res < 0)
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
245 return res;
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
246 }
6177
3a0c63aea9e9 RTSP: Move more SDP/FMTP stuff from rtsp.c to rtpdec_mpeg4.c
mstorsjo
parents: 6176
diff changeset
247
3a0c63aea9e9 RTSP: Move more SDP/FMTP stuff from rtsp.c to rtpdec_mpeg4.c
mstorsjo
parents: 6176
diff changeset
248 if (codec->codec_id == CODEC_ID_AAC) {
3a0c63aea9e9 RTSP: Move more SDP/FMTP stuff from rtsp.c to rtpdec_mpeg4.c
mstorsjo
parents: 6176
diff changeset
249 /* Looking for a known attribute */
3a0c63aea9e9 RTSP: Move more SDP/FMTP stuff from rtsp.c to rtpdec_mpeg4.c
mstorsjo
parents: 6176
diff changeset
250 for (i = 0; attr_names[i].str; ++i) {
3a0c63aea9e9 RTSP: Move more SDP/FMTP stuff from rtsp.c to rtpdec_mpeg4.c
mstorsjo
parents: 6176
diff changeset
251 if (!strcasecmp(attr, attr_names[i].str)) {
3a0c63aea9e9 RTSP: Move more SDP/FMTP stuff from rtsp.c to rtpdec_mpeg4.c
mstorsjo
parents: 6176
diff changeset
252 if (attr_names[i].type == ATTR_NAME_TYPE_INT) {
3a0c63aea9e9 RTSP: Move more SDP/FMTP stuff from rtsp.c to rtpdec_mpeg4.c
mstorsjo
parents: 6176
diff changeset
253 *(int *)((char *)rtp_payload_data +
3a0c63aea9e9 RTSP: Move more SDP/FMTP stuff from rtsp.c to rtpdec_mpeg4.c
mstorsjo
parents: 6176
diff changeset
254 attr_names[i].offset) = atoi(value);
3a0c63aea9e9 RTSP: Move more SDP/FMTP stuff from rtsp.c to rtpdec_mpeg4.c
mstorsjo
parents: 6176
diff changeset
255 } else if (attr_names[i].type == ATTR_NAME_TYPE_STR)
3a0c63aea9e9 RTSP: Move more SDP/FMTP stuff from rtsp.c to rtpdec_mpeg4.c
mstorsjo
parents: 6176
diff changeset
256 *(char **)((char *)rtp_payload_data +
3a0c63aea9e9 RTSP: Move more SDP/FMTP stuff from rtsp.c to rtpdec_mpeg4.c
mstorsjo
parents: 6176
diff changeset
257 attr_names[i].offset) = av_strdup(value);
3a0c63aea9e9 RTSP: Move more SDP/FMTP stuff from rtsp.c to rtpdec_mpeg4.c
mstorsjo
parents: 6176
diff changeset
258 }
3a0c63aea9e9 RTSP: Move more SDP/FMTP stuff from rtsp.c to rtpdec_mpeg4.c
mstorsjo
parents: 6176
diff changeset
259 }
3a0c63aea9e9 RTSP: Move more SDP/FMTP stuff from rtsp.c to rtpdec_mpeg4.c
mstorsjo
parents: 6176
diff changeset
260 }
6176
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
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
264 return 0;
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
265
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
266 }
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
267
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
268 RTPDynamicProtocolHandler ff_mp4v_es_dynamic_handler = {
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
269 .enc_name = "MP4V-ES",
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
270 .codec_type = AVMEDIA_TYPE_VIDEO,
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
271 .codec_id = CODEC_ID_MPEG4,
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
272 .parse_sdp_a_line = parse_sdp_line,
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
273 .open = NULL,
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
274 .close = NULL,
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
275 .parse_packet = NULL
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
276 };
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
277
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
278 RTPDynamicProtocolHandler ff_mpeg4_generic_dynamic_handler = {
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
279 .enc_name = "mpeg4-generic",
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
280 .codec_type = AVMEDIA_TYPE_AUDIO,
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
281 .codec_id = CODEC_ID_AAC,
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
282 .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
283 .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
284 .close = free_context,
6178
7aca26f37b02 rtpdec: Move AAC depacketization code in rtpdec to a proper payload handler
mstorsjo
parents: 6177
diff changeset
285 .parse_packet = aac_parse_packet
6176
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
286 };