mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-libstb-hal.git
synced 2025-08-26 23:12:44 +02:00
libeplayer3: code format
Origin commit data
------------------
Branch: master
Commit: 61903c41fd
Author: max_10 <max_10@gmx.de>
Date: 2017-12-15 (Fri, 15 Dec 2017)
------------------
No further description and justification available within origin commit message!
------------------
This commit was generated by Migit
This commit is contained in:
@@ -545,7 +545,7 @@ bool Input::UpdateTracks()
|
|||||||
}
|
}
|
||||||
|
|
||||||
track.pid = use_index_as_pid ? n + 1: stream->id;
|
track.pid = use_index_as_pid ? n + 1: stream->id;
|
||||||
track.ac3flags = 0;
|
track.ac3flags = 0;
|
||||||
|
|
||||||
switch (stream->codec->codec_type) {
|
switch (stream->codec->codec_type) {
|
||||||
case AVMEDIA_TYPE_VIDEO:
|
case AVMEDIA_TYPE_VIDEO:
|
||||||
@@ -555,43 +555,43 @@ bool Input::UpdateTracks()
|
|||||||
break;
|
break;
|
||||||
case AVMEDIA_TYPE_AUDIO:
|
case AVMEDIA_TYPE_AUDIO:
|
||||||
switch(stream->codec->codec_id) {
|
switch(stream->codec->codec_id) {
|
||||||
case AV_CODEC_ID_MP2:
|
case AV_CODEC_ID_MP2:
|
||||||
track.ac3flags = 1;
|
track.ac3flags = 1;
|
||||||
break;
|
break;
|
||||||
case AV_CODEC_ID_MP3:
|
case AV_CODEC_ID_MP3:
|
||||||
track.ac3flags = 2;
|
track.ac3flags = 2;
|
||||||
break;
|
break;
|
||||||
case AV_CODEC_ID_AC3:
|
case AV_CODEC_ID_AC3:
|
||||||
track.ac3flags = 3;
|
track.ac3flags = 3;
|
||||||
break;
|
break;
|
||||||
case AV_CODEC_ID_DTS:
|
case AV_CODEC_ID_DTS:
|
||||||
track.ac3flags = 4;
|
track.ac3flags = 4;
|
||||||
break;
|
break;
|
||||||
case AV_CODEC_ID_AAC: {
|
case AV_CODEC_ID_AAC: {
|
||||||
unsigned int extradata_size = stream->codec->extradata_size;
|
unsigned int extradata_size = stream->codec->extradata_size;
|
||||||
unsigned int object_type = 2;
|
unsigned int object_type = 2;
|
||||||
if(extradata_size >= 2)
|
if(extradata_size >= 2)
|
||||||
object_type = stream->codec->extradata[0] >> 3;
|
object_type = stream->codec->extradata[0] >> 3;
|
||||||
if (extradata_size <= 1 || object_type == 1 || object_type == 5) {
|
if (extradata_size <= 1 || object_type == 1 || object_type == 5) {
|
||||||
fprintf(stderr, "use resampling for AAC\n");
|
fprintf(stderr, "use resampling for AAC\n");
|
||||||
track.ac3flags = 6;
|
track.ac3flags = 6;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
track.ac3flags = 5;
|
track.ac3flags = 5;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case AV_CODEC_ID_FLAC:
|
case AV_CODEC_ID_FLAC:
|
||||||
track.ac3flags = 8;
|
track.ac3flags = 8;
|
||||||
break;
|
break;
|
||||||
case AV_CODEC_ID_WMAV1:
|
case AV_CODEC_ID_WMAV1:
|
||||||
case AV_CODEC_ID_WMAV2:
|
case AV_CODEC_ID_WMAV2:
|
||||||
case AV_CODEC_ID_WMAVOICE:
|
case AV_CODEC_ID_WMAVOICE:
|
||||||
case AV_CODEC_ID_WMAPRO:
|
case AV_CODEC_ID_WMAPRO:
|
||||||
case AV_CODEC_ID_WMALOSSLESS:
|
case AV_CODEC_ID_WMALOSSLESS:
|
||||||
track.ac3flags = 9;
|
track.ac3flags = 9;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
track.ac3flags = 0;
|
track.ac3flags = 0;
|
||||||
}
|
}
|
||||||
player->manager.addAudioTrack(track);
|
player->manager.addAudioTrack(track);
|
||||||
if (!audioTrack)
|
if (!audioTrack)
|
||||||
|
@@ -311,7 +311,7 @@ bool Output::SwitchAudio(Track *track)
|
|||||||
}
|
}
|
||||||
audioTrack = track;
|
audioTrack = track;
|
||||||
if (track->stream) {
|
if (track->stream) {
|
||||||
AVCodecContext *avcc = track->stream->codec;
|
AVCodecContext *avcc = track->stream->codec;
|
||||||
if (!avcc)
|
if (!avcc)
|
||||||
return false;
|
return false;
|
||||||
audioWriter = Writer::GetWriter(avcc->codec_id, avcc->codec_type, audioTrack->ac3flags);
|
audioWriter = Writer::GetWriter(avcc->codec_id, avcc->codec_type, audioTrack->ac3flags);
|
||||||
|
@@ -242,24 +242,24 @@ bool WriterPCM::Write(AVPacket *packet, int64_t pts)
|
|||||||
restart_audio_resampling = false;
|
restart_audio_resampling = false;
|
||||||
initialHeader = true;
|
initialHeader = true;
|
||||||
|
|
||||||
if (swr) {
|
if (swr) {
|
||||||
swr_free(&swr);
|
swr_free(&swr);
|
||||||
swr = NULL;
|
swr = NULL;
|
||||||
}
|
}
|
||||||
if (decoded_frame) {
|
if (decoded_frame) {
|
||||||
av_frame_free(&decoded_frame);
|
av_frame_free(&decoded_frame);
|
||||||
decoded_frame = NULL;
|
decoded_frame = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
AVCodec *codec = avcodec_find_decoder(c->codec_id);
|
AVCodec *codec = avcodec_find_decoder(c->codec_id);
|
||||||
if (!codec) {
|
if (!codec) {
|
||||||
fprintf(stderr, "%s %d: avcodec_find_decoder(%llx)\n", __func__, __LINE__, (unsigned long long) c->codec_id);
|
fprintf(stderr, "%s %d: avcodec_find_decoder(%llx)\n", __func__, __LINE__, (unsigned long long) c->codec_id);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
avcodec_close(c);
|
avcodec_close(c);
|
||||||
if (avcodec_open2(c, codec, NULL)) {
|
if (avcodec_open2(c, codec, NULL)) {
|
||||||
fprintf(stderr, "%s %d: avcodec_open2 failed\n", __func__, __LINE__);
|
fprintf(stderr, "%s %d: avcodec_open2 failed\n", __func__, __LINE__);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -315,13 +315,13 @@ bool WriterPCM::Write(AVPacket *packet, int64_t pts)
|
|||||||
while (packet_size > 0 || (!packet_size && !packet->data)) {
|
while (packet_size > 0 || (!packet_size && !packet->data)) {
|
||||||
int got_frame = 0;
|
int got_frame = 0;
|
||||||
|
|
||||||
if (!decoded_frame) {
|
if (!decoded_frame) {
|
||||||
if (!(decoded_frame = av_frame_alloc())) {
|
if (!(decoded_frame = av_frame_alloc())) {
|
||||||
fprintf(stderr, "out of memory\n");
|
fprintf(stderr, "out of memory\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
av_frame_unref(decoded_frame);
|
av_frame_unref(decoded_frame);
|
||||||
|
|
||||||
int len = avcodec_decode_audio4(c, decoded_frame, &got_frame, packet);
|
int len = avcodec_decode_audio4(c, decoded_frame, &got_frame, packet);
|
||||||
if (len < 0) {
|
if (len < 0) {
|
||||||
|
@@ -68,21 +68,21 @@ static Writer writer __attribute__ ((init_priority (300)));
|
|||||||
|
|
||||||
Writer *Writer::GetWriter(enum AVCodecID id, enum AVMediaType codec_type, int track_type)
|
Writer *Writer::GetWriter(enum AVCodecID id, enum AVMediaType codec_type, int track_type)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "GETWRITER %d %d %d", id, codec_type, track_type);
|
fprintf(stderr, "GETWRITER %d %d %d", id, codec_type, track_type);
|
||||||
if (track_type != 6) { // hack for ACC resampling
|
if (track_type != 6) { // hack for ACC resampling
|
||||||
std::map<enum AVCodecID,Writer*>::iterator it = writers.find(id);
|
std::map<enum AVCodecID,Writer*>::iterator it = writers.find(id);
|
||||||
if (it != writers.end())
|
if (it != writers.end())
|
||||||
return it->second;
|
return it->second;
|
||||||
}
|
}
|
||||||
switch (codec_type) {
|
switch (codec_type) {
|
||||||
case AVMEDIA_TYPE_AUDIO:
|
case AVMEDIA_TYPE_AUDIO:
|
||||||
if (id == AV_CODEC_ID_INJECTPCM) // should not happen
|
if (id == AV_CODEC_ID_INJECTPCM) // should not happen
|
||||||
break;
|
break;
|
||||||
return GetWriter(AV_CODEC_ID_INJECTPCM, codec_type, 100);
|
return GetWriter(AV_CODEC_ID_INJECTPCM, codec_type, 100);
|
||||||
case AVMEDIA_TYPE_VIDEO:
|
case AVMEDIA_TYPE_VIDEO:
|
||||||
if (id == AV_CODEC_ID_MPEG2TS) // should not happen
|
if (id == AV_CODEC_ID_MPEG2TS) // should not happen
|
||||||
break;
|
break;
|
||||||
return GetWriter(AV_CODEC_ID_MPEG2TS, codec_type, 100);
|
return GetWriter(AV_CODEC_ID_MPEG2TS, codec_type, 100);
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user