Commit c617d7b8 authored by Stefano Sabatini's avatar Stefano Sabatini

examples/muxing.c: apply misc style fixes

parent 90b043a6
...@@ -81,7 +81,7 @@ static AVStream *add_audio_stream(AVFormatContext *oc, enum CodecID codec_id) ...@@ -81,7 +81,7 @@ static AVStream *add_audio_stream(AVFormatContext *oc, enum CodecID codec_id)
c->channels = 2; c->channels = 2;
// some formats want stream headers to be separate // some formats want stream headers to be separate
if(oc->oformat->flags & AVFMT_GLOBALHEADER) if (oc->oformat->flags & AVFMT_GLOBALHEADER)
c->flags |= CODEC_FLAG_GLOBAL_HEADER; c->flags |= CODEC_FLAG_GLOBAL_HEADER;
return st; return st;
...@@ -144,7 +144,7 @@ static void get_audio_frame(int16_t *samples, int frame_size, int nb_channels) ...@@ -144,7 +144,7 @@ static void get_audio_frame(int16_t *samples, int frame_size, int nb_channels)
int16_t *q; int16_t *q;
q = samples; q = samples;
for(j=0;j<frame_size;j++) { for (j = 0; j < frame_size; j++) {
v = (int)(sin(t) * 10000); v = (int)(sin(t) * 10000);
for(i = 0; i < nb_channels; i++) for(i = 0; i < nb_channels; i++)
*q++ = v; *q++ = v;
...@@ -163,13 +163,13 @@ static void write_audio_frame(AVFormatContext *oc, AVStream *st) ...@@ -163,13 +163,13 @@ static void write_audio_frame(AVFormatContext *oc, AVStream *st)
get_audio_frame(samples, audio_input_frame_size, c->channels); get_audio_frame(samples, audio_input_frame_size, c->channels);
pkt.size= avcodec_encode_audio(c, audio_outbuf, audio_outbuf_size, samples); pkt.size = avcodec_encode_audio(c, audio_outbuf, audio_outbuf_size, samples);
if (c->coded_frame && c->coded_frame->pts != AV_NOPTS_VALUE) if (c->coded_frame && c->coded_frame->pts != AV_NOPTS_VALUE)
pkt.pts= av_rescale_q(c->coded_frame->pts, c->time_base, st->time_base); pkt.pts= av_rescale_q(c->coded_frame->pts, c->time_base, st->time_base);
pkt.flags |= AV_PKT_FLAG_KEY; pkt.flags |= AV_PKT_FLAG_KEY;
pkt.stream_index= st->index; pkt.stream_index = st->index;
pkt.data= audio_outbuf; pkt.data = audio_outbuf;
/* write the compressed frame in the media file */ /* write the compressed frame in the media file */
if (av_interleaved_write_frame(oc, &pkt) != 0) { if (av_interleaved_write_frame(oc, &pkt) != 0) {
...@@ -233,7 +233,7 @@ static AVStream *add_video_stream(AVFormatContext *oc, enum CodecID codec_id) ...@@ -233,7 +233,7 @@ static AVStream *add_video_stream(AVFormatContext *oc, enum CodecID codec_id)
c->mb_decision=2; c->mb_decision=2;
} }
// some formats want stream headers to be separate // some formats want stream headers to be separate
if(oc->oformat->flags & AVFMT_GLOBALHEADER) if (oc->oformat->flags & AVFMT_GLOBALHEADER)
c->flags |= CODEC_FLAG_GLOBAL_HEADER; c->flags |= CODEC_FLAG_GLOBAL_HEADER;
return st; return st;
...@@ -319,15 +319,15 @@ static void fill_yuv_image(AVFrame *pict, int frame_index, int width, int height ...@@ -319,15 +319,15 @@ static void fill_yuv_image(AVFrame *pict, int frame_index, int width, int height
i = frame_index; i = frame_index;
/* Y */ /* Y */
for(y=0;y<height;y++) { for (y = 0; y < height; y++) {
for(x=0;x<width;x++) { for (x = 0; x < width; x++) {
pict->data[0][y * pict->linesize[0] + x] = x + y + i * 3; pict->data[0][y * pict->linesize[0] + x] = x + y + i * 3;
} }
} }
/* Cb and Cr */ /* Cb and Cr */
for(y=0;y<height/2;y++) { for (y = 0; y < height/2; y++) {
for(x=0;x<width/2;x++) { for (x = 0; x < width/2; x++) {
pict->data[1][y * pict->linesize[1] + x] = 128 + y + i * 2; pict->data[1][y * pict->linesize[1] + x] = 128 + y + i * 2;
pict->data[2][y * pict->linesize[2] + x] = 64 + x + i * 5; pict->data[2][y * pict->linesize[2] + x] = 64 + x + i * 5;
} }
...@@ -377,9 +377,9 @@ static void write_video_frame(AVFormatContext *oc, AVStream *st) ...@@ -377,9 +377,9 @@ static void write_video_frame(AVFormatContext *oc, AVStream *st)
av_init_packet(&pkt); av_init_packet(&pkt);
pkt.flags |= AV_PKT_FLAG_KEY; pkt.flags |= AV_PKT_FLAG_KEY;
pkt.stream_index= st->index; pkt.stream_index = st->index;
pkt.data= (uint8_t *)picture; pkt.data = (uint8_t *)picture;
pkt.size= sizeof(AVPicture); pkt.size = sizeof(AVPicture);
ret = av_interleaved_write_frame(oc, &pkt); ret = av_interleaved_write_frame(oc, &pkt);
} else { } else {
...@@ -394,9 +394,9 @@ static void write_video_frame(AVFormatContext *oc, AVStream *st) ...@@ -394,9 +394,9 @@ static void write_video_frame(AVFormatContext *oc, AVStream *st)
pkt.pts= av_rescale_q(c->coded_frame->pts, c->time_base, st->time_base); pkt.pts= av_rescale_q(c->coded_frame->pts, c->time_base, st->time_base);
if(c->coded_frame->key_frame) if(c->coded_frame->key_frame)
pkt.flags |= AV_PKT_FLAG_KEY; pkt.flags |= AV_PKT_FLAG_KEY;
pkt.stream_index= st->index; pkt.stream_index = st->index;
pkt.data= video_outbuf; pkt.data = video_outbuf;
pkt.size= out_size; pkt.size = out_size;
/* write the compressed frame in the media file */ /* write the compressed frame in the media file */
ret = av_interleaved_write_frame(oc, &pkt); ret = av_interleaved_write_frame(oc, &pkt);
...@@ -458,7 +458,7 @@ int main(int argc, char **argv) ...@@ -458,7 +458,7 @@ int main(int argc, char **argv)
if (!oc) { if (!oc) {
exit(1); exit(1);
} }
fmt= oc->oformat; fmt = oc->oformat;
/* add the audio and video streams using the default format codecs /* add the audio and video streams using the default format codecs
and initialize the codecs */ and initialize the codecs */
......
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