Add RTP packetization of Theora and Vorbis

Patch by Josh Allmann, joshua dot allmann at gmail

Originally committed as revision 24735 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Josh Allmann
2010-08-07 11:16:07 +00:00
committed by Martin Storsjö
parent a63dbf3970
commit 91af5601c1
8 changed files with 259 additions and 2 deletions

View File

@@ -53,6 +53,8 @@ static int is_supported(enum CodecID id)
case CODEC_ID_MPEG2TS:
case CODEC_ID_AMR_NB:
case CODEC_ID_AMR_WB:
case CODEC_ID_VORBIS:
case CODEC_ID_THEORA:
return 1;
default:
return 0;
@@ -135,6 +137,13 @@ static int rtp_write_header(AVFormatContext *s1)
s->nal_length_size = (st->codec->extradata[4] & 0x03) + 1;
}
break;
case CODEC_ID_VORBIS:
case CODEC_ID_THEORA:
if (!s->max_frames_per_packet) s->max_frames_per_packet = 15;
s->max_frames_per_packet = av_clip(s->max_frames_per_packet, 1, 15);
s->max_payload_size -= 6; // ident+frag+tdt/vdt+pkt_num+pkt_length
s->num_frames = 0;
goto defaultcase;
case CODEC_ID_AMR_NB:
case CODEC_ID_AMR_WB:
if (!s->max_frames_per_packet)
@@ -155,6 +164,7 @@ static int rtp_write_header(AVFormatContext *s1)
case CODEC_ID_AAC:
s->num_frames = 0;
default:
defaultcase:
if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO) {
av_set_pts_info(st, 32, 1, st->codec->sample_rate);
}
@@ -393,6 +403,10 @@ static int rtp_write_packet(AVFormatContext *s1, AVPacket *pkt)
case CODEC_ID_H263P:
ff_rtp_send_h263(s1, pkt->data, size);
break;
case CODEC_ID_VORBIS:
case CODEC_ID_THEORA:
ff_rtp_send_xiph(s1, pkt->data, size);
break;
default:
/* better than nothing : send the codec raw data */
rtp_send_raw(s1, pkt->data, size);