annotate rtpdec_mpeg4.c @ 6177:3a0c63aea9e9 libavformat

RTSP: Move more SDP/FMTP stuff from rtsp.c to rtpdec_mpeg4.c Patch by Josh Allmann, joshua dot allmann at gmail
author mstorsjo
date Fri, 25 Jun 2010 08:00:05 +0000
parents 5708c6d4223d
children 7aca26f37b02
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"
6177
3a0c63aea9e9 RTSP: Move more SDP/FMTP stuff from rtsp.c to rtpdec_mpeg4.c
mstorsjo
parents: 6176
diff changeset
33 #include <strings.h>
3a0c63aea9e9 RTSP: Move more SDP/FMTP stuff from rtsp.c to rtpdec_mpeg4.c
mstorsjo
parents: 6176
diff changeset
34
3a0c63aea9e9 RTSP: Move more SDP/FMTP stuff from rtsp.c to rtpdec_mpeg4.c
mstorsjo
parents: 6176
diff changeset
35 #include "rtsp.h" //XXX remove this dependency
6176
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
36
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
37 /* return the length and optionally the data */
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
38 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
39 {
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
40 int c, len, v;
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
41
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
42 len = 0;
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
43 v = 1;
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
44 for (;;) {
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
45 p += strspn(p, SPACE_CHARS);
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
46 if (*p == '\0')
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
47 break;
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
48 c = toupper((unsigned char) *p++);
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
49 if (c >= '0' && c <= '9')
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
50 c = c - '0';
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
51 else if (c >= 'A' && c <= 'F')
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
52 c = c - 'A' + 10;
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
53 else
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
54 break;
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
55 v = (v << 4) | c;
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
56 if (v & 0x100) {
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
57 if (data)
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
58 data[len] = v;
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
59 len++;
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
60 v = 1;
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
61 }
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
62 }
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
63 return len;
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
64 }
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
65
6177
3a0c63aea9e9 RTSP: Move more SDP/FMTP stuff from rtsp.c to rtpdec_mpeg4.c
mstorsjo
parents: 6176
diff changeset
66 typedef struct {
3a0c63aea9e9 RTSP: Move more SDP/FMTP stuff from rtsp.c to rtpdec_mpeg4.c
mstorsjo
parents: 6176
diff changeset
67 const char *str;
3a0c63aea9e9 RTSP: Move more SDP/FMTP stuff from rtsp.c to rtpdec_mpeg4.c
mstorsjo
parents: 6176
diff changeset
68 uint16_t type;
3a0c63aea9e9 RTSP: Move more SDP/FMTP stuff from rtsp.c to rtpdec_mpeg4.c
mstorsjo
parents: 6176
diff changeset
69 uint32_t offset;
3a0c63aea9e9 RTSP: Move more SDP/FMTP stuff from rtsp.c to rtpdec_mpeg4.c
mstorsjo
parents: 6176
diff changeset
70 } AttrNameMap;
3a0c63aea9e9 RTSP: Move more SDP/FMTP stuff from rtsp.c to rtpdec_mpeg4.c
mstorsjo
parents: 6176
diff changeset
71
3a0c63aea9e9 RTSP: Move more SDP/FMTP stuff from rtsp.c to rtpdec_mpeg4.c
mstorsjo
parents: 6176
diff changeset
72 /* 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
73 #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
74 #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
75 static const AttrNameMap attr_names[]=
3a0c63aea9e9 RTSP: Move more SDP/FMTP stuff from rtsp.c to rtpdec_mpeg4.c
mstorsjo
parents: 6176
diff changeset
76 {
3a0c63aea9e9 RTSP: Move more SDP/FMTP stuff from rtsp.c to rtpdec_mpeg4.c
mstorsjo
parents: 6176
diff changeset
77 { "SizeLength", ATTR_NAME_TYPE_INT,
3a0c63aea9e9 RTSP: Move more SDP/FMTP stuff from rtsp.c to rtpdec_mpeg4.c
mstorsjo
parents: 6176
diff changeset
78 offsetof(RTPPayloadData, sizelength) },
3a0c63aea9e9 RTSP: Move more SDP/FMTP stuff from rtsp.c to rtpdec_mpeg4.c
mstorsjo
parents: 6176
diff changeset
79 { "IndexLength", ATTR_NAME_TYPE_INT,
3a0c63aea9e9 RTSP: Move more SDP/FMTP stuff from rtsp.c to rtpdec_mpeg4.c
mstorsjo
parents: 6176
diff changeset
80 offsetof(RTPPayloadData, indexlength) },
3a0c63aea9e9 RTSP: Move more SDP/FMTP stuff from rtsp.c to rtpdec_mpeg4.c
mstorsjo
parents: 6176
diff changeset
81 { "IndexDeltaLength", ATTR_NAME_TYPE_INT,
3a0c63aea9e9 RTSP: Move more SDP/FMTP stuff from rtsp.c to rtpdec_mpeg4.c
mstorsjo
parents: 6176
diff changeset
82 offsetof(RTPPayloadData, indexdeltalength) },
3a0c63aea9e9 RTSP: Move more SDP/FMTP stuff from rtsp.c to rtpdec_mpeg4.c
mstorsjo
parents: 6176
diff changeset
83 { "profile-level-id", ATTR_NAME_TYPE_INT,
3a0c63aea9e9 RTSP: Move more SDP/FMTP stuff from rtsp.c to rtpdec_mpeg4.c
mstorsjo
parents: 6176
diff changeset
84 offsetof(RTPPayloadData, profile_level_id) },
3a0c63aea9e9 RTSP: Move more SDP/FMTP stuff from rtsp.c to rtpdec_mpeg4.c
mstorsjo
parents: 6176
diff changeset
85 { "StreamType", ATTR_NAME_TYPE_INT,
3a0c63aea9e9 RTSP: Move more SDP/FMTP stuff from rtsp.c to rtpdec_mpeg4.c
mstorsjo
parents: 6176
diff changeset
86 offsetof(RTPPayloadData, streamtype) },
3a0c63aea9e9 RTSP: Move more SDP/FMTP stuff from rtsp.c to rtpdec_mpeg4.c
mstorsjo
parents: 6176
diff changeset
87 { "mode", ATTR_NAME_TYPE_STR,
3a0c63aea9e9 RTSP: Move more SDP/FMTP stuff from rtsp.c to rtpdec_mpeg4.c
mstorsjo
parents: 6176
diff changeset
88 offsetof(RTPPayloadData, mode) },
3a0c63aea9e9 RTSP: Move more SDP/FMTP stuff from rtsp.c to rtpdec_mpeg4.c
mstorsjo
parents: 6176
diff changeset
89 { NULL, -1, -1 },
3a0c63aea9e9 RTSP: Move more SDP/FMTP stuff from rtsp.c to rtpdec_mpeg4.c
mstorsjo
parents: 6176
diff changeset
90 };
3a0c63aea9e9 RTSP: Move more SDP/FMTP stuff from rtsp.c to rtpdec_mpeg4.c
mstorsjo
parents: 6176
diff changeset
91
6176
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
92 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
93 {
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
94 /* decode the hexa encoded parameter */
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
95 int len = hex_to_data(NULL, value);
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
96 if (codec->extradata)
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
97 av_free(codec->extradata);
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
98 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
99 if (!codec->extradata)
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
100 return AVERROR(ENOMEM);
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
101 codec->extradata_size = len;
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
102 hex_to_data(codec->extradata, value);
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
103 return 0;
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
104 }
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
105
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
106 static int parse_sdp_line(AVFormatContext *s, int st_index,
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
107 PayloadContext *data, const char *line)
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
108 {
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
109 const char *p;
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
110 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
111 int res = 0, i;
3a0c63aea9e9 RTSP: Move more SDP/FMTP stuff from rtsp.c to rtpdec_mpeg4.c
mstorsjo
parents: 6176
diff changeset
112 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
113 RTSPStream *rtsp_st = st->priv_data;
3a0c63aea9e9 RTSP: Move more SDP/FMTP stuff from rtsp.c to rtpdec_mpeg4.c
mstorsjo
parents: 6176
diff changeset
114 AVCodecContext* codec = st->codec;
3a0c63aea9e9 RTSP: Move more SDP/FMTP stuff from rtsp.c to rtpdec_mpeg4.c
mstorsjo
parents: 6176
diff changeset
115 RTPPayloadData *rtp_payload_data = &rtsp_st->rtp_payload_data;
6176
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
116
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
117 if (av_strstart(line, "fmtp:", &p)) {
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
118 // remove protocol identifier
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
119 while (*p && *p == ' ') p++; // strip spaces
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
120 while (*p && *p != ' ') p++; // eat protocol identifier
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
121 while (*p && *p == ' ') p++; // strip trailing spaces
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
122
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
123 while (ff_rtsp_next_attr_and_value(&p,
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
124 attr, sizeof(attr),
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
125 value, sizeof(value))) {
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
126 if (!strcmp(attr, "config")) {
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
127 res = parse_fmtp_config(codec, value);
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
128
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
129 if (res < 0)
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
130 return res;
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
131 }
6177
3a0c63aea9e9 RTSP: Move more SDP/FMTP stuff from rtsp.c to rtpdec_mpeg4.c
mstorsjo
parents: 6176
diff changeset
132
3a0c63aea9e9 RTSP: Move more SDP/FMTP stuff from rtsp.c to rtpdec_mpeg4.c
mstorsjo
parents: 6176
diff changeset
133 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
134 /* Looking for a known attribute */
3a0c63aea9e9 RTSP: Move more SDP/FMTP stuff from rtsp.c to rtpdec_mpeg4.c
mstorsjo
parents: 6176
diff changeset
135 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
136 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
137 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
138 *(int *)((char *)rtp_payload_data +
3a0c63aea9e9 RTSP: Move more SDP/FMTP stuff from rtsp.c to rtpdec_mpeg4.c
mstorsjo
parents: 6176
diff changeset
139 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
140 } 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
141 *(char **)((char *)rtp_payload_data +
3a0c63aea9e9 RTSP: Move more SDP/FMTP stuff from rtsp.c to rtpdec_mpeg4.c
mstorsjo
parents: 6176
diff changeset
142 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
143 }
3a0c63aea9e9 RTSP: Move more SDP/FMTP stuff from rtsp.c to rtpdec_mpeg4.c
mstorsjo
parents: 6176
diff changeset
144 }
3a0c63aea9e9 RTSP: Move more SDP/FMTP stuff from rtsp.c to rtpdec_mpeg4.c
mstorsjo
parents: 6176
diff changeset
145 }
6176
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
146 }
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
147 }
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
148
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
149 return 0;
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
150
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
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
153 RTPDynamicProtocolHandler ff_mp4v_es_dynamic_handler = {
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
154 .enc_name = "MP4V-ES",
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
155 .codec_type = AVMEDIA_TYPE_VIDEO,
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
156 .codec_id = CODEC_ID_MPEG4,
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
157 .parse_sdp_a_line = parse_sdp_line,
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
158 .open = NULL,
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
159 .close = NULL,
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
160 .parse_packet = NULL
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
161 };
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
162
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
163 RTPDynamicProtocolHandler ff_mpeg4_generic_dynamic_handler = {
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
164 .enc_name = "mpeg4-generic",
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
165 .codec_type = AVMEDIA_TYPE_AUDIO,
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
166 .codec_id = CODEC_ID_AAC,
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
167 .parse_sdp_a_line = parse_sdp_line,
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
168 .open = NULL,
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
169 .close = NULL,
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
170 .parse_packet = NULL
5708c6d4223d RTSP: Decouple MPEG-4 and AAC specific parts from rtsp.c
mstorsjo
parents:
diff changeset
171 };