libeplayer3/ffmpeg: minor cleanup

This commit is contained in:
martii
2013-10-12 19:11:17 +02:00
committed by Stefan Seyfried
parent e01a3d5312
commit fc06947ba7

View File

@@ -326,7 +326,6 @@ static void FFMPEGThread(Context_t *context) {
strncpy(threadname, __func__, sizeof(threadname)); strncpy(threadname, __func__, sizeof(threadname));
threadname[16] = 0; threadname[16] = 0;
prctl (PR_SET_NAME, (unsigned long)&threadname); prctl (PR_SET_NAME, (unsigned long)&threadname);
AVPacket packet;
off_t lastSeek = -1; off_t lastSeek = -1;
long long int lastPts = -1, currentVideoPts = -1, currentAudioPts = -1, showtime = 0, bofcount = 0; long long int lastPts = -1, currentVideoPts = -1, currentAudioPts = -1, showtime = 0, bofcount = 0;
int err = 0; int err = 0;
@@ -426,6 +425,9 @@ static void FFMPEGThread(Context_t *context) {
context->output->Command(context, OUTPUT_AUDIOMUTE, "0"); context->output->Command(context, OUTPUT_AUDIOMUTE, "0");
} }
AVPacket packet;
av_init_packet(&packet);
if (av_read_frame(avContext, &packet) == 0 ) if (av_read_frame(avContext, &packet) == 0 )
{ {
long long int pts; long long int pts;
@@ -909,8 +911,6 @@ int container_ffmpeg_init(Context_t *context, char * filename)
* until other works are done and we can prove this. * until other works are done and we can prove this.
*/ */
avformat_close_input(&avContext); avformat_close_input(&avContext);
//for buffered io
ffmpeg_buf_free();
//for buffered io (end) //for buffered io (end)
return cERR_CONTAINER_FFMPEG_STREAM; return cERR_CONTAINER_FFMPEG_STREAM;
#endif #endif
@@ -1023,7 +1023,7 @@ int container_ffmpeg_update_tracks(Context_t *context, char *filename, int initi
track.Name = "und"; track.Name = "und";
track.Encoding = encoding; track.Encoding = encoding;
track.stream = stream; track.stream = stream;
track.Id = ((AVStream *) (track.stream))->id; track.Id = stream->id;
if(stream->duration == AV_NOPTS_VALUE) { if(stream->duration == AV_NOPTS_VALUE) {
ffmpeg_printf(10, "Stream has no duration so we take the duration from context\n"); ffmpeg_printf(10, "Stream has no duration so we take the duration from context\n");
@@ -1059,7 +1059,7 @@ int container_ffmpeg_update_tracks(Context_t *context, char *filename, int initi
track.Encoding = encoding; track.Encoding = encoding;
track.stream = stream; track.stream = stream;
track.Id = ((AVStream *) (track.stream))->id; track.Id = stream->id;
track.duration = (double)stream->duration * av_q2d(stream->time_base) * 1000.0; track.duration = (double)stream->duration * av_q2d(stream->time_base) * 1000.0;
track.aacbuf = 0; track.aacbuf = 0;
track.have_aacheader = -1; track.have_aacheader = -1;
@@ -1257,7 +1257,7 @@ int container_ffmpeg_update_tracks(Context_t *context, char *filename, int initi
track.Encoding = encoding; track.Encoding = encoding;
track.stream = stream; track.stream = stream;
track.Id = ((AVStream *) (track.stream))->id; track.Id = stream->id;
track.duration = (double)stream->duration * av_q2d(stream->time_base) * 1000.0; track.duration = (double)stream->duration * av_q2d(stream->time_base) * 1000.0;
track.aacbuf = 0; track.aacbuf = 0;