121 |
{ |
{ |
122 |
AVPacketList *pkt, *pkt1; |
AVPacketList *pkt, *pkt1; |
123 |
|
|
124 |
for(pkt = q->first_pkt; pkt != NULL; pkt = pkt1) { |
for (pkt = q->first_pkt; pkt != NULL; pkt = pkt1) { |
125 |
pkt1 = pkt->next; |
pkt1 = pkt->next; |
126 |
av_free_packet(&pkt->pkt); |
av_free_packet(&pkt->pkt); |
127 |
} |
} |
176 |
|
|
177 |
pthread_mutex_lock(&q->mutex); |
pthread_mutex_lock(&q->mutex); |
178 |
|
|
179 |
for(;;) { |
for (;;) { |
180 |
if (q->abort_request) { |
if (q->abort_request) { |
181 |
ret = -1; |
ret = -1; |
182 |
break; |
break; |
308 |
i = 0; |
i = 0; |
309 |
y1 = (s->height >> 1) + s->ytop; |
y1 = (s->height >> 1) + s->ytop; |
310 |
h = y1; |
h = y1; |
311 |
for(x = 0; x < s->width; x++) { |
for (x = 0; x < s->width; x++) { |
312 |
y = (is->sample_array[i] * h) >> 15; |
y = (is->sample_array[i] * h) >> 15; |
313 |
if (y < 0) { |
if (y < 0) { |
314 |
y = -y; |
y = -y; |
355 |
if (vp->bmp) |
if (vp->bmp) |
356 |
bmp_free(s->screen, vp->bmp); |
bmp_free(s->screen, vp->bmp); |
357 |
/* XXX: use generic function */ |
/* XXX: use generic function */ |
358 |
switch(is->video_st->codec.pix_fmt) { |
switch (is->video_st->codec.pix_fmt) { |
359 |
case PIX_FMT_YUV420P: |
case PIX_FMT_YUV420P: |
360 |
case PIX_FMT_YUV422P: |
case PIX_FMT_YUV422P: |
361 |
case PIX_FMT_YUV444P: |
case PIX_FMT_YUV444P: |
448 |
bmp_lock(s->screen, vp->bmp, &qepict, |
bmp_lock(s->screen, vp->bmp, &qepict, |
449 |
0, 0, vp->bmp->width, vp->bmp->height); |
0, 0, vp->bmp->width, vp->bmp->height); |
450 |
dst_pix_fmt = qe_bitmap_format_to_pix_fmt(vp->bmp->format); |
dst_pix_fmt = qe_bitmap_format_to_pix_fmt(vp->bmp->format); |
451 |
for(i=0;i<4;i++) { |
for (i = 0; i < 4; i++) { |
452 |
pict.data[i] = qepict.data[i]; |
pict.data[i] = qepict.data[i]; |
453 |
pict.linesize[i] = qepict.linesize[i]; |
pict.linesize[i] = qepict.linesize[i]; |
454 |
} |
} |
483 |
AVFrame frame; |
AVFrame frame; |
484 |
AVPicture pict; |
AVPicture pict; |
485 |
|
|
486 |
for(;;) { |
for (;;) { |
487 |
while (is->paused && !is->videoq.abort_request) { |
while (is->paused && !is->videoq.abort_request) { |
488 |
usleep(10000); |
usleep(10000); |
489 |
} |
} |
505 |
if (len1 < 0) |
if (len1 < 0) |
506 |
break; |
break; |
507 |
if (got_picture) { |
if (got_picture) { |
508 |
for(i=0;i<4;i++) { |
for (i = 0; i < 4; i++) { |
509 |
pict.data[i] = frame.data[i]; |
pict.data[i] = frame.data[i]; |
510 |
pict.linesize[i] = frame.linesize[i]; |
pict.linesize[i] = frame.linesize[i]; |
511 |
} |
} |
536 |
len = n; |
len = n; |
537 |
out = is->sample_array + is->sample_array_index; |
out = is->sample_array + is->sample_array_index; |
538 |
in = samples; |
in = samples; |
539 |
for(i = 0; i < len; i++) { |
for (i = 0; i < len; i++) { |
540 |
out[i] = in[0]; |
out[i] = in[0]; |
541 |
in += channels; |
in += channels; |
542 |
} |
} |
555 |
int len, len1, data_size; |
int len, len1, data_size; |
556 |
short samples[AVCODEC_MAX_AUDIO_FRAME_SIZE / 2]; |
short samples[AVCODEC_MAX_AUDIO_FRAME_SIZE / 2]; |
557 |
|
|
558 |
for(;;) { |
for (;;) { |
559 |
while (is->paused && !is->audioq.abort_request) { |
while (is->paused && !is->audioq.abort_request) { |
560 |
usleep(10000); |
usleep(10000); |
561 |
} |
} |
612 |
if (!codec || |
if (!codec || |
613 |
avcodec_open(enc, codec) < 0) |
avcodec_open(enc, codec) < 0) |
614 |
return -1; |
return -1; |
615 |
switch(enc->codec_type) { |
switch (enc->codec_type) { |
616 |
case CODEC_TYPE_AUDIO: |
case CODEC_TYPE_AUDIO: |
617 |
is->audio_stream = stream_index; |
is->audio_stream = stream_index; |
618 |
is->audio_st = ic->streams[stream_index]; |
is->audio_st = ic->streams[stream_index]; |
641 |
|
|
642 |
enc = &ic->streams[stream_index]->codec; |
enc = &ic->streams[stream_index]->codec; |
643 |
|
|
644 |
switch(enc->codec_type) { |
switch (enc->codec_type) { |
645 |
case CODEC_TYPE_AUDIO: |
case CODEC_TYPE_AUDIO: |
646 |
packet_queue_abort(&is->audioq); |
packet_queue_abort(&is->audioq); |
647 |
pthread_join(is->audio_tid, NULL); |
pthread_join(is->audio_tid, NULL); |
670 |
} |
} |
671 |
|
|
672 |
avcodec_close(enc); |
avcodec_close(enc); |
673 |
switch(enc->codec_type) { |
switch (enc->codec_type) { |
674 |
case CODEC_TYPE_AUDIO: |
case CODEC_TYPE_AUDIO: |
675 |
is->audio_st = NULL; |
is->audio_st = NULL; |
676 |
is->audio_stream = -1; |
is->audio_stream = -1; |
707 |
if (err < 0) |
if (err < 0) |
708 |
goto fail; |
goto fail; |
709 |
|
|
710 |
for(i = 0; i < ic->nb_streams; i++) { |
for (i = 0; i < ic->nb_streams; i++) { |
711 |
AVCodecContext *enc = &ic->streams[i]->codec; |
AVCodecContext *enc = &ic->streams[i]->codec; |
712 |
switch(enc->codec_type) { |
switch (enc->codec_type) { |
713 |
case CODEC_TYPE_AUDIO: |
case CODEC_TYPE_AUDIO: |
714 |
if (audio_index < 0) |
if (audio_index < 0) |
715 |
audio_index = i; |
audio_index = i; |
739 |
goto fail; |
goto fail; |
740 |
} |
} |
741 |
|
|
742 |
for(;;) { |
for (;;) { |
743 |
if (is->abort_request) |
if (is->abort_request) |
744 |
break; |
break; |
745 |
/* if the queue are full, no need to read more */ |
/* if the queue are full, no need to read more */ |
809 |
/* if there is already a window with this video playing, then we |
/* if there is already a window with this video playing, then we |
810 |
stop this new instance (C-x 2 case) */ |
stop this new instance (C-x 2 case) */ |
811 |
video_playing = 0; |
video_playing = 0; |
812 |
for(e = qs->first_window; e != NULL; e = e->next_window) { |
for (e = qs->first_window; e != NULL; e = e->next_window) { |
813 |
if (e->mode == s->mode && e != s && e->b == s->b) { |
if (e->mode == s->mode && e != s && e->b == s->b) { |
814 |
VideoState *is1 = e->mode_data; |
VideoState *is1 = e->mode_data; |
815 |
if (!is1->paused) |
if (!is1->paused) |
837 |
is->abort_request = 1; |
is->abort_request = 1; |
838 |
pthread_join(is->parse_tid, NULL); |
pthread_join(is->parse_tid, NULL); |
839 |
/* free all pictures */ |
/* free all pictures */ |
840 |
for(i=0;i<VIDEO_PICTURE_QUEUE_SIZE; i++) { |
for (i = 0; i < VIDEO_PICTURE_QUEUE_SIZE; i++) { |
841 |
vp = &is->pictq[i]; |
vp = &is->pictq[i]; |
842 |
if (vp->bmp) { |
if (vp->bmp) { |
843 |
bmp_free(s->screen, vp->bmp); |
bmp_free(s->screen, vp->bmp); |
922 |
} |
} |
923 |
|
|
924 |
stream_index = start_index; |
stream_index = start_index; |
925 |
for(;;) { |
for (;;) { |
926 |
if (++stream_index >= ic->nb_streams) |
if (++stream_index >= ic->nb_streams) |
927 |
stream_index = 0; |
stream_index = 0; |
928 |
if (stream_index == start_index) { |
if (stream_index == start_index) { |