Lines Matching refs:ret

64     int ret;
68 if ((ret = avformat_open_input(&ifmt_ctx, filename, NULL, NULL)) < 0) {
70 filename, av_err2str(ret));
71 return ret;
74 if ((ret = avformat_find_stream_info(ifmt_ctx, NULL)) < 0) {
76 av_err2str(ret));
77 return ret;
80 ret = av_find_best_stream(ifmt_ctx, AVMEDIA_TYPE_VIDEO, -1, -1, &decoder, 0);
81 if (ret < 0) {
83 "Error code: %s\n", av_err2str(ret));
84 return ret;
86 video_stream = ret;
92 if ((ret = avcodec_parameters_to_context(decoder_ctx, video->codecpar)) < 0) {
94 av_err2str(ret));
95 return ret;
105 if ((ret = avcodec_open2(decoder_ctx, decoder, NULL)) < 0)
107 av_err2str(ret));
109 return ret;
114 int ret = 0;
118 if ((ret = avcodec_send_frame(encoder_ctx, frame)) < 0) {
119 fprintf(stderr, "Error during encoding. Error code: %s\n", av_err2str(ret));
123 ret = avcodec_receive_packet(encoder_ctx, enc_pkt);
124 if (ret)
130 ret = av_interleaved_write_frame(ofmt_ctx, enc_pkt);
131 if (ret < 0) {
133 "Error code: %s\n", av_err2str(ret));
139 if (ret == AVERROR_EOF)
141 ret = ((ret == AVERROR(EAGAIN)) ? 0:-1);
142 return ret;
148 int ret = 0;
150 ret = avcodec_send_packet(decoder_ctx, pkt);
151 if (ret < 0) {
152 fprintf(stderr, "Error during decoding. Error code: %s\n", av_err2str(ret));
153 return ret;
156 while (ret >= 0) {
160 ret = avcodec_receive_frame(decoder_ctx, frame);
161 if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) {
164 } else if (ret < 0) {
165 fprintf(stderr, "Error while decoding. Error code: %s\n", av_err2str(ret));
174 ret = AVERROR(ENOMEM);
186 if ((ret = avcodec_open2(encoder_ctx, enc_codec, NULL)) < 0) {
188 av_err2str(ret));
194 ret = AVERROR(ENOMEM);
199 ret = avcodec_parameters_from_context(ost->codecpar, encoder_ctx);
200 if (ret < 0) {
202 "Error code: %s\n", av_err2str(ret));
207 if ((ret = avformat_write_header(ofmt_ctx, NULL)) < 0) {
209 "Error code: %s\n", av_err2str(ret));
216 if ((ret = encode_write(pkt, frame)) < 0)
221 if (ret < 0)
222 return ret;
230 int ret = 0;
240 ret = av_hwdevice_ctx_create(&hw_device_ctx, AV_HWDEVICE_TYPE_VAAPI, NULL, NULL, 0);
241 if (ret < 0) {
242 fprintf(stderr, "Failed to create a VAAPI device. Error code: %s\n", av_err2str(ret));
252 if ((ret = open_input_file(argv[1])) < 0)
257 ret = -1;
261 if ((ret = (avformat_alloc_output_context2(&ofmt_ctx, NULL, NULL, argv[3]))) < 0) {
263 "%s\n", av_err2str(ret));
268 ret = AVERROR(ENOMEM);
272 ret = avio_open(&ofmt_ctx->pb, argv[3], AVIO_FLAG_WRITE);
273 if (ret < 0) {
275 "Error code: %s\n", av_err2str(ret));
280 while (ret >= 0) {
281 if ((ret = av_read_frame(ifmt_ctx, dec_pkt)) < 0)
285 ret = dec_enc(dec_pkt, enc_codec);
292 ret = dec_enc(dec_pkt, enc_codec);
295 ret = encode_write(dec_pkt, NULL);
307 return ret;