Commit 96070b8b authored by Josh Allmann's avatar Josh Allmann Committed by Ronald S. Bultje

Rename functions / comments from "Theora" to "Xiph" where relevant.

Patch by Josh Allmann <joshua DOT allmann AT gmail DOT com>.

Originally committed as revision 22766 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 06a36faf
/* /*
* RTP Theora Protocol * Xiph RTP Protocols
* Copyright (c) 2010 Josh Allmann * Copyright (c) 2010 Josh Allmann
* *
* This file is part of FFmpeg. * This file is part of FFmpeg.
...@@ -20,8 +20,8 @@ ...@@ -20,8 +20,8 @@
*/ */
/** /**
* @file libavformat/rtpdec_theora.c * @file libavformat/rtpdec_xiph.c
* @brief Theora / RTP Code * @brief Xiph / RTP Code
* @author Josh Allmann <joshua.allmann@gmail.com> * @author Josh Allmann <joshua.allmann@gmail.com>
*/ */
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
#include "rtpdec_xiph.h" #include "rtpdec_xiph.h"
/** /**
* RTP/Theora specific private data. * RTP/Xiph specific private data.
*/ */
struct PayloadContext { struct PayloadContext {
unsigned ident; ///< 24-bit stream configuration identifier unsigned ident; ///< 24-bit stream configuration identifier
...@@ -43,7 +43,7 @@ struct PayloadContext { ...@@ -43,7 +43,7 @@ struct PayloadContext {
ByteIOContext* fragment; ///< buffer for split payloads ByteIOContext* fragment; ///< buffer for split payloads
}; };
static PayloadContext *theora_new_context(void) static PayloadContext *xiph_new_context(void)
{ {
return av_mallocz(sizeof(PayloadContext)); return av_mallocz(sizeof(PayloadContext));
} }
...@@ -58,13 +58,13 @@ static inline void free_fragment_if_needed(PayloadContext * data) ...@@ -58,13 +58,13 @@ static inline void free_fragment_if_needed(PayloadContext * data)
} }
} }
static void theora_free_context(PayloadContext * data) static void xiph_free_context(PayloadContext * data)
{ {
free_fragment_if_needed(data); free_fragment_if_needed(data);
av_free(data); av_free(data);
} }
static int theora_handle_packet(AVFormatContext * ctx, static int xiph_handle_packet(AVFormatContext * ctx,
PayloadContext * data, PayloadContext * data,
AVStream * st, AVStream * st,
AVPacket * pkt, AVPacket * pkt,
...@@ -79,7 +79,7 @@ static int theora_handle_packet(AVFormatContext * ctx, ...@@ -79,7 +79,7 @@ static int theora_handle_packet(AVFormatContext * ctx,
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
} }
// read theora rtp headers // read xiph rtp headers
ident = AV_RB24(buf); ident = AV_RB24(buf);
fragmented = buf[3] >> 6; fragmented = buf[3] >> 6;
tdt = (buf[3] >> 4) & 3; tdt = (buf[3] >> 4) & 3;
...@@ -95,13 +95,13 @@ static int theora_handle_packet(AVFormatContext * ctx, ...@@ -95,13 +95,13 @@ static int theora_handle_packet(AVFormatContext * ctx,
if (ident != data->ident) { if (ident != data->ident) {
av_log(ctx, AV_LOG_ERROR, av_log(ctx, AV_LOG_ERROR,
"Unimplemented Theora SDP configuration change detected\n"); "Unimplemented Xiph SDP configuration change detected\n");
return AVERROR_PATCHWELCOME; return AVERROR_PATCHWELCOME;
} }
if (tdt) { if (tdt) {
av_log(ctx, AV_LOG_ERROR, av_log(ctx, AV_LOG_ERROR,
"Unimplemented RTP Theora packet settings (%d,%d,%d)\n", "Unimplemented RTP Xiph packet settings (%d,%d,%d)\n",
fragmented, tdt, num_pkts); fragmented, tdt, num_pkts);
return AVERROR_PATCHWELCOME; return AVERROR_PATCHWELCOME;
} }
...@@ -149,7 +149,7 @@ static int theora_handle_packet(AVFormatContext * ctx, ...@@ -149,7 +149,7 @@ static int theora_handle_packet(AVFormatContext * ctx,
return 0; return 0;
} else if (fragmented == 1) { } else if (fragmented == 1) {
// start of theora data fragment // start of xiph data fragment
int res; int res;
// end packet has been lost somewhere, so drop buffered data // end packet has been lost somewhere, so drop buffered data
...@@ -175,9 +175,9 @@ static int theora_handle_packet(AVFormatContext * ctx, ...@@ -175,9 +175,9 @@ static int theora_handle_packet(AVFormatContext * ctx,
put_buffer(data->fragment, buf, pkt_len); put_buffer(data->fragment, buf, pkt_len);
if (fragmented == 3) { if (fragmented == 3) {
// end of theora data packet // end of xiph data packet
uint8_t* theora_data; uint8_t* xiph_data;
int frame_size = url_close_dyn_buf(data->fragment, &theora_data); int frame_size = url_close_dyn_buf(data->fragment, &xiph_data);
if (frame_size < 0) { if (frame_size < 0) {
av_log(ctx, AV_LOG_ERROR, av_log(ctx, AV_LOG_ERROR,
...@@ -190,10 +190,10 @@ static int theora_handle_packet(AVFormatContext * ctx, ...@@ -190,10 +190,10 @@ static int theora_handle_packet(AVFormatContext * ctx,
return AVERROR_NOMEM; return AVERROR_NOMEM;
} }
memcpy(pkt->data, theora_data, frame_size); memcpy(pkt->data, xiph_data, frame_size);
pkt->stream_index = st->index; pkt->stream_index = st->index;
av_free(theora_data); av_free(xiph_data);
data->fragment = NULL; data->fragment = NULL;
return 0; return 0;
...@@ -226,7 +226,7 @@ static int get_base128(const uint8_t ** buf, const uint8_t * buf_end) ...@@ -226,7 +226,7 @@ static int get_base128(const uint8_t ** buf, const uint8_t * buf_end)
static unsigned int static unsigned int
parse_packed_headers(const uint8_t * packed_headers, parse_packed_headers(const uint8_t * packed_headers,
const uint8_t * packed_headers_end, const uint8_t * packed_headers_end,
AVCodecContext * codec, PayloadContext * theora_data) AVCodecContext * codec, PayloadContext * xiph_data)
{ {
unsigned num_packed, num_headers, length, length1, length2, extradata_alloc; unsigned num_packed, num_headers, length, length1, length2, extradata_alloc;
...@@ -240,7 +240,7 @@ parse_packed_headers(const uint8_t * packed_headers, ...@@ -240,7 +240,7 @@ parse_packed_headers(const uint8_t * packed_headers,
} }
num_packed = bytestream_get_be32(&packed_headers); num_packed = bytestream_get_be32(&packed_headers);
theora_data->ident = bytestream_get_be24(&packed_headers); xiph_data->ident = bytestream_get_be24(&packed_headers);
length = bytestream_get_be16(&packed_headers); length = bytestream_get_be16(&packed_headers);
num_headers = get_base128(&packed_headers, packed_headers_end); num_headers = get_base128(&packed_headers, packed_headers_end);
length1 = get_base128(&packed_headers, packed_headers_end); length1 = get_base128(&packed_headers, packed_headers_end);
...@@ -284,8 +284,8 @@ parse_packed_headers(const uint8_t * packed_headers, ...@@ -284,8 +284,8 @@ parse_packed_headers(const uint8_t * packed_headers,
return 0; return 0;
} }
static int theora_parse_fmtp_pair(AVCodecContext * codec, static int xiph_parse_fmtp_pair(AVCodecContext * codec,
PayloadContext *theora_data, PayloadContext *xiph_data,
char *attr, char *value) char *attr, char *value)
{ {
int result = 0; int result = 0;
...@@ -325,7 +325,7 @@ static int theora_parse_fmtp_pair(AVCodecContext * codec, ...@@ -325,7 +325,7 @@ static int theora_parse_fmtp_pair(AVCodecContext * codec,
result = parse_packed_headers result = parse_packed_headers
(decoded_packet, decoded_packet + packet_size, codec, (decoded_packet, decoded_packet + packet_size, codec,
theora_data); xiph_data);
} else { } else {
av_log(codec, AV_LOG_ERROR, av_log(codec, AV_LOG_ERROR,
"Out of memory while decoding SDP configuration.\n"); "Out of memory while decoding SDP configuration.\n");
...@@ -340,7 +340,7 @@ static int theora_parse_fmtp_pair(AVCodecContext * codec, ...@@ -340,7 +340,7 @@ static int theora_parse_fmtp_pair(AVCodecContext * codec,
return result; return result;
} }
static int theora_parse_sdp_line(AVFormatContext *s, int st_index, static int xiph_parse_sdp_line(AVFormatContext *s, int st_index,
PayloadContext *data, const char *line) PayloadContext *data, const char *line)
{ {
const char *p; const char *p;
...@@ -366,7 +366,7 @@ static int theora_parse_sdp_line(AVFormatContext *s, int st_index, ...@@ -366,7 +366,7 @@ static int theora_parse_sdp_line(AVFormatContext *s, int st_index,
while (ff_rtsp_next_attr_and_value(&p, while (ff_rtsp_next_attr_and_value(&p,
attr, attr_size, attr, attr_size,
value, value_size)) { value, value_size)) {
res = theora_parse_fmtp_pair(codec, data, attr, value); res = xiph_parse_fmtp_pair(codec, data, attr, value);
if (res < 0 && res != AVERROR_PATCHWELCOME) if (res < 0 && res != AVERROR_PATCHWELCOME)
return res; return res;
} }
...@@ -380,8 +380,8 @@ RTPDynamicProtocolHandler ff_theora_dynamic_handler = { ...@@ -380,8 +380,8 @@ RTPDynamicProtocolHandler ff_theora_dynamic_handler = {
.enc_name = "theora", .enc_name = "theora",
.codec_type = AVMEDIA_TYPE_VIDEO, .codec_type = AVMEDIA_TYPE_VIDEO,
.codec_id = CODEC_ID_THEORA, .codec_id = CODEC_ID_THEORA,
.parse_sdp_a_line = theora_parse_sdp_line, .parse_sdp_a_line = xiph_parse_sdp_line,
.open = theora_new_context, .open = xiph_new_context,
.close = theora_free_context, .close = xiph_free_context,
.parse_packet = theora_handle_packet .parse_packet = xiph_handle_packet
}; };
/* /*
* RTP Theora Protocol. * Xiph RTP Protocols
* Based off RFC 5215 (Vorbis RTP) and the Theora RTP draft. * Based off RFC 5215 (Vorbis RTP) and the Theora RTP draft.
* Copyright (c) 2010 Josh Allmann * Copyright (c) 2010 Josh Allmann
* *
...@@ -20,8 +20,8 @@ ...@@ -20,8 +20,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#ifndef AVFORMAT_RTPDEC_THEORA_H #ifndef AVFORMAT_RTPDEC_XIPH_H
#define AVFORMAT_RTPDEC_THEORA_H #define AVFORMAT_RTPDEC_XIPH_H
#include "libavcodec/avcodec.h" #include "libavcodec/avcodec.h"
#include "rtpdec.h" #include "rtpdec.h"
...@@ -31,4 +31,4 @@ ...@@ -31,4 +31,4 @@
*/ */
extern RTPDynamicProtocolHandler ff_theora_dynamic_handler; extern RTPDynamicProtocolHandler ff_theora_dynamic_handler;
#endif /* AVFORMAT_RTPDEC_THEORA_H */ #endif /* AVFORMAT_RTPDEC_XIPH_H */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment