libeplayer3: minor adjustments

This commit is contained in:
martii
2014-05-02 13:34:08 +02:00
parent e2d9a58fc5
commit dff15731cb
3 changed files with 4 additions and 4 deletions

View File

@@ -313,8 +313,8 @@ bool Input::ReadSubtitle(const char *filename, const char *format, int pid)
dvbsub_ass_write(c, &sub, pid); dvbsub_ass_write(c, &sub, pid);
av_free_packet(&packet); av_free_packet(&packet);
} }
avformat_close_input(&subavfc);
avcodec_close(c); avcodec_close(c);
avformat_close_input(&subavfc);
avformat_free_context(subavfc); avformat_free_context(subavfc);
Track track; Track track;

View File

@@ -129,7 +129,6 @@ bool WriterPCM::prepareClipPlay()
SubFrameLen *= uBitsPerSample / 8; SubFrameLen *= uBitsPerSample / 8;
//rewrite PES size to have as many complete subframes per PES as we can //rewrite PES size to have as many complete subframes per PES as we can
// FIXME: PES header size was hardcoded to 18 in earlier code. Actual size returned by InsertPesHeader is 14.
SubFramesPerPES = ((sizeof(injectBuffer) - 18) - sizeof(lpcm_prv)) / SubFrameLen; SubFramesPerPES = ((sizeof(injectBuffer) - 18) - sizeof(lpcm_prv)) / SubFrameLen;
SubFrameLen *= SubFramesPerPES; SubFrameLen *= SubFramesPerPES;
@@ -248,6 +247,7 @@ bool WriterPCM::Write(AVPacket *packet, int64_t pts)
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);
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;
@@ -292,7 +292,7 @@ bool WriterPCM::Write(AVPacket *packet, int64_t pts)
int e = swr_init(swr); int e = swr_init(swr);
if (e < 0) { if (e < 0) {
fprintf(stderr, "swr_init: %d (icl=%d ocl=%d isr=%d osr=%d isf=%d osf=%d\n", fprintf(stderr, "swr_init: %d (icl=%d ocl=%d isr=%d osr=%d isf=%d osf=%d)\n",
-e, (int) c->channel_layout, -e, (int) c->channel_layout,
(int) out_channel_layout, c->sample_rate, out_sample_rate, c->sample_fmt, AV_SAMPLE_FMT_S16); (int) out_channel_layout, c->sample_rate, out_sample_rate, c->sample_fmt, AV_SAMPLE_FMT_S16);
restart_audio_resampling = true; restart_audio_resampling = true;

View File

@@ -107,7 +107,7 @@ int InsertPesHeader(uint8_t *data, int size, uint8_t stream_id, int64_t pts, int
PutBits(&ld2, 0x1, 8); // Start Code PutBits(&ld2, 0x1, 8); // Start Code
PutBits(&ld2, pic_start_code & 0xff, 8); // 00, for picture start PutBits(&ld2, pic_start_code & 0xff, 8); // 00, for picture start
PutBits(&ld2, (pic_start_code >> 8) & 0xff, 8); // For any extra information (like in mpeg4p2, the pic_start_code) PutBits(&ld2, (pic_start_code >> 8) & 0xff, 8); // For any extra information (like in mpeg4p2, the pic_start_code)
//14 + 4 = 18 //14 + 5 = 19
} }
FlushBits(&ld2); FlushBits(&ld2);