| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Linux audio play and grab interface | 2 * Linux audio play and grab interface |
| 3 * Copyright (c) 2000, 2001 Fabrice Bellard | 3 * Copyright (c) 2000, 2001 Fabrice Bellard |
| 4 * | 4 * |
| 5 * This file is part of FFmpeg. | 5 * This file is part of FFmpeg. |
| 6 * | 6 * |
| 7 * FFmpeg is free software; you can redistribute it and/or | 7 * FFmpeg is free software; you can redistribute it and/or |
| 8 * modify it under the terms of the GNU Lesser General Public | 8 * modify it under the terms of the GNU Lesser General Public |
| 9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
| 10 * version 2.1 of the License, or (at your option) any later version. | 10 * version 2.1 of the License, or (at your option) any later version. |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 static int audio_read_packet(AVFormatContext *s1, AVPacket *pkt) | 244 static int audio_read_packet(AVFormatContext *s1, AVPacket *pkt) |
| 245 { | 245 { |
| 246 AudioData *s = s1->priv_data; | 246 AudioData *s = s1->priv_data; |
| 247 int ret, bdelay; | 247 int ret, bdelay; |
| 248 int64_t cur_time; | 248 int64_t cur_time; |
| 249 struct audio_buf_info abufi; | 249 struct audio_buf_info abufi; |
| 250 | 250 |
| 251 if ((ret=av_new_packet(pkt, s->frame_size)) < 0) | 251 if ((ret=av_new_packet(pkt, s->frame_size)) < 0) |
| 252 return ret; | 252 return ret; |
| 253 | 253 |
| 254 ret = read(s->fd, pkt->data, pkt->size); | 254 ret = read(s->fd, pkt->data, pkt->size); |
| 255 if (ret <= 0){ | 255 if (ret <= 0){ |
| 256 av_free_packet(pkt); | 256 av_free_packet(pkt); |
| 257 pkt->size = 0; | 257 pkt->size = 0; |
| 258 if (ret<0) return AVERROR(errno); | 258 if (ret<0) return AVERROR(errno); |
| 259 else return AVERROR(EOF); | 259 else return AVERROR(EOF); |
| 260 } | 260 } |
| 261 pkt->size = ret; | 261 pkt->size = ret; |
| 262 | 262 |
| 263 /* compute pts of the start of the packet */ | 263 /* compute pts of the start of the packet */ |
| 264 cur_time = av_gettime(); | 264 cur_time = av_gettime(); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 #else | 320 #else |
| 321 CODEC_ID_PCM_S16LE, | 321 CODEC_ID_PCM_S16LE, |
| 322 #endif | 322 #endif |
| 323 CODEC_ID_NONE, | 323 CODEC_ID_NONE, |
| 324 audio_write_header, | 324 audio_write_header, |
| 325 audio_write_packet, | 325 audio_write_packet, |
| 326 audio_write_trailer, | 326 audio_write_trailer, |
| 327 .flags = AVFMT_NOFILE, | 327 .flags = AVFMT_NOFILE, |
| 328 }; | 328 }; |
| 329 #endif | 329 #endif |
| OLD | NEW |