summaryrefslogtreecommitdiff
path: root/doc/examples
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-07-27 01:05:05 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-07-27 01:05:05 +0200
commita98cadef7fe1e6fedeb916bb95dfe61161dd0034 (patch)
tree6673d7db5b8c85e57168333fe2c41e77c4c40dab /doc/examples
parent8b1d54ba40ff63a2b98ff59fb47bd59b0b52d19d (diff)
doc/examples/muxing: Move samples_count to OutputStream
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'doc/examples')
-rw-r--r--doc/examples/muxing.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/doc/examples/muxing.c b/doc/examples/muxing.c
index 3ab36c7a0e..4410f82805 100644
--- a/doc/examples/muxing.c
+++ b/doc/examples/muxing.c
@@ -55,6 +55,7 @@ typedef struct OutputStream {
/* pts of the next frame that will be generated */
int64_t next_pts;
+ int samples_count;
AVFrame *frame;
AVFrame *tmp_frame;
@@ -177,8 +178,6 @@ static void add_stream(OutputStream *ost, AVFormatContext *oc,
/**************************************************************/
/* audio output */
-int samples_count;
-
static void open_audio(AVFormatContext *oc, AVCodec *codec, OutputStream *ost, AVDictionary *opt_arg)
{
AVCodecContext *c;
@@ -332,8 +331,8 @@ static int write_audio_frame(AVFormatContext *oc, OutputStream *ost)
dst_nb_samples = frame->nb_samples;
}
- frame->pts = av_rescale_q(samples_count, (AVRational){1, c->sample_rate}, c->time_base);
- samples_count += dst_nb_samples;
+ frame->pts = av_rescale_q(ost->samples_count, (AVRational){1, c->sample_rate}, c->time_base);
+ ost->samples_count += dst_nb_samples;
}
ret = avcodec_encode_audio2(c, &pkt, frame, &got_packet);