summaryrefslogtreecommitdiff
path: root/libavformat/ogg.c
diff options
context:
space:
mode:
Diffstat (limited to 'libavformat/ogg.c')
-rw-r--r--libavformat/ogg.c38
1 files changed, 19 insertions, 19 deletions
diff --git a/libavformat/ogg.c b/libavformat/ogg.c
index 53c8b05826..68d678ba5f 100644
--- a/libavformat/ogg.c
+++ b/libavformat/ogg.c
@@ -30,14 +30,14 @@ typedef struct OggContext {
#ifdef CONFIG_MUXERS
-static int ogg_write_header(AVFormatContext *avfcontext)
+static int ogg_write_header(AVFormatContext *avfcontext)
{
OggContext *context = avfcontext->priv_data;
- ogg_packet *op= &context->op;
+ ogg_packet *op= &context->op;
int n;
ogg_stream_init(&context->os, 31415);
-
+
for(n = 0 ; n < avfcontext->nb_streams ; n++) {
AVCodecContext *codec = avfcontext->streams[n]->codec;
uint8_t *headers = codec->extradata;
@@ -45,7 +45,7 @@ static int ogg_write_header(AVFormatContext *avfcontext)
uint8_t *header_start[3];
int header_len[3];
int i, j;
-
+
av_set_pts_info(avfcontext->streams[n], 60, 1, AV_TIME_BASE);
for(j=1,i=0;i<2;++i, ++j) {
@@ -75,7 +75,7 @@ static int ogg_write_header(AVFormatContext *avfcontext)
context->header_handled = 0 ;
}
-
+
return 0 ;
}
@@ -108,14 +108,14 @@ static int ogg_write_packet(AVFormatContext *avfcontext, AVPacket *pkt)
op->granulepos= pts;
/* correct the fields in the packet -- essential for streaming */
-
- ogg_stream_packetin(&context->os, op);
-
+
+ ogg_stream_packetin(&context->os, op);
+
while(ogg_stream_pageout(&context->os, &og)) {
put_buffer(&avfcontext->pb, og.header, og.header_len);
- put_buffer(&avfcontext->pb, og.body, og.body_len);
+ put_buffer(&avfcontext->pb, og.body, og.body_len);
put_flush_packet(&avfcontext->pb);
- }
+ }
op->packetno++;
return 0;
@@ -164,9 +164,9 @@ static int next_packet(AVFormatContext *avfcontext, ogg_packet *op) {
buf = ogg_sync_buffer(&context->oy, DECODER_BUFFER_SIZE) ;
if(get_buffer(&avfcontext->pb, buf, DECODER_BUFFER_SIZE) <= 0)
return 1 ;
- ogg_sync_wrote(&context->oy, DECODER_BUFFER_SIZE) ;
- }
-
+ ogg_sync_wrote(&context->oy, DECODER_BUFFER_SIZE) ;
+ }
+
/* got a page. Feed it into the stream and get the packet */
if(ogg_stream_pagein(&context->os, &og) != 0)
return 1 ;
@@ -179,25 +179,25 @@ static int next_packet(AVFormatContext *avfcontext, ogg_packet *op) {
static int ogg_read_header(AVFormatContext *avfcontext, AVFormatParameters *ap)
{
OggContext *context = avfcontext->priv_data;
- ogg_packet op ;
+ ogg_packet op ;
char *buf ;
ogg_page og ;
AVStream *ast ;
AVCodecContext *codec;
uint8_t *p;
int i;
-
+
ogg_sync_init(&context->oy) ;
buf = ogg_sync_buffer(&context->oy, DECODER_BUFFER_SIZE) ;
if(get_buffer(&avfcontext->pb, buf, DECODER_BUFFER_SIZE) <= 0)
return AVERROR_IO ;
-
- ogg_sync_wrote(&context->oy, DECODER_BUFFER_SIZE) ;
+
+ ogg_sync_wrote(&context->oy, DECODER_BUFFER_SIZE) ;
ogg_sync_pageout(&context->oy, &og) ;
ogg_stream_init(&context->os, ogg_page_serialno(&og)) ;
ogg_stream_pagein(&context->os, &og) ;
-
+
/* currently only one vorbis stream supported */
ast = av_new_stream(avfcontext, 0) ;
@@ -230,7 +230,7 @@ static int ogg_read_header(AVFormatContext *avfcontext, AVFormatParameters *ap)
static int ogg_read_packet(AVFormatContext *avfcontext, AVPacket *pkt) {
ogg_packet op ;
- if(next_packet(avfcontext, &op))
+ if(next_packet(avfcontext, &op))
return AVERROR_IO ;
if(av_new_packet(pkt, op.bytes) < 0)
return AVERROR_IO ;