Commits

zeroth  committed a0c3fc8

Put module back into workable state, turned off audio connections. Must
read up on buffers/pointers, etc.

  • Participants
  • Parent commits 4ef9abf
  • Branches tylerthemovie

Comments (0)

Files changed (2)

File src/_gmovie.c

         	/* Buffer is filled up with a new frame, we spin lock/wait for a signal, where we then call playBuffer */
         	SDL_LockMutex(movie->audio_mutex);
         	//SDL_CondWait(movie->audio_sig, movie->audio_mutex);
-        	playBuffer(movie->audio_buf1, data_size);
+        	playBuffer(movie->audio_buf1, len1);
         	filled=0;
         	len1=0;
         	SDL_UnlockMutex(movie->audio_mutex);
     }
 
     /* open the streams */
-    if (audio_index >= 0) {
+    /*if (audio_index >= 0) {
 		stream_component_open(is, audio_index);
-   	}
+   	}*/
 	
     if (video_index >= 0) {
     	stream_component_open(is, video_index);
 		movie->paused=0;
 		state =decoder(movie);
 		stream_component_close(movie, movie->video_st->index);
-		stream_component_close(movie, movie->audio_st->index);
+		//stream_component_close(movie, movie->audio_st->index);
 	}
 	if(gstate==PyGILState_LOCKED) RELEASEGIL	
 	return state;
 	                break;
 	            }
 	        }
-	        if (pkt->stream_index == is->audio_stream) {
+	        /*if (pkt->stream_index == is->audio_stream) {
 	            packet_queue_put(&is->audioq, pkt);
-	        } else if (pkt->stream_index == is->video_stream) {
+	        } else*/ if (pkt->stream_index == is->video_stream) {
 	            packet_queue_put(&is->videoq, pkt);
 	        //} else if (pkt->stream_index == is->subtitle_stream) {
 	        //    packet_queue_put(&is->subtitleq, pkt);
 	            av_free_packet(pkt);
 	        }
 		}
-        video_render(is);
-        audio_thread(is);
+		if(is->video_st)
+	        video_render(is);
+        //audio_thread(is);
         if(co<2)
         	video_refresh_timer(is);
         if(is->timing>0) {

File src/_gsound.c

                 q->last = NULL;
             q->size--;
             node = pkt1;
-            PyMem_Free(pkt1);
+            //PyMem_Free(pkt1);
             ret = 1;
             break;
         } else {
 			BufferNode *node;
 			node = (BufferNode *)PyMem_Malloc(sizeof(BufferNode));
 			node->buf = (uint8_t *)PyMem_Malloc((size_t)len);
-			memcpy(&node->buf, &buf, (size_t)len);
+			memcpy(&node->buf, &buf, (size_t)len-1);
 			node->len = len;
 			node->next =NULL;
 			queue_put(queue, node);
 		}
 		BufferNode *new;
 		queue_get(queue, new);
-		memcpy(&buf, &new->buf, new->len);
+		memcpy(&buf, &new->buf, new->len-1);
 		len=new->len;
-		PyMem_Free(new->buf);
-		PyMem_Free(new);
+		PyMem_Free(&new->buf);
+		PyMem_Free(&new);
 	}
 	else if(playing)
 	{
 			BufferNode *node;
 			node = (BufferNode *)PyMem_Malloc(sizeof(BufferNode));
 			node->buf = (uint8_t *)PyMem_Malloc((size_t)len);
-			memcpy(&node->buf, &buf, (size_t)len);
+			memcpy(&node->buf, &buf, (size_t)len-1);
 			node->len = len;
 			node->next =NULL;
 			queue_put(queue, node);
 	}
 	mix= (Mix_Chunk *)PyMem_Malloc(sizeof(Mix_Chunk));
 	mix->allocated=1;
-	mix->abuf = (Uint8 *)buf;
+	if(queue->size==0)
+	{
+		mix->abuf = (Uint8 *)PyMem_Malloc((size_t)len);
+		memcpy(&mix->abuf, &buf, len-1);
+	}
+	else
+	{
+		mix->abuf = (Uint8 *)buf;
+	}
 	mix->alen = (Uint32 )len;
 	mix->volume = 127;
 	playing = 1;