summaryrefslogtreecommitdiff
path: root/src/decoder.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/decoder.cc')
-rw-r--r--src/decoder.cc19
1 files changed, 9 insertions, 10 deletions
diff --git a/src/decoder.cc b/src/decoder.cc
index b9f634a..3c5a4e8 100644
--- a/src/decoder.cc
+++ b/src/decoder.cc
@@ -106,7 +106,7 @@ void Decoder::decode()
// NOTE: we only decode video, we only need the data from stream_index 0
// (stream 0: video, stream 1: audio)
// while(pkt.stream_index == 0 && len > 0) {
- while(len > 0) {
+ while(pkt.stream_index == 0 && len > 0) {
int ret;
int got_picture;
// buf_t *buf = buf_alloc();
@@ -117,8 +117,9 @@ void Decoder::decode()
memcpy(dvf->frame, ptr, len);
// fprintf(stderr, "DVBufferSize: [%d]bytes\n", len);
+
ret = avcodec_decode_video(&fc->streams[0]->codec,
- fff->frame, &got_picture, ptr, len);
+ fff->frame, &got_picture, ptr, len);
if(ret < 0) {
fprintf(stderr, "Error while decoding stream\n");
@@ -130,18 +131,16 @@ void Decoder::decode()
pthread_mutex_lock(mutex);
encode_queue->push(dvf);
- if(pkt.stream_index == 0) player_queue->push(fff);
+ player_queue->push(fff);
pthread_mutex_unlock(mutex);
sem_post(encode_sem);
- if(pkt.stream_index == 0) {
- user_event.type = SDL_USEREVENT;
- user_event.user.code = 0;
- user_event.user.data1 = NULL;
- user_event.user.data2 = NULL;
- SDL_PushEvent(&user_event);
- }
+ user_event.type = SDL_USEREVENT;
+ user_event.user.code = 0;
+ user_event.user.data1 = NULL;
+ user_event.user.data2 = NULL;
+ SDL_PushEvent(&user_event);
}
/*
// For later use, when audio must be implemented