mirror of
https://github.com/tuxbox-neutrino/libstb-hal.git
synced 2025-08-27 15:33:00 +02:00
libeplayer3: code format
This commit is contained in:
@@ -242,24 +242,24 @@ bool WriterPCM::Write(AVPacket *packet, int64_t pts)
|
||||
restart_audio_resampling = false;
|
||||
initialHeader = true;
|
||||
|
||||
if (swr) {
|
||||
swr_free(&swr);
|
||||
swr = NULL;
|
||||
if (swr) {
|
||||
swr_free(&swr);
|
||||
swr = NULL;
|
||||
}
|
||||
if (decoded_frame) {
|
||||
av_frame_free(&decoded_frame);
|
||||
decoded_frame = NULL;
|
||||
if (decoded_frame) {
|
||||
av_frame_free(&decoded_frame);
|
||||
decoded_frame = NULL;
|
||||
}
|
||||
|
||||
AVCodec *codec = avcodec_find_decoder(c->codec_id);
|
||||
if (!codec) {
|
||||
fprintf(stderr, "%s %d: avcodec_find_decoder(%llx)\n", __func__, __LINE__, (unsigned long long) c->codec_id);
|
||||
return false;
|
||||
if (!codec) {
|
||||
fprintf(stderr, "%s %d: avcodec_find_decoder(%llx)\n", __func__, __LINE__, (unsigned long long) c->codec_id);
|
||||
return false;
|
||||
}
|
||||
avcodec_close(c);
|
||||
if (avcodec_open2(c, codec, NULL)) {
|
||||
fprintf(stderr, "%s %d: avcodec_open2 failed\n", __func__, __LINE__);
|
||||
return false;
|
||||
if (avcodec_open2(c, codec, NULL)) {
|
||||
fprintf(stderr, "%s %d: avcodec_open2 failed\n", __func__, __LINE__);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -315,13 +315,13 @@ bool WriterPCM::Write(AVPacket *packet, int64_t pts)
|
||||
while (packet_size > 0 || (!packet_size && !packet->data)) {
|
||||
int got_frame = 0;
|
||||
|
||||
if (!decoded_frame) {
|
||||
if (!(decoded_frame = av_frame_alloc())) {
|
||||
fprintf(stderr, "out of memory\n");
|
||||
exit(1);
|
||||
}
|
||||
} else
|
||||
av_frame_unref(decoded_frame);
|
||||
if (!decoded_frame) {
|
||||
if (!(decoded_frame = av_frame_alloc())) {
|
||||
fprintf(stderr, "out of memory\n");
|
||||
exit(1);
|
||||
}
|
||||
} else
|
||||
av_frame_unref(decoded_frame);
|
||||
|
||||
int len = avcodec_decode_audio4(c, decoded_frame, &got_frame, packet);
|
||||
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)
|
||||
{
|
||||
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
|
||||
std::map<enum AVCodecID,Writer*>::iterator it = writers.find(id);
|
||||
if (it != writers.end())
|
||||
return it->second;
|
||||
if (it != writers.end())
|
||||
return it->second;
|
||||
}
|
||||
switch (codec_type) {
|
||||
case AVMEDIA_TYPE_AUDIO:
|
||||
if (id == AV_CODEC_ID_INJECTPCM) // should not happen
|
||||
break;
|
||||
return GetWriter(AV_CODEC_ID_INJECTPCM, codec_type, 100);
|
||||
return GetWriter(AV_CODEC_ID_INJECTPCM, codec_type, 100);
|
||||
case AVMEDIA_TYPE_VIDEO:
|
||||
if (id == AV_CODEC_ID_MPEG2TS) // should not happen
|
||||
break;
|
||||
return GetWriter(AV_CODEC_ID_MPEG2TS, codec_type, 100);
|
||||
return GetWriter(AV_CODEC_ID_MPEG2TS, codec_type, 100);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
Reference in New Issue
Block a user