Update code style

Limit source code to 80 chars, and declare functions return type and
modifiers on a separate line.

This allows to avoid very long lines, and all function names are
aligned.

(We do this on VLC, and I like it.)
This commit is contained in:
Romain Vimont
2019-03-02 20:09:56 +01:00
parent b2fe005498
commit aeda583a2c
45 changed files with 813 additions and 409 deletions

View File

@@ -18,8 +18,10 @@
#include "video_buffer.h"
// set the decoded frame as ready for rendering, and notify
static void push_frame(struct decoder *decoder) {
SDL_bool previous_frame_consumed = video_buffer_offer_decoded_frame(decoder->video_buffer);
static void
push_frame(struct decoder *decoder) {
SDL_bool previous_frame_consumed =
video_buffer_offer_decoded_frame(decoder->video_buffer);
if (!previous_frame_consumed) {
// the previous EVENT_NEW_FRAME will consume this frame
return;
@@ -30,11 +32,13 @@ static void push_frame(struct decoder *decoder) {
SDL_PushEvent(&new_frame_event);
}
void decoder_init(struct decoder *decoder, struct video_buffer *vb) {
void
decoder_init(struct decoder *decoder, struct video_buffer *vb) {
decoder->video_buffer = vb;
}
SDL_bool decoder_open(struct decoder *decoder, AVCodec *codec) {
SDL_bool
decoder_open(struct decoder *decoder, AVCodec *codec) {
decoder->codec_ctx = avcodec_alloc_context3(codec);
if (!decoder->codec_ctx) {
LOGC("Could not allocate decoder context");
@@ -50,12 +54,14 @@ SDL_bool decoder_open(struct decoder *decoder, AVCodec *codec) {
return SDL_TRUE;
}
void decoder_close(struct decoder *decoder) {
void
decoder_close(struct decoder *decoder) {
avcodec_close(decoder->codec_ctx);
avcodec_free_context(&decoder->codec_ctx);
}
SDL_bool decoder_push(struct decoder *decoder, AVPacket *packet) {
SDL_bool
decoder_push(struct decoder *decoder, AVPacket *packet) {
// the new decoding/encoding API has been introduced by:
// <http://git.videolan.org/?p=ffmpeg.git;a=commitdiff;h=7fc329e2dd6226dfecaa4a1d7adf353bf2773726>
#ifdef SCRCPY_LAVF_HAS_NEW_ENCODING_DECODING_API
@@ -90,6 +96,7 @@ SDL_bool decoder_push(struct decoder *decoder, AVPacket *packet) {
return SDL_TRUE;
}
void decoder_interrupt(struct decoder *decoder) {
void
decoder_interrupt(struct decoder *decoder) {
video_buffer_interrupt(decoder->video_buffer);
}