Revision eef16966

View differences:

ffplay.c
284 284

  
285 285
static SDL_Surface *screen;
286 286

  
287
static int packet_queue_put(PacketQueue *q, AVPacket *pkt);
287
static int packet_queue_put(PacketQueue *q, AVPacket *pkt)
288
{
289
    AVPacketList *pkt1;
290

  
291
    /* duplicate the packet */
292
    if (pkt!=&flush_pkt && av_dup_packet(pkt) < 0)
293
        return -1;
294

  
295
    pkt1 = av_malloc(sizeof(AVPacketList));
296
    if (!pkt1)
297
        return -1;
298
    pkt1->pkt = *pkt;
299
    pkt1->next = NULL;
300

  
301

  
302
    SDL_LockMutex(q->mutex);
303

  
304
    if (!q->last_pkt)
305

  
306
        q->first_pkt = pkt1;
307
    else
308
        q->last_pkt->next = pkt1;
309
    q->last_pkt = pkt1;
310
    q->nb_packets++;
311
    q->size += pkt1->pkt.size + sizeof(*pkt1);
312
    /* XXX: should duplicate packet data in DV case */
313
    SDL_CondSignal(q->cond);
314

  
315
    SDL_UnlockMutex(q->mutex);
316
    return 0;
317
}
288 318

  
289 319
/* packet queue handling */
290 320
static void packet_queue_init(PacketQueue *q)
......
319 349
    SDL_DestroyCond(q->cond);
320 350
}
321 351

  
322
static int packet_queue_put(PacketQueue *q, AVPacket *pkt)
323
{
324
    AVPacketList *pkt1;
325

  
326
    /* duplicate the packet */
327
    if (pkt!=&flush_pkt && av_dup_packet(pkt) < 0)
328
        return -1;
329

  
330
    pkt1 = av_malloc(sizeof(AVPacketList));
331
    if (!pkt1)
332
        return -1;
333
    pkt1->pkt = *pkt;
334
    pkt1->next = NULL;
335

  
336

  
337
    SDL_LockMutex(q->mutex);
338

  
339
    if (!q->last_pkt)
340

  
341
        q->first_pkt = pkt1;
342
    else
343
        q->last_pkt->next = pkt1;
344
    q->last_pkt = pkt1;
345
    q->nb_packets++;
346
    q->size += pkt1->pkt.size + sizeof(*pkt1);
347
    /* XXX: should duplicate packet data in DV case */
348
    SDL_CondSignal(q->cond);
349

  
350
    SDL_UnlockMutex(q->mutex);
351
    return 0;
352
}
353

  
354 352
static void packet_queue_abort(PacketQueue *q)
355 353
{
356 354
    SDL_LockMutex(q->mutex);

Also available in: Unified diff